LoRaWAN demo.

Dependencies:   modem_ref_helper DebouncedInterrupt

Revision:
5:2d5d3124703a
Parent:
4:f83753357cdf
Child:
8:544a04d2bf55
--- a/main.cpp	Mon Mar 05 16:47:22 2018 +0000
+++ b/main.cpp	Tue Mar 13 17:13:49 2018 +0000
@@ -25,13 +25,31 @@
 
 bool alarm_ready = false;
 
-// This is WizziLab's The Things Network LoRaWAN configuration file
-// This device is already registered on WizziLab's APP
-//
-// You can create your own account to get custom app_id and app_key.
-// The device EUI is the modem's UID.
-// https://account.thethingsnetwork.org/register
-// https://console.thethingsnetwork.org/applications
+#define USE_WL_TTN
+#ifdef USE_WL_TTN
+    // This is WizziLab's The Things Network LoRaWAN configuration file
+    // This device is already registered on WizziLab's APP
+    //
+    // You can create your own account to get custom app_id and app_key.
+    // The device EUI is the modem's UID.
+    // https://account.thethingsnetwork.org/register
+    // https://console.thethingsnetwork.org/applications
+    
+    #define MY_APP_ID           {0x70, 0xB3, 0xD5, 0x7E, 0xF0, 0x00, 0x3A, 0xF1 }
+    #define MY_APP_KEY          {0x73, 0x90, 0x54, 0x78, 0xB5, 0x0B, 0xA8, 0x9A, 0x78, 0x23, 0xB7, 0x12, 0xD5, 0x5C, 0x70, 0x99 }
+#else
+    // This is your APP_ID and APP_KEY, as defined on your own TTN account
+    // https://account.thethingsnetwork.org/register
+    // https://console.thethingsnetwork.org/applications
+    
+    #define MY_APP_ID           { 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x00, 0xAC, 0xB2 }
+    #define MY_APP_KEY          { 0xDF, 0xF7, 0x26, 0x21, 0x22, 0xAD, 0x9A, 0xD6, 0x16, 0x84, 0xD1, 0x95, 0xBA, 0x8C, 0xD1, 0x1E }
+
+#endif
+
+
+
+
 lwan_itf_cfg_t lwan_itf_ttn = {
     .type                   = ALP_ITF_TYPE_LWAN,
     // 0: NONE, 1: OTAA, 2: ABP
@@ -39,13 +57,13 @@
     // LoRaWAN device class
     .cfg.dev_class          = LWAN_CLASS_A,
     .cfg.dev_address        = 0x700006BF, // For ABP Mode (Big Endian)
-    .cfg.app_id             = {0x70, 0xB3, 0xD5, 0x7E, 0xF0, 0x00, 0x3A, 0xF1 },
-    .cfg.app_key            = {0x73, 0x90, 0x54, 0x78, 0xB5, 0x0B, 0xA8, 0x9A, 0x78, 0x23, 0xB7, 0x12, 0xD5, 0x5C, 0x70, 0x99 },
+    .cfg.app_id             = MY_APP_ID,
+    .cfg.app_key            = MY_APP_KEY,
     // State of adaptative Datarate
-    .cfg.adr_enable         = 0,
+    .cfg.adr_enable         = 1,
     .cfg.app_skey           = {0}, // For ABP Mode
     .cfg.nw_skey            = {0}, // For ABP Mode
-    .cfg.nw_id              = 0, // ??
+    .cfg.nw_id              = 0, //
     // Enable or disable a public network
     .cfg.nw_public          = 1,
     // Uplink datarate, if adr_enable is off