Skip to content

Commit

Permalink
samples: usb: cdc_acm_composite: Fix missing irq handling
Browse files Browse the repository at this point in the history
If there are several queued interrupts we can miss some of them. Use
while() loop to catch them all.

Signed-off-by: Andrei Emeltchenko <[email protected]>
  • Loading branch information
finikorg authored and carlescufi committed Mar 25, 2019
1 parent cd95560 commit 7ecd8d2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions samples/subsys/usb/cdc_acm_composite/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@ static void interrupt_handler(void *user_data)
const struct serial_data *dev_data = user_data;
struct device *dev = dev_data->dev;

uart_irq_update(dev);

if (uart_irq_tx_ready(dev)) {
/* TODO */
}

if (uart_irq_rx_ready(dev)) {
while (uart_irq_update(dev) && uart_irq_is_pending(dev)) {
struct device *peer = dev_data->peer;
u8_t byte;

if (!uart_irq_rx_ready(dev)) {
break;
}

uart_fifo_read(dev, &byte, sizeof(byte));
uart_poll_out(peer, byte);

Expand Down

0 comments on commit 7ecd8d2

Please sign in to comment.