mirror of
https://github.com/Optiboot/optiboot.git
synced 2025-08-17 21:41:03 +03:00
Debugging.
This commit is contained in:
@@ -330,8 +330,10 @@ int main(void) {
|
|||||||
#if LED_START_FLASHES > 0
|
#if LED_START_FLASHES > 0
|
||||||
// Set up RTC counting at about 1/8s (input is 32kHz)
|
// Set up RTC counting at about 1/8s (input is 32kHz)
|
||||||
RTC.CTRLA= RTC_PRESCALER_DIV4096_gc | RTC_RTCEN_bm;
|
RTC.CTRLA= RTC_PRESCALER_DIV4096_gc | RTC_RTCEN_bm;
|
||||||
|
RTC.DBGCTRL = 1; // enable during debug
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, 0); // full speed clock
|
||||||
|
|
||||||
MYUART_TXPORT.DIR |= MYUART_TXPIN; // set TX pin to output
|
MYUART_TXPORT.DIR |= MYUART_TXPIN; // set TX pin to output
|
||||||
MYUART_TXPORT.OUT |= MYUART_TXPIN; // and "1" as per datasheet
|
MYUART_TXPORT.OUT |= MYUART_TXPIN; // and "1" as per datasheet
|
||||||
@@ -349,7 +351,7 @@ int main(void) {
|
|||||||
|
|
||||||
#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) || defined(LED_START_ON)
|
#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) || defined(LED_START_ON)
|
||||||
/* Set LED pin as output */
|
/* Set LED pin as output */
|
||||||
LED_PORT.DIR |= _BV(LED);
|
LED_PORT.DIR |= LED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LED_START_FLASHES > 0
|
#if LED_START_FLASHES > 0
|
||||||
@@ -358,7 +360,7 @@ int main(void) {
|
|||||||
#else
|
#else
|
||||||
#if defined(LED_START_ON)
|
#if defined(LED_START_ON)
|
||||||
/* Turn on LED to indicate starting bootloader (less code!) */
|
/* Turn on LED to indicate starting bootloader (less code!) */
|
||||||
LED_PORT.OUT |= _BV(LED);
|
LED_PORT.OUT |= LED;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -486,15 +488,14 @@ void putch(char ch) {
|
|||||||
|
|
||||||
uint8_t getch(void) {
|
uint8_t getch(void) {
|
||||||
uint8_t ch, flags;
|
uint8_t ch, flags;
|
||||||
while (!(MYUART.STATUS & USART_RXCIF_bm)) {
|
while (!(MYUART.STATUS & USART_RXCIF_bm))
|
||||||
return (MYUART.RXDATAL);
|
;
|
||||||
}
|
|
||||||
flags = MYUART.RXDATAH;
|
flags = MYUART.RXDATAH;
|
||||||
ch = MYUART.RXDATAL;
|
ch = MYUART.RXDATAL;
|
||||||
if ((flags & USART_FERR_bm) == 0)
|
if ((flags & USART_FERR_bm) == 0)
|
||||||
watchdogReset();
|
watchdogReset();
|
||||||
#ifdef LED_DATA_FLASH
|
#ifdef LED_DATA_FLASH
|
||||||
LED_PORT.IN |= _BV(LED);
|
LED_PORT.IN |= LED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
@@ -518,14 +519,14 @@ void verifySpace() {
|
|||||||
void flash_led(uint8_t count) {
|
void flash_led(uint8_t count) {
|
||||||
uint8_t last;
|
uint8_t last;
|
||||||
while (count--) {
|
while (count--) {
|
||||||
LED_PORT.IN |= _BV(LED);
|
LED_PORT.IN |= LED;
|
||||||
last = RTC.CNTL & 1;
|
last = RTC.CNTL & 1;
|
||||||
while ((RTC.CNTL & 1) == last) {
|
while ((RTC.CNTL & 1) == last) {
|
||||||
watchdogReset();
|
watchdogReset();
|
||||||
if (MYUART.STATUS & USART_RXCIF_bm)
|
if (MYUART.STATUS & USART_RXCIF_bm)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} while (--count);
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -199,411 +199,411 @@
|
|||||||
#define LED_NAME "B0"
|
#define LED_NAME "B0"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTB
|
#define LED_PORT VPORTB
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == B1
|
#elif LED == B1
|
||||||
#define LED_NAME "B1"
|
#define LED_NAME "B1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTB
|
#define LED_PORT VPORTB
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == B2
|
#elif LED == B2
|
||||||
#define LED_NAME "B2"
|
#define LED_NAME "B2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTB
|
#define LED_PORT VPORTB
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == B3
|
#elif LED == B3
|
||||||
#define LED_NAME "B3"
|
#define LED_NAME "B3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTB
|
#define LED_PORT VPORTB
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == B4
|
#elif LED == B4
|
||||||
#define LED_NAME "B4"
|
#define LED_NAME "B4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTB
|
#define LED_PORT VPORTB
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == B5
|
#elif LED == B5
|
||||||
#define LED_NAME "B5"
|
#define LED_NAME "B5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTB
|
#define LED_PORT VPORTB
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == B6
|
#elif LED == B6
|
||||||
#define LED_NAME "B6"
|
#define LED_NAME "B6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTB
|
#define LED_PORT VPORTB
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == B7
|
#elif LED == B7
|
||||||
#define LED_NAME "B7"
|
#define LED_NAME "B7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTB
|
#define LED_PORT VPORTB
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#elif LED == C0
|
#elif LED == C0
|
||||||
#define LED_NAME "C0"
|
#define LED_NAME "C0"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTC
|
#define LED_PORT VPORTC
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == C1
|
#elif LED == C1
|
||||||
#define LED_NAME "C1"
|
#define LED_NAME "C1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTC
|
#define LED_PORT VPORTC
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == C2
|
#elif LED == C2
|
||||||
#define LED_NAME "C2"
|
#define LED_NAME "C2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTC
|
#define LED_PORT VPORTC
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == C3
|
#elif LED == C3
|
||||||
#define LED_NAME "C3"
|
#define LED_NAME "C3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTC
|
#define LED_PORT VPORTC
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == C4
|
#elif LED == C4
|
||||||
#define LED_NAME "C4"
|
#define LED_NAME "C4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTC
|
#define LED_PORT VPORTC
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == C5
|
#elif LED == C5
|
||||||
#define LED_NAME "C5"
|
#define LED_NAME "C5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTC
|
#define LED_PORT VPORTC
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == C6
|
#elif LED == C6
|
||||||
#define LED_NAME "C6"
|
#define LED_NAME "C6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTC
|
#define LED_PORT VPORTC
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == C7
|
#elif LED == C7
|
||||||
#define LED_NAME "C7"
|
#define LED_NAME "C7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTC
|
#define LED_PORT VPORTC
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#elif LED == D0
|
#elif LED == D0
|
||||||
#define LED_NAME "D0"
|
#define LED_NAME "D0"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTD
|
#define LED_PORT VPORTD
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == D1
|
#elif LED == D1
|
||||||
#define LED_NAME "D1"
|
#define LED_NAME "D1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTD
|
#define LED_PORT VPORTD
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == D2
|
#elif LED == D2
|
||||||
#define LED_NAME "D2"
|
#define LED_NAME "D2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTD
|
#define LED_PORT VPORTD
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == D3
|
#elif LED == D3
|
||||||
#define LED_NAME "D3"
|
#define LED_NAME "D3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTD
|
#define LED_PORT VPORTD
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == D4
|
#elif LED == D4
|
||||||
#define LED_NAME "D4"
|
#define LED_NAME "D4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTD
|
#define LED_PORT VPORTD
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == D5
|
#elif LED == D5
|
||||||
#define LED_NAME "D5"
|
#define LED_NAME "D5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTD
|
#define LED_PORT VPORTD
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == D6
|
#elif LED == D6
|
||||||
#define LED_NAME "D6"
|
#define LED_NAME "D6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTD
|
#define LED_PORT VPORTD
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == D7
|
#elif LED == D7
|
||||||
#define LED_NAME "D7"
|
#define LED_NAME "D7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTD
|
#define LED_PORT VPORTD
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#elif LED == E0
|
#elif LED == E0
|
||||||
#define LED_NAME "E0"
|
#define LED_NAME "E0"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTE
|
#define LED_PORT VPORTE
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == E1
|
#elif LED == E1
|
||||||
#define LED_NAME "E1"
|
#define LED_NAME "E1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTE
|
#define LED_PORT VPORTE
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == E2
|
#elif LED == E2
|
||||||
#define LED_NAME "E2"
|
#define LED_NAME "E2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTE
|
#define LED_PORT VPORTE
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == E3
|
#elif LED == E3
|
||||||
#define LED_NAME "E3"
|
#define LED_NAME "E3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTE
|
#define LED_PORT VPORTE
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == E4
|
#elif LED == E4
|
||||||
#define LED_NAME "E4"
|
#define LED_NAME "E4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTE
|
#define LED_PORT VPORTE
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == E5
|
#elif LED == E5
|
||||||
#define LED_NAME "E5"
|
#define LED_NAME "E5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTE
|
#define LED_PORT VPORTE
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == E6
|
#elif LED == E6
|
||||||
#define LED_NAME "E6"
|
#define LED_NAME "E6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTE
|
#define LED_PORT VPORTE
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == E7
|
#elif LED == E7
|
||||||
#define LED_NAME "E7"
|
#define LED_NAME "E7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTE
|
#define LED_PORT VPORTE
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#elif LED == F0
|
#elif LED == F0
|
||||||
#define LED_NAME "F0"
|
#define LED_NAME "F0"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTF
|
#define LED_PORT VPORTF
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == F1
|
#elif LED == F1
|
||||||
#define LED_NAME "F1"
|
#define LED_NAME "F1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTF
|
#define LED_PORT VPORTF
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == F2
|
#elif LED == F2
|
||||||
#define LED_NAME "F2"
|
#define LED_NAME "F2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTF
|
#define LED_PORT VPORTF
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == F3
|
#elif LED == F3
|
||||||
#define LED_NAME "F3"
|
#define LED_NAME "F3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTF
|
#define LED_PORT VPORTF
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == F4
|
#elif LED == F4
|
||||||
#define LED_NAME "F4"
|
#define LED_NAME "F4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTF
|
#define LED_PORT VPORTF
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == F5
|
#elif LED == F5
|
||||||
#define LED_NAME "F5"
|
#define LED_NAME "F5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTF
|
#define LED_PORT VPORTF
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == F6
|
#elif LED == F6
|
||||||
#define LED_NAME "F6"
|
#define LED_NAME "F6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTF
|
#define LED_PORT VPORTF
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == F7
|
#elif LED == F7
|
||||||
#define LED_NAME "F7"
|
#define LED_NAME "F7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTF
|
#define LED_PORT VPORTF
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#elif LED == G0
|
#elif LED == G0
|
||||||
#define LED_NAME "G0"
|
#define LED_NAME "G0"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTG
|
#define LED_PORT VPORTG
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == G1
|
#elif LED == G1
|
||||||
#define LED_NAME "G1"
|
#define LED_NAME "G1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTG
|
#define LED_PORT VPORTG
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == G2
|
#elif LED == G2
|
||||||
#define LED_NAME "G2"
|
#define LED_NAME "G2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTG
|
#define LED_PORT VPORTG
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == G3
|
#elif LED == G3
|
||||||
#define LED_NAME "G3"
|
#define LED_NAME "G3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTG
|
#define LED_PORT VPORTG
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == G4
|
#elif LED == G4
|
||||||
#define LED_NAME "G4"
|
#define LED_NAME "G4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTG
|
#define LED_PORT VPORTG
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == G5
|
#elif LED == G5
|
||||||
#define LED_NAME "G5"
|
#define LED_NAME "G5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTG
|
#define LED_PORT VPORTG
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == G6
|
#elif LED == G6
|
||||||
#define LED_NAME "G6"
|
#define LED_NAME "G6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTG
|
#define LED_PORT VPORTG
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == G7
|
#elif LED == G7
|
||||||
#define LED_NAME "G7"
|
#define LED_NAME "G7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTG
|
#define LED_PORT VPORTG
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#elif LED == H0
|
#elif LED == H0
|
||||||
#define LED_NAME "H0"
|
#define LED_NAME "H0"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTH
|
#define LED_PORT VPORTH
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == H1
|
#elif LED == H1
|
||||||
#define LED_NAME "H1"
|
#define LED_NAME "H1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTH
|
#define LED_PORT VPORTH
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == H2
|
#elif LED == H2
|
||||||
#define LED_NAME "H2"
|
#define LED_NAME "H2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTH
|
#define LED_PORT VPORTH
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == H3
|
#elif LED == H3
|
||||||
#define LED_NAME "H3"
|
#define LED_NAME "H3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTH
|
#define LED_PORT VPORTH
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == H4
|
#elif LED == H4
|
||||||
#define LED_NAME "H4"
|
#define LED_NAME "H4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTH
|
#define LED_PORT VPORTH
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == H5
|
#elif LED == H5
|
||||||
#define LED_NAME "H5"
|
#define LED_NAME "H5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTH
|
#define LED_PORT VPORTH
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == H6
|
#elif LED == H6
|
||||||
#define LED_NAME "H6"
|
#define LED_NAME "H6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTH
|
#define LED_PORT VPORTH
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == H7
|
#elif LED == H7
|
||||||
#define LED_NAME "H7"
|
#define LED_NAME "H7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTH
|
#define LED_PORT VPORTH
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#elif LED == J0
|
#elif LED == J0
|
||||||
#define LED_NAME "J0"
|
#define LED_NAME "J0"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTJ
|
#define LED_PORT VPORTJ
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == J1
|
#elif LED == J1
|
||||||
#define LED_NAME "J1"
|
#define LED_NAME "J1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTJ
|
#define LED_PORT VPORTJ
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == J2
|
#elif LED == J2
|
||||||
#define LED_NAME "J2"
|
#define LED_NAME "J2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTJ
|
#define LED_PORT VPORTJ
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == J3
|
#elif LED == J3
|
||||||
#define LED_NAME "J3"
|
#define LED_NAME "J3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTJ
|
#define LED_PORT VPORTJ
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == J4
|
#elif LED == J4
|
||||||
#define LED_NAME "J4"
|
#define LED_NAME "J4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTJ
|
#define LED_PORT VPORTJ
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == J5
|
#elif LED == J5
|
||||||
#define LED_NAME "J5"
|
#define LED_NAME "J5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTJ
|
#define LED_PORT VPORTJ
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == J6
|
#elif LED == J6
|
||||||
#define LED_NAME "J6"
|
#define LED_NAME "J6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTJ
|
#define LED_PORT VPORTJ
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == J7
|
#elif LED == J7
|
||||||
#define LED_NAME "J7"
|
#define LED_NAME "J7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTJ
|
#define LED_PORT VPORTJ
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#elif LED == K0
|
#elif LED == K0
|
||||||
#define LED_NAME "K0"
|
#define LED_NAME "K0"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTK
|
#define LED_PORT VPORTK
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == K1
|
#elif LED == K1
|
||||||
#define LED_NAME "K1"
|
#define LED_NAME "K1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTK
|
#define LED_PORT VPORTK
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == K2
|
#elif LED == K2
|
||||||
#define LED_NAME "K2"
|
#define LED_NAME "K2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTK
|
#define LED_PORT VPORTK
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == K3
|
#elif LED == K3
|
||||||
#define LED_NAME "K3"
|
#define LED_NAME "K3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTK
|
#define LED_PORT VPORTK
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == K4
|
#elif LED == K4
|
||||||
#define LED_NAME "K4"
|
#define LED_NAME "K4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTK
|
#define LED_PORT VPORTK
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == K5
|
#elif LED == K5
|
||||||
#define LED_NAME "K5"
|
#define LED_NAME "K5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTK
|
#define LED_PORT VPORTK
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == K6
|
#elif LED == K6
|
||||||
#define LED_NAME "K6"
|
#define LED_NAME "K6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTK
|
#define LED_PORT VPORTK
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == K7
|
#elif LED == K7
|
||||||
#define LED_NAME "K7"
|
#define LED_NAME "K7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTK
|
#define LED_PORT VPORTK
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#elif LED == L0
|
#elif LED == L0
|
||||||
#define LED_NAME "L0"
|
#define LED_NAME "L0"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTL
|
#define LED_PORT VPORTL
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == L1
|
#elif LED == L1
|
||||||
#define LED_NAME "L1"
|
#define LED_NAME "L1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTL
|
#define LED_PORT VPORTL
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == L2
|
#elif LED == L2
|
||||||
#define LED_NAME "L2"
|
#define LED_NAME "L2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTL
|
#define LED_PORT VPORTL
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == L3
|
#elif LED == L3
|
||||||
#define LED_NAME "L3"
|
#define LED_NAME "L3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTL
|
#define LED_PORT VPORTL
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == L4
|
#elif LED == L4
|
||||||
#define LED_NAME "L4"
|
#define LED_NAME "L4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTL
|
#define LED_PORT VPORTL
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == L5
|
#elif LED == L5
|
||||||
#define LED_NAME "L5"
|
#define LED_NAME "L5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTL
|
#define LED_PORT VPORTL
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == L6
|
#elif LED == L6
|
||||||
#define LED_NAME "L6"
|
#define LED_NAME "L6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTL
|
#define LED_PORT VPORTL
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == L7
|
#elif LED == L7
|
||||||
#define LED_NAME "L7"
|
#define LED_NAME "L7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTL
|
#define LED_PORT VPORTL
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#elif LED == A0
|
#elif LED == A0
|
||||||
#define LED_NAME "A0"
|
#define LED_NAME "A0"
|
||||||
@@ -614,42 +614,42 @@
|
|||||||
#else
|
#else
|
||||||
#define LED_PORT VPORTA
|
#define LED_PORT VPORTA
|
||||||
#endif
|
#endif
|
||||||
#define LED PORT0
|
#define LED (1<<PORT0)
|
||||||
#elif LED == A1
|
#elif LED == A1
|
||||||
#define LED_NAME "A1"
|
#define LED_NAME "A1"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTA
|
#define LED_PORT VPORTA
|
||||||
#define LED PORT1
|
#define LED (1<<PORT1)
|
||||||
#elif LED == A2
|
#elif LED == A2
|
||||||
#define LED_NAME "A2"
|
#define LED_NAME "A2"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTA
|
#define LED_PORT VPORTA
|
||||||
#define LED PORT2
|
#define LED (1<<PORT2)
|
||||||
#elif LED == A3
|
#elif LED == A3
|
||||||
#define LED_NAME "A3"
|
#define LED_NAME "A3"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTA
|
#define LED_PORT VPORTA
|
||||||
#define LED PORT3
|
#define LED (1<<PORT3)
|
||||||
#elif LED == A4
|
#elif LED == A4
|
||||||
#define LED_NAME "A4"
|
#define LED_NAME "A4"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTA
|
#define LED_PORT VPORTA
|
||||||
#define LED PORT4
|
#define LED (1<<PORT4)
|
||||||
#elif LED == A5
|
#elif LED == A5
|
||||||
#define LED_NAME "A5"
|
#define LED_NAME "A5"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTA
|
#define LED_PORT VPORTA
|
||||||
#define LED PORT5
|
#define LED (1<<PORT5)
|
||||||
#elif LED == A6
|
#elif LED == A6
|
||||||
#define LED_NAME "A6"
|
#define LED_NAME "A6"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTA
|
#define LED_PORT VPORTA
|
||||||
#define LED PORT6
|
#define LED (1<<PORT6)
|
||||||
#elif LED == A7
|
#elif LED == A7
|
||||||
#define LED_NAME "A7"
|
#define LED_NAME "A7"
|
||||||
#undef LED
|
#undef LED
|
||||||
#define LED_PORT VPORTA
|
#define LED_PORT VPORTA
|
||||||
#define LED PORT7
|
#define LED (1<<PORT7)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Stop compilation right away, so we don't get more errors.
|
// Stop compilation right away, so we don't get more errors.
|
||||||
@@ -667,7 +667,7 @@
|
|||||||
/*
|
/*
|
||||||
* Handle devices with up to 4 uarts. Rather inelegantly.
|
* Handle devices with up to 4 uarts. Rather inelegantly.
|
||||||
*/
|
*/
|
||||||
#define MYUART_ALTPMUX 1
|
#define USART_ALTPMUX 1
|
||||||
|
|
||||||
#if defined(__AVR_ATmega4809__)
|
#if defined(__AVR_ATmega4809__)
|
||||||
# if (UARTTX == A0)
|
# if (UARTTX == A0)
|
||||||
@@ -676,14 +676,14 @@
|
|||||||
# endif
|
# endif
|
||||||
# define MYUART USART0
|
# define MYUART USART0
|
||||||
# define MYUART_TXPORT VPORTA
|
# define MYUART_TXPORT VPORTA
|
||||||
# define MYUART_TXPIN PORT0
|
# define MYUART_TXPIN (1<<PORT0)
|
||||||
# elif (UARTTX == A4)
|
# elif (UARTTX == A4)
|
||||||
# ifndef USART0
|
# ifndef USART0
|
||||||
# error Pin on USART0, but no USART0 exists
|
# error Pin on USART0, but no USART0 exists
|
||||||
# endif
|
# endif
|
||||||
# define MYUART USART0
|
# define MYUART USART0
|
||||||
# define MYUART_TXPORT VPORTA
|
# define MYUART_TXPORT VPORTA
|
||||||
# define MYUART_TXPIN PORT4
|
# define MYUART_TXPIN (1<<PORT4)
|
||||||
# define MYUART_PMUX (USART_ALTPMUX<<PORTMUX_USART0_gp)
|
# define MYUART_PMUX (USART_ALTPMUX<<PORTMUX_USART0_gp)
|
||||||
# elif (UARTTX == B0)
|
# elif (UARTTX == B0)
|
||||||
# ifndef USART3
|
# ifndef USART3
|
||||||
@@ -691,14 +691,14 @@
|
|||||||
# endif
|
# endif
|
||||||
# define MYUART USART3
|
# define MYUART USART3
|
||||||
# define MYUART_TXPORT VPORTB
|
# define MYUART_TXPORT VPORTB
|
||||||
# define MYUART_TXPIN PORT0
|
# define MYUART_TXPIN (1<<PORT0)
|
||||||
# elif (UARTTX == B4)
|
# elif (UARTTX == B4)
|
||||||
# ifndef USART3
|
# ifndef USART3
|
||||||
# error Pin on USART3, but no USART3 exists
|
# error Pin on USART3, but no USART3 exists
|
||||||
# endif
|
# endif
|
||||||
# define MYUART USART3
|
# define MYUART USART3
|
||||||
# define MYUART_TXPORT VPORTB
|
# define MYUART_TXPORT VPORTB
|
||||||
# define MYUART_TXPIN PORT4
|
# define MYUART_TXPIN (1<<PORT4)
|
||||||
# define MYUART_PMUX (USART_ALTPMUX<<PORTMUX_USART3_gp)
|
# define MYUART_PMUX (USART_ALTPMUX<<PORTMUX_USART3_gp)
|
||||||
# elif (UARTTX == C0)
|
# elif (UARTTX == C0)
|
||||||
# ifndef USART1
|
# ifndef USART1
|
||||||
@@ -706,14 +706,14 @@
|
|||||||
# endif
|
# endif
|
||||||
# define MYUART USART1
|
# define MYUART USART1
|
||||||
# define MYUART_TXPORT VPORTC
|
# define MYUART_TXPORT VPORTC
|
||||||
# define MYUART_TXPIN PORT0
|
# define MYUART_TXPIN (1<<PORT0)
|
||||||
# elif (UARTTX == C4)
|
# elif (UARTTX == C4)
|
||||||
# ifndef USART1
|
# ifndef USART1
|
||||||
# error Pin on USART1, but no USART1 exists
|
# error Pin on USART1, but no USART1 exists
|
||||||
# endif
|
# endif
|
||||||
# define MYUART USART1
|
# define MYUART USART1
|
||||||
# define MYUART_TXPORT VPORTC
|
# define MYUART_TXPORT VPORTC
|
||||||
# define MYUART_TXPIN PORT4
|
# define MYUART_TXPIN (1<<PORT4)
|
||||||
# define MYUART_PMUX (USART_ALTPMUX<<PORTMUX_USART1_gp)
|
# define MYUART_PMUX (USART_ALTPMUX<<PORTMUX_USART1_gp)
|
||||||
# elif (UARTTX == F0)
|
# elif (UARTTX == F0)
|
||||||
# ifndef USART2
|
# ifndef USART2
|
||||||
@@ -721,14 +721,14 @@
|
|||||||
# endif
|
# endif
|
||||||
# define MYUART USART2
|
# define MYUART USART2
|
||||||
# define MYUART_TXPORT VPORTF
|
# define MYUART_TXPORT VPORTF
|
||||||
# define MYUART_TXPIN PORT0
|
# define MYUART_TXPIN (1<<PORT0)
|
||||||
# elif (UARTTX == F4)
|
# elif (UARTTX == F4)
|
||||||
# ifndef USART2
|
# ifndef USART2
|
||||||
# error Pin on USART2, but no USART2 exists
|
# error Pin on USART2, but no USART2 exists
|
||||||
# endif
|
# endif
|
||||||
# define MYUART USART2
|
# define MYUART USART2
|
||||||
# define MYUART_TXPORT VPORTF
|
# define MYUART_TXPORT VPORTF
|
||||||
# define MYUART_TXPIN PORT4
|
# define MYUART_TXPIN (1<<PORT4)
|
||||||
# define MYUART_PMUX (USART_ALTPMUX<<PORTMUX_USART2_gp)
|
# define MYUART_PMUX (USART_ALTPMUX<<PORTMUX_USART2_gp)
|
||||||
# endif
|
# endif
|
||||||
#endif // ATmega4809
|
#endif // ATmega4809
|
||||||
|
Reference in New Issue
Block a user