We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
/*---------------------------------------------------------------------------- * CMSIS-RTOS 'main' function template *---------------------------------------------------------------------------*/ #include "RTE_Components.h" #include CMSIS_device_header #include "cmsis_os2.h" void GPIOInit(void); void LEDOn(void); void LEDOff(void); /*---------------------------------------------------------------------------- * Application main thread *---------------------------------------------------------------------------*/ __NO_RETURN static void app_main (void *argument) { (void)argument; // ... for (;;) { LEDOn() ; osDelay(500); LEDOff(); osDelay(500); } } int main (void) { osKernelInitialize(); // Initialize CMSIS-RTOS // System Initialization SystemCoreClockUpdate(); GPIOInit(); // ... osThreadNew(app_main, NULL, NULL); // Create application main thread osKernelStart(); // Start thread execution for (;;) { osDelay(20); } } void GPIOInit(void) { //enable GPIOA RCC->APB2ENR |= RCC_APB2ENR_IOPAEN; //PA_5 - output, push pull (green Led) GPIOA->CRL |= GPIO_CRL_MODE5_0 | GPIO_CRL_MODE5_1; GPIOA->CRL &= ~GPIO_CRL_CNF; } void LEDOn(void) { //turn on A_5 GPIOA->BSRR |= GPIO_BSRR_BS5; } void LEDOff(void) { //turn off A_5 GPIOA->BSRR |= GPIO_BSRR_BR5; }