light sensor

Dependencies:   X_NUCLEO_IKS01A1 LoRaWAN-lib SX1276Lib mbed

Fork of LoRaWAN-SX1276-Application-Demo by Uttam Bhat

Files at this revision

API Documentation at this revision

Comitter:
ubhat
Date:
Sat Sep 09 00:26:19 2017 +0000
Parent:
5:f04a6f68e159
Commit message:
Changed packet format to Senet Packet Format for numeric stream on M2X

Changed in this revision

app/Comissioning.h Show annotated file Show diff for this revision Revisions of this file
app/Config.h 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/Comissioning.h	Fri Sep 08 21:05:04 2017 +0000
+++ b/app/Comissioning.h	Sat Sep 09 00:26:19 2017 +0000
@@ -21,6 +21,9 @@
  */
 #define OVER_THE_AIR_ACTIVATION                     1
 
+// Set to 1 for Sensor; Set to 0 for LED
+#define SENSOR                                      1
+
 /*!
  * Indicates if the end-device is to be connected to a private or public network
  */
@@ -28,11 +31,12 @@
 
 #if( OVER_THE_AIR_ACTIVATION != 0 )
 
+#if( SENSOR == 1 )
 /*!
  * Mote device IEEE OUI (big endian)
  * \remark This is unique to a company or organization
  */
-#define IEEE_OUI                                    0x00, 0x00, 0x00
+#define IEEE_OUI                                    0x00, 0x25, 0x0C
 
 /*!
  * Mote device IEEE EUI (big endian)
@@ -40,17 +44,45 @@
  * \remark In this application, if the last 4 bytes are all 0, then the 32 bit address is automatically generated using a pseudo random generator seeded with a value derived from BoardUniqueId value
  * If provided by user, e.g. { IEEE_OUI, 0x00, 0x00, 0x00, 0xFF, 0x01 }, then this value is used by the application
  */
-#define LORAWAN_DEVICE_EUI                          { 0x00, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x78 }
+#define LORAWAN_DEVICE_EUI                          { IEEE_OUI, 0x01, 0x00, 0x00, 0x10, 0xE9 }
 
 /*!
  * Application IEEE EUI (big endian)
  */
-#define LORAWAN_APPLICATION_EUI                     { 0x70, 0xB3, 0xD5, 0x7E, 0xF0, 0x00, 0x63, 0xA6 }
+#define LORAWAN_APPLICATION_EUI                     { 0x00, 0x25, 0x0C, 0x00, 0x00, 0x01, 0x00, 0x01 }
 
 /*!
  * AES encryption/decryption cipher application key
  */
-#define LORAWAN_APPLICATION_KEY                     { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }
+#define LORAWAN_APPLICATION_KEY                     {0x54,0xBC,0x37,0x85,0xB7,0x5B,0x3B,0x3C,0x87,0x3E,0xB0,0x16,0x96,0xBD,0xE2,0x7D}
+
+#else
+
+/*!
+ * Mote device IEEE OUI (big endian)
+ * \remark This is unique to a company or organization
+ */
+#define IEEE_OUI                                    0x00, 0x25, 0x0C
+
+/*!
+ * Mote device IEEE EUI (big endian)
+ *
+ * \remark In this application, if the last 4 bytes are all 0, then the 32 bit address is automatically generated using a pseudo random generator seeded with a value derived from BoardUniqueId value
+ * If provided by user, e.g. { IEEE_OUI, 0x00, 0x00, 0x00, 0xFF, 0x01 }, then this value is used by the application
+ */
+#define LORAWAN_DEVICE_EUI                          { IEEE_OUI, 0x01, 0x00, 0x00, 0x10, 0xEA }
+
+/*!
+ * Application IEEE EUI (big endian)
+ */
+#define LORAWAN_APPLICATION_EUI                     { 0x00, 0x25, 0x0C, 0x00, 0x00, 0x01, 0x00, 0x01 }
+
+/*!
+ * AES encryption/decryption cipher application key
+ */
+#define LORAWAN_APPLICATION_KEY                     {0x8B,0x51,0x41,0xF8,0x41,0x76,0x7C,0xF4,0x61,0x60,0x74,0x8F,0xA0,0x71,0x92,0x3B}
+
+#endif
 
 #else
 
--- a/app/Config.h	Fri Sep 08 21:05:04 2017 +0000
+++ b/app/Config.h	Sat Sep 09 00:26:19 2017 +0000
@@ -45,7 +45,7 @@
  * \remark 1 : Confirmed messages enabled. Must receive ACK from network server
            0 : Confirmed messages disabled. 
  */
-#define LORAWAN_CONFIRMED_MSG_ON                    1
+#define LORAWAN_CONFIRMED_MSG_ON                    0
 
 /*!
  * LoRaWAN Adaptive Data Rate
@@ -60,11 +60,20 @@
  */
 #define LORAWAN_DEFAULT_DATARATE                    DR_0
 
+#if( SENSOR == 1 )
+/*!
+ * LoRaWAN application port
+ */
+#define LORAWAN_APP_PORT                            13
+
+#else
 /*!
  * LoRaWAN application port
  */
 #define LORAWAN_APP_PORT                            14
 
+#endif
+
 /*!
  * LoRaWAN User defined Tx Power
  *
@@ -130,7 +139,7 @@
 /*!
  * User application data buffer size
  */
-#define LORAWAN_APP_DATA_SIZE                       2
+#define LORAWAN_APP_DATA_SIZE                       5
 
 #elif ( LORAWAN_APP_PORT == 14 )
 /*====================================================
--- a/app/LoRaEventProc.cpp	Fri Sep 08 21:05:04 2017 +0000
+++ b/app/LoRaEventProc.cpp	Sat Sep 09 00:26:19 2017 +0000
@@ -210,16 +210,13 @@
     case 13: 
     {
         uint8_t ptrIndex       =  0;
-        uint8_t data_header[2] = {0};
-
-            //Point the pointer to position index of Tx Buffer
-            LoRaApp.ApplicationPtrPos( ptrIndex );
+        uint8_t data_header[3] = {1, 8, 1};
 
-        //data_header[0] = 0;
-        //data_header[1] = 0;
+        //Point the pointer to position index of Tx Buffer
+        LoRaApp.ApplicationPtrPos( ptrIndex );
             
-            //LoRaApp.ApplicationAppendData( data_header, 2 ); 
-            LoRaApp.ApplicationCall( AppExtLight ); // Transmit uplink counter   
+        LoRaApp.ApplicationAppendData( data_header, 3 ); 
+        LoRaApp.ApplicationCall( AppExtLight ); // Transmit uplink counter   
         break;
     }