"Sensors Reader" Sample Application for X-NUCLEO-IKS01A1 Expansion Board

Dependencies:   X_NUCLEO_IKS01A2 mbed

Fork of Sensors_Reader by ST

Revision:
49:0223aee4b17a
Parent:
48:9631c81e1d87
Child:
50:4a902230142d
--- a/main.cpp	Mon Jun 22 11:46:53 2015 +0200
+++ b/main.cpp	Tue Jun 23 14:46:09 2015 +0200
@@ -230,8 +230,6 @@
 
 
 /*** Main function ------------------------------------------------------------- ***/
-#define D_SLEEP_VERSION 4
-
 /* Generic main function/loop for enabling WFI in case of 
    interrupt based cyclic execution
 */
@@ -244,51 +242,6 @@
 	/* Start timer irq */
 	ticker.attach_us(timer_irq, MS_INTERVALS * APP_LOOP_PERIOD);
 
-#if D_SLEEP_VERSION == 1 // version without WFI/WFE and without IRQ synchronization
-	while (true) {
-		if(timer_irq_triggered) {
-			timer_irq_triggered = false;
-			main_cycle();
-		} else if(ff_irq_triggered) {
-			ff_irq_triggered = false;
-			handle_ff_irq();
-		}
-	}
-#elif D_SLEEP_VERSION == 2 // classical version with WFI and with IRQ synchronization
-	while (true) {
-		__disable_irq();
-		if(timer_irq_triggered) {
-			timer_irq_triggered = false;
-			__enable_irq();
-			main_cycle();
-		} else if(ff_irq_triggered) {
-			ff_irq_triggered = false;
-			__enable_irq();
-			handle_ff_irq();
-		} else {
-			__WFI();
-                        __enable_irq(); /* do NOT enable irqs before WFI to avoid
-					   opening a window in which you can loose
-					   irq arrivals before going into WFI */
-		}
-	}
-#elif D_SLEEP_VERSION == 3 // version with WFE and with IRQ synchronization
-	while (true) {
-		__disable_irq();
-		if(timer_irq_triggered) {
-			timer_irq_triggered = false;
-			__enable_irq();
-			main_cycle();
-		} else if(ff_irq_triggered) {
-			ff_irq_triggered = false;
-			__enable_irq();
-			handle_ff_irq();
-		} else {
-                        __enable_irq();
-			__WFE(); /* assuming that SEVONPEND in the System Control Register is NOT set */
-		}
-	}
-#elif D_SLEEP_VERSION == 4 // version with WFE and without IRQ synchronization
 	while (true) {
 		if(timer_irq_triggered) {
 			timer_irq_triggered = false;
@@ -297,10 +250,8 @@
 			ff_irq_triggered = false;
 			handle_ff_irq();
 		} else {
-			__WFE(); /* assuming that SEVONPEND in the System Control Register is NOT set */
+			__WFE(); /* it is recommended that SEVONPEND in the 
+				    System Control Register is NOT set */
 		}
 	}
-#else  // D_SLEEP_VERSION != [1|2|3|4]
-#error "Unsupported D_SLEEP_VERSION selected!"
-#endif // D_SLEEP_VERSION != [1|2|3|4]
 }