#include "cmsis_os.h"
void Thread_alive (void const *argument);
osThreadDef (Thread_alive, osPriorityNormal, 1, 0);
// Toggle LED every so often to show we are alive.
void Thread_alive (void const *argument) {
u8 onoff = 0;
while (1) {
onoff = !onoff;
if (onoff)
GPIOA->ODR |= GPIO_ODR_0;
else
GPIOA->ODR &= ~GPIO_ODR_0;
osDelay(1000);
}
}
int main(void)
{
osKernelInitialize ();
//..
osThreadCreate (osThread(Thread_main), NULL);
osThreadCreate (osThread(Thread_alive), NULL);
osKernelStart ();
}