Hello Everyone,
Story start from this thread ref:http://arduino.cc/forum/index.php/topic,159519.0.html.
To feel "union in c" I tested it in real (not only for Arduino base system) Wireless Sensor Network application. This is the format of packet
union uPacket{
struct packet{
char sDelimeter; //To mantian Backward Compatibilty
uint8_t id;
uint8_t payload[10];
char mDelimeter; //To mantian Backward Compatibilty
uint16_t msgId;
char eDelimeter; //To mantian Backward Compatibilty
}
sPac;
uint8_t asBytes[16];
}
uRx, uTx;
Cycle of Communication
NODE 1 NODE 2
Fill(struct) -->Send(uTx.asBytes) -... ...- Recv(&buffer) -->copy(uRx.asBytes) -->extract(struct)
Suggestion required (anything need to keep in mind?).
Thanks in advance.
Literature Links:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=115140&postdays=0&postorder=asc
http://lxr.linux.no/linux+v3.1.5/+search
http://nrqm.ca/nrf24l01/driver/
Edit: Sorry for last time posting in wrong section