1 #include CMSIS_device_header
2 #include "Driver_GPIO.h"
9 extern ARM_DRIVER_GPIO Driver_GPIOA, Driver_GPIOC;
10 ARM_DRIVER_GPIO *ioa = &Driver_GPIOA, *ioc = &Driver_GPIOC;
12 // CMSIS RTOS2 error handler
13 void osRtxErrorNotify(uint32_t code)
20 void control_led_task(void *args)
24 sample_state button_samples;
25 debounce_init(&button_samples, true, 5);
27 ioa->SetOutput(5, led);
33 &button_samples, ioc->GetInput(13));
34 if (stable && !*stable)
37 ioa->SetOutput(5, led);
39 vTaskDelay(pdMS_TO_TICKS(1000));
47 SystemCoreClockUpdate();
50 RCC_AHB1ENR_GPIOAEN | RCC_AHB1ENR_GPIOCEN;
55 ioa->SetDirection(5, ARM_GPIO_OUTPUT);
60 const osThreadAttr_t thread_attr = {
61 .name = "LED Control",
62 .stack_size = 512 // 512 words = 2048 bytes
64 osThreadNew(control_led_task, NULL, &thread_attr);
68 // Should never reach here