X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fstm32l0%2Fao_lpuart_stm.c;fp=src%2Fstm32l0%2Fao_lpuart_stm.c;h=c4a23f5b4f94c8edfba8c387dba676bd05bb8f56;hp=8fdc09f488a47d2375a954352d8df39c570cc896;hb=476fd2f2c23da427b6b2a68f7d285767a924041e;hpb=7b1f4177d42e5e951a7db4289c847d355a785c2a diff --git a/src/stm32l0/ao_lpuart_stm.c b/src/stm32l0/ao_lpuart_stm.c index 8fdc09f4..c4a23f5b 100644 --- a/src/stm32l0/ao_lpuart_stm.c +++ b/src/stm32l0/ao_lpuart_stm.c @@ -182,7 +182,7 @@ ao_lpuart_set_speed(struct ao_stm_lpuart *lpuart, uint8_t speed) { if (speed > AO_SERIAL_SPEED_115200) return; - lpuart->reg->brr = AO_PCLK1 / ao_usart_speeds[speed]; + lpuart->reg->brr = 256 * AO_PCLK1 / ao_usart_speeds[speed]; } static void @@ -355,16 +355,16 @@ ao_lpuart1_enable(void) void ao_lpuart1_disable(void) { - /* Disable interrupts */ - stm_nvic_clear_enable(STM_ISR_LPUART1_AES_POS); - /* Stop LPUART */ ao_lpuart_disable(&ao_stm_lpuart1); + /* Disable interrupts */ + stm_nvic_clear_enable(STM_ISR_LPUART1_AES_POS); + /* Remap pins to GPIO use */ # if LPUART_1_PA0_PA1 - stm_afr_set(&stm_gpioa, 0, STM_AFR_NONE); - stm_afr_set(&stm_gpioa, 1, STM_AFR_NONE); + stm_moder_set(&stm_gpioa, 0, STM_MODER_INPUT); + stm_moder_set(&stm_gpioa, 1, STM_MODER_OUTPUT); # else # error "No LPUART_1 port configuration specified" # endif @@ -372,3 +372,4 @@ ao_lpuart1_disable(void) /* Disable LPUART */ stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_LPUART1EN); } +