Natalia Coria / Mbed 2 deprecated Training-Aug2018-SX1272-X-NUCLEO-IKS01A2_Natalia

Dependencies:   X_NUCLEO_IKS01A2 driver_mbed_TH02 mbed LoRaWAN-lib-v1_0_1 SX1272Lib

Fork of Training-Aug2018-SX1272-X-NUCLEO-IKS01A2 by Uttam Bhat

Files at this revision

API Documentation at this revision

Comitter:
ubhat
Date:
Sun Aug 12 06:09:53 2018 +0000
Parent:
8:7ddaacb6dda6
Child:
10:bba416e2c3e1
Commit message:
Add Cayenne Application for Push Button

Changed in this revision

app/Config.h Show annotated file Show diff for this revision Revisions of this file
app/LoRaApp.cpp Show annotated file Show diff for this revision Revisions of this file
app/LoRaEventProc.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/app/Config.h	Tue Nov 28 07:30:45 2017 +0000
+++ b/app/Config.h	Sun Aug 12 06:09:53 2018 +0000
@@ -130,7 +130,7 @@
 /*!
  * User application data buffer size
  */
-#define LORAWAN_APP_DATA_SIZE                       2
+#define LORAWAN_APP_DATA_SIZE                       3
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
--- a/app/LoRaApp.cpp	Tue Nov 28 07:30:45 2017 +0000
+++ b/app/LoRaApp.cpp	Sun Aug 12 06:09:53 2018 +0000
@@ -193,12 +193,14 @@
 
         case AppPushButton:
         {   
-            uint16_t PushButtonCnt;
+            static uint8_t PushButtonCnt = 0;
             uint8_t *p = (uint8_t *) &PushButtonCnt;
 
             PushButtonCnt = LoRaMacUplinkStatus.UplinkCounter;
+            PushButtonCnt = (PushButtonCnt + 1) & 0xFF;
                 
-            memcpy( &BuffAddr[BuffPtr], p, sizeof(uint16_t) );
+            //memcpy( &BuffAddr[BuffPtr], p, sizeof(uint16_t) );
+            BuffAddr[BuffPtr] = PushButtonCnt;
             
             break;
         }
--- a/app/LoRaEventProc.cpp	Tue Nov 28 07:30:45 2017 +0000
+++ b/app/LoRaEventProc.cpp	Sun Aug 12 06:09:53 2018 +0000
@@ -186,9 +186,15 @@
         // Push-Button Demo
         case 11: {
             uint8_t ptrIndex = 0;
+            
+            uint8_t tmp[2] = {0};
 
             //Point the pointer to position index of Tx Buffer
             LoRaApp.ApplicationPtrPos( ptrIndex );
+            
+            tmp[0] = 0;
+            tmp[1] = 0; 
+            LoRaApp.ApplicationAppendData( tmp, 2 );
 
             LoRaApp.ApplicationCall( AppPushButton ); // Transmit uplink counter