Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
chintal committed Oct 12, 2024
1 parent adaa616 commit bcd88a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/hal_platform/u0xx/uart_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ static inline void _uart_handler_fifo(const HAL_BASE_t intfnum);

static inline void _uart_handler_tx_norm(const HAL_BASE_t intfnum){
// TXE in single byte mode
uint8_t wbyte;
if (bytebuf_cPopulation(uart_if[intfnum]->txbuf) <= 1){
*(HAL_SFR_t *) (uart_if[intfnum]->hwif->base + OFS_UART_CR1) &= ~USART_CR1_TXEIE;
uart_if[intfnum]->state->triggered = 0;
}
if (bytebuf_cPopulation(uart_if[intfnum]->txbuf)) {
*(HAL_SFR_t *) (uart_if[intfnum]->hwif->base + OFS_UART_TDR) = bytebuf_cPopByte(uart_if[intfnum]->txbuf);
wbyte = bytebuf_cPopByte(uart_if[intfnum]->txbuf);
*(HAL_SFR_t *) (uart_if[intfnum]->hwif->base + OFS_UART_TDR) = wbyte;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/hal_platform/u0xx/uart_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,12 @@ static inline void uart_discard_rxb(HAL_BASE_t intfnum){

static inline void uart_send_trigger(HAL_BASE_t intfnum){
if (!(uart_if[intfnum]->state->triggered)){
uart_if[intfnum]->state->triggered = 1;
if (uart_if[intfnum]->hwif->fifomode){
* (HAL_SFR_t *) (uart_if[intfnum]->hwif->base + OFS_UART_CR3) |= USART_CR3_TXFTIE;
} else {
* (HAL_SFR_t *) (uart_if[intfnum]->hwif->base + OFS_UART_CR1) |= USART_CR1_TXEIE;
}
uart_if[intfnum]->state->triggered = 1;
}
}

Expand Down

0 comments on commit bcd88a7

Please sign in to comment.