aboutsummaryrefslogtreecommitdiffstats
path: root/app/usart.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/usart.c')
-rw-r--r--app/usart.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/app/usart.c b/app/usart.c
index ecd8e56..8659ab0 100644
--- a/app/usart.c
+++ b/app/usart.c
@@ -14,30 +14,28 @@ usart1_isr (void)
uint8_t data;
/* Check if we were called because of RXNE. */
- if ( ( (USART_CR1 (USART1) & USART_CR1_RXNEIE) != 0) &&
- ( (USART_SR (USART1) & USART_SR_RXNE) != 0)) {
+ if (((USART_CR1 (USART1) & USART_CR1_RXNEIE) != 0) &&
+ ((USART_SR (USART1) & USART_SR_RXNE) != 0)) {
/* Retrieve the data from the peripheral. */
data = usart_recv (USART1);
ring_write_byte (&usart_rx_ring, data);
}
/* Check if we were called because of TXE. */
- if ( ( (USART_CR1 (USART1) & USART_CR1_TXEIE) != 0) &&
- ( (USART_SR (USART1) & USART_SR_TXE) != 0)) {
+ if (((USART_CR1 (USART1) & USART_CR1_TXEIE) != 0) &&
+ ((USART_SR (USART1) & USART_SR_TXE) != 0)) {
if (ring_read_byte (&usart_tx_ring, &data)) {
/*No more data, Disable the TXE interrupt, it's no longer needed. */
USART_CR1 (USART1) &= ~USART_CR1_TXEIE;
- } else {
+ } else
usart_send (USART1, data);
- }
}
}
void usart_kick (void)
{
- if (!ring_empty (&usart_tx_ring)) {
+ if (!ring_empty (&usart_tx_ring))
USART_CR1 (USART1) |= USART_CR1_TXEIE;
- }
}
@@ -49,10 +47,10 @@ _write (int file, char *ptr, int len)
if (file == 1) {
ret = ring_write (&usart_tx_ring, (uint8_t *) ptr, len);
usart_kick();
+ ring_write (&cdcacm_tx_ring, (uint8_t *) ptr, len);
- if (ret < 0) {
+ if (ret < 0)
ret = -ret;
- }
return ret;
}