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.
44 lines
884 B
44 lines
884 B
/* This is our reset code (tested).
|
|
*
|
|
* TODO: integrate fully within code base.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <libopencm3/stm32/rcc.h>
|
|
#include <libopencm3/stm32/gpio.h>
|
|
|
|
static void delay(unsigned ms)
|
|
{
|
|
unsigned i;
|
|
|
|
for (i = 0; i < 1000 * ms; ++i) {
|
|
__asm__("nop");
|
|
}
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
rcc_periph_clock_enable(RCC_GPIOB);
|
|
rcc_periph_clock_enable(RCC_GPIOC);
|
|
|
|
gpio_mode_setup(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO11);
|
|
gpio_set_output_options(GPIOB, GPIO_OTYPE_OD, GPIO_OSPEED_25MHZ, GPIO11);
|
|
|
|
gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO8);
|
|
gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO9);
|
|
|
|
while (1) {
|
|
gpio_set(GPIOB, GPIO11);
|
|
gpio_clear(GPIOC, GPIO8);
|
|
gpio_set(GPIOC, GPIO9);
|
|
delay(5 * 5000);
|
|
|
|
gpio_clear(GPIOB, GPIO11);
|
|
gpio_set(GPIOC, GPIO8);
|
|
gpio_clear(GPIOC, GPIO9);
|
|
delay(5 * 5000);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|