From 95abd8d8d9fb9135d8d06b4db99b75d8ae6a625c Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 25 Jul 2021 10:59:43 +0200 Subject: [PATCH] protab: blink-usbboot --- protab/blink-usbboot/Makefile | 8 ++++++++ protab/blink-usbboot/blink.c | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 protab/blink-usbboot/Makefile create mode 100644 protab/blink-usbboot/blink.c diff --git a/protab/blink-usbboot/Makefile b/protab/blink-usbboot/Makefile new file mode 100644 index 0000000..011261f --- /dev/null +++ b/protab/blink-usbboot/Makefile @@ -0,0 +1,8 @@ +ROOT=../.. +BINARY=blink +OBJS=blink.o +LIB_OBJS= +WITH_BOOT_LOADER=1 +WITH_DFU_FLASH=1 + +include $(ROOT)/mk/bluepill.mk diff --git a/protab/blink-usbboot/blink.c b/protab/blink-usbboot/blink.c new file mode 100644 index 0000000..7fe240a --- /dev/null +++ b/protab/blink-usbboot/blink.c @@ -0,0 +1,23 @@ +#include +#include + +int main(void) +{ + rcc_clock_setup_in_hse_8mhz_out_72mhz(); + rcc_periph_clock_enable(RCC_GPIOC); + + // PC13 = BluePill LED + gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13); + + for (;;) { + gpio_clear(GPIOC, GPIO13); + + for (int i=0; i<10000000; i++) + asm volatile (""); + + gpio_set(GPIOC, GPIO13); + + for (int i=0; i<10000000; i++) + asm volatile (""); + } +} -- 2.39.2