aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/stm32f2/jobygps/usart_printf/usart_printf.c3
-rw-r--r--lib/stm32f2/gpio.c19
2 files changed, 2 insertions, 20 deletions
diff --git a/examples/stm32f2/jobygps/usart_printf/usart_printf.c b/examples/stm32f2/jobygps/usart_printf/usart_printf.c
index b03b842..f5a4cf5 100644
--- a/examples/stm32f2/jobygps/usart_printf/usart_printf.c
+++ b/examples/stm32f2/jobygps/usart_printf/usart_printf.c
@@ -43,8 +43,7 @@ void clock_setup(void)
void usart_setup(void)
{
- //gpio_mode_setup(GPIOA, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO9);
- GPIO_MODER(GPIOA) |= GPIO_MODE(9, GPIO_MODE_AF);
+ gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9);
gpio_set_af(GPIOA, GPIO_AF7, GPIO9|GPIO10);
/* Setup UART parameters. */
diff --git a/lib/stm32f2/gpio.c b/lib/stm32f2/gpio.c
index 2330628..abb08c0 100644
--- a/lib/stm32f2/gpio.c
+++ b/lib/stm32f2/gpio.c
@@ -17,29 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/*
- * Basic GPIO handling API.
- *
- * Examples:
- * gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ,
- * GPIO_CNF_OUTPUT_PUSHPULL, GPIO12);
- * gpio_set(GPIOB, GPIO4);
- * gpio_clear(GPIOG, GPIO2 | GPIO9);
- * gpio_get(GPIOC, GPIO1);
- * gpio_toggle(GPIOA, GPIO7 | GPIO8);
- * reg16 = gpio_port_read(GPIOD);
- * gpio_port_write(GPIOF, 0xc8fe);
- *
- * TODO:
- * - GPIO remapping support
- */
-
#include <libopencm3/stm32/f2/gpio.h>
void gpio_mode_setup(u32 gpioport, u8 mode, u8 pull_up_down, u16 gpios)
{
u16 i;
- u16 moder, pupd;
+ u32 moder, pupd;
/*
* We want to set the config only for the pins mentioned in gpios,