Part Number: CC3220SF-LAUNCHXL
Tool/software: TI C/C++ Compiler
I have a struct like this:
typedef struct
{
_u32 time; // 4 bytes
_u32 cnt; // 4
_i16 temp; // 2
_u16 humy; // 2
_u16 batt; // 2
_u8 rssi; // 1
} record_t;
I would like to convert it to a 4+4+2+2+1=13 bytes array to store it on a flash memory and easy retrieve it. Example:
record_t record; record.time=1510054330; record.cnt=12345; // populate other fields _u8 *raw = &record; WriteToFlash(address, raw, 13); // ReadFromFlash(another_address, &raw, 13); // now raw contains the new data // how to assign the content to the record variable?
I'm afraid about any padding or alignment in data type. Of course I can do it manually, field by field, but if there's a direct (and reliable) way it would be nice.