Added STM32F0-Discovery board to the blink example code
[fw/stlink] / example / blink / main.c
index 0a38069be301c930f6751a393cf60196f0587237..26fcca029ebd3487f6a941b4e88b60eb604b427c 100644 (file)
@@ -1,7 +1,7 @@
 /* missing type */
 
 typedef unsigned int uint32_t;
-
+void main(void);
 
 /* hardware configuration */
 
@@ -58,6 +58,26 @@ static inline void setup_leds(void)
        (1 << (13 * 2)) | (1 << (14 * 2)) | (1 << (15 * 2));
 }
 
+#elif CONFIG_STM32F0_DISCOVERY
+
+#define GPIOC 0x48000800 /* port C */
+#define GPIOC_MODER (GPIOC + 0x00) /* port mode register */
+#define LED_PORT_ODR (GPIOC + 0x14) /* port output data register */
+
+#define LED_BLUE (1 << 8) /* port C, pin 8 */
+#define LED_GREEN (1 << 9) /* port C, pin 9 */
+#define LED_ORANGE 0
+#define LED_RED 0
+
+void _tmain(void) {
+       main();
+}
+static inline void setup_leds(void)
+{
+  /* configure port 8 and 9 as output */
+  *(volatile uint32_t*)GPIOC_MODER |= (1 << (9* 2)) | (1 << (8 * 2));
+}
+
 #else
 #error "Architecture must be defined!"
 #endif /* otherwise, error */