From 23c592250e0ff0cf86ae6c6be8b465faeef1bc44 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Thu, 23 Jun 2011 13:03:34 -0300 Subject: [PATCH] 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. --- atusb/fw/board_app.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/atusb/fw/board_app.c b/atusb/fw/board_app.c index 4a83e7e..80eed69 100644 --- a/atusb/fw/board_app.c +++ b/atusb/fw/board_app.c @@ -144,29 +144,20 @@ void gpio_cleanup(void) } -static uint8_t irqs = 0; - - -static void irqs_more(void *user) +static void done(void *user) { - static uint8_t buf; - - if (!irqs) - return; - buf = irqs; - usb_send(&eps[1], &buf, 1, irqs_more, NULL); - irqs = 0; + led(0); } ISR(INT0_vect) { - spi_begin(); - spi_send(AT86RF230_REG_READ | REG_IRQ_STATUS); - irqs |= spi_recv(); - spi_end(); - if (eps[1].state == EP_IDLE) - irqs_more(NULL); + static uint8_t buf; + + if (eps[1].state == EP_IDLE) { + led(1); + usb_send(&eps[1], &buf, 1, done, NULL); + } }