Send custom structure over i2c

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Send custom structure over i2c

566 Views
rudasi
Contributor I

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?

Labels (1)
Tags (2)
0 Kudos
2 Replies

485 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

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

0 Kudos

485 Views
rudasi
Contributor I

Figured it out by just type casting the data to my structure. 

0 Kudos