IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Commit Details
Date: | 2011-02-10 11:42:34 (13 years 1 month ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 3e9f9613cb2cf55e715f0d5f02748f26789c2ef6 |
Message: | atusb/fw2: added proper support for interrupt polling - board.h (read_irq), board.c: return status of the RF IRQ - board.h (PIN, PIN_1, PIN_2): macros to read port pins - ep0.c (my_setup): make ATUSB_POLL_INT return the real interrupt |
Files: |
atusb/fw2/board.c (2 diffs) atusb/fw2/board.h (2 diffs) atusb/fw2/ep0.c (1 diff) |
Change Details
atusb/fw2/board.c | ||
---|---|---|
1 | #include <stdint.h> | |
2 | ||
1 | 3 | #include <avr/io.h> |
2 | 4 | |
3 | 5 | #define F_CPU 8000000UL |
... | ... | |
18 | 20 | |
19 | 21 | _delay_us(1); |
20 | 22 | } |
23 | ||
24 | ||
25 | uint8_t read_irq(void) | |
26 | { | |
27 | return PIN(IRQ_RF); | |
28 | } |
atusb/fw2/board.h | ||
---|---|---|
1 | 1 | #ifndef BOARD_H |
2 | 2 | #define BOARD_H |
3 | 3 | |
4 | #include <stdint.h> | |
5 | ||
6 | ||
4 | 7 | #define LED_PORT B |
5 | 8 | #define LED_BIT 6 |
6 | 9 | #define nRST_RF_PORT C |
... | ... | |
25 | 28 | #define CLR_2(p, b) PORT##p &= ~(1 << (b)) |
26 | 29 | #define IN_2(p, b) DDR##p &= ~(1 << (b)) |
27 | 30 | #define OUT_2(p, b) DDR##p |= 1 << (b) |
31 | #define PIN_2(p, b) ((PIN##p >> (b)) & 1) | |
28 | 32 | |
29 | 33 | #define SET_1(p, b) SET_2(p, b) |
30 | 34 | #define CLR_1(p, b) CLR_2(p, b) |
31 | 35 | #define IN_1(p, b) IN_2(p, b) |
32 | 36 | #define OUT_1(p, b) OUT_2(p, b) |
37 | #define PIN_1(p, b) PIN_2(p, b) | |
33 | 38 | |
34 | 39 | #define SET(n) SET_1(n##_PORT, n##_BIT) |
35 | 40 | #define CLR(n) CLR_1(n##_PORT, n##_BIT) |
36 | 41 | #define IN(n) IN_1(n##_PORT, n##_BIT) |
37 | 42 | #define OUT(n) OUT_1(n##_PORT, n##_BIT) |
38 | ||
43 | #define PIN(n) PIN_1(n##_PORT, n##_BIT) | |
39 | 44 | |
40 | 45 | void reset_rf(void); |
46 | uint8_t read_irq(void); | |
41 | 47 | |
42 | 48 | #endif /* !BOARD_H */ |
atusb/fw2/ep0.c | ||
---|---|---|
151 | 151 | debug("ATUSB_POLL_INT\n"); |
152 | 152 | if (setup->wLength < 1) |
153 | 153 | return 0; |
154 | *buf = 0;//IRQ_RF; | |
154 | *buf = read_irq(); | |
155 | 155 | usb_send(&ep0, buf, 1, NULL, NULL); |
156 | 156 | return 1; |
157 | 157 |