From f4fd294e389ff3d8c3afe3fbc6a9ec06492795fb Mon Sep 17 00:00:00 2001 From: WestfW Date: Tue, 22 Jun 2021 16:55:35 -0700 Subject: [PATCH] add SOFTRX=pin and SOFTTX=pin options to allow the pins to be selected when using SOFT_UART=1 pin_defs.h was getting large and ugly, so split out the SOFTRX/SOFTRX/RS485 into separate .h files --- optiboot/bootloaders/optiboot/Makefile | 10 + optiboot/bootloaders/optiboot/pin_defs.h | 1440 +---------------- optiboot/bootloaders/optiboot/pins_rs485.h | 1437 ++++++++++++++++ optiboot/bootloaders/optiboot/pins_softuart.h | 831 ++++++++++ 4 files changed, 2282 insertions(+), 1436 deletions(-) create mode 100644 optiboot/bootloaders/optiboot/pins_rs485.h create mode 100644 optiboot/bootloaders/optiboot/pins_softuart.h diff --git a/optiboot/bootloaders/optiboot/Makefile b/optiboot/bootloaders/optiboot/Makefile index 5177365e1..0554500b7 100644 --- a/optiboot/bootloaders/optiboot/Makefile +++ b/optiboot/bootloaders/optiboot/Makefile @@ -228,6 +228,16 @@ SOFT_UART_CMD = -DSOFT_UART=1 dummy = FORCE endif endif +HELPTEXT += "Option SOFTTX=B5 - pin for software UART xmit \n" +ifdef SOFTTX +SOFT_UART_CMD += -DSOFTTX=$(SOFTTX) +dummy = FORCE +endif +HELPTEXT += "Option SOFTRX=B6 - pin for software UART receive\n" +ifdef SOFTRX +SOFT_UART_CMD += -DSOFTRX=$(SOFTRX) +dummy = FORCE +endif HELPTEXT += "Option SINGLESPEED=1 - do not use U2X mode on UART\n" ifdef SINGLESPEED diff --git a/optiboot/bootloaders/optiboot/pin_defs.h b/optiboot/bootloaders/optiboot/pin_defs.h index cd7cec9f7..58c7cea82 100644 --- a/optiboot/bootloaders/optiboot/pin_defs.h +++ b/optiboot/bootloaders/optiboot/pin_defs.h @@ -1537,1441 +1537,9 @@ #ifdef RS485 - -#define PIN_INVERTED 0x8000 -#define A0_INV (PIN_INVERTED + A0) -#define A1_INV (PIN_INVERTED + A1) -#define A2_INV (PIN_INVERTED + A2) -#define A3_INV (PIN_INVERTED + A3) -#define A4_INV (PIN_INVERTED + A4) -#define A5_INV (PIN_INVERTED + A5) -#define A6_INV (PIN_INVERTED + A6) -#define A7_INV (PIN_INVERTED + A7) -#define B0_INV (PIN_INVERTED + B0) -#define B1_INV (PIN_INVERTED + B1) -#define B2_INV (PIN_INVERTED + B2) -#define B3_INV (PIN_INVERTED + B3) -#define B4_INV (PIN_INVERTED + B4) -#define B5_INV (PIN_INVERTED + B5) -#define B6_INV (PIN_INVERTED + B6) -#define B7_INV (PIN_INVERTED + B7) -#define C0_INV (PIN_INVERTED + C0) -#define C1_INV (PIN_INVERTED + C1) -#define C2_INV (PIN_INVERTED + C2) -#define C3_INV (PIN_INVERTED + C3) -#define C4_INV (PIN_INVERTED + C4) -#define C5_INV (PIN_INVERTED + C5) -#define C6_INV (PIN_INVERTED + C6) -#define C7_INV (PIN_INVERTED + C7) -#define D0_INV (PIN_INVERTED + D0) -#define D1_INV (PIN_INVERTED + D1) -#define D2_INV (PIN_INVERTED + D2) -#define D3_INV (PIN_INVERTED + D3) -#define D4_INV (PIN_INVERTED + D4) -#define D5_INV (PIN_INVERTED + D5) -#define D6_INV (PIN_INVERTED + D6) -#define D7_INV (PIN_INVERTED + D7) -#define E0_INV (PIN_INVERTED + E0) -#define E1_INV (PIN_INVERTED + E1) -#define E2_INV (PIN_INVERTED + E2) -#define E3_INV (PIN_INVERTED + E3) -#define E4_INV (PIN_INVERTED + E4) -#define E5_INV (PIN_INVERTED + E5) -#define E6_INV (PIN_INVERTED + E6) -#define E7_INV (PIN_INVERTED + E7) -#define F0_INV (PIN_INVERTED + F0) -#define F1_INV (PIN_INVERTED + F1) -#define F2_INV (PIN_INVERTED + F2) -#define F3_INV (PIN_INVERTED + F3) -#define F4_INV (PIN_INVERTED + F4) -#define F5_INV (PIN_INVERTED + F5) -#define F6_INV (PIN_INVERTED + F6) -#define F7_INV (PIN_INVERTED + F7) -#define G0_INV (PIN_INVERTED + G0) -#define G1_INV (PIN_INVERTED + G1) -#define G2_INV (PIN_INVERTED + G2) -#define G3_INV (PIN_INVERTED + G3) -#define G4_INV (PIN_INVERTED + G4) -#define G5_INV (PIN_INVERTED + G5) -#define G6_INV (PIN_INVERTED + G6) -#define G7_INV (PIN_INVERTED + G7) -#define H0_INV (PIN_INVERTED + H0) -#define H1_INV (PIN_INVERTED + H1) -#define H2_INV (PIN_INVERTED + H2) -#define H3_INV (PIN_INVERTED + H3) -#define H4_INV (PIN_INVERTED + H4) -#define H5_INV (PIN_INVERTED + H5) -#define H6_INV (PIN_INVERTED + H6) -#define H7_INV (PIN_INVERTED + H7) -#define J0_INV (PIN_INVERTED + J0) -#define J1_INV (PIN_INVERTED + J1) -#define J2_INV (PIN_INVERTED + J2) -#define J3_INV (PIN_INVERTED + J3) -#define J4_INV (PIN_INVERTED + J4) -#define J5_INV (PIN_INVERTED + J5) -#define J6_INV (PIN_INVERTED + J6) -#define J7_INV (PIN_INVERTED + J7) -#define K0_INV (PIN_INVERTED + K0) -#define K1_INV (PIN_INVERTED + K1) -#define K2_INV (PIN_INVERTED + K2) -#define K3_INV (PIN_INVERTED + K3) -#define K4_INV (PIN_INVERTED + K4) -#define K5_INV (PIN_INVERTED + K5) -#define K6_INV (PIN_INVERTED + K6) -#define K7_INV (PIN_INVERTED + K7) -#define L0_INV (PIN_INVERTED + L0) -#define L1_INV (PIN_INVERTED + L1) -#define L2_INV (PIN_INVERTED + L2) -#define L3_INV (PIN_INVERTED + L3) -#define L4_INV (PIN_INVERTED + L4) -#define L5_INV (PIN_INVERTED + L5) -#define L6_INV (PIN_INVERTED + L6) -#define L7_INV (PIN_INVERTED + L7) - -#if RS485 == B0 -#define RS485_NAME "B0" -#undef RS485 -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB0 -#elif RS485 == B1 -#define RS485_NAME "B1" -#undef RS485 -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB1 -#elif RS485 == B2 -#define RS485_NAME "B2" -#undef RS485 -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB2 -#elif RS485 == B3 -#define RS485_NAME "B3" -#undef RS485 -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB3 -#elif RS485 == B4 -#define RS485_NAME "B4" -#undef RS485 -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB4 -#elif RS485 == B5 -#define RS485_NAME "B5" -#undef RS485 -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB5 -#elif RS485 == B6 -#define RS485_NAME "B6" -#undef RS485 -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB6 -#elif RS485 == B7 -#define RS485_NAME "B7" -#undef RS485 -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB7 - -#elif RS485 == C0 -#define RS485_NAME "C0" -#undef RS485 -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC0 -#elif RS485 == C1 -#define RS485_NAME "C1" -#undef RS485 -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC1 -#elif RS485 == C2 -#define RS485_NAME "C2" -#undef RS485 -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC2 -#elif RS485 == C3 -#define RS485_NAME "C3" -#undef RS485 -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC3 -#elif RS485 == C4 -#define RS485_NAME "C4" -#undef RS485 -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC4 -#elif RS485 == C5 -#define RS485_NAME "C5" -#undef RS485 -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC5 -#elif RS485 == C6 -#define RS485_NAME "C6" -#undef RS485 -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC6 -#elif RS485 == C7 -#define RS485_NAME "C7" -#undef RS485 -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC7 - -#elif RS485 == D0 -#define RS485_NAME "D0" -#undef RS485 -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND0 -#elif RS485 == D1 -#define RS485_NAME "D1" -#undef RS485 -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND1 -#elif RS485 == D2 -#define RS485_NAME "D2" -#undef RS485 -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND2 -#elif RS485 == D3 -#define RS485_NAME "D3" -#undef RS485 -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND3 -#elif RS485 == D4 -#define RS485_NAME "D4" -#undef RS485 -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND4 -#elif RS485 == D5 -#define RS485_NAME "D5" -#undef RS485 -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND5 -#elif RS485 == D6 -#define RS485_NAME "D6" -#undef RS485 -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND6 -#elif RS485 == D7 -#define RS485_NAME "D7" -#undef RS485 -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND7 - -#elif RS485 == E0 -#define RS485_NAME "E0" -#undef RS485 -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE0 -#elif RS485 == E1 -#define RS485_NAME "E1" -#undef RS485 -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE1 -#elif RS485 == E2 -#define RS485_NAME "E2" -#undef RS485 -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE2 -#elif RS485 == E3 -#define RS485_NAME "E3" -#undef RS485 -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE3 -#elif RS485 == E4 -#define RS485_NAME "E4" -#undef RS485 -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE4 -#elif RS485 == E5 -#define RS485_NAME "E5" -#undef RS485 -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE5 -#elif RS485 == E6 -#define RS485_NAME "E6" -#undef RS485 -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE6 -#elif RS485 == E7 -#define RS485_NAME "E7" -#undef RS485 -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE7 - -#elif RS485 == F0 -#define RS485_NAME "F0" -#undef RS485 -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF0 -#elif RS485 == F1 -#define RS485_NAME "F1" -#undef RS485 -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF1 -#elif RS485 == F2 -#define RS485_NAME "F2" -#undef RS485 -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF2 -#elif RS485 == F3 -#define RS485_NAME "F3" -#undef RS485 -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF3 -#elif RS485 == F4 -#define RS485_NAME "F4" -#undef RS485 -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF4 -#elif RS485 == F5 -#define RS485_NAME "F5" -#undef RS485 -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF5 -#elif RS485 == F6 -#define RS485_NAME "F6" -#undef RS485 -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF6 -#elif RS485 == F7 -#define RS485_NAME "F7" -#undef RS485 -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF7 - -#elif RS485 == G0 -#define RS485_NAME "G0" -#undef RS485 -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING0 -#elif RS485 == G1 -#define RS485_NAME "G1" -#undef RS485 -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING1 -#elif RS485 == G2 -#define RS485_NAME "G2" -#undef RS485 -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING2 -#elif RS485 == G3 -#define RS485_NAME "G3" -#undef RS485 -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING3 -#elif RS485 == G4 -#define RS485_NAME "G4" -#undef RS485 -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING4 -#elif RS485 == G5 -#define RS485_NAME "G5" -#undef RS485 -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING5 -#elif RS485 == G6 -#define RS485_NAME "G6" -#undef RS485 -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING6 -#elif RS485 == G7 -#define RS485_NAME "G7" -#undef RS485 -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING7 - -#elif RS485 == H0 -#define RS485_NAME "H0" -#undef RS485 -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH0 -#elif RS485 == H1 -#define RS485_NAME "H1" -#undef RS485 -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH1 -#elif RS485 == H2 -#define RS485_NAME "H2" -#undef RS485 -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH2 -#elif RS485 == H3 -#define RS485_NAME "H3" -#undef RS485 -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH3 -#elif RS485 == H4 -#define RS485_NAME "H4" -#undef RS485 -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH4 -#elif RS485 == H5 -#define RS485_NAME "H5" -#undef RS485 -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH5 -#elif RS485 == H6 -#define RS485_NAME "H6" -#undef RS485 -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH6 -#elif RS485 == H7 -#define RS485_NAME "H7" -#undef RS485 -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH7 - -#elif RS485 == J0 -#define RS485_NAME "J0" -#undef RS485 -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ0 -#elif RS485 == J1 -#define RS485_NAME "J1" -#undef RS485 -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ1 -#elif RS485 == J2 -#define RS485_NAME "J2" -#undef RS485 -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ2 -#elif RS485 == J3 -#define RS485_NAME "J3" -#undef RS485 -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ3 -#elif RS485 == J4 -#define RS485_NAME "J4" -#undef RS485 -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ4 -#elif RS485 == J5 -#define RS485_NAME "J5" -#undef RS485 -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ5 -#elif RS485 == J6 -#define RS485_NAME "J6" -#undef RS485 -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ6 -#elif RS485 == J7 -#define RS485_NAME "J7" -#undef RS485 -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ7 - -#elif RS485 == K0 -#define RS485_NAME "K0" -#undef RS485 -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK0 -#elif RS485 == K1 -#define RS485_NAME "K1" -#undef RS485 -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK1 -#elif RS485 == K2 -#define RS485_NAME "K2" -#undef RS485 -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK2 -#elif RS485 == K3 -#define RS485_NAME "K3" -#undef RS485 -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK3 -#elif RS485 == K4 -#define RS485_NAME "K4" -#undef RS485 -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK4 -#elif RS485 == K5 -#define RS485_NAME "K5" -#undef RS485 -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK5 -#elif RS485 == K6 -#define RS485_NAME "K6" -#undef RS485 -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK6 -#elif RS485 == K7 -#define RS485_NAME "K7" -#undef RS485 -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK7 - -#elif RS485 == L0 -#define RS485_NAME "L0" -#undef RS485 -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL0 -#elif RS485 == L1 -#define RS485_NAME "L1" -#undef RS485 -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL1 -#elif RS485 == L2 -#define RS485_NAME "L2" -#undef RS485 -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL2 -#elif RS485 == L3 -#define RS485_NAME "L3" -#undef RS485 -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL3 -#elif RS485 == L4 -#define RS485_NAME "L4" -#undef RS485 -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL4 -#elif RS485 == L5 -#define RS485_NAME "L5" -#undef RS485 -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL5 -#elif RS485 == L6 -#define RS485_NAME "L6" -#undef RS485 -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL6 -#elif RS485 == L7 -#define RS485_NAME "L7" -#undef RS485 -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL7 - -#elif RS485 == A0 -#define RS485_NAME "A0" -#undef RS485 -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA0 -#elif RS485 == A1 -#define RS485_NAME "A1" -#undef RS485 -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA1 -#elif RS485 == A2 -#define RS485_NAME "A2" -#undef RS485 -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA2 -#elif RS485 == A3 -#define RS485_NAME "A3" -#undef RS485 -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA3 -#elif RS485 == A4 -#define RS485_NAME "A4" -#undef RS485 -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA4 -#elif RS485 == A5 -#define RS485_NAME "A5" -#undef RS485 -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA5 -#elif RS485 == A6 -#define RS485_NAME "A6" -#undef RS485 -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA6 -#elif RS485 == A7 -#define RS485_NAME "A7" -#undef RS485 -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA7 -#elif RS485 == B0_INV -#define RS485_NAME "B0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB0 -#elif RS485 == B1_INV -#define RS485_NAME "B1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB1 -#elif RS485 == B2_INV -#define RS485_NAME "B2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB2 -#elif RS485 == B3_INV -#define RS485_NAME "B3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB3 -#elif RS485 == B4_INV -#define RS485_NAME "B4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB4 -#elif RS485 == B5_INV -#define RS485_NAME "B5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB5 -#elif RS485 == B6_INV -#define RS485_NAME "B6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB6 -#elif RS485 == B7_INV -#define RS485_NAME "B7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRB -#define RS485_PORT PORTB -#define RS485_PIN PINB -#define RS485 PINB7 - -#elif RS485 == C0_INV -#define RS485_NAME "C0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC0 -#elif RS485 == C1_INV -#define RS485_NAME "C1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC1 -#elif RS485 == C2_INV -#define RS485_NAME "C2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC2 -#elif RS485 == C3_INV -#define RS485_NAME "C3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC3 -#elif RS485 == C4_INV -#define RS485_NAME "C4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC4 -#elif RS485 == C5_INV -#define RS485_NAME "C5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC5 -#elif RS485 == C6_INV -#define RS485_NAME "C6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC6 -#elif RS485 == C7_INV -#define RS485_NAME "C7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRC -#define RS485_PORT PORTC -#define RS485_PIN PINC -#define RS485 PINC7 - -#elif RS485 == D0_INV -#define RS485_NAME "D0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND0 -#elif RS485 == D1_INV -#define RS485_NAME "D1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND1 -#elif RS485 == D2_INV -#define RS485_NAME "D2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND2 -#elif RS485 == D3_INV -#define RS485_NAME "D3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND3 -#elif RS485 == D4_INV -#define RS485_NAME "D4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND4 -#elif RS485 == D5_INV -#define RS485_NAME "D5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND5 -#elif RS485 == D6_INV -#define RS485_NAME "D6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND6 -#elif RS485 == D7_INV -#define RS485_NAME "D7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRD -#define RS485_PORT PORTD -#define RS485_PIN PIND -#define RS485 PIND7 - -#elif RS485 == E0_INV -#define RS485_NAME "E0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE0 -#elif RS485 == E1_INV -#define RS485_NAME "E1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE1 -#elif RS485 == E2_INV -#define RS485_NAME "E2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE2 -#elif RS485 == E3_INV -#define RS485_NAME "E3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE3 -#elif RS485 == E4_INV -#define RS485_NAME "E4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE4 -#elif RS485 == E5_INV -#define RS485_NAME "E5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE5 -#elif RS485 == E6_INV -#define RS485_NAME "E6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE6 -#elif RS485 == E7_INV -#define RS485_NAME "E7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRE -#define RS485_PORT PORTE -#define RS485_PIN PINE -#define RS485 PINE7 - -#elif RS485 == F0_INV -#define RS485_NAME "F0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF0 -#elif RS485 == F1_INV -#define RS485_NAME "F1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF1 -#elif RS485 == F2_INV -#define RS485_NAME "F2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF2 -#elif RS485 == F3_INV -#define RS485_NAME "F3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF3 -#elif RS485 == F4_INV -#define RS485_NAME "F4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF4 -#elif RS485 == F5_INV -#define RS485_NAME "F5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF5 -#elif RS485 == F6_INV -#define RS485_NAME "F6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF6 -#elif RS485 == F7_INV -#define RS485_NAME "F7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRF -#define RS485_PORT PORTF -#define RS485_PIN PINF -#define RS485 PINF7 - -#elif RS485 == G0_INV -#define RS485_NAME "G0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING0 -#elif RS485 == G1_INV -#define RS485_NAME "G1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING1 -#elif RS485 == G2_INV -#define RS485_NAME "G2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING2 -#elif RS485 == G3_INV -#define RS485_NAME "G3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING3 -#elif RS485 == G4_INV -#define RS485_NAME "G4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING4 -#elif RS485 == G5_INV -#define RS485_NAME "G5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING5 -#elif RS485 == G6_INV -#define RS485_NAME "G6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING6 -#elif RS485 == G7_INV -#define RS485_NAME "G7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRG -#define RS485_PORT PORTG -#define RS485_PIN PING -#define RS485 PING7 - -#elif RS485 == H0_INV -#define RS485_NAME "H0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH0 -#elif RS485 == H1_INV -#define RS485_NAME "H1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH1 -#elif RS485 == H2_INV -#define RS485_NAME "H2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH2 -#elif RS485 == H3_INV -#define RS485_NAME "H3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH3 -#elif RS485 == H4_INV -#define RS485_NAME "H4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH4 -#elif RS485 == H5_INV -#define RS485_NAME "H5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH5 -#elif RS485 == H6_INV -#define RS485_NAME "H6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH6 -#elif RS485 == H7_INV -#define RS485_NAME "H7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRH -#define RS485_PORT PORTH -#define RS485_PIN PINH -#define RS485 PINH7 - -#elif RS485 == J0_INV -#define RS485_NAME "J0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ0 -#elif RS485 == J1_INV -#define RS485_NAME "J1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ1 -#elif RS485 == J2_INV -#define RS485_NAME "J2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ2 -#elif RS485 == J3_INV -#define RS485_NAME "J3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ3 -#elif RS485 == J4_INV -#define RS485_NAME "J4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ4 -#elif RS485 == J5_INV -#define RS485_NAME "J5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ5 -#elif RS485 == J6_INV -#define RS485_NAME "J6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ6 -#elif RS485 == J7_INV -#define RS485_NAME "J7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRJ -#define RS485_PORT PORTJ -#define RS485_PIN PINJ -#define RS485 PINJ7 - -#elif RS485 == K0_INV -#define RS485_NAME "K0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK0 -#elif RS485 == K1_INV -#define RS485_NAME "K1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK1 -#elif RS485 == K2_INV -#define RS485_NAME "K2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK2 -#elif RS485 == K3_INV -#define RS485_NAME "K3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK3 -#elif RS485 == K4_INV -#define RS485_NAME "K4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK4 -#elif RS485 == K5_INV -#define RS485_NAME "K5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK5 -#elif RS485 == K6_INV -#define RS485_NAME "K6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK6 -#elif RS485 == K7_INV -#define RS485_NAME "K7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRK -#define RS485_PORT PORTK -#define RS485_PIN PINK -#define RS485 PINK7 - -#elif RS485 == L0_INV -#define RS485_NAME "L0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL0 -#elif RS485 == L1_INV -#define RS485_NAME "L1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL1 -#elif RS485 == L2_INV -#define RS485_NAME "L2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL2 -#elif RS485 == L3_INV -#define RS485_NAME "L3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL3 -#elif RS485 == L4_INV -#define RS485_NAME "L4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL4 -#elif RS485 == L5_INV -#define RS485_NAME "L5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL5 -#elif RS485 == L6_INV -#define RS485_NAME "L6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL6 -#elif RS485 == L7_INV -#define RS485_NAME "L7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRL -#define RS485_PORT PORTL -#define RS485_PIN PINL -#define RS485 PINL7 - -#elif RS485 == A0_INV -#define RS485_NAME "A0_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA0 -#elif RS485 == A1_INV -#define RS485_NAME "A1_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA1 -#elif RS485 == A2_INV -#define RS485_NAME "A2_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA2 -#elif RS485 == A3_INV -#define RS485_NAME "A3_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA3 -#elif RS485 == A4_INV -#define RS485_NAME "A4_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA4 -#elif RS485 == A5_INV -#define RS485_NAME "A5_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA5 -#elif RS485 == A6_INV -#define RS485_NAME "A6_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA6 -#elif RS485 == A7_INV -#define RS485_NAME "A7_INV" -#undef RS485 -#define RS485_INVERT -#define RS485_DDR DDRA -#define RS485_PORT PORTA -#define RS485_PIN PINA -#define RS485 PINA7 -#else -#error ------------------------------------------- -#error Unrecognized RS485 name. Should be like "B5" -#error or "B5_INV" for active high -#error ------------------------------------------- +#include "pins_rs485.h" #endif + +#if SOFT_UART && defined(SOFTTX) && defined(SOFTRX) +#include "pins_softuart.h" #endif diff --git a/optiboot/bootloaders/optiboot/pins_rs485.h b/optiboot/bootloaders/optiboot/pins_rs485.h new file mode 100644 index 000000000..02ad6ccf7 --- /dev/null +++ b/optiboot/bootloaders/optiboot/pins_rs485.h @@ -0,0 +1,1437 @@ + +#define PIN_INVERTED 0x8000 +#define A0_INV (PIN_INVERTED + A0) +#define A1_INV (PIN_INVERTED + A1) +#define A2_INV (PIN_INVERTED + A2) +#define A3_INV (PIN_INVERTED + A3) +#define A4_INV (PIN_INVERTED + A4) +#define A5_INV (PIN_INVERTED + A5) +#define A6_INV (PIN_INVERTED + A6) +#define A7_INV (PIN_INVERTED + A7) +#define B0_INV (PIN_INVERTED + B0) +#define B1_INV (PIN_INVERTED + B1) +#define B2_INV (PIN_INVERTED + B2) +#define B3_INV (PIN_INVERTED + B3) +#define B4_INV (PIN_INVERTED + B4) +#define B5_INV (PIN_INVERTED + B5) +#define B6_INV (PIN_INVERTED + B6) +#define B7_INV (PIN_INVERTED + B7) +#define C0_INV (PIN_INVERTED + C0) +#define C1_INV (PIN_INVERTED + C1) +#define C2_INV (PIN_INVERTED + C2) +#define C3_INV (PIN_INVERTED + C3) +#define C4_INV (PIN_INVERTED + C4) +#define C5_INV (PIN_INVERTED + C5) +#define C6_INV (PIN_INVERTED + C6) +#define C7_INV (PIN_INVERTED + C7) +#define D0_INV (PIN_INVERTED + D0) +#define D1_INV (PIN_INVERTED + D1) +#define D2_INV (PIN_INVERTED + D2) +#define D3_INV (PIN_INVERTED + D3) +#define D4_INV (PIN_INVERTED + D4) +#define D5_INV (PIN_INVERTED + D5) +#define D6_INV (PIN_INVERTED + D6) +#define D7_INV (PIN_INVERTED + D7) +#define E0_INV (PIN_INVERTED + E0) +#define E1_INV (PIN_INVERTED + E1) +#define E2_INV (PIN_INVERTED + E2) +#define E3_INV (PIN_INVERTED + E3) +#define E4_INV (PIN_INVERTED + E4) +#define E5_INV (PIN_INVERTED + E5) +#define E6_INV (PIN_INVERTED + E6) +#define E7_INV (PIN_INVERTED + E7) +#define F0_INV (PIN_INVERTED + F0) +#define F1_INV (PIN_INVERTED + F1) +#define F2_INV (PIN_INVERTED + F2) +#define F3_INV (PIN_INVERTED + F3) +#define F4_INV (PIN_INVERTED + F4) +#define F5_INV (PIN_INVERTED + F5) +#define F6_INV (PIN_INVERTED + F6) +#define F7_INV (PIN_INVERTED + F7) +#define G0_INV (PIN_INVERTED + G0) +#define G1_INV (PIN_INVERTED + G1) +#define G2_INV (PIN_INVERTED + G2) +#define G3_INV (PIN_INVERTED + G3) +#define G4_INV (PIN_INVERTED + G4) +#define G5_INV (PIN_INVERTED + G5) +#define G6_INV (PIN_INVERTED + G6) +#define G7_INV (PIN_INVERTED + G7) +#define H0_INV (PIN_INVERTED + H0) +#define H1_INV (PIN_INVERTED + H1) +#define H2_INV (PIN_INVERTED + H2) +#define H3_INV (PIN_INVERTED + H3) +#define H4_INV (PIN_INVERTED + H4) +#define H5_INV (PIN_INVERTED + H5) +#define H6_INV (PIN_INVERTED + H6) +#define H7_INV (PIN_INVERTED + H7) +#define J0_INV (PIN_INVERTED + J0) +#define J1_INV (PIN_INVERTED + J1) +#define J2_INV (PIN_INVERTED + J2) +#define J3_INV (PIN_INVERTED + J3) +#define J4_INV (PIN_INVERTED + J4) +#define J5_INV (PIN_INVERTED + J5) +#define J6_INV (PIN_INVERTED + J6) +#define J7_INV (PIN_INVERTED + J7) +#define K0_INV (PIN_INVERTED + K0) +#define K1_INV (PIN_INVERTED + K1) +#define K2_INV (PIN_INVERTED + K2) +#define K3_INV (PIN_INVERTED + K3) +#define K4_INV (PIN_INVERTED + K4) +#define K5_INV (PIN_INVERTED + K5) +#define K6_INV (PIN_INVERTED + K6) +#define K7_INV (PIN_INVERTED + K7) +#define L0_INV (PIN_INVERTED + L0) +#define L1_INV (PIN_INVERTED + L1) +#define L2_INV (PIN_INVERTED + L2) +#define L3_INV (PIN_INVERTED + L3) +#define L4_INV (PIN_INVERTED + L4) +#define L5_INV (PIN_INVERTED + L5) +#define L6_INV (PIN_INVERTED + L6) +#define L7_INV (PIN_INVERTED + L7) + +#if RS485 == B0 +#define RS485_NAME "B0" +#undef RS485 +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB0 +#elif RS485 == B1 +#define RS485_NAME "B1" +#undef RS485 +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB1 +#elif RS485 == B2 +#define RS485_NAME "B2" +#undef RS485 +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB2 +#elif RS485 == B3 +#define RS485_NAME "B3" +#undef RS485 +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB3 +#elif RS485 == B4 +#define RS485_NAME "B4" +#undef RS485 +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB4 +#elif RS485 == B5 +#define RS485_NAME "B5" +#undef RS485 +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB5 +#elif RS485 == B6 +#define RS485_NAME "B6" +#undef RS485 +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB6 +#elif RS485 == B7 +#define RS485_NAME "B7" +#undef RS485 +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB7 + +#elif RS485 == C0 +#define RS485_NAME "C0" +#undef RS485 +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC0 +#elif RS485 == C1 +#define RS485_NAME "C1" +#undef RS485 +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC1 +#elif RS485 == C2 +#define RS485_NAME "C2" +#undef RS485 +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC2 +#elif RS485 == C3 +#define RS485_NAME "C3" +#undef RS485 +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC3 +#elif RS485 == C4 +#define RS485_NAME "C4" +#undef RS485 +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC4 +#elif RS485 == C5 +#define RS485_NAME "C5" +#undef RS485 +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC5 +#elif RS485 == C6 +#define RS485_NAME "C6" +#undef RS485 +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC6 +#elif RS485 == C7 +#define RS485_NAME "C7" +#undef RS485 +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC7 + +#elif RS485 == D0 +#define RS485_NAME "D0" +#undef RS485 +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND0 +#elif RS485 == D1 +#define RS485_NAME "D1" +#undef RS485 +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND1 +#elif RS485 == D2 +#define RS485_NAME "D2" +#undef RS485 +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND2 +#elif RS485 == D3 +#define RS485_NAME "D3" +#undef RS485 +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND3 +#elif RS485 == D4 +#define RS485_NAME "D4" +#undef RS485 +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND4 +#elif RS485 == D5 +#define RS485_NAME "D5" +#undef RS485 +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND5 +#elif RS485 == D6 +#define RS485_NAME "D6" +#undef RS485 +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND6 +#elif RS485 == D7 +#define RS485_NAME "D7" +#undef RS485 +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND7 + +#elif RS485 == E0 +#define RS485_NAME "E0" +#undef RS485 +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE0 +#elif RS485 == E1 +#define RS485_NAME "E1" +#undef RS485 +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE1 +#elif RS485 == E2 +#define RS485_NAME "E2" +#undef RS485 +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE2 +#elif RS485 == E3 +#define RS485_NAME "E3" +#undef RS485 +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE3 +#elif RS485 == E4 +#define RS485_NAME "E4" +#undef RS485 +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE4 +#elif RS485 == E5 +#define RS485_NAME "E5" +#undef RS485 +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE5 +#elif RS485 == E6 +#define RS485_NAME "E6" +#undef RS485 +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE6 +#elif RS485 == E7 +#define RS485_NAME "E7" +#undef RS485 +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE7 + +#elif RS485 == F0 +#define RS485_NAME "F0" +#undef RS485 +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF0 +#elif RS485 == F1 +#define RS485_NAME "F1" +#undef RS485 +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF1 +#elif RS485 == F2 +#define RS485_NAME "F2" +#undef RS485 +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF2 +#elif RS485 == F3 +#define RS485_NAME "F3" +#undef RS485 +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF3 +#elif RS485 == F4 +#define RS485_NAME "F4" +#undef RS485 +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF4 +#elif RS485 == F5 +#define RS485_NAME "F5" +#undef RS485 +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF5 +#elif RS485 == F6 +#define RS485_NAME "F6" +#undef RS485 +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF6 +#elif RS485 == F7 +#define RS485_NAME "F7" +#undef RS485 +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF7 + +#elif RS485 == G0 +#define RS485_NAME "G0" +#undef RS485 +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING0 +#elif RS485 == G1 +#define RS485_NAME "G1" +#undef RS485 +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING1 +#elif RS485 == G2 +#define RS485_NAME "G2" +#undef RS485 +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING2 +#elif RS485 == G3 +#define RS485_NAME "G3" +#undef RS485 +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING3 +#elif RS485 == G4 +#define RS485_NAME "G4" +#undef RS485 +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING4 +#elif RS485 == G5 +#define RS485_NAME "G5" +#undef RS485 +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING5 +#elif RS485 == G6 +#define RS485_NAME "G6" +#undef RS485 +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING6 +#elif RS485 == G7 +#define RS485_NAME "G7" +#undef RS485 +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING7 + +#elif RS485 == H0 +#define RS485_NAME "H0" +#undef RS485 +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH0 +#elif RS485 == H1 +#define RS485_NAME "H1" +#undef RS485 +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH1 +#elif RS485 == H2 +#define RS485_NAME "H2" +#undef RS485 +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH2 +#elif RS485 == H3 +#define RS485_NAME "H3" +#undef RS485 +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH3 +#elif RS485 == H4 +#define RS485_NAME "H4" +#undef RS485 +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH4 +#elif RS485 == H5 +#define RS485_NAME "H5" +#undef RS485 +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH5 +#elif RS485 == H6 +#define RS485_NAME "H6" +#undef RS485 +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH6 +#elif RS485 == H7 +#define RS485_NAME "H7" +#undef RS485 +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH7 + +#elif RS485 == J0 +#define RS485_NAME "J0" +#undef RS485 +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ0 +#elif RS485 == J1 +#define RS485_NAME "J1" +#undef RS485 +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ1 +#elif RS485 == J2 +#define RS485_NAME "J2" +#undef RS485 +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ2 +#elif RS485 == J3 +#define RS485_NAME "J3" +#undef RS485 +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ3 +#elif RS485 == J4 +#define RS485_NAME "J4" +#undef RS485 +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ4 +#elif RS485 == J5 +#define RS485_NAME "J5" +#undef RS485 +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ5 +#elif RS485 == J6 +#define RS485_NAME "J6" +#undef RS485 +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ6 +#elif RS485 == J7 +#define RS485_NAME "J7" +#undef RS485 +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ7 + +#elif RS485 == K0 +#define RS485_NAME "K0" +#undef RS485 +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK0 +#elif RS485 == K1 +#define RS485_NAME "K1" +#undef RS485 +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK1 +#elif RS485 == K2 +#define RS485_NAME "K2" +#undef RS485 +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK2 +#elif RS485 == K3 +#define RS485_NAME "K3" +#undef RS485 +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK3 +#elif RS485 == K4 +#define RS485_NAME "K4" +#undef RS485 +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK4 +#elif RS485 == K5 +#define RS485_NAME "K5" +#undef RS485 +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK5 +#elif RS485 == K6 +#define RS485_NAME "K6" +#undef RS485 +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK6 +#elif RS485 == K7 +#define RS485_NAME "K7" +#undef RS485 +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK7 + +#elif RS485 == L0 +#define RS485_NAME "L0" +#undef RS485 +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL0 +#elif RS485 == L1 +#define RS485_NAME "L1" +#undef RS485 +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL1 +#elif RS485 == L2 +#define RS485_NAME "L2" +#undef RS485 +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL2 +#elif RS485 == L3 +#define RS485_NAME "L3" +#undef RS485 +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL3 +#elif RS485 == L4 +#define RS485_NAME "L4" +#undef RS485 +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL4 +#elif RS485 == L5 +#define RS485_NAME "L5" +#undef RS485 +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL5 +#elif RS485 == L6 +#define RS485_NAME "L6" +#undef RS485 +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL6 +#elif RS485 == L7 +#define RS485_NAME "L7" +#undef RS485 +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL7 + +#elif RS485 == A0 +#define RS485_NAME "A0" +#undef RS485 +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA0 +#elif RS485 == A1 +#define RS485_NAME "A1" +#undef RS485 +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA1 +#elif RS485 == A2 +#define RS485_NAME "A2" +#undef RS485 +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA2 +#elif RS485 == A3 +#define RS485_NAME "A3" +#undef RS485 +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA3 +#elif RS485 == A4 +#define RS485_NAME "A4" +#undef RS485 +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA4 +#elif RS485 == A5 +#define RS485_NAME "A5" +#undef RS485 +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA5 +#elif RS485 == A6 +#define RS485_NAME "A6" +#undef RS485 +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA6 +#elif RS485 == A7 +#define RS485_NAME "A7" +#undef RS485 +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA7 +#elif RS485 == B0_INV +#define RS485_NAME "B0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB0 +#elif RS485 == B1_INV +#define RS485_NAME "B1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB1 +#elif RS485 == B2_INV +#define RS485_NAME "B2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB2 +#elif RS485 == B3_INV +#define RS485_NAME "B3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB3 +#elif RS485 == B4_INV +#define RS485_NAME "B4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB4 +#elif RS485 == B5_INV +#define RS485_NAME "B5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB5 +#elif RS485 == B6_INV +#define RS485_NAME "B6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB6 +#elif RS485 == B7_INV +#define RS485_NAME "B7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRB +#define RS485_PORT PORTB +#define RS485_PIN PINB +#define RS485 PINB7 + +#elif RS485 == C0_INV +#define RS485_NAME "C0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC0 +#elif RS485 == C1_INV +#define RS485_NAME "C1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC1 +#elif RS485 == C2_INV +#define RS485_NAME "C2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC2 +#elif RS485 == C3_INV +#define RS485_NAME "C3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC3 +#elif RS485 == C4_INV +#define RS485_NAME "C4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC4 +#elif RS485 == C5_INV +#define RS485_NAME "C5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC5 +#elif RS485 == C6_INV +#define RS485_NAME "C6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC6 +#elif RS485 == C7_INV +#define RS485_NAME "C7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRC +#define RS485_PORT PORTC +#define RS485_PIN PINC +#define RS485 PINC7 + +#elif RS485 == D0_INV +#define RS485_NAME "D0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND0 +#elif RS485 == D1_INV +#define RS485_NAME "D1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND1 +#elif RS485 == D2_INV +#define RS485_NAME "D2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND2 +#elif RS485 == D3_INV +#define RS485_NAME "D3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND3 +#elif RS485 == D4_INV +#define RS485_NAME "D4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND4 +#elif RS485 == D5_INV +#define RS485_NAME "D5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND5 +#elif RS485 == D6_INV +#define RS485_NAME "D6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND6 +#elif RS485 == D7_INV +#define RS485_NAME "D7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRD +#define RS485_PORT PORTD +#define RS485_PIN PIND +#define RS485 PIND7 + +#elif RS485 == E0_INV +#define RS485_NAME "E0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE0 +#elif RS485 == E1_INV +#define RS485_NAME "E1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE1 +#elif RS485 == E2_INV +#define RS485_NAME "E2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE2 +#elif RS485 == E3_INV +#define RS485_NAME "E3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE3 +#elif RS485 == E4_INV +#define RS485_NAME "E4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE4 +#elif RS485 == E5_INV +#define RS485_NAME "E5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE5 +#elif RS485 == E6_INV +#define RS485_NAME "E6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE6 +#elif RS485 == E7_INV +#define RS485_NAME "E7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRE +#define RS485_PORT PORTE +#define RS485_PIN PINE +#define RS485 PINE7 + +#elif RS485 == F0_INV +#define RS485_NAME "F0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF0 +#elif RS485 == F1_INV +#define RS485_NAME "F1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF1 +#elif RS485 == F2_INV +#define RS485_NAME "F2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF2 +#elif RS485 == F3_INV +#define RS485_NAME "F3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF3 +#elif RS485 == F4_INV +#define RS485_NAME "F4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF4 +#elif RS485 == F5_INV +#define RS485_NAME "F5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF5 +#elif RS485 == F6_INV +#define RS485_NAME "F6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF6 +#elif RS485 == F7_INV +#define RS485_NAME "F7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRF +#define RS485_PORT PORTF +#define RS485_PIN PINF +#define RS485 PINF7 + +#elif RS485 == G0_INV +#define RS485_NAME "G0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING0 +#elif RS485 == G1_INV +#define RS485_NAME "G1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING1 +#elif RS485 == G2_INV +#define RS485_NAME "G2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING2 +#elif RS485 == G3_INV +#define RS485_NAME "G3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING3 +#elif RS485 == G4_INV +#define RS485_NAME "G4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING4 +#elif RS485 == G5_INV +#define RS485_NAME "G5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING5 +#elif RS485 == G6_INV +#define RS485_NAME "G6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING6 +#elif RS485 == G7_INV +#define RS485_NAME "G7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRG +#define RS485_PORT PORTG +#define RS485_PIN PING +#define RS485 PING7 + +#elif RS485 == H0_INV +#define RS485_NAME "H0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH0 +#elif RS485 == H1_INV +#define RS485_NAME "H1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH1 +#elif RS485 == H2_INV +#define RS485_NAME "H2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH2 +#elif RS485 == H3_INV +#define RS485_NAME "H3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH3 +#elif RS485 == H4_INV +#define RS485_NAME "H4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH4 +#elif RS485 == H5_INV +#define RS485_NAME "H5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH5 +#elif RS485 == H6_INV +#define RS485_NAME "H6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH6 +#elif RS485 == H7_INV +#define RS485_NAME "H7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRH +#define RS485_PORT PORTH +#define RS485_PIN PINH +#define RS485 PINH7 + +#elif RS485 == J0_INV +#define RS485_NAME "J0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ0 +#elif RS485 == J1_INV +#define RS485_NAME "J1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ1 +#elif RS485 == J2_INV +#define RS485_NAME "J2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ2 +#elif RS485 == J3_INV +#define RS485_NAME "J3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ3 +#elif RS485 == J4_INV +#define RS485_NAME "J4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ4 +#elif RS485 == J5_INV +#define RS485_NAME "J5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ5 +#elif RS485 == J6_INV +#define RS485_NAME "J6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ6 +#elif RS485 == J7_INV +#define RS485_NAME "J7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRJ +#define RS485_PORT PORTJ +#define RS485_PIN PINJ +#define RS485 PINJ7 + +#elif RS485 == K0_INV +#define RS485_NAME "K0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK0 +#elif RS485 == K1_INV +#define RS485_NAME "K1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK1 +#elif RS485 == K2_INV +#define RS485_NAME "K2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK2 +#elif RS485 == K3_INV +#define RS485_NAME "K3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK3 +#elif RS485 == K4_INV +#define RS485_NAME "K4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK4 +#elif RS485 == K5_INV +#define RS485_NAME "K5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK5 +#elif RS485 == K6_INV +#define RS485_NAME "K6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK6 +#elif RS485 == K7_INV +#define RS485_NAME "K7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRK +#define RS485_PORT PORTK +#define RS485_PIN PINK +#define RS485 PINK7 + +#elif RS485 == L0_INV +#define RS485_NAME "L0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL0 +#elif RS485 == L1_INV +#define RS485_NAME "L1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL1 +#elif RS485 == L2_INV +#define RS485_NAME "L2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL2 +#elif RS485 == L3_INV +#define RS485_NAME "L3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL3 +#elif RS485 == L4_INV +#define RS485_NAME "L4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL4 +#elif RS485 == L5_INV +#define RS485_NAME "L5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL5 +#elif RS485 == L6_INV +#define RS485_NAME "L6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL6 +#elif RS485 == L7_INV +#define RS485_NAME "L7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRL +#define RS485_PORT PORTL +#define RS485_PIN PINL +#define RS485 PINL7 + +#elif RS485 == A0_INV +#define RS485_NAME "A0_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA0 +#elif RS485 == A1_INV +#define RS485_NAME "A1_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA1 +#elif RS485 == A2_INV +#define RS485_NAME "A2_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA2 +#elif RS485 == A3_INV +#define RS485_NAME "A3_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA3 +#elif RS485 == A4_INV +#define RS485_NAME "A4_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA4 +#elif RS485 == A5_INV +#define RS485_NAME "A5_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA5 +#elif RS485 == A6_INV +#define RS485_NAME "A6_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA6 +#elif RS485 == A7_INV +#define RS485_NAME "A7_INV" +#undef RS485 +#define RS485_INVERT +#define RS485_DDR DDRA +#define RS485_PORT PORTA +#define RS485_PIN PINA +#define RS485 PINA7 +#else +#error ------------------------------------------- +#error Unrecognized RS485 name. Should be like "B5" +#error or "B5_INV" for active high +#error ------------------------------------------- +#endif diff --git a/optiboot/bootloaders/optiboot/pins_softuart.h b/optiboot/bootloaders/optiboot/pins_softuart.h new file mode 100644 index 000000000..444927741 --- /dev/null +++ b/optiboot/bootloaders/optiboot/pins_softuart.h @@ -0,0 +1,831 @@ +#undef UART_PORT +#undef UART_PIN +#undef UART_DDR +#undef UART_TX_BIT +#undef UART_RX_BIT + +#if SOFTTX == B0 +#define SOFTTX_NAME "B0" +#define UART_DDR DDRB +#define UART_PORT PORTB +#define UART_TX_BIT PINB0 +#elif SOFTTX == B1 +#define SOFTTX_NAME "B1" +#define UART_DDR DDRB +#define UART_PORT PORTB +#define UART_TX_BIT PINB1 +#elif SOFTTX == B2 +#define SOFTTX_NAME "B2" +#define UART_DDR DDRB +#define UART_PORT PORTB +#define UART_TX_BIT PINB2 +#elif SOFTTX == B3 +#define SOFTTX_NAME "B3" +#define UART_DDR DDRB +#define UART_PORT PORTB +#define UART_TX_BIT PINB3 +#elif SOFTTX == B4 +#define SOFTTX_NAME "B4" +#define UART_DDR DDRB +#define UART_PORT PORTB +#define UART_TX_BIT PINB4 +#elif SOFTTX == B5 +#define SOFTTX_NAME "B5" +#define UART_DDR DDRB +#define UART_PORT PORTB +#define UART_TX_BIT PINB5 +#elif SOFTTX == B6 +#define SOFTTX_NAME "B6" +#define UART_DDR DDRB +#define UART_PORT PORTB +#define UART_TX_BIT PINB6 +#elif SOFTTX == B7 +#define SOFTTX_NAME "B7" +#define UART_DDR DDRB +#define UART_PORT PORTB +#define UART_TX_BIT PINB7 + +#elif SOFTTX == C0 +#define SOFTTX_NAME "C0" +#define UART_DDR DDRC +#define UART_PORT PORTC +#define UART_TX_BIT PINC0 +#elif SOFTTX == C1 +#define SOFTTX_NAME "C1" +#define UART_DDR DDRC +#define UART_PORT PORTC +#define UART_TX_BIT PINC1 +#elif SOFTTX == C2 +#define SOFTTX_NAME "C2" +#define UART_DDR DDRC +#define UART_PORT PORTC +#define UART_TX_BIT PINC2 +#elif SOFTTX == C3 +#define SOFTTX_NAME "C3" +#define UART_DDR DDRC +#define UART_PORT PORTC +#define UART_TX_BIT PINC3 +#elif SOFTTX == C4 +#define SOFTTX_NAME "C4" +#define UART_DDR DDRC +#define UART_PORT PORTC +#define UART_TX_BIT PINC4 +#elif SOFTTX == C5 +#define SOFTTX_NAME "C5" +#define UART_DDR DDRC +#define UART_PORT PORTC +#define UART_TX_BIT PINC5 +#elif SOFTTX == C6 +#define SOFTTX_NAME "C6" +#define UART_DDR DDRC +#define UART_PORT PORTC +#define UART_TX_BIT PINC6 +#elif SOFTTX == C7 +#define SOFTTX_NAME "C7" +#define UART_DDR DDRC +#define UART_PORT PORTC +#define UART_TX_BIT PINC7 + +#elif SOFTTX == D0 +#define SOFTTX_NAME "D0" +#define UART_DDR DDRD +#define UART_PORT PORTD +#define UART_TX_BIT PIND0 +#elif SOFTTX == D1 +#define SOFTTX_NAME "D1" +#define UART_DDR DDRD +#define UART_PORT PORTD +#define UART_TX_BIT PIND1 +#elif SOFTTX == D2 +#define SOFTTX_NAME "D2" +#define UART_DDR DDRD +#define UART_PORT PORTD +#define UART_TX_BIT PIND2 +#elif SOFTTX == D3 +#define SOFTTX_NAME "D3" +#define UART_DDR DDRD +#define UART_PORT PORTD +#define UART_TX_BIT PIND3 +#elif SOFTTX == D4 +#define SOFTTX_NAME "D4" +#define UART_DDR DDRD +#define UART_PORT PORTD +#define UART_TX_BIT PIND4 +#elif SOFTTX == D5 +#define SOFTTX_NAME "D5" +#define UART_DDR DDRD +#define UART_PORT PORTD +#define UART_TX_BIT PIND5 +#elif SOFTTX == D6 +#define SOFTTX_NAME "D6" +#define UART_DDR DDRD +#define UART_PORT PORTD +#define UART_TX_BIT PIND6 +#elif SOFTTX == D7 +#define SOFTTX_NAME "D7" +#define UART_DDR DDRD +#define UART_PORT PORTD +#define UART_TX_BIT PIND7 + +#elif SOFTTX == E0 +#define SOFTTX_NAME "E0" +#define UART_DDR DDRE +#define UART_PORT PORTE +#define UART_TX_BIT PINE0 +#elif SOFTTX == E1 +#define SOFTTX_NAME "E1" +#define UART_DDR DDRE +#define UART_PORT PORTE +#define UART_TX_BIT PINE1 +#elif SOFTTX == E2 +#define SOFTTX_NAME "E2" +#define UART_DDR DDRE +#define UART_PORT PORTE +#define UART_TX_BIT PINE2 +#elif SOFTTX == E3 +#define SOFTTX_NAME "E3" +#define UART_DDR DDRE +#define UART_PORT PORTE +#define UART_TX_BIT PINE3 +#elif SOFTTX == E4 +#define SOFTTX_NAME "E4" +#define UART_DDR DDRE +#define UART_PORT PORTE +#define UART_TX_BIT PINE4 +#elif SOFTTX == E5 +#define SOFTTX_NAME "E5" +#define UART_DDR DDRE +#define UART_PORT PORTE +#define UART_TX_BIT PINE5 +#elif SOFTTX == E6 +#define SOFTTX_NAME "E6" +#define UART_DDR DDRE +#define UART_PORT PORTE +#define UART_TX_BIT PINE6 +#elif SOFTTX == E7 +#define SOFTTX_NAME "E7" +#define UART_DDR DDRE +#define UART_PORT PORTE +#define UART_TX_BIT PINE7 + +#elif SOFTTX == F0 +#define SOFTTX_NAME "F0" +#define UART_DDR DDRF +#define UART_PORT PORTF +#define UART_TX_BIT PINF0 +#elif SOFTTX == F1 +#define SOFTTX_NAME "F1" +#define UART_DDR DDRF +#define UART_PORT PORTF +#define UART_TX_BIT PINF1 +#elif SOFTTX == F2 +#define SOFTTX_NAME "F2" +#define UART_DDR DDRF +#define UART_PORT PORTF +#define UART_TX_BIT PINF2 +#elif SOFTTX == F3 +#define SOFTTX_NAME "F3" +#define UART_DDR DDRF +#define UART_PORT PORTF +#define UART_TX_BIT PINF3 +#elif SOFTTX == F4 +#define SOFTTX_NAME "F4" +#define UART_DDR DDRF +#define UART_PORT PORTF +#define UART_TX_BIT PINF4 +#elif SOFTTX == F5 +#define SOFTTX_NAME "F5" +#define UART_DDR DDRF +#define UART_PORT PORTF +#define UART_TX_BIT PINF5 +#elif SOFTTX == F6 +#define SOFTTX_NAME "F6" +#define UART_DDR DDRF +#define UART_PORT PORTF +#define UART_TX_BIT PINF6 +#elif SOFTTX == F7 +#define SOFTTX_NAME "F7" +#define UART_DDR DDRF +#define UART_PORT PORTF +#define UART_TX_BIT PINF7 + +#elif SOFTTX == G0 +#define SOFTTX_NAME "G0" +#define UART_DDR DDRG +#define UART_PORT PORTG +#define UART_TX_BIT PING0 +#elif SOFTTX == G1 +#define SOFTTX_NAME "G1" +#define UART_DDR DDRG +#define UART_PORT PORTG +#define UART_TX_BIT PING1 +#elif SOFTTX == G2 +#define SOFTTX_NAME "G2" +#define UART_DDR DDRG +#define UART_PORT PORTG +#define UART_TX_BIT PING2 +#elif SOFTTX == G3 +#define SOFTTX_NAME "G3" +#define UART_DDR DDRG +#define UART_PORT PORTG +#define UART_TX_BIT PING3 +#elif SOFTTX == G4 +#define SOFTTX_NAME "G4" +#define UART_DDR DDRG +#define UART_PORT PORTG +#define UART_TX_BIT PING4 +#elif SOFTTX == G5 +#define SOFTTX_NAME "G5" +#define UART_DDR DDRG +#define UART_PORT PORTG +#define UART_TX_BIT PING5 +#elif SOFTTX == G6 +#define SOFTTX_NAME "G6" +#define UART_DDR DDRG +#define UART_PORT PORTG +#define UART_TX_BIT PING6 +#elif SOFTTX == G7 +#define SOFTTX_NAME "G7" +#define UART_DDR DDRG +#define UART_PORT PORTG +#define UART_TX_BIT PING7 + +#elif SOFTTX == H0 +#define SOFTTX_NAME "H0" +#define UART_DDR DDRH +#define UART_PORT PORTH +#define UART_TX_BIT PINH0 +#elif SOFTTX == H1 +#define SOFTTX_NAME "H1" +#define UART_DDR DDRH +#define UART_PORT PORTH +#define UART_TX_BIT PINH1 +#elif SOFTTX == H2 +#define SOFTTX_NAME "H2" +#define UART_DDR DDRH +#define UART_PORT PORTH +#define UART_TX_BIT PINH2 +#elif SOFTTX == H3 +#define SOFTTX_NAME "H3" +#define UART_DDR DDRH +#define UART_PORT PORTH +#define UART_TX_BIT PINH3 +#elif SOFTTX == H4 +#define SOFTTX_NAME "H4" +#define UART_DDR DDRH +#define UART_PORT PORTH +#define UART_TX_BIT PINH4 +#elif SOFTTX == H5 +#define SOFTTX_NAME "H5" +#define UART_DDR DDRH +#define UART_PORT PORTH +#define UART_TX_BIT PINH5 +#elif SOFTTX == H6 +#define SOFTTX_NAME "H6" +#define UART_DDR DDRH +#define UART_PORT PORTH +#define UART_TX_BIT PINH6 +#elif SOFTTX == H7 +#define SOFTTX_NAME "H7" +#define UART_DDR DDRH +#define UART_PORT PORTH +#define UART_TX_BIT PINH7 + +#elif SOFTTX == J0 +#define SOFTTX_NAME "J0" +#define UART_DDR DDRJ +#define UART_PORT PORTJ +#define UART_TX_BIT PINJ0 +#elif SOFTTX == J1 +#define SOFTTX_NAME "J1" +#define UART_DDR DDRJ +#define UART_PORT PORTJ +#define UART_TX_BIT PINJ1 +#elif SOFTTX == J2 +#define SOFTTX_NAME "J2" +#define UART_DDR DDRJ +#define UART_PORT PORTJ +#define UART_TX_BIT PINJ2 +#elif SOFTTX == J3 +#define SOFTTX_NAME "J3" +#define UART_DDR DDRJ +#define UART_PORT PORTJ +#define UART_TX_BIT PINJ3 +#elif SOFTTX == J4 +#define SOFTTX_NAME "J4" +#define UART_DDR DDRJ +#define UART_PORT PORTJ +#define UART_TX_BIT PINJ4 +#elif SOFTTX == J5 +#define SOFTTX_NAME "J5" +#define UART_DDR DDRJ +#define UART_PORT PORTJ +#define UART_TX_BIT PINJ5 +#elif SOFTTX == J6 +#define SOFTTX_NAME "J6" +#define UART_DDR DDRJ +#define UART_PORT PORTJ +#define UART_TX_BIT PINJ6 +#elif SOFTTX == J7 +#define SOFTTX_NAME "J7" +#define UART_DDR DDRJ +#define UART_PORT PORTJ +#define UART_TX_BIT PINJ7 + +#elif SOFTTX == K0 +#define SOFTTX_NAME "K0" +#define UART_DDR DDRK +#define UART_PORT PORTK +#define UART_TX_BIT PINK0 +#elif SOFTTX == K1 +#define SOFTTX_NAME "K1" +#define UART_DDR DDRK +#define UART_PORT PORTK +#define UART_TX_BIT PINK1 +#elif SOFTTX == K2 +#define SOFTTX_NAME "K2" +#define UART_DDR DDRK +#define UART_PORT PORTK +#define UART_TX_BIT PINK2 +#elif SOFTTX == K3 +#define SOFTTX_NAME "K3" +#define UART_DDR DDRK +#define UART_PORT PORTK +#define UART_TX_BIT PINK3 +#elif SOFTTX == K4 +#define SOFTTX_NAME "K4" +#define UART_DDR DDRK +#define UART_PORT PORTK +#define UART_TX_BIT PINK4 +#elif SOFTTX == K5 +#define SOFTTX_NAME "K5" +#define UART_DDR DDRK +#define UART_PORT PORTK +#define UART_TX_BIT PINK5 +#elif SOFTTX == K6 +#define SOFTTX_NAME "K6" +#define UART_DDR DDRK +#define UART_PORT PORTK +#define UART_TX_BIT PINK6 +#elif SOFTTX == K7 +#define SOFTTX_NAME "K7" +#define UART_DDR DDRK +#define UART_PORT PORTK +#define UART_TX_BIT PINK7 + +#elif SOFTTX == L0 +#define SOFTTX_NAME "L0" +#define UART_DDR DDRL +#define UART_PORT PORTL +#define UART_TX_BIT PINL0 +#elif SOFTTX == L1 +#define SOFTTX_NAME "L1" +#define UART_DDR DDRL +#define UART_PORT PORTL +#define UART_TX_BIT PINL1 +#elif SOFTTX == L2 +#define SOFTTX_NAME "L2" +#define UART_DDR DDRL +#define UART_PORT PORTL +#define UART_TX_BIT PINL2 +#elif SOFTTX == L3 +#define SOFTTX_NAME "L3" +#define UART_DDR DDRL +#define UART_PORT PORTL +#define UART_TX_BIT PINL3 +#elif SOFTTX == L4 +#define SOFTTX_NAME "L4" +#define UART_DDR DDRL +#define UART_PORT PORTL +#define UART_TX_BIT PINL4 +#elif SOFTTX == L5 +#define SOFTTX_NAME "L5" +#define UART_DDR DDRL +#define UART_PORT PORTL +#define UART_TX_BIT PINL5 +#elif SOFTTX == L6 +#define SOFTTX_NAME "L6" +#define UART_DDR DDRL +#define UART_PORT PORTL +#define UART_TX_BIT PINL6 +#elif SOFTTX == L7 +#define SOFTTX_NAME "L7" +#define UART_DDR DDRL +#define UART_PORT PORTL +#define UART_TX_BIT PINL7 + +#elif SOFTTX == A0 +#define SOFTTX_NAME "A0" +#define UART_DDR DDRA +#define UART_PORT PORTA +#define UART_TX_BIT PINA0 +#elif SOFTTX == A1 +#define SOFTTX_NAME "A1" +#define UART_DDR DDRA +#define UART_PORT PORTA +#define UART_TX_BIT PINA1 +#elif SOFTTX == A2 +#define SOFTTX_NAME "A2" +#define UART_DDR DDRA +#define UART_PORT PORTA +#define UART_TX_BIT PINA2 +#elif SOFTTX == A3 +#define SOFTTX_NAME "A3" +#define UART_DDR DDRA +#define UART_PORT PORTA +#define UART_TX_BIT PINA3 +#elif SOFTTX == A4 +#define SOFTTX_NAME "A4" +#define UART_DDR DDRA +#define UART_PORT PORTA +#define UART_TX_BIT PINA4 +#elif SOFTTX == A5 +#define SOFTTX_NAME "A5" +#define UART_DDR DDRA +#define UART_PORT PORTA +#define UART_TX_BIT PINA5 +#elif SOFTTX == A6 +#define SOFTTX_NAME "A6" +#define UART_DDR DDRA +#define UART_PORT PORTA +#define UART_TX_BIT PINA6 +#elif SOFTTX == A7 +#define SOFTTX_NAME "A7" +#define UART_DDR DDRA +#define UART_PORT PORTA +#define UART_TX_BIT PINA7 +#else +#error ------------------------------------------- +#error Unrecognized SOFTTX name. Should be like "B5" +#error ------------------------------------------- +#endif + + +#if SOFTRX == B0 +#define SOFTRX_NAME "B0" +#define UART_PIN PINB +#define UART_RX_BIT PINB0 +#elif SOFTRX == B1 +#define SOFTRX_NAME "B1" +#define UART_PIN PINB +#define UART_RX_BIT PINB1 +#elif SOFTRX == B2 +#define SOFTRX_NAME "B2" +#define UART_PIN PINB +#define UART_RX_BIT PINB2 +#elif SOFTRX == B3 +#define SOFTRX_NAME "B3" +#define UART_PIN PINB +#define UART_RX_BIT PINB3 +#elif SOFTRX == B4 +#define SOFTRX_NAME "B4" +#define UART_PIN PINB +#define UART_RX_BIT PINB4 +#elif SOFTRX == B5 +#define SOFTRX_NAME "B5" +#define UART_PIN PINB +#define UART_RX_BIT PINB5 +#elif SOFTRX == B6 +#define SOFTRX_NAME "B6" +#define UART_PIN PINB +#define UART_RX_BIT PINB6 +#elif SOFTRX == B7 +#define SOFTRX_NAME "B7" +#define UART_PIN PINB +#define UART_RX_BIT PINB7 + +#elif SOFTRX == C0 +#define SOFTRX_NAME "C0" +#define UART_PIN PINC +#define UART_RX_BIT PINC0 +#elif SOFTRX == C1 +#define SOFTRX_NAME "C1" +#define UART_PIN PINC +#define UART_RX_BIT PINC1 +#elif SOFTRX == C2 +#define SOFTRX_NAME "C2" +#define UART_PIN PINC +#define UART_RX_BIT PINC2 +#elif SOFTRX == C3 +#define SOFTRX_NAME "C3" +#define UART_PIN PINC +#define UART_RX_BIT PINC3 +#elif SOFTRX == C4 +#define SOFTRX_NAME "C4" +#define UART_PIN PINC +#define UART_RX_BIT PINC4 +#elif SOFTRX == C5 +#define SOFTRX_NAME "C5" +#define UART_PIN PINC +#define UART_RX_BIT PINC5 +#elif SOFTRX == C6 +#define SOFTRX_NAME "C6" +#define UART_PIN PINC +#define UART_RX_BIT PINC6 +#elif SOFTRX == C7 +#define SOFTRX_NAME "C7" +#define UART_PIN PINC +#define UART_RX_BIT PINC7 + +#elif SOFTRX == D0 +#define SOFTRX_NAME "D0" +#define UART_PIN PIND +#define UART_RX_BIT PIND0 +#elif SOFTRX == D1 +#define SOFTRX_NAME "D1" +#define UART_PIN PIND +#define UART_RX_BIT PIND1 +#elif SOFTRX == D2 +#define SOFTRX_NAME "D2" +#define UART_PIN PIND +#define UART_RX_BIT PIND2 +#elif SOFTRX == D3 +#define SOFTRX_NAME "D3" +#define UART_PIN PIND +#define UART_RX_BIT PIND3 +#elif SOFTRX == D4 +#define SOFTRX_NAME "D4" +#define UART_PIN PIND +#define UART_RX_BIT PIND4 +#elif SOFTRX == D5 +#define SOFTRX_NAME "D5" +#define UART_PIN PIND +#define UART_RX_BIT PIND5 +#elif SOFTRX == D6 +#define SOFTRX_NAME "D6" +#define UART_PIN PIND +#define UART_RX_BIT PIND6 +#elif SOFTRX == D7 +#define SOFTRX_NAME "D7" +#define UART_PIN PIND +#define UART_RX_BIT PIND7 + +#elif SOFTRX == E0 +#define SOFTRX_NAME "E0" +#define UART_PIN PINE +#define UART_RX_BIT PINE0 +#elif SOFTRX == E1 +#define SOFTRX_NAME "E1" +#define UART_PIN PINE +#define UART_RX_BIT PINE1 +#elif SOFTRX == E2 +#define SOFTRX_NAME "E2" +#define UART_PIN PINE +#define UART_RX_BIT PINE2 +#elif SOFTRX == E3 +#define SOFTRX_NAME "E3" +#define UART_PIN PINE +#define UART_RX_BIT PINE3 +#elif SOFTRX == E4 +#define SOFTRX_NAME "E4" +#define UART_PIN PINE +#define UART_RX_BIT PINE4 +#elif SOFTRX == E5 +#define SOFTRX_NAME "E5" +#define UART_PIN PINE +#define UART_RX_BIT PINE5 +#elif SOFTRX == E6 +#define SOFTRX_NAME "E6" +#define UART_PIN PINE +#define UART_RX_BIT PINE6 +#elif SOFTRX == E7 +#define SOFTRX_NAME "E7" +#define UART_PIN PINE +#define UART_RX_BIT PINE7 + +#elif SOFTRX == F0 +#define SOFTRX_NAME "F0" +#define UART_PIN PINF +#define UART_RX_BIT PINF0 +#elif SOFTRX == F1 +#define SOFTRX_NAME "F1" +#define UART_PIN PINF +#define UART_RX_BIT PINF1 +#elif SOFTRX == F2 +#define SOFTRX_NAME "F2" +#define UART_PIN PINF +#define UART_RX_BIT PINF2 +#elif SOFTRX == F3 +#define SOFTRX_NAME "F3" +#define UART_PIN PINF +#define UART_RX_BIT PINF3 +#elif SOFTRX == F4 +#define SOFTRX_NAME "F4" +#define UART_PIN PINF +#define UART_RX_BIT PINF4 +#elif SOFTRX == F5 +#define SOFTRX_NAME "F5" +#define UART_PIN PINF +#define UART_RX_BIT PINF5 +#elif SOFTRX == F6 +#define SOFTRX_NAME "F6" +#define UART_PIN PINF +#define UART_RX_BIT PINF6 +#elif SOFTRX == F7 +#define SOFTRX_NAME "F7" +#define UART_PIN PINF +#define UART_RX_BIT PINF7 + +#elif SOFTRX == G0 +#define SOFTRX_NAME "G0" +#define UART_PIN PING +#define UART_RX_BIT PING0 +#elif SOFTRX == G1 +#define SOFTRX_NAME "G1" +#define UART_PIN PING +#define UART_RX_BIT PING1 +#elif SOFTRX == G2 +#define SOFTRX_NAME "G2" +#define UART_PIN PING +#define UART_RX_BIT PING2 +#elif SOFTRX == G3 +#define SOFTRX_NAME "G3" +#define UART_PIN PING +#define UART_RX_BIT PING3 +#elif SOFTRX == G4 +#define SOFTRX_NAME "G4" +#define UART_PIN PING +#define UART_RX_BIT PING4 +#elif SOFTRX == G5 +#define SOFTRX_NAME "G5" +#define UART_PIN PING +#define UART_RX_BIT PING5 +#elif SOFTRX == G6 +#define SOFTRX_NAME "G6" +#define UART_PIN PING +#define UART_RX_BIT PING6 +#elif SOFTRX == G7 +#define SOFTRX_NAME "G7" +#define UART_PIN PING +#define UART_RX_BIT PING7 + +#elif SOFTRX == H0 +#define SOFTRX_NAME "H0" +#define UART_PIN PINH +#define UART_RX_BIT PINH0 +#elif SOFTRX == H1 +#define SOFTRX_NAME "H1" +#define UART_PIN PINH +#define UART_RX_BIT PINH1 +#elif SOFTRX == H2 +#define SOFTRX_NAME "H2" +#define UART_PIN PINH +#define UART_RX_BIT PINH2 +#elif SOFTRX == H3 +#define SOFTRX_NAME "H3" +#define UART_PIN PINH +#define UART_RX_BIT PINH3 +#elif SOFTRX == H4 +#define SOFTRX_NAME "H4" +#define UART_PIN PINH +#define UART_RX_BIT PINH4 +#elif SOFTRX == H5 +#define SOFTRX_NAME "H5" +#define UART_PIN PINH +#define UART_RX_BIT PINH5 +#elif SOFTRX == H6 +#define SOFTRX_NAME "H6" +#define UART_PIN PINH +#define UART_RX_BIT PINH6 +#elif SOFTRX == H7 +#define SOFTRX_NAME "H7" +#define UART_PIN PINH +#define UART_RX_BIT PINH7 + +#elif SOFTRX == J0 +#define SOFTRX_NAME "J0" +#define UART_PIN PINJ +#define UART_RX_BIT PINJ0 +#elif SOFTRX == J1 +#define SOFTRX_NAME "J1" +#define UART_PIN PINJ +#define UART_RX_BIT PINJ1 +#elif SOFTRX == J2 +#define SOFTRX_NAME "J2" +#define UART_PIN PINJ +#define UART_RX_BIT PINJ2 +#elif SOFTRX == J3 +#define SOFTRX_NAME "J3" +#define UART_PIN PINJ +#define UART_RX_BIT PINJ3 +#elif SOFTRX == J4 +#define SOFTRX_NAME "J4" +#define UART_PIN PINJ +#define UART_RX_BIT PINJ4 +#elif SOFTRX == J5 +#define SOFTRX_NAME "J5" +#define UART_PIN PINJ +#define UART_RX_BIT PINJ5 +#elif SOFTRX == J6 +#define SOFTRX_NAME "J6" +#define UART_PIN PINJ +#define UART_RX_BIT PINJ6 +#elif SOFTRX == J7 +#define SOFTRX_NAME "J7" +#define UART_PIN PINJ +#define UART_RX_BIT PINJ7 + +#elif SOFTRX == K0 +#define SOFTRX_NAME "K0" +#define UART_PIN PINK +#define UART_RX_BIT PINK0 +#elif SOFTRX == K1 +#define SOFTRX_NAME "K1" +#define UART_PIN PINK +#define UART_RX_BIT PINK1 +#elif SOFTRX == K2 +#define SOFTRX_NAME "K2" +#define UART_PIN PINK +#define UART_RX_BIT PINK2 +#elif SOFTRX == K3 +#define SOFTRX_NAME "K3" +#define UART_PIN PINK +#define UART_RX_BIT PINK3 +#elif SOFTRX == K4 +#define SOFTRX_NAME "K4" +#define UART_PIN PINK +#define UART_RX_BIT PINK4 +#elif SOFTRX == K5 +#define SOFTRX_NAME "K5" +#define UART_PIN PINK +#define UART_RX_BIT PINK5 +#elif SOFTRX == K6 +#define SOFTRX_NAME "K6" +#define UART_PIN PINK +#define UART_RX_BIT PINK6 +#elif SOFTRX == K7 +#define SOFTRX_NAME "K7" +#define UART_PIN PINK +#define UART_RX_BIT PINK7 + +#elif SOFTRX == L0 +#define SOFTRX_NAME "L0" +#define UART_PIN PINL +#define UART_RX_BIT PINL0 +#elif SOFTRX == L1 +#define SOFTRX_NAME "L1" +#define UART_PIN PINL +#define UART_RX_BIT PINL1 +#elif SOFTRX == L2 +#define SOFTRX_NAME "L2" +#define UART_PIN PINL +#define UART_RX_BIT PINL2 +#elif SOFTRX == L3 +#define SOFTRX_NAME "L3" +#define UART_PIN PINL +#define UART_RX_BIT PINL3 +#elif SOFTRX == L4 +#define SOFTRX_NAME "L4" +#define UART_PIN PINL +#define UART_RX_BIT PINL4 +#elif SOFTRX == L5 +#define SOFTRX_NAME "L5" +#define UART_PIN PINL +#define UART_RX_BIT PINL5 +#elif SOFTRX == L6 +#define SOFTRX_NAME "L6" +#define UART_PIN PINL +#define UART_RX_BIT PINL6 +#elif SOFTRX == L7 +#define SOFTRX_NAME "L7" +#define UART_PIN PINL +#define UART_RX_BIT PINL7 + +#elif SOFTRX == A0 +#define SOFTRX_NAME "A0" +#define UART_PIN PINA +#define UART_RX_BIT PINA0 +#elif SOFTRX == A1 +#define SOFTRX_NAME "A1" +#define UART_PIN PINA +#define UART_RX_BIT PINA1 +#elif SOFTRX == A2 +#define SOFTRX_NAME "A2" +#define UART_PIN PINA +#define UART_RX_BIT PINA2 +#elif SOFTRX == A3 +#define SOFTRX_NAME "A3" +#define UART_PIN PINA +#define UART_RX_BIT PINA3 +#elif SOFTRX == A4 +#define SOFTRX_NAME "A4" +#define UART_PIN PINA +#define UART_RX_BIT PINA4 +#elif SOFTRX == A5 +#define SOFTRX_NAME "A5" +#define UART_PIN PINA +#define UART_RX_BIT PINA5 +#elif SOFTRX == A6 +#define SOFTRX_NAME "A6" +#define UART_PIN PINA +#define UART_RX_BIT PINA6 +#elif SOFTRX == A7 +#define SOFTRX_NAME "A7" +#define UART_PIN PINA +#define UART_RX_BIT PINA7 +#else +#error ------------------------------------------- +#error Unrecognized SOFTRX name. Should be like "B5" +#error ------------------------------------------- +#endif +