summaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
authorJoakim Tufvegren <jocke@barbanet.com>2020-10-11 02:48:52 +0200
committerGitHub <noreply@github.com>2020-10-11 01:48:52 +0100
commitcacf495c91c7f6ad0e31edcefa8355eba98f75b6 (patch)
treefce415f8afeb6ee2b388cafc329a4211434d4795 /keyboards
parenta88cfa395ba2eef999d60958a1390e63e0834d55 (diff)
downloadqmk_firmware-cacf495c91c7f6ad0e31edcefa8355eba98f75b6.tar.gz
qmk_firmware-cacf495c91c7f6ad0e31edcefa8355eba98f75b6.zip
Ergodox Infinity: Add EE_HANDS support. (#9527)
Including a guide to set these EEPROM values (in the readme).
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/ergodox_infinity/matrix.c15
-rw-r--r--keyboards/ergodox_infinity/readme.md36
2 files changed, 47 insertions, 4 deletions
diff --git a/keyboards/ergodox_infinity/matrix.c b/keyboards/ergodox_infinity/matrix.c
index 3a0a179286..941367a360 100644
--- a/keyboards/ergodox_infinity/matrix.c
+++ b/keyboards/ergodox_infinity/matrix.c
@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "print.h"
#include "debug.h"
#include "matrix.h"
+#include "eeconfig.h"
#include "serial_link/system/serial_link.h"
@@ -118,8 +119,12 @@ uint8_t matrix_scan(void)
}
uint8_t offset = 0;
-#ifdef MASTER_IS_ON_RIGHT
+#if (defined(EE_HANDS) || defined(MASTER_IS_ON_RIGHT))
+#ifdef EE_HANDS
+ if (is_serial_link_master() && !eeconfig_read_handedness()) {
+#else
if (is_serial_link_master()) {
+#endif
offset = MATRIX_ROWS - LOCAL_MATRIX_ROWS;
}
#endif
@@ -162,7 +167,13 @@ void matrix_print(void)
void matrix_set_remote(matrix_row_t* rows, uint8_t index) {
uint8_t offset = 0;
-#ifdef MASTER_IS_ON_RIGHT
+#ifdef EE_HANDS
+ if (eeconfig_read_handedness()) {
+ offset = LOCAL_MATRIX_ROWS * (index + 1);
+ } else {
+ offset = MATRIX_ROWS - LOCAL_MATRIX_ROWS * (index + 2);
+ }
+#elif defined(MASTER_IS_ON_RIGHT)
offset = MATRIX_ROWS - LOCAL_MATRIX_ROWS * (index + 2);
#else
offset = LOCAL_MATRIX_ROWS * (index + 1);
diff --git a/keyboards/ergodox_infinity/readme.md b/keyboards/ergodox_infinity/readme.md
index d712bb880c..73ee3bc1df 100644
--- a/keyboards/ergodox_infinity/readme.md
+++ b/keyboards/ergodox_infinity/readme.md
@@ -29,6 +29,9 @@ Input Club Infinity Ergodox](https://github.com/fredizzimo/infinity_ergodox/blob
The Infinity is two completely independent keyboards, that can connect together.
You have a few options in how you flash the firmware:
+- Add `#define EE_HANDS` to your config.h, initialize the EEPROM values (see below),
+ and then flash the same firmware to both halves.
+
- Flash the left half, rebuild the firmware with "MASTER=right" and then flash
the right half. This allows you to plug in either half directly to the
computer and is what the above instructions do.
@@ -43,6 +46,35 @@ You have a few options in how you flash the firmware:
directly connect the right half to the computer.
- For minor changes such as changing only the keymap without having updated
- any part of the firmware code itself, you can program only the MASTER half.
+ any part of the firmware code itself, you can program only the MASTER half,
+ but it is safest to program both halves.
+
+### EE_HANDS initialization
+
+To initialize the EEPROM values for `EE_HANDS` to work properly, these steps should work.
+They only need to be done once, unless you reset the EEPROM later.
+
+ - Plug in the left keyboard half to the computer, and press its program button.
+
+ - Flash the left half with `make ergodox_infinity:default:dfu-util-split-left`
+ (If you need to use a different method to flash your keyboard, still run this command,
+ and abort it with Ctrl+C when the flashing attempts starts to print errors,
+ then flash the built firmware).
+
+ - On the left half, press the top vertical 1.5U key (second from the top in the rightmost column) once,
+ then the 1U key at the bottom in the opposite corner (bottom left corner).
+
+ - Plug in the right keyboard half to the computer, and press its program button.
+
+ - Flash the right half with `make ergodox_infinity:default:dfu-util-split-right`
+
+ - On the right half, press the top vertical 1.5U key (second from the top in the leftmost column) once,
+ then the 1U key at the bottom in the opposite corner (bottom right corner).
+
+ - Add `#define EE_HANDS` to the config.h file of your keymap, and build your firmware using
+ `make ergodox_infinity:keymapname`.
+
+ - After this, you can flash both halves with the same firmware, _without_ having to rebuild with
+ "MASTER=right" or risking a mirrored keyboard when connected the wrong way.
+ If you reset your EEPROM later, you'll have to follow these steps again, though.
-- It is safest to program both halves though.