1 #include <libopencm3/cm3/systick.h>
2 #include <libopencm3/stm32/rcc.h>
3 #include <libopencm3/stm32/gpio.h>
5 static void delay_ms(unsigned int ms)
8 for (unsigned int i=0; i<ms; i++)
9 while (!systick_get_countflag())
15 rcc_clock_setup_in_hse_8mhz_out_72mhz();
16 rcc_periph_clock_enable(RCC_GPIOC);
18 // PC13 = BluePill LED
19 gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13);
21 systick_set_clocksource(STK_CSR_CLKSOURCE_AHB);
22 systick_set_reload(71999);
23 systick_counter_enable();
26 gpio_clear(GPIOC, GPIO13);
28 gpio_set(GPIOC, GPIO13);