From: Martin Mares Date: Sun, 25 Jul 2021 08:59:43 +0000 (+0200) Subject: protab: blink-usbboot X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=95abd8d8d9fb9135d8d06b4db99b75d8ae6a625c;p=home-hw.git protab: blink-usbboot --- 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 (""); + } +}