Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BufferedSerial SX1276GenericLib USBDeviceHT mbed Crypto X_NUCLEO_IKS01A2
Fork of STM32L0_LoRa by
Revision 28:9d7be893610d, committed 2018-05-31
- Comitter:
- marcozecchini
- Date:
- Thu May 31 22:50:54 2018 +0000
- Parent:
- 27:d308dd4d8f51
- Child:
- 29:04e1489f8fe2
- Commit message:
- added ack constraint in rxdone
Changed in this revision
| smartage/smartage.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/smartage/smartage.cpp Wed May 30 18:09:34 2018 +0000
+++ b/smartage/smartage.cpp Thu May 31 22:50:54 2018 +0000
@@ -91,6 +91,7 @@
uint8_t *Buffer;
unsigned char myKEY[16] = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,};
unsigned char myIV[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, } ;
+const uint8_t ack[] = { 0xff, 0xff, 0x00, 0x00, 'A', 'C', 'K', '!'};
DigitalOut *led3;
void print_stuff(){
@@ -317,13 +318,15 @@
void OnRxDone(void *radio, void *userThisPtr, void *userData, uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
{
- Radio->Sleep( );
- BufferSize = size;
- memcpy( Buffer, payload, BufferSize );
- State = RX;
- if (DEBUG_MESSAGE)
- dprintf("> OnRxDone: RssiValue=%d dBm, SnrValue=%d", rssi, snr);
- //dump("Data:", payload, size);
+ if(memcmp(payload, ack, 8) == 0) {
+ Radio->Sleep( );
+ BufferSize = size;
+ memcpy( Buffer, payload, BufferSize );
+ State = RX;
+ if (DEBUG_MESSAGE)
+ dprintf("> OnRxDone: RssiValue=%d dBm, SnrValue=%d", rssi, snr);
+ //dump("Data:", payload, size);
+ }
}
void OnTxTimeout(void *radio, void *userThisPtr, void *userData)
