1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-25 23:49:41 +02:00

atusb/fw/board_app.c: do not read and accumulate IRQs; flash LED when EP1 busy

To indicate an interrupt, we just send a zero byte.
This commit is contained in:
Werner Almesberger 2011-06-23 13:03:34 -03:00
parent 27fc0a0e2c
commit 23c592250e

View File

@ -144,29 +144,20 @@ void gpio_cleanup(void)
} }
static uint8_t irqs = 0; static void done(void *user)
static void irqs_more(void *user)
{ {
static uint8_t buf; led(0);
if (!irqs)
return;
buf = irqs;
usb_send(&eps[1], &buf, 1, irqs_more, NULL);
irqs = 0;
} }
ISR(INT0_vect) ISR(INT0_vect)
{ {
spi_begin(); static uint8_t buf;
spi_send(AT86RF230_REG_READ | REG_IRQ_STATUS);
irqs |= spi_recv(); if (eps[1].state == EP_IDLE) {
spi_end(); led(1);
if (eps[1].state == EP_IDLE) usb_send(&eps[1], &buf, 1, done, NULL);
irqs_more(NULL); }
} }