|
|
@ -18,10 +18,18 @@
|
|
|
|
#define STM32F1 1 // Needed for libopencm3
|
|
|
|
#define STM32F1 1 // Needed for libopencm3
|
|
|
|
|
|
|
|
|
|
|
|
void setup (void) { // All the blackbox code
|
|
|
|
void setup (void) { // All the blackbox code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set up clock
|
|
|
|
rcc_clock_setup_in_hse_8mhz_out_24mhz();
|
|
|
|
rcc_clock_setup_in_hse_8mhz_out_24mhz();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Enable the two GPIOs
|
|
|
|
rcc_periph_clock_enable(RCC_GPIOC);
|
|
|
|
rcc_periph_clock_enable(RCC_GPIOC);
|
|
|
|
rcc_periph_clock_enable(RCC_GPIOA);
|
|
|
|
rcc_periph_clock_enable(RCC_GPIOA);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GPIO C8 amd C9 are the two LEDs
|
|
|
|
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO8 | GPIO9);
|
|
|
|
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO8 | GPIO9);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GPIO A0 is the push button
|
|
|
|
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO0);
|
|
|
|
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|