![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Wireless interface using LoRa technology
Dependencies: AlohaTransceiver RingBuffer SX1276Lib_inAir SerialInterfaceProtocol mbed L3PDU
Diff: main.cpp
- Revision:
- 25:2fff6d1b4eb6
- Parent:
- 24:e41b5098ed0a
- Child:
- 27:9196cb5859f7
diff -r e41b5098ed0a -r 2fff6d1b4eb6 main.cpp --- a/main.cpp Fri Sep 02 04:20:47 2016 +0000 +++ b/main.cpp Fri Sep 02 04:44:18 2016 +0000 @@ -77,15 +77,7 @@ // calculate crc doorEvent.generateCrc(); - // serialize and send it - uint8_t buffer[8]; - memset(buffer, 0x0, sizeof(buffer)); - - // copy bytes into buffer - doorEvent.serialize(buffer); - - // send to aloha transceiver - aloha.send(buffer, 8, 0x0); + aloha.send(&doorEvent); } void serialInterruptHandler() { @@ -152,15 +144,7 @@ // generate crc packet.generateCrc(); - // create buffer for transmission - uint8_t buffer[8]; - memset(buffer, 0x0, sizeof(buffer)); - - // copy bytes into buffer - packet.serialize(buffer); - - // send to aloha transceiver - aloha.send(buffer, 8, node_id); + aloha.send(&packet); return 0; } @@ -526,15 +510,7 @@ // calculate crc response.generateCrc(); - // serialize and send it - uint8_t buffer[8]; - memset(buffer, 0x0, sizeof(buffer)); - - // copy bytes into buffer - response.serialize(buffer); - - // send to aloha transceiver - aloha.send(buffer, 8, src_addr); + aloha.send(&response); break; } @@ -566,15 +542,7 @@ // calculate crc response.generateCrc(); - // serialize and send it - uint8_t buffer[8]; - memset(buffer, 0x0, sizeof(buffer)); - - // copy bytes into buffer - response.serialize(buffer); - - // send to aloha transceiver - aloha.send(buffer, 8, src_addr); + aloha.send(&response); break; } @@ -613,15 +581,7 @@ // calculate crc response.generateCrc(); - // serialize and send it - uint8_t buffer[8]; - memset(buffer, 0x0, sizeof(buffer)); - - // copy bytes into buffer - response.serialize(buffer); - - // send to aloha transceiver - aloha.send(buffer, 8, src_addr); + aloha.send(&response); break; }