Format
This commit is contained in:
parent
7b52f473f1
commit
6933084c76
1 changed files with 15 additions and 16 deletions
31
main.c
31
main.c
|
@ -2,31 +2,30 @@
|
||||||
#include <libopencm3/stm32/rcc.h>
|
#include <libopencm3/stm32/rcc.h>
|
||||||
|
|
||||||
static void clock_setup(void) {
|
static void clock_setup(void) {
|
||||||
// Use external 8 MHz HSE and PLL to 72 MHz
|
// Use external 8 MHz HSE and PLL to 72 MHz
|
||||||
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]);
|
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]);
|
||||||
rcc_periph_clock_enable(RCC_GPIOC);
|
rcc_periph_clock_enable(RCC_GPIOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gpio_setup(void) {
|
static void gpio_setup(void) {
|
||||||
// gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO13);
|
// gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO13);
|
||||||
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL,
|
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13);
|
||||||
GPIO13);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void delay(volatile uint32_t count) {
|
static void delay(volatile uint32_t count) {
|
||||||
while (count-- > 0) {
|
while (count-- > 0) {
|
||||||
__asm__("nop");
|
__asm__("nop");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
clock_setup();
|
clock_setup();
|
||||||
gpio_setup();
|
gpio_setup();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
gpio_toggle(GPIOC, GPIO13); // On Blue Pill: LED is on PC13
|
gpio_toggle(GPIOC, GPIO13); // On Blue Pill: LED is on PC13
|
||||||
delay(10000000); // Crude delay loop
|
delay(10000000); // Crude delay loop
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue