From ae49f750ee76c54a2680c4c30f0ceffea9e14ac3 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 23 Nov 2018 18:18:29 +0100 Subject: [PATCH 1/2] hardware/Atreus: Restore COL_PIN_LIST & key layout to its original The pin list (and consequently the key layout list) was rearranged in the early days of the plugin for more optimal scanning code. With -O3 and moving to `ATMegaKeyboard`, that optimization is no longer relevant. This restores the pin list and the layout to its original order, the order at which the hardware is laid out. Signed-off-by: Gergely Nagy --- src/kaleidoscope/hardware/technomancy/Atreus.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/kaleidoscope/hardware/technomancy/Atreus.h b/src/kaleidoscope/hardware/technomancy/Atreus.h index d4f0821b..45b81544 100644 --- a/src/kaleidoscope/hardware/technomancy/Atreus.h +++ b/src/kaleidoscope/hardware/technomancy/Atreus.h @@ -44,7 +44,7 @@ class Atreus: public kaleidoscope::hardware::ATMegaKeyboard { ATMEGA_KEYBOARD_CONFIG( ROW_PIN_LIST({PIN_D0, PIN_D1, PIN_D3, PIN_D2}), - COL_PIN_LIST({PIN_B4, PIN_B5, PIN_B6, PIN_B7, PIN_C6, PIN_D4, PIN_D6, PIN_D7, PIN_E6, PIN_F6, PIN_F7}) + COL_PIN_LIST({PIN_D7, PIN_C6, PIN_B5, PIN_B4, PIN_E6, PIN_D4, PIN_B6, PIN_F6, PIN_F7, PIN_D6, PIN_B7}) ); static constexpr int8_t led_count = 0; @@ -61,10 +61,10 @@ class Atreus: public kaleidoscope::hardware::ATMegaKeyboard { R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 \ ) \ { \ - { R0C3, R0C2, R0C7, R0C11, R0C1, XXX, R0C10, R0C0, R0C4, R0C8, R0C9 }, \ - { R1C3, R1C2, R1C7, R1C11, R1C1, XXX, R1C10, R1C0, R1C4, R1C8, R1C9 }, \ - { R2C3, R2C2, R2C7, R2C11, R2C1, R3C5, R2C10, R2C0, R2C4, R2C8, R2C9 }, \ - { R3C3, R3C2, R3C7, R3C11, R3C1, R3C6, R3C10, R3C0, R3C4, R3C8, R3C9 } \ + { R0C0, R0C1, R0C2, R0C3, R0C4, XXX, R0C7, R0C8, R0C9, R0C10, R0C11 }, \ + { R1C0, R1C1, R1C2, R1C3, R1C4, XXX, R1C7, R1C8, R1C9, R1C10, R1C11 }, \ + { R2C0, R2C1, R2C2, R2C3, R2C4, R3C5, R2C7, R2C8, R2C9, R2C10, R2C11 }, \ + { R3C0, R3C1, R3C2, R3C3, R3C4, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 } \ } #define KEYMAP_STACKED( \ @@ -79,10 +79,10 @@ class Atreus: public kaleidoscope::hardware::ATMegaKeyboard { R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 \ ) \ { \ - { R0C3, R0C2, R0C7, R0C11, R0C1, XXX, R0C10, R0C0, R0C4, R0C8, R0C9 }, \ - { R1C3, R1C2, R1C7, R1C11, R1C1, XXX, R1C10, R1C0, R1C4, R1C8, R1C9 }, \ - { R2C3, R2C2, R2C7, R2C11, R2C1, R3C5, R2C10, R2C0, R2C4, R2C8, R2C9 }, \ - { R3C3, R3C2, R3C7, R3C11, R3C1, R3C6, R3C10, R3C0, R3C4, R3C8, R3C9 } \ + { R0C0, R0C1, R0C2, R0C3, R0C4, XXX, R0C7, R0C8, R0C9, R0C10, R0C11 }, \ + { R1C0, R1C1, R1C2, R1C3, R1C4, XXX, R1C7, R1C8, R1C9, R1C10, R1C11 }, \ + { R2C0, R2C1, R2C2, R2C3, R2C4, R3C5, R2C7, R2C8, R2C9, R2C10, R2C11 }, \ + { R3C0, R3C1, R3C2, R3C3, R3C4, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 } \ } } } From 930d4920c2a406b44a4e612470eb8b174b57b051 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 23 Nov 2018 18:44:29 +0100 Subject: [PATCH 2/2] hardware/Atreus: Add support for all Atreus variants Make it possible to use the plugin for all known Atreus variants: the post-2016 PCB with A* and the FalbaTech handwired one with a Teensy (these two were the only supported ones until now), the pre-2016 PCB with A*, and the legacy Teensy2 variant. Fixes #430. Signed-off-by: Gergely Nagy --- doc/plugin/Hardware-Technomancy-Atreus.md | 14 +++++++++++--- src/Kaleidoscope-Hardware-Technomancy-Atreus.h | 7 +++++++ src/kaleidoscope/hardware/technomancy/Atreus.h | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/doc/plugin/Hardware-Technomancy-Atreus.md b/doc/plugin/Hardware-Technomancy-Atreus.md index fb7fcfc1..ff1e5131 100644 --- a/doc/plugin/Hardware-Technomancy-Atreus.md +++ b/doc/plugin/Hardware-Technomancy-Atreus.md @@ -1,10 +1,18 @@ # Kaleidoscope-Hardware-Technomancy-Atreus This is a plugin for [Kaleidoscope][fw], that adds hardware support for the -[Atreus][atreus]. Supported models include post-2016 PCB variants with an A* -MCU, and the hand-wired variant from [FalbaTech][falba] with a Teensy2. +[Atreus][atreus]. Supports both the pre- and post-2016 variants with an A* MCU, +the hand-wired variant from [FalbaTech][falba] with a Teensy2, and the legacy +teensy2 variant too. -PCBs prior to 2016, and the legacy teensy2 variants are not supported. +To select which one to build for, you can either use the Arduino IDE, and select +the appropriate Pinout and CPU, or, if using `kaleidoscope-builder`, you can add +a `LOCAL_CFLAGS` setting to `.kaleidoscope-builder.conf`. + +For the post-2016 variant (the default, also used by the handwired variant from +FalbaTech), if you want to explicitly select it, add +`-DKALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR=1`. For the pre-2016 variant, add +`-DKALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR_DOWN`. For the legacy teensy2 variant, add `-DKALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_LEGACY_TEENSY2=1`. [fw]: https://github.com/keyboardio/Kaleidoscope [atreus]: https://atreus.technomancy.us/ diff --git a/src/Kaleidoscope-Hardware-Technomancy-Atreus.h b/src/Kaleidoscope-Hardware-Technomancy-Atreus.h index 1f5eb6f6..cf6f010e 100644 --- a/src/Kaleidoscope-Hardware-Technomancy-Atreus.h +++ b/src/Kaleidoscope-Hardware-Technomancy-Atreus.h @@ -19,4 +19,11 @@ #pragma once #define KALEIDOSCOPE_WITH_ATMEGA_KEYBOARD 1 + +#if !defined(KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR) && \ + !defined(KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR_DOWN) && \ + !defined(KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_LEGACY_TEENSY2) +#define KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR 1 +#endif + #include "kaleidoscope/hardware/technomancy/Atreus.h" diff --git a/src/kaleidoscope/hardware/technomancy/Atreus.h b/src/kaleidoscope/hardware/technomancy/Atreus.h index 45b81544..7b500067 100644 --- a/src/kaleidoscope/hardware/technomancy/Atreus.h +++ b/src/kaleidoscope/hardware/technomancy/Atreus.h @@ -42,10 +42,27 @@ class Atreus: public kaleidoscope::hardware::ATMegaKeyboard { public: Atreus(void) {} +#ifdef KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR ATMEGA_KEYBOARD_CONFIG( ROW_PIN_LIST({PIN_D0, PIN_D1, PIN_D3, PIN_D2}), COL_PIN_LIST({PIN_D7, PIN_C6, PIN_B5, PIN_B4, PIN_E6, PIN_D4, PIN_B6, PIN_F6, PIN_F7, PIN_D6, PIN_B7}) ); +#endif + +#ifdef KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR_DOWN + ATMEGA_KEYBOARD_CONFIG( + ROW_PIN_LIST({PIN_D0, PIN_D1, PIN_D3, PIN_D2}), + COL_PIN_LIST({PIN_B7, PIN_D6, PIN_F7, PIN_F6, PIN_B6, PIN_D4, PIN_E6, PIN_B4, PIN_B5, PIN_C6, PIN_D7}) + ); +#endif + +#ifdef KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_LEGACY_TEENSY2 + ATMEGA_KEYBOARD_CONFIG( + ROW_PIN_LIST({PIN_D0, PIN_D1, PIN_D2, PIN_D3}), + COL_PIN_LIST({PIN_F6, PIN_F5, PIN_F4, PIN_B7, PIN_B6, PIN_B5, PIN_B4, PIN_B3, PIN_B2, PIN_B1, PIN_B0}) + ); + ) +#endif static constexpr int8_t led_count = 0;