1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-25 21:27:31 +02:00

atusb/fw/: disable INT0 if manipulating GPIOs (tentative)

Since GPIO manipulations may cause stray INT0 activity, we turn off
INT0 handing on ATUSB_GPIO. The MCU must be reset to restore access
to INT0.

There are still issues to resolve with the GPIO test. It may turn
out that there's a less invasive solution than just turning off
INT0 completely.

- board_app.c (gpio): mask INT0 before manipulating GPIOs
- board_app.c (board_app_init): make it clearer that EIMSK is a bit
  mask
This commit is contained in:
Werner Almesberger 2011-06-20 20:50:22 -03:00
parent 76707d6b37
commit 12fef1b196

View File

@ -93,6 +93,8 @@ void timer_init(void)
int gpio(uint8_t port, uint8_t data, uint8_t dir, uint8_t mask, uint8_t *res) int gpio(uint8_t port, uint8_t data, uint8_t dir, uint8_t mask, uint8_t *res)
{ {
EIMSK = 0; /* must reset to recover INT_RF */
switch (port) { switch (port) {
case 1: case 1:
DDRB = (DDRB & ~mask) | dir; DDRB = (DDRB & ~mask) | dir;
@ -154,5 +156,5 @@ void board_app_init(void)
{ {
/* enable INT0, trigger on rising edge */ /* enable INT0, trigger on rising edge */
EICRA = 1 << ISC01 | 1 << ISC00; EICRA = 1 << ISC01 | 1 << ISC00;
EIMSK = 1; EIMSK = 1 << 0;
} }