first draft

Dependencies:   LMiC SX1272Libx mbed

Fork of LoRaWAN-lmic-app by Semtech

Revision:
8:0137acc9a6cd
Parent:
6:fc465060b63e
Child:
9:0b63a0a90205
--- a/main.cpp	Tue Feb 23 15:44:48 2016 +0000
+++ b/main.cpp	Thu Feb 25 15:40:21 2016 +0000
@@ -69,12 +69,18 @@
 
 #endif
 Serial pc(PTE0, PTE1);
+#define LED_RED         PTA1
+#define LED_YEL         PTA2
+
+DigitalOut led1(LED_RED);
+DigitalOut led2(LED_YEL);
 
 //////////////////////////////////////////////////
 // CONFIGURATION (FOR APPLICATION CALLBACKS BELOW)
 //////////////////////////////////////////////////
 // application router ID (LSBF)
-static const u1_t AppEui[8]  = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 };
+//static const u1_t AppEui[8]  = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 };
+static const u1_t AppEui[8]  = { 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00 };
 
 // unique device ID (LSBF)
 static const u1_t DevEui[8]  = { 0x02, 0x00, 0x00, 0x00, 0x00, 0xee, 0xff, 0xc0 };
@@ -211,6 +217,7 @@
     os_setTimedCallback( &txLedJob, os_getTime( ) + ms2osticks( 25 ), onTxLed );
 }
 
+#if 1
 // Initialization job
 static void onInit( osjob_t* j )
 {
@@ -233,12 +240,40 @@
 #endif
     // init done - onEvent( ) callback will be invoked...
 }
+#endif
+
+#if 0
+// counter static 
+int cnt = 0; 
+// log text to USART and toggle LED
+static void onInit (osjob_t* job) 
+{ 
+    // say hello 
+    debug_str("Hello World!\r\n");
+    // log counter 
+    debug_val("cnt = ", cnt); 
+    // toggle LED 
+    if((cnt & 1) == 1)
+    {
+         led1 = 1;
+    }
+    else
+     {
+         led1 = 0;
+    }
+     debug_led(cnt & 1); 
+    cnt++;
+   // reschedule job every second 
+    os_setTimedCallback(job, os_getTime()+sec2osticks(1), onInit);
+}
+#endif
 
 int main( void )
 {
     osjob_t initjob;
     
-    pc.baud(115200);
+    led1=0;
+     pc.baud(115200);
     printf( "\r\nLoRaWan Demo Application TJM\r\n" );
     // initialize runtime env
     os_init( );