I have a pretty nasty case on a texas instruments C2000 microcontroller, that is only available to represent uin16_t and not uint8_t. Now I have a struct like the following, where each uint16_t represents only a byte of data, that will be written to an external EEPROM:
typedef struct
{
uint32_t a;
uint32_t b;
uint32_t c;
uint32_t d;
} MCL_Struct_t;
MCL_Struct_t struc_write = {0};
MCL_Struct_t struc_read = {0};
uint16_t *struc_write_handle = ((uint16_t *)&struc_write);
uint16_t *struc_read_handle = ((uint16_t *)&struc_read);
struc_write.a = 0x11112222;
struc_write.b = 0x11113333;
struc_write.c = 0x11114444;
struc_write.d = 0x11115555;
//call eeprom write
EEPROM_writeTransaction(eepromAddr, struc_write_handle, sizeof(MCL_Struct_t));
//read back eeprom
EEPROM_readTransaction(eepromAddr, sizeof(MCL_Struct_t));
//copy to struc_read
memcpy(struc_read_handle, &SPI_DMA_Handle.pSPIRXDMA->pbuffer[0], sizeof(MCL_Struct_t));
Since the SPI is only capable of transfering bytewise, the uint16_t data is handle as a byte and so I only write something like struc_write.a = 0x00110022 etc.
How can I make, that my handles point to the data bytewise?