Date:2011-06-21 01:50:22 (9 years 1 month ago)
Author:Werner Almesberger
Commit:12fef1b196d3eb4b5f35ba177d196cf2e1def95c
Message: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
Files: atusb/fw/board_app.c (2 diffs)

Change Details

atusb/fw/board_app.c
9393
9494int gpio(uint8_t port, uint8_t data, uint8_t dir, uint8_t mask, uint8_t *res)
9595{
96    EIMSK = 0; /* must reset to recover INT_RF */
97
9698    switch (port) {
9799    case 1:
98100        DDRB = (DDRB & ~mask) | dir;
...... 
154156{
155157    /* enable INT0, trigger on rising edge */
156158    EICRA = 1 << ISC01 | 1 << ISC00;
157    EIMSK = 1;
159    EIMSK = 1 << 0;
158160}

Archive Download the corresponding diff file



interactive