Skip to content

Commit d353dd3

Browse files
committed
Slight changes
1 parent 7ba9065 commit d353dd3

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

STM32F1/cores/maple/libmaple/usart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ uint32 usart_tx(usart_dev *dev, const uint8 *buf, uint32 len) {
105105
else
106106
break;
107107
}
108-
if (rb_full_count(dev->wb) > 0) {
108+
if (!rb_is_empty(dev->wb)) {
109109
regs->CR1 |= USART_CR1_TXEIE;
110110
}
111111
return txed;

STM32F1/system/libmaple/usart_private.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ static inline __always_inline void usart_irq(ring_buffer *rb, ring_buffer *wb, u
5555
}
5656
/* TXE signifies readiness to send a byte to DR. */
5757
if ((regs->CR1 & USART_CR1_TXEIE) && (regs->SR & USART_SR_TXE)) {
58-
regs->DR=rb_remove(wb);
59-
if (rb_is_empty(wb))
58+
if (!rb_is_empty(wb))
59+
regs->DR=rb_remove(wb);
60+
else
6061
regs->CR1 &= ~((uint32)USART_CR1_TXEIE); // disable TXEIE
6162
}
6263
}

0 commit comments

Comments
 (0)