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.
27 lines
704 B
27 lines
704 B
8 years ago
|
#include <libopencm3/stm32/gpio.h>
|
||
|
|
||
|
#include <gpio.h>
|
||
|
|
||
|
int gpio_init(void)
|
||
|
{
|
||
|
/* Set up GPIOs for SPI 1 */
|
||
|
gpio_mode_setup(GPIOA, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO4);
|
||
|
gpio_set(GPIOA, GPIO4);
|
||
|
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)
|
||
|
{
|
||
|
}
|