Simon Hawe / D7_MLX_AND_BAT

Dependencies:   X_NUCLEO_IKS01A1 MLX90614 d7a_1x wizzi-utils

Fork of D7A_1x_demo_sensors_OS5 by WizziLab

Revision:
5:ef4b5c422d3a
Parent:
4:8ac150ec1532
Child:
6:55244aef7c67
--- a/main.cpp	Mon Jan 30 11:45:24 2017 +0000
+++ b/main.cpp	Thu Feb 02 15:31:22 2017 +0000
@@ -38,6 +38,9 @@
 #include "DebouncedInterrupt.h"
 #include "files.h"
 
+// Enable DBG led blinking (ms)
+#define DGB_LED_BLINK_PERIOD        (1000)
+
 // -----------------------------------------------
 // Hardware configuration
 // -----------------------------------------------
@@ -56,6 +59,7 @@
     #define D7A_PIN_CTS             (D10)
     #define D7A_PIN_RESET           (D12)
     #define DEBUG_LED               (D13) // LED1
+    #define DEBUG_BUTTON            (D9)
 #else
     #error "Please choose or add the right platform."
 #endif
@@ -508,18 +512,27 @@
     // For button
 #ifdef DEBUG_BUTTON
     DebouncedInterrupt user_interrupt(DEBUG_BUTTON);
-    user_interrupt.attach(button_push_isr, IRQ_FALL, 200, true);
+    user_interrupt.attach(button_push_isr, IRQ_FALL, 500, true);
 
     Thread but_th(osPriorityNormal, 512, NULL);
     status = but_th.start(button_user_thread);
     ASSERT(status == osOK, "Failed to start but thread (err: %d)\r\n", status);
 #endif
-    
+
+#ifdef DGB_LED_BLINK_PERIOD
+    DigitalOut my_led(DEBUG_LED);
+#endif
+
     // Set main task to lowest priority
     osThreadSetPriority(osThreadGetId(), osPriorityIdle);
     while(true)
     {
+#ifdef DGB_LED_BLINK_PERIOD
         // Wait to avoid beeing stuck in loop
+        Thread::wait(DGB_LED_BLINK);
+        my_led = !my_led;
+#else
         Thread::wait(osWaitForever);
+#endif
     }
 }
\ No newline at end of file