projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/easytimer-v2: Initialize logging too
[fw/altos]
/
src
/
stm32l0
/
ao_lpuart_stm.c
diff --git
a/src/stm32l0/ao_lpuart_stm.c
b/src/stm32l0/ao_lpuart_stm.c
index 8fdc09f488a47d2375a954352d8df39c570cc896..08a0859b0ea1e18ad163b812c0b66ca23c90e7f9 100644
(file)
--- a/
src/stm32l0/ao_lpuart_stm.c
+++ b/
src/stm32l0/ao_lpuart_stm.c
@@
-85,7
+85,7
@@
_ao_lpuart_rx(struct ao_stm_lpuart *lpuart, int is_stdin)
}
#endif
} else {
}
#endif
} else {
- lpuart->reg->cr1 &= ~(1 << STM_LPUART_CR1_RXNEIE);
+ lpuart->reg->cr1 &= ~(1
UL
<< STM_LPUART_CR1_RXNEIE);
}
}
}
}
}
}
@@
-96,11
+96,11
@@
ao_lpuart_isr(struct ao_stm_lpuart *lpuart, int is_stdin)
_ao_lpuart_rx(lpuart, is_stdin);
if (!_ao_lpuart_tx_start(lpuart))
_ao_lpuart_rx(lpuart, is_stdin);
if (!_ao_lpuart_tx_start(lpuart))
- lpuart->reg->cr1 &= ~(1<< STM_LPUART_CR1_TXEIE);
+ lpuart->reg->cr1 &= ~(1
UL
<< STM_LPUART_CR1_TXEIE);
if (lpuart->reg->isr & (1 << STM_LPUART_ISR_TC)) {
lpuart->tx_running = 0;
if (lpuart->reg->isr & (1 << STM_LPUART_ISR_TC)) {
lpuart->tx_running = 0;
- lpuart->reg->cr1 &= ~(1 << STM_LPUART_CR1_TCIE);
+ lpuart->reg->cr1 &= ~(1
UL
<< STM_LPUART_CR1_TCIE);
if (lpuart->draining) {
lpuart->draining = 0;
ao_wakeup(&lpuart->tx_fifo);
if (lpuart->draining) {
lpuart->draining = 0;
ao_wakeup(&lpuart->tx_fifo);
@@
-182,7
+182,7
@@
ao_lpuart_set_speed(struct ao_stm_lpuart *lpuart, uint8_t speed)
{
if (speed > AO_SERIAL_SPEED_115200)
return;
{
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
}
static void
@@
-355,20
+355,21
@@
ao_lpuart1_enable(void)
void
ao_lpuart1_disable(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);
/* 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
/* 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
/* Disable LPUART */
# else
# error "No LPUART_1 port configuration specified"
# endif
/* Disable LPUART */
- stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_LPUART1EN);
+ stm_rcc.apb1enr &= ~(1
UL
<< STM_RCC_APB1ENR_LPUART1EN);
}
}
+