Skip to content

Commit

Permalink
stm32 hal: fix F1xx builds
Browse files Browse the repository at this point in the history
  • Loading branch information
cruwaller committed Jun 24, 2024
1 parent 1f3040f commit bf40ab3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/src/stm32_hal/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,14 @@ void FAST_CODE_2 USART_IDLE_IRQ_handler(uint32_t index)
uint8_t head_pos = sizeof(serial->rx_buffer) -
LL_DMA_GetDataLength((DMA_TypeDef *)serial->dma_unit_rx, serial->dma_ch_rx);
serial->rx_head = head_pos;
//LL_USART_ClearFlag_IDLE((USART_TypeDef *)uart);
#if defined(USART_ICR_IDLECF)
uart->ICR = USART_ICR_IDLECF;
#elif defined(STM32F1xx)
// SR already read, just read DR to clear IRQ flags
(void)uart->RxDataReg;
#else
LL_USART_ClearFlag_IDLE((USART_TypeDef *)uart);
#endif
}
/* Check for RX data */
else if ((SR & (USART_SR_RXNE | USART_SR_ORE)) && (CR1 & USART_CR1_RXNEIE)) {
Expand Down Expand Up @@ -646,7 +652,7 @@ uint32_t HardwareSerial::write_direct(const uint8_t *buff, uint32_t len)
hw_enable_transmitter();
uart_tx->CR1 &= ~USART_CR1_TXEIE; // Disable TX ISR
while (len--) {
while(!(uart_tx->StatReg & USART_ISR_TXE));
while(!(uart_tx->StatReg & USART_SR_TXE));
uart_tx->TxDataReg = *buff++;
}
hw_enable_receiver();
Expand Down

0 comments on commit bf40ab3

Please sign in to comment.