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.
26 lines
704 B
26 lines
704 B
#include <libopencm3/stm32/gpio.h>
|
|
|
|
#include <gpio.h>
|
|
|
|
int gpio_init(void)
|
|
{
|
|
/* Set up GPIOs for SPI 1 */
|
|
gpio_mode_setup(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO6);
|
|
gpio_set(GPIOB, GPIO6);
|
|
gpio_mode_setup(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO3 | GPIO4 | GPIO5);
|
|
gpio_set_af(GPIOB, GPIO_AF0, GPIO3 | GPIO4 | GPIO5);
|
|
|
|
/* Set up GPIOs for user console (USART 1) */
|
|
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9 | GPIO10);
|
|
gpio_set_af(GPIOA, GPIO_AF1, GPIO9 | GPIO10);
|
|
|
|
/* Set up GPIOs for admin console (USART 2) */
|
|
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO2 | GPIO3);
|
|
gpio_set_af(GPIOA, GPIO_AF1, GPIO2 | GPIO3);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void gpio_cleanup(void)
|
|
{
|
|
}
|
|
|