#include "system.h" #include "gpio.h" //////////////////////////////////////////////////////////////////////// static constexpr unsigned ticks = SYSTEM_CORE_CLOCK / 1000u; static volatile unsigned counter = 0u; extern "C" [[gnu::interrupt]] void SysTick_Handler (); //////////////////////////////////////////////////////////////////////// void SysTick_Handler () { SysTick.SR = 0u; if (counter) counter -= 1u; } static void delay (const unsigned dly = 200u) { counter = dly; while (counter); } int main () { GpioClass led (GPIOB, 8); SysTick.Config (ticks); unsigned pass_cnt = 0u; for (;;) { delay(); const bool b = pass_cnt & 1u; led << b; pass_cnt += 1u; } return 0; }