From 7765653d83364f266b7f1917b1cd6ab1508e7acf Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 31 Mar 2019 22:01:41 -0400 Subject: avr: Use enumerations for buses and reserve pins Signed-off-by: Kevin O'Connor --- src/avr/serial.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/avr/serial.c') diff --git a/src/avr/serial.c b/src/avr/serial.c index 4cc2ebc8..e0b35bef 100644 --- a/src/avr/serial.c +++ b/src/avr/serial.c @@ -7,8 +7,24 @@ #include // USART_RX_vect #include "autoconf.h" // CONFIG_SERIAL_BAUD #include "board/serial_irq.h" // serial_rx_byte +#include "command.h" // DECL_CONSTANT_STR #include "sched.h" // DECL_INIT +// Reserve serial pins +#if CONFIG_SERIAL_PORT == 0 + #if CONFIG_MACH_atmega1280 || CONFIG_MACH_atmega2560 +DECL_CONSTANT_STR("RESERVE_PINS_serial", "PE0,PE1"); + #else +DECL_CONSTANT_STR("RESERVE_PINS_serial", "PD0,PD1"); + #endif +#elif CONFIG_SERIAL_PORT == 1 +DECL_CONSTANT_STR("RESERVE_PINS_serial", "PD2,PD3"); +#elif CONFIG_SERIAL_PORT == 2 +DECL_CONSTANT_STR("RESERVE_PINS_serial", "PH0,PH1"); +#else +DECL_CONSTANT_STR("RESERVE_PINS_serial", "PJ0,PJ1"); +#endif + // Helper macros for defining serial port aliases #define AVR_SERIAL_REG1(prefix, id, suffix) prefix ## id ## suffix #define AVR_SERIAL_REG(prefix, id, suffix) AVR_SERIAL_REG1(prefix, id, suffix) -- cgit v1.2.3-70-g09d2