I am trying to send a custom structure over i2c to a kinetis board which is acting as a slave with an interrupt triggering a callback in this scenario. I am able to run the example code which has a uint8_t buffer but I am not sure how to send a custom structure with different data types over.
Any example code out there?
Hi, Rahul,
If you need complicated structure, I think you can use sprintf() function to output all variable to a buffer with char type, it is okay. If you want to output a structure, I think you can use union type structure.
typedef struct str_union
{
char array[];
union
{
}
}
Hope it can help you
BR
XiangJun Rong
Figured it out by just type casting the data to my structure.