mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2025-04-21 12:27:27 +03:00
atusb/fw/: added "lazy enabling" of UART-SPI after ATUSB_GPIO
- spi.h (spi_off), spi.c: disable the UART - spi.c (spi_initialized, spi_begin, spi_init): initialize the UART if necessary - board_app.c (gpio): call spi_off to disable the UART instead of open-coding the operation - board_app.c (gpio): don't explicitly re-enable the UART but defer it to the next communication
This commit is contained in:
@@ -94,7 +94,7 @@ int gpio(uint8_t port, uint8_t data, uint8_t dir, uint8_t mask, uint8_t *res)
|
||||
}
|
||||
|
||||
/* disable the UART so that we can meddle with these pins as well. */
|
||||
UCSR1B = 0;
|
||||
spi_off();
|
||||
_delay_ms(1);
|
||||
|
||||
switch (port) {
|
||||
@@ -115,7 +115,5 @@ int gpio(uint8_t port, uint8_t data, uint8_t dir, uint8_t mask, uint8_t *res)
|
||||
break;
|
||||
}
|
||||
|
||||
spi_init();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user