#include #include #include #include #include #include #include "system.h" static void gpio_setup(void) { rcc_periph_clock_enable(RCC_GPIOC); gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13); } int main(void) { rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]); // rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSI_48MHZ]); gpio_setup(); sys_tick_setup(); gpio_clear(GPIOC, GPIO13); gpio_set(GPIOC, GPIO13); // gpio_set(GPIOB, GPIO6); /* LED2 off */ // ticks = 0; uint64_t init = sys_ticks_get(); while (sys_ticks_get() == init); /* We call this handler every 1ms so 1000ms = 1s on/off. */ uint64_t ref = 0; while (1) { if (sys_ticks_get() > ref) { ref += 500; gpio_toggle(GPIOC, GPIO13); // while (sys_ticks_get() % 1000 == 0); } } while (1); return 0; }