Libopencm3 blink template, simplified for only bluepill/stm32f1 target as a base template for stm32f1 projects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

15 lines
401 B

#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/gpio.h>
int main(void) {
rcc_periph_clock_enable(RCC_LED1);
gpio_set_mode(PORT_LED1, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, PIN_LED1);
gpio_set(PORT_LED1, PIN_LED1);
while(1) {
/* wait a little bit */
for (int i = 0; i < LITTLE_BIT; i++) {
__asm__("nop");
}
gpio_toggle(PORT_LED1, PIN_LED1);
}
}