How can I have a variable point to a member of a different struct? This is what I'm trying to do, but the third line fails.
volatile uint8_t tx_message_buffer[sizeof(MESSAGE)];
struct MESSAGE *tx_message = (MESSAGE *)tx_message_buffer;
struct PAYLOAD *tx_payload = (PAYLOAD *)tx_message->payload;
Here are the struct definitions.
#define MSG_MAX_PAYLOAD_LENGTH 64
typedef struct PAYLOAD {
uint8_t descriptor;
uint8_t parameters[MSG_MAX_PAYLOAD_LENGTH-1];
};
typedef struct MESSAGE {
uint8_t address;
uint8_t length;
PAYLOAD payload;
uint8_t checksum;
};