X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstm32f103-nucleo%2Fhello.c;h=1571eae4f5427c457ba3b352c0dd6ce7796daeef;hb=e54e09c9b510f67074f25a0b348088c0b614cb26;hp=938afd2d706ba3767343c7c8f744b159f26822e3;hpb=2c334d6e809d7e94d19cc6cfbb20d6fd13637e36;p=fw%2Faltos diff --git a/src/stm32f103-nucleo/hello.c b/src/stm32f103-nucleo/hello.c index 938afd2d..1571eae4 100644 --- a/src/stm32f103-nucleo/hello.c +++ b/src/stm32f103-nucleo/hello.c @@ -18,21 +18,25 @@ #include -void -ao_delay(AO_TICK_TYPE ticks) +static void blink(void) { - uint32_t then = ao_time(); - while ((int32_t) (ao_time() - then) < (int32_t) ticks) - ao_arch_nop(); + for (;;) { + ao_led_for(AO_LED_GREEN, 50); + ao_delay(50); + } } +static struct ao_task blink_task; + int main(void) { ao_clock_init(); - ao_timer_init(); ao_led_init(); - for (;;) { - ao_led_for(AO_LED_GREEN, 50); - ao_delay(50); - } + ao_timer_init(); + ao_serial_init(); + ao_usb_init(); + ao_task_init(); + ao_cmd_init(); + ao_add_task(&blink_task, blink, "blink"); + ao_start_scheduler(); }