diff options
author | Keith Packard <keithp@keithp.com> | 2012-03-22 19:41:23 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-03-28 21:37:03 -0700 |
commit | f6e557bc2f0bd6d4272ed00dd09554d27a83be89 (patch) | |
tree | f044528f7ddf6882700bbd75a8ca794ea98b8dd9 /src | |
parent | 03fbc18ea17a9e77a1d4d8e0ddb97abbe5da3658 (diff) |
Actually enable usarts with the new usart code
And move USART1 to PB6/PB7 to avoid conflicting with
the LCD pins.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/stm/ao_serial_stm.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/stm/ao_serial_stm.c b/src/stm/ao_serial_stm.c index 881819db..bd3b1e61 100644 --- a/src/stm/ao_serial_stm.c +++ b/src/stm/ao_serial_stm.c @@ -203,21 +203,22 @@ ao_serial_init(void) /* * TX RX * PA9 PA10 - * PB6 PB7 + * PB6 PB7 * */ - stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOAEN); + stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOBEN); - stm_moder_set(&stm_gpioa, 9, STM_MODER_ALTERNATE); - stm_moder_set(&stm_gpioa, 10, STM_MODER_ALTERNATE); - stm_afr_set(&stm_gpioa, 9, STM_AFR_AF7); - stm_afr_set(&stm_gpioa, 10, STM_AFR_AF7); + stm_moder_set(&stm_gpiob, 6, STM_MODER_ALTERNATE); + stm_moder_set(&stm_gpiob, 7, STM_MODER_ALTERNATE); + stm_afr_set(&stm_gpiob, 6, STM_AFR_AF7); + stm_afr_set(&stm_gpiob, 7, STM_AFR_AF7); /* Enable USART */ stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_USART1EN); - ao_stm_usart1.reg = &stm_usart1; + ao_usart_init(&ao_stm_usart1); + stm_nvic_set_enable(STM_ISR_USART1_POS); stm_nvic_set_priority(STM_ISR_USART1_POS, 4); #if USE_SERIAL_STDIN @@ -243,6 +244,7 @@ ao_serial_init(void) /* Enable USART */ stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_USART2EN); + ao_usart_init(&stm_usart1); ao_stm_usart2.reg = &stm_usart2; @@ -266,6 +268,7 @@ ao_serial_init(void) /* Enable USART */ stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_USART3EN); + ao_usart_init(&stm_usart1); ao_stm_usart3.reg = &stm_usart3; |