stm32p103: change debug message in example application.
[bertos.git] / examples / stm32p103 / main.c
index 83481f8c00ac6ab037d663b2939531f00da78abf..de49bbb5a98c458c257a711450be1af289da564d 100644 (file)
 
 #define LED_PIN                    (1 << 12)
 
+static void led_init(void)
+{
+       /* Enable clocking on GPIOA and GPIOC */
+       RCC->APB2ENR |= RCC_APB2_GPIOC;
+       /* Configure the LED pin as GPIO */
+       stm32_gpioPinConfig((struct stm32_gpio *)GPIOC_BASE,
+                       LED_PIN, GPIO_MODE_OUT_PP, GPIO_SPEED_50MHZ);
+}
+
 int main(void)
 {
+       int i;
+
        IRQ_ENABLE;
+       kdbg_init();
        timer_init();
+       proc_init();
+       led_init();
 
-       /* Enable clocking on RCC APB2 */
-       RCC->AHBENR |= 1;
-       /* Enable clocking on GPIOA and GPIOC */
-       RCC->APB2ENR |= RCC_APB2_GPIOA | RCC_APB2_GPIOC;
-
-       stm32_gpioPinConfig((struct stm32_gpio *)GPIOC_BASE,
-                       LED_PIN, GPIO_MODE_OUT_PP, GPIO_SPEED_50MHZ);
-       while(1)
+       for (i = 0; ; i = !i)
        {
-               ticks_t clock = timer_clock_unlocked();
-
-               if (clock & 0x10)
-                       stm32_gpioPinWrite((struct stm32_gpio *)GPIOC_BASE, LED_PIN, 1);
-               else
-                       stm32_gpioPinWrite((struct stm32_gpio *)GPIOC_BASE, LED_PIN, 0);
+               stm32_gpioPinWrite((struct stm32_gpio *)GPIOC_BASE, LED_PIN, i);
+               kputs("BeRTOS up & running!\n");
+               timer_delay(500);
        }
 }