stm32p103: create a distinct process to blink the status LED in the example application.
authorarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 12 May 2010 16:32:46 +0000 (16:32 +0000)
committerarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 12 May 2010 16:32:46 +0000 (16:32 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3673 38d2e660-2303-0410-9eaa-f027e97ec537

examples/stm32p103/main.c

index de49bbb5a98c458c257a711450be1af289da564d..483852e2148263abc988f5ca505c9402424687c0 100644 (file)
@@ -52,6 +52,17 @@ static void led_init(void)
                        LED_PIN, GPIO_MODE_OUT_PP, GPIO_SPEED_50MHZ);
 }
 
+static void NORETURN led_process(void)
+{
+       int i;
+
+       for (i = 0; ; i = !i)
+       {
+               stm32_gpioPinWrite((struct stm32_gpio *)GPIOC_BASE, LED_PIN, i);
+               timer_delay(250);
+       }
+}
+
 int main(void)
 {
        int i;
@@ -62,9 +73,9 @@ int main(void)
        proc_init();
        led_init();
 
+       proc_new(led_process, NULL, KERN_MINSTACKSIZE, NULL);
        for (i = 0; ; i = !i)
        {
-               stm32_gpioPinWrite((struct stm32_gpio *)GPIOC_BASE, LED_PIN, i);
                kputs("BeRTOS up & running!\n");
                timer_delay(500);
        }