Senet-ized LMIC for MOTE_L152RC

Fork of lmic_MOTE_L152RC by Semtech

Revision:
1:04fd63382b03
Parent:
0:f2716e543d97
Child:
2:edb5d1f3deeb
diff -r f2716e543d97 -r 04fd63382b03 TARGET_MOTE_L152RC/hal.cpp
--- a/TARGET_MOTE_L152RC/hal.cpp	Tue Jun 02 19:04:29 2015 +0000
+++ b/TARGET_MOTE_L152RC/hal.cpp	Wed Jun 03 23:17:59 2015 +0000
@@ -163,9 +163,9 @@
     // Convert to timestamp
     time_t t = mktime(&timeinfo);
 
-    t &= 0xffff;
     // 14: SSR is driven at 16384Hz
-    return (t << 14) | sub_seconds;
+    t <<= 14;
+    return t | sub_seconds;
 }
 
 void hal_waitUntil (u4_t time)
@@ -234,6 +234,9 @@
         for (;;) asm("nop");
 #endif /* USE_DEBUGGER */
 
+    //printf("%x cr:%06x isr:%04x %d\r\n", RtcHandle.Instance->WUTR, RtcHandle.Instance->CR, RtcHandle.Instance->ISR, deep_sleep);
+    //debug_done();
+
     if (deep_sleep)
         debug_done();   // wait here if debug still printing
 
@@ -263,7 +266,7 @@
 #ifdef SLEEP_DEBUG
         end_tick = hal_ticks();
         time_asleep = end_tick - start_tick;
-        printf("%d\r\n", time_asleep);
+        printf("%u = %u - %u\r\n", time_asleep, end_tick, start_tick);
 #endif /* SLEEP_DEBUG */
         // restore gpio from sleep
     }