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.
 
 
 

16 lines
380 B

  1. #include <libopencm3/stm32/rcc.h>
  2. #include <libopencm3/stm32/gpio.h>
  3. int main(void) {
  4. rcc_periph_clock_enable(RCC_GPIOC);
  5. gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13);
  6. gpio_set(GPIOC, GPIO13);
  7. while(1) {
  8. /* wait a little bit */
  9. for (int i = 0; i < 800000; i++) {
  10. __asm__("nop");
  11. }
  12. gpio_toggle(GPIOC, GPIO13);
  13. }
  14. }