aboutsummaryrefslogtreecommitdiffstats
path: root/src/avr/spi.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-03-31 22:01:41 -0400
committerKevin O'Connor <kevin@koconnor.net>2019-04-04 18:29:31 -0400
commit7765653d83364f266b7f1917b1cd6ab1508e7acf (patch)
tree6f0b0024ca431253e8b351fda0cb2e13af3def77 /src/avr/spi.c
parent1ab02e522565ba991e13a0629041cadf60066926 (diff)
downloadkutter-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/spi.c')
-rw-r--r--src/avr/spi.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/avr/spi.c b/src/avr/spi.c
index 495e8330..319c51d6 100644
--- a/src/avr/spi.c
+++ b/src/avr/spi.c
@@ -11,17 +11,22 @@
#include "pgm.h" // READP
#include "sched.h" // sched_shutdown
+DECL_ENUMERATION("spi_bus", "spi", 0);
+
#if CONFIG_MACH_atmega168 || CONFIG_MACH_atmega328 || CONFIG_MACH_atmega328p
-static const uint8_t SS = GPIO('B', 2), SCK = GPIO('B', 5);
-static const uint8_t MOSI = GPIO('B', 3), MISO = GPIO('B', 4);
+static const uint8_t MISO = GPIO('B', 4), MOSI = GPIO('B', 3);
+static const uint8_t SCK = GPIO('B', 5), SS = GPIO('B', 2);
+DECL_CONSTANT_STR("BUS_PINS_spi", "PB4,PB3,PB5");
#elif CONFIG_MACH_atmega644p || CONFIG_MACH_atmega1284p
-static const uint8_t SS = GPIO('B', 4), SCK = GPIO('B', 7);
-static const uint8_t MOSI = GPIO('B', 5), MISO = GPIO('B', 6);
+static const uint8_t MISO = GPIO('B', 6), MOSI = GPIO('B', 5);
+static const uint8_t SCK = GPIO('B', 7), SS = GPIO('B', 4);
+DECL_CONSTANT_STR("BUS_PINS_spi", "PB6,PB5,PB7");
#elif CONFIG_MACH_at90usb1286 || CONFIG_MACH_at90usb646 \
|| CONFIG_MACH_atmega32u4 || CONFIG_MACH_atmega1280 \
|| CONFIG_MACH_atmega2560
-static const uint8_t SS = GPIO('B', 0), SCK = GPIO('B', 1);
-static const uint8_t MOSI = GPIO('B', 2), MISO = GPIO('B', 3);
+static const uint8_t MISO = GPIO('B', 3), MOSI = GPIO('B', 2);
+static const uint8_t SCK = GPIO('B', 1), SS = GPIO('B', 0);
+DECL_CONSTANT_STR("BUS_PINS_spi", "PB3,PB2,PB1");
#endif
static void