mbed library sources

Fork of mbed-src by mbed official

Revision:
79:6fdc4ea80ae0
Parent:
9:0ce32e54c9a7
Child:
113:65a335a675de
diff -r 2cab419ff388 -r 6fdc4ea80ae0 common/board.c
--- a/common/board.c	Wed Jan 29 18:45:05 2014 +0000
+++ b/common/board.c	Thu Jan 30 09:45:05 2014 +0000
@@ -19,10 +19,12 @@
 
 WEAK void mbed_die(void);
 WEAK void mbed_die(void) {
-#if   defined(DEVICE_ERROR_RED)
+	__disable_irq();	// dont allow interrupts to disturb the flash pattern
+	
+#if   (DEVICE_ERROR_RED == 1)
     gpio_t led_red; gpio_init(&led_red, LED_RED, PIN_OUTPUT);
 
-#elif defined(DEVICE_ERROR_PATTERN)
+#elif (DEVICE_ERROR_PATTERN == 1)
     gpio_t led_1; gpio_init(&led_1, LED1, PIN_OUTPUT);
     gpio_t led_2; gpio_init(&led_2, LED2, PIN_OUTPUT);
     gpio_t led_3; gpio_init(&led_3, LED3, PIN_OUTPUT);
@@ -30,26 +32,28 @@
 #endif
     
     while (1) {
-#if defined(DEVICE_ERROR_RED)
+#if   (DEVICE_ERROR_RED == 1)
         gpio_write(&led_red, 1);
 
-#elif  defined(DEVICE_ERROR_PATTERN)
+#elif (DEVICE_ERROR_PATTERN == 1)
         gpio_write(&led_1, 1);
         gpio_write(&led_2, 0);
         gpio_write(&led_3, 0);
         gpio_write(&led_4, 1);
 #endif
+        
         wait_ms(150);
 
-#if   defined(DEVICE_ERROR_RED)
+#if   (DEVICE_ERROR_RED == 1)
         gpio_write(&led_red, 0);
 
-#elif defined(DEVICE_ERROR_PATTERN)
+#elif (DEVICE_ERROR_PATTERN == 1)
         gpio_write(&led_1, 0);
         gpio_write(&led_2, 1);
         gpio_write(&led_3, 1);
         gpio_write(&led_4, 0);
 #endif
+        
         wait_ms(150);
     }
 }