diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-03-31 22:01:41 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-04-04 18:29:31 -0400 |
commit | 7765653d83364f266b7f1917b1cd6ab1508e7acf (patch) | |
tree | 6f0b0024ca431253e8b351fda0cb2e13af3def77 /src/avr/serial.c | |
parent | 1ab02e522565ba991e13a0629041cadf60066926 (diff) | |
download | kutter-7765653d83364f266b7f1917b1cd6ab1508e7acf.tar.gz kutter-7765653d83364f266b7f1917b1cd6ab1508e7acf.tar.xz kutter-7765653d83364f266b7f1917b1cd6ab1508e7acf.zip |
avr: Use enumerations for buses and reserve pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/avr/serial.c')
-rw-r--r-- | src/avr/serial.c | 16 |
1 files changed, 16 insertions, 0 deletions
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 <avr/interrupt.h> // 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) |