mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-25 18:57:11 +02:00
atusb/fw/: aggregate interrupts while waiting
- board_app.c (INT0_vect): always read IRQ_STATUS, even if an interrupt is already enqueued - board_app.c (INT0_vect): if an interrupt is enqueued, accumulate the interrupts signaled since - board_app.c (irqs_more): when a pending transfer completes, send interrupts accumulated since (if any)
This commit is contained in:
parent
15db279ca2
commit
27fc0a0e2c
@ -144,17 +144,29 @@ void gpio_cleanup(void)
|
||||
}
|
||||
|
||||
|
||||
static uint8_t irqs = 0;
|
||||
|
||||
|
||||
static void irqs_more(void *user)
|
||||
{
|
||||
static uint8_t buf;
|
||||
|
||||
if (!irqs)
|
||||
return;
|
||||
buf = irqs;
|
||||
usb_send(&eps[1], &buf, 1, irqs_more, NULL);
|
||||
irqs = 0;
|
||||
}
|
||||
|
||||
|
||||
ISR(INT0_vect)
|
||||
{
|
||||
static uint8_t irq;
|
||||
|
||||
if (eps[1].state != EP_IDLE)
|
||||
return;
|
||||
spi_begin();
|
||||
spi_send(AT86RF230_REG_READ | REG_IRQ_STATUS);
|
||||
irq = spi_recv();
|
||||
irqs |= spi_recv();
|
||||
spi_end();
|
||||
usb_send(&eps[1], &irq, 1, NULL, NULL);
|
||||
if (eps[1].state == EP_IDLE)
|
||||
irqs_more(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user