From 49746830402cc0e1c0227c6c3c06ebc22fcd016c Mon Sep 17 00:00:00 2001
From: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
Date: Mon, 15 Apr 2019 06:58:56 +0300
Subject: [PATCH 1/3] [Keyboard] IBM Model M (ANSI/ISO) Teensy 2.0++ conversion
(#5560)
* Added initial modelm101 config
* Update keyboards/modelm101/keymaps/default/keymap.c
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Update keyboards/modelm101/keymaps/iw0rm3r/keymap.c
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Update keyboards/modelm101/readme.md
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Added wiring notes to clarify use of the config
* Small fix
* Small fix
* Moved modelm101 to converter directory
* Added info.json file for QMK configurator
* Corrected path
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Update keyboards/converter/modelm101/readme.md
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Update keyboards/converter/modelm101/modelm101.c
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Update keyboards/converter/modelm101/modelm101.c
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Update keyboards/converter/modelm101/modelm101.c
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Update keyboards/converter/modelm101/modelm101.c
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Update keyboards/converter/modelm101/modelm101.c
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Update keyboards/converter/modelm101/modelm101.c
Co-Authored-By: iw0rm3r <49209191+iw0rm3r@users.noreply.github.com>
* Replaced DDR and PORT with QMK functions
---
keyboards/converter/modelm101/config.h | 123 ++++++++++++++++++
keyboards/converter/modelm101/info.json | 12 ++
.../modelm101/keymaps/default/config.h | 19 +++
.../modelm101/keymaps/default/keymap.c | 43 ++++++
.../modelm101/keymaps/default/readme.md | 1 +
.../modelm101/keymaps/iw0rm3r/config.h | 19 +++
.../modelm101/keymaps/iw0rm3r/keymap.c | 43 ++++++
.../modelm101/keymaps/iw0rm3r/readme.md | 5 +
keyboards/converter/modelm101/modelm101.c | 67 ++++++++++
keyboards/converter/modelm101/modelm101.h | 45 +++++++
keyboards/converter/modelm101/readme.md | 42 ++++++
keyboards/converter/modelm101/rules.mk | 81 ++++++++++++
12 files changed, 500 insertions(+)
create mode 100644 keyboards/converter/modelm101/config.h
create mode 100644 keyboards/converter/modelm101/info.json
create mode 100644 keyboards/converter/modelm101/keymaps/default/config.h
create mode 100644 keyboards/converter/modelm101/keymaps/default/keymap.c
create mode 100644 keyboards/converter/modelm101/keymaps/default/readme.md
create mode 100644 keyboards/converter/modelm101/keymaps/iw0rm3r/config.h
create mode 100644 keyboards/converter/modelm101/keymaps/iw0rm3r/keymap.c
create mode 100644 keyboards/converter/modelm101/keymaps/iw0rm3r/readme.md
create mode 100644 keyboards/converter/modelm101/modelm101.c
create mode 100644 keyboards/converter/modelm101/modelm101.h
create mode 100644 keyboards/converter/modelm101/readme.md
create mode 100644 keyboards/converter/modelm101/rules.mk
diff --git a/keyboards/converter/modelm101/config.h b/keyboards/converter/modelm101/config.h
new file mode 100644
index 00000000000..97b78614ce6
--- /dev/null
+++ b/keyboards/converter/modelm101/config.h
@@ -0,0 +1,123 @@
+/*
+Copyright 2019 iw0rm3r
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+#pragma once
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x0000
+#define DEVICE_VER 0x0001
+#define MANUFACTURER iw0rm3r
+#define PRODUCT IBM Model M 101/102
+#define DESCRIPTION Controlled by AVR chip
+
+/* key matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 16
+
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+*/
+#define MATRIX_ROW_PINS { F7, F6, F5, F4, F3, F2, F1, F0 }
+#define MATRIX_COL_PINS { C7, C6, C5, C4, C3, C2, C1, C0, E1, E0, D7, D6, D5, D4, D3, D2 }
+#define UNUSED_PINS
+
+/* COL2ROW, ROW2COL*/
+#define DIODE_DIRECTION ROW2COL
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed (5 is default) */
+#define DEBOUNCING_DELAY 5
+
+/*
+ * Magic Key Options
+ *
+ * Magic keys are hotkey commands that allow control over firmware functions of
+ * the keyboard. They are best used in combination with the HID Listen program,
+ * found here: https://www.pjrc.com/teensy/hid_listen.html
+ *
+ * The options below allow the magic key functionality to be changed. This is
+ * useful if your keyboard/keypad is missing keys and you want magic key support.
+ *
+ */
+
+/* key combination for magic key command */
+/* defined by default; to change, uncomment and set to the combination you want */
+// #define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
+
+/* control how magic key switches layers */
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
+
+/* override magic key keymap */
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
+//#define MAGIC_KEY_HELP H
+//#define MAGIC_KEY_HELP_ALT SLASH
+//#define MAGIC_KEY_DEBUG D
+//#define MAGIC_KEY_DEBUG_MATRIX X
+//#define MAGIC_KEY_DEBUG_KBD K
+//#define MAGIC_KEY_DEBUG_MOUSE M
+//#define MAGIC_KEY_VERSION V
+//#define MAGIC_KEY_STATUS S
+//#define MAGIC_KEY_CONSOLE C
+//#define MAGIC_KEY_LAYER0 0
+//#define MAGIC_KEY_LAYER0_ALT GRAVE
+//#define MAGIC_KEY_LAYER1 1
+//#define MAGIC_KEY_LAYER2 2
+//#define MAGIC_KEY_LAYER3 3
+//#define MAGIC_KEY_LAYER4 4
+//#define MAGIC_KEY_LAYER5 5
+//#define MAGIC_KEY_LAYER6 6
+//#define MAGIC_KEY_LAYER7 7
+//#define MAGIC_KEY_LAYER8 8
+//#define MAGIC_KEY_LAYER9 9
+//#define MAGIC_KEY_BOOTLOADER B
+//#define MAGIC_KEY_BOOTLOADER_ALT ESC
+//#define MAGIC_KEY_LOCK CAPS
+//#define MAGIC_KEY_EEPROM E
+//#define MAGIC_KEY_EEPROM_CLEAR BSPACE
+//#define MAGIC_KEY_NKRO N
+//#define MAGIC_KEY_SLEEP_LED Z
+
+/*
+ * Feature disable options
+ * These options are also useful to firmware size reduction.
+ */
+
+/* disable debug print */
+//#define NO_DEBUG
+
+/* disable print */
+//#define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
+//#define NO_ACTION_MACRO
+//#define NO_ACTION_FUNCTION
\ No newline at end of file
diff --git a/keyboards/converter/modelm101/info.json b/keyboards/converter/modelm101/info.json
new file mode 100644
index 00000000000..868cd89b1a6
--- /dev/null
+++ b/keyboards/converter/modelm101/info.json
@@ -0,0 +1,12 @@
+{
+ "keyboard_name": "IBM Model M 101 ANSI/102 ISO",
+ "url": "https://github.com/iw0rm3r/qmk_firmware/tree/modelm101/keyboards/converter/modelm101",
+ "maintainer": "iw0rm3r",
+ "width": 22.5,
+ "height": 6.5,
+ "layouts": {
+ "LAYOUT": {
+ "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":2, "y":0}, {"label":"F2", "x":3, "y":0}, {"label":"F3", "x":4, "y":0}, {"label":"F4", "x":5, "y":0}, {"label":"F5", "x":6.5, "y":0}, {"label":"F6", "x":7.5, "y":0}, {"label":"F7", "x":8.5, "y":0}, {"label":"F8", "x":9.5, "y":0}, {"label":"F9", "x":11, "y":0}, {"label":"F10", "x":12, "y":0}, {"label":"F11", "x":13, "y":0}, {"label":"F12", "x":14, "y":0}, {"label":"PrtSc", "x":15.25, "y":0}, {"label":"Scroll Lock", "x":16.25, "y":0}, {"label":"Pause", "x":17.25, "y":0}, {"label":"~", "x":0, "y":1.5}, {"label":"!", "x":1, "y":1.5}, {"label":"@", "x":2, "y":1.5}, {"label":"#", "x":3, "y":1.5}, {"label":"$", "x":4, "y":1.5}, {"label":"%", "x":5, "y":1.5}, {"label":"^", "x":6, "y":1.5}, {"label":"&", "x":7, "y":1.5}, {"label":"*", "x":8, "y":1.5}, {"label":"(", "x":9, "y":1.5}, {"label":")", "x":10, "y":1.5}, {"label":"_", "x":11, "y":1.5}, {"label":"+", "x":12, "y":1.5}, {"label":"Backspace", "x":13, "y":1.5, "w":2}, {"label":"Insert", "x":15.25, "y":1.5}, {"label":"Home", "x":16.25, "y":1.5}, {"label":"PgUp", "x":17.25, "y":1.5}, {"label":"Num Lock", "x":18.5, "y":1.5}, {"label":"/", "x":19.5, "y":1.5}, {"label":"*", "x":20.5, "y":1.5}, {"label":"-", "x":21.5, "y":1.5}, {"label":"Tab", "x":0, "y":2.5, "w":1.5}, {"label":"Q", "x":1.5, "y":2.5}, {"label":"W", "x":2.5, "y":2.5}, {"label":"E", "x":3.5, "y":2.5}, {"label":"R", "x":4.5, "y":2.5}, {"label":"T", "x":5.5, "y":2.5}, {"label":"Y", "x":6.5, "y":2.5}, {"label":"U", "x":7.5, "y":2.5}, {"label":"I", "x":8.5, "y":2.5}, {"label":"O", "x":9.5, "y":2.5}, {"label":"P", "x":10.5, "y":2.5}, {"label":"{", "x":11.5, "y":2.5}, {"label":"}", "x":12.5, "y":2.5}, {"label":"|", "x":13.5, "y":2.5, "w":1.5}, {"label":"Delete", "x":15.25, "y":2.5}, {"label":"End", "x":16.25, "y":2.5}, {"label":"PgDn", "x":17.25, "y":2.5}, {"label":"7", "x":18.5, "y":2.5}, {"label":"8", "x":19.5, "y":2.5}, {"label":"9", "x":20.5, "y":2.5}, {"label":"+", "x":21.5, "y":2.5, "h":2}, {"label":"Caps Lock", "x":0, "y":3.5, "w":1.5}, {"label":"A", "x":1.75, "y":3.5}, {"label":"S", "x":2.75, "y":3.5}, {"label":"D", "x":3.75, "y":3.5}, {"label":"F", "x":4.75, "y":3.5}, {"label":"G", "x":5.75, "y":3.5}, {"label":"H", "x":6.75, "y":3.5}, {"label":"J", "x":7.75, "y":3.5}, {"label":"K", "x":8.75, "y":3.5}, {"label":"L", "x":9.75, "y":3.5}, {"label":":", "x":10.75, "y":3.5}, {"label":"\"", "x":11.75, "y":3.5}, {"label":"~", "x":12.75, "y":3.5}, {"label":"Enter", "x":13.75, "y":3.5, "w":1.25}, {"label":"4", "x":18.5, "y":3.5}, {"label":"5", "x":19.5, "y":3.5}, {"label":"6", "x":20.5, "y":3.5}, {"label":"Shift", "x":0, "y":4.5, "w":1.25}, {"label":"|", "x":1.25, "y":4.5}, {"label":"Z", "x":2.25, "y":4.5}, {"label":"X", "x":3.25, "y":4.5}, {"label":"C", "x":4.25, "y":4.5}, {"label":"V", "x":5.25, "y":4.5}, {"label":"B", "x":6.25, "y":4.5}, {"label":"N", "x":7.25, "y":4.5}, {"label":"M", "x":8.25, "y":4.5}, {"label":"<", "x":9.25, "y":4.5}, {"label":">", "x":10.25, "y":4.5}, {"label":"?", "x":11.25, "y":4.5}, {"label":"Shift", "x":12.25, "y":4.5, "w":2.75}, {"label":"\u2191", "x":16.25, "y":4.5}, {"label":"1", "x":18.5, "y":4.5}, {"label":"2", "x":19.5, "y":4.5}, {"label":"3", "x":20.5, "y":4.5}, {"label":"Enter", "x":21.5, "y":4.5, "h":2}, {"label":"Ctrl", "x":0, "y":5.5, "w":1.5}, {"label":"Alt", "x":2.5, "y":5.5, "w":1.5}, {"x":4, "y":5.5, "w":7}, {"label":"Alt", "x":11, "y":5.5, "w":1.5}, {"label":"Ctrl", "x":13.5, "y":5.5, "w":1.5}, {"label":"\u2190", "x":15.25, "y":5.5}, {"label":"\u2193", "x":16.25, "y":5.5}, {"label":"\u2192", "x":17.25, "y":5.5}, {"label":"0", "x":18.5, "y":5.5, "w":2}, {"label":".", "x":20.5, "y":5.5}]
+ }
+ }
+}
\ No newline at end of file
diff --git a/keyboards/converter/modelm101/keymaps/default/config.h b/keyboards/converter/modelm101/keymaps/default/config.h
new file mode 100644
index 00000000000..779e5a858f9
--- /dev/null
+++ b/keyboards/converter/modelm101/keymaps/default/config.h
@@ -0,0 +1,19 @@
+/* Copyright 2019 iw0rm3r
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+// place overrides here
diff --git a/keyboards/converter/modelm101/keymaps/default/keymap.c b/keyboards/converter/modelm101/keymaps/default/keymap.c
new file mode 100644
index 00000000000..4a8614a3f9c
--- /dev/null
+++ b/keyboards/converter/modelm101/keymaps/default/keymap.c
@@ -0,0 +1,43 @@
+/* Copyright 2019 iw0rm3r
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT( /* Base layer */
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6,
+ KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LGUI,
+ KC_LCTL, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
+ ),
+};
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ return true;
+}
+
+void matrix_init_user(void) {
+
+}
+
+void matrix_scan_user(void) {
+
+}
+
+void led_set_user(uint8_t usb_led) {
+
+}
diff --git a/keyboards/converter/modelm101/keymaps/default/readme.md b/keyboards/converter/modelm101/keymaps/default/readme.md
new file mode 100644
index 00000000000..fb91a8ebe52
--- /dev/null
+++ b/keyboards/converter/modelm101/keymaps/default/readme.md
@@ -0,0 +1 @@
+# The default keymap for modelm101
\ No newline at end of file
diff --git a/keyboards/converter/modelm101/keymaps/iw0rm3r/config.h b/keyboards/converter/modelm101/keymaps/iw0rm3r/config.h
new file mode 100644
index 00000000000..779e5a858f9
--- /dev/null
+++ b/keyboards/converter/modelm101/keymaps/iw0rm3r/config.h
@@ -0,0 +1,19 @@
+/* Copyright 2019 iw0rm3r
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+// place overrides here
diff --git a/keyboards/converter/modelm101/keymaps/iw0rm3r/keymap.c b/keyboards/converter/modelm101/keymaps/iw0rm3r/keymap.c
new file mode 100644
index 00000000000..26ced801e5a
--- /dev/null
+++ b/keyboards/converter/modelm101/keymaps/iw0rm3r/keymap.c
@@ -0,0 +1,43 @@
+/* Copyright 2019 iw0rm3r
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT( /* Base layer */
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS,
+ KC_LGUI, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6,
+ KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_CAPS,
+ KC_LCTL, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_APP, KC_PDOT
+ ),
+};
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ return true;
+}
+
+void matrix_init_user(void) {
+
+}
+
+void matrix_scan_user(void) {
+
+}
+
+void led_set_user(uint8_t usb_led) {
+
+}
diff --git a/keyboards/converter/modelm101/keymaps/iw0rm3r/readme.md b/keyboards/converter/modelm101/keymaps/iw0rm3r/readme.md
new file mode 100644
index 00000000000..17b0f40da27
--- /dev/null
+++ b/keyboards/converter/modelm101/keymaps/iw0rm3r/readme.md
@@ -0,0 +1,5 @@
+# This is my personal keymap for modelm101
+
+Caps Lock is mapped as LGUI (Windows key).
+Num Enter is mapped as Caps Lock.
+Num0 is mapped as App key (context menu).
\ No newline at end of file
diff --git a/keyboards/converter/modelm101/modelm101.c b/keyboards/converter/modelm101/modelm101.c
new file mode 100644
index 00000000000..c2204bea660
--- /dev/null
+++ b/keyboards/converter/modelm101/modelm101.c
@@ -0,0 +1,67 @@
+/* Copyright 2019 iw0rm3r
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#include "modelm101.h"
+
+void keyboard_pre_init_kb(void) {
+ /* Setting status LEDs pins to output and +5V (off) */
+ setPinOutput(B4);
+ setPinOutput(B5);
+ setPinOutput(B6);
+ writePinHigh(B4);
+ writePinHigh(B5);
+ writePinHigh(B6);
+}
+
+void matrix_init_kb(void) {
+ /* put your keyboard start-up code here
+ * runs once when the firmware starts up */
+
+ matrix_init_user();
+}
+
+void matrix_scan_kb(void) {
+ /* put your looping keyboard code here
+ * runs every cycle (a lot) */
+
+ matrix_scan_user();
+}
+
+bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
+ /* put your per-action keyboard code here
+ * runs for every action, just before processing by the firmware */
+
+ return process_record_user(keycode, record);
+}
+
+void led_set_kb(uint8_t usb_led) {
+ if (usb_led & (1<.
+ */
+#pragma once
+
+#include "quantum.h"
+
+/* This a shortcut to help you visually see your layout.
+ * The first section contains "names" for physical keys of the keyboard
+ * and defines their position on the board.
+ * The second section defines position of the keys on the switch matrix
+ * (where COLUMNS and ROWS crosses). */
+
+#define LAYOUT( \
+ K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, \
+ \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, K4S, K4T, K4U, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3O, K3P, K3Q, K3R, K3S, K3T, K3U, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2O, K2P, K2Q, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1O, K1P, K1Q, K1R, \
+ K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0H, K0I, K0J \
+) \
+{ \
+/* 00 */ { KC_NO, KC_NO, K5A, K1B, K5E, K2F, K5F, K2G, K5G, KC_NO, K2L, KC_NO, K0I, K0J, K1N, K0B }, \
+/* 01 */ { KC_NO, K1A, K3A, K2A, K5D, K3F, K4N, K3G, K3M, K5H, K3L, K2O, K2P, K2Q, KC_NO, KC_NO }, \
+/* 02 */ { K0A, KC_NO, K4A, K5B, K5C, K4F, K5J, K4G, K4M, K5I, K4L, K3O, K4O, K4Q, K4P, KC_NO }, \
+/* 03 */ { KC_NO, KC_NO, K4B, K4C, K4D, K4E, K5K, K4H, K4I, K4J, K4K, K5L, K5M, K3Q, K3P, K5N }, \
+/* 04 */ { KC_NO, KC_NO, K3B, K3C, K3D, K3E, KC_NO, K3H, K3I, K3J, K3K, K3R, K3S, K3T, K3U, K5O }, \
+/* 05 */ { KC_NO, KC_NO, K2B, K2C, K2D, K2E, K3N, K2H, K2I, K2J, K2K, K1O, K1P, K1Q, K1R, KC_NO }, \
+/* 06 */ { K0E, K1M, K1C, K1D, K1E, K1F, K2N, K1I, K1J, K1K, K2M, K4R, K4S, K4T, K5P, KC_NO }, \
+/* 07 */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K1G, K0C, K1H, KC_NO, KC_NO, K1L, K0G, K0H, K4U, K0F, K0D }, \
+}
+/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
\ No newline at end of file
diff --git a/keyboards/converter/modelm101/readme.md b/keyboards/converter/modelm101/readme.md
new file mode 100644
index 00000000000..5355c800714
--- /dev/null
+++ b/keyboards/converter/modelm101/readme.md
@@ -0,0 +1,42 @@
+# modelm101
+
+
+
+This is a configuration for the QMK firmware for reversible conversion of IBM's Model M keyboards (common 101-key ANSI and 102-key ISO models) from stock, power-hungry controller, to a modern one, running the USB bus.
+Configuration is build for the Atmel AT90USB1286 controller, which you can easily use on the Teensy 2.0++ board (produced by PJRC).
+Project is heavely based on 2 other projects:
+1. Teensy 2.0++-based custom Model M controller running TMK firmware ('modelm" by [lmorchard](https://blog.lmorchard.com/2016/02/21/modelm-controller/)); - had a few issues.
+2. Teensy 2.0++-based custom Model M 122-key controller running QMK firmware ("ibm122m" by [lukexorz](https://github.com/lukexorz)); - had wrong layout for 101/102-key boards and no status LED support.
+
+For this conversion you will need:
+1. Teensy 2.0++ dev board itself (can be used a different dev board, but it will require some changes in configuration);
+2. Ribbon connectors to connect the membrane to a dev board. Depending on your Model M variation, you will need 1 Trio-mate 16pin connector (6-520315-6 or 6-520415-6) and 1 Trio-mate 8pin connector (5-120628-8 or 5-520314-8), or 2 Trio-mate 16pin connectors;
+3. Full-sized breadboard (without power rails; half-size should do, but full-sized one looks more native) or a PCB to wire everything up;
+4. A bunch of jumper wires;
+5. mini-USB male cable with any USB socket you want to use to connect Teensy inside the keyboard to your PC (I use short mini-USB male to mini-USB female cable);
+6. (optional) Resistors for connecting status LEDs if your LED PCB doesn't have any;
+7. (optional) Double-sided tape to fix USB socket on or inside the keyboard case.
+
+Pins of the Teensy board you should use by default:
+```
+Columns: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+Pins: C7 C6 C5 C4 C3 C2 C1 C0 E1 E0 D7 D6 D5 D4 D3 D2
+--------------------------------------------------------
+Rows: 1 2 3 4 5 6 7 8
+Pins: F7 F6 F5 F4 F3 F2 F1 F0
+--------------------------------------------------------
+Status LEDs: CapsLock +5V ScrollLock NumLock
+Pins: B6 5V B5 B4
+```
+
+Please note that some versions of Model M have LED connected with a ribbon cable, and not with separate wires.
+
+Keyboard Maintainer: [iw0rm3r](https://github.com/iw0rm3r)
+Hardware Supported: Teensy 2.0++ board by PJRC
+Hardware Availability: https://www.pjrc.com/store/teensypp.html
+
+Make example for this keyboard (after setting up your build environment):
+
+ make converter/modelm101:default:teensy
+
+See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/converter/modelm101/rules.mk b/keyboards/converter/modelm101/rules.mk
new file mode 100644
index 00000000000..62052697151
--- /dev/null
+++ b/keyboards/converter/modelm101/rules.mk
@@ -0,0 +1,81 @@
+# MCU name
+MCU = at90usb1286
+#MCU = atmega32u4
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_USB below, as it is sourced by
+# F_USB after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 16000000
+
+
+#
+# LUFA specific
+#
+# Target architecture (see library "Board Types" documentation).
+ARCH = AVR8
+
+# Input clock frequency.
+# This will define a symbol, F_USB, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_USB = $(F_CPU)
+
+# Interrupt driven control endpoint task(+60)
+OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+
+
+# Bootloader selection
+# Teensy halfkay
+# Pro Micro caterina
+# Atmel DFU atmel-dfu
+# LUFA DFU lufa-dfu
+# QMK DFU qmk-dfu
+# atmega32a bootloadHID
+BOOTLOADER = halfkay
+
+
+# If you don't know the bootloader type, then you can specify the
+# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
+# Teensy halfKay 512
+# Teensy++ halfKay 1024
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+# USBaspLoader 2048
+#OPT_DEFS += -DBOOTLOADER_SIZE=1024
+
+
+# Build Options
+# change yes to no to disable
+#
+BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = no # Mouse keys(+4700)
+EXTRAKEY_ENABLE = no # Audio control and System control(+450)
+CONSOLE_ENABLE = no # Console for debug(+400)
+COMMAND_ENABLE = no # Commands for debug and configuration
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = no # USB Nkey Rollover
+BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
+RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
+MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
+UNICODE_ENABLE = no # Unicode
+BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
+AUDIO_ENABLE = no # Audio output on port C6
+FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
+HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
From ffc82ebdb2ee00c14dd225eb057d209d4584a623 Mon Sep 17 00:00:00 2001
From: XScorpion2
Date: Mon, 15 Apr 2019 00:29:50 -0400
Subject: [PATCH 2/3] [Keyboard] Zen keyboard update for Rev2 (#5522)
* Updated Zen keyboard for rev2 support
* Fixing r1 compile errors
* PR feedback and changes for Proton-C compile errors
---
keyboards/zen/common/glcdfont.c | 239 +++++++++
keyboards/zen/config.h | 13 +-
keyboards/zen/keymaps/default/rules.mk | 3 -
keyboards/zen/keymaps/jwlawrence/rules.mk | 3 -
keyboards/zen/keymaps/xyverz/rules.mk | 3 -
keyboards/zen/matrix.c | 466 ------------------
keyboards/zen/readme.md | 19 +-
keyboards/zen/rev1/config.h | 21 +-
.../zen/{ => rev1}/keymaps/333fred/config.h | 0
.../zen/{ => rev1}/keymaps/333fred/keymap.c | 0
.../zen/{ => rev1}/keymaps/333fred/rules.mk | 1 -
.../keymaps/default}/config.h | 5 +-
.../zen/{ => rev1}/keymaps/default/keymap.c | 0
keyboards/zen/rev1/keymaps/default/rules.mk | 1 +
.../keymaps/jwlawrence}/config.h | 0
.../{ => rev1}/keymaps/jwlawrence/keymap.c | 0
.../zen/rev1/keymaps/jwlawrence/rules.mk | 1 +
.../zen/{ => rev1}/keymaps/kageurufu/keymap.c | 4 +-
.../zen/{ => rev1}/keymaps/xyverz/config.h | 5 +-
.../zen/{ => rev1}/keymaps/xyverz/keymap.c | 0
keyboards/zen/rev1/keymaps/xyverz/rules.mk | 1 +
keyboards/zen/rev1/rev1.h | 5 +-
keyboards/zen/rev1/rules.mk | 2 -
keyboards/zen/rev2/config.h | 98 ++++
keyboards/zen/rev2/keymaps/debug/keymap.c | 19 +
keyboards/zen/rev2/keymaps/default/keymap.c | 117 +++++
keyboards/zen/rev2/rev2.c | 66 +++
keyboards/zen/rev2/rev2.h | 56 +++
keyboards/zen/rev2/rules.mk | 14 +
keyboards/zen/rules.mk | 71 +--
keyboards/zen/serial.c | 228 ---------
keyboards/zen/serial.h | 26 -
keyboards/zen/split_rgb.c | 41 --
keyboards/zen/split_rgb.h | 6 -
keyboards/zen/split_util.c | 86 ----
keyboards/zen/split_util.h | 20 -
keyboards/zen/zen.h | 11 +-
37 files changed, 663 insertions(+), 988 deletions(-)
create mode 100644 keyboards/zen/common/glcdfont.c
delete mode 100644 keyboards/zen/keymaps/default/rules.mk
delete mode 100644 keyboards/zen/keymaps/jwlawrence/rules.mk
delete mode 100644 keyboards/zen/keymaps/xyverz/rules.mk
delete mode 100644 keyboards/zen/matrix.c
rename keyboards/zen/{ => rev1}/keymaps/333fred/config.h (100%)
rename keyboards/zen/{ => rev1}/keymaps/333fred/keymap.c (100%)
rename keyboards/zen/{ => rev1}/keymaps/333fred/rules.mk (85%)
rename keyboards/zen/{keymaps/jwlawrence => rev1/keymaps/default}/config.h (95%)
rename keyboards/zen/{ => rev1}/keymaps/default/keymap.c (100%)
create mode 100644 keyboards/zen/rev1/keymaps/default/rules.mk
rename keyboards/zen/{keymaps/default => rev1/keymaps/jwlawrence}/config.h (100%)
rename keyboards/zen/{ => rev1}/keymaps/jwlawrence/keymap.c (100%)
create mode 100644 keyboards/zen/rev1/keymaps/jwlawrence/rules.mk
rename keyboards/zen/{ => rev1}/keymaps/kageurufu/keymap.c (98%)
rename keyboards/zen/{ => rev1}/keymaps/xyverz/config.h (94%)
rename keyboards/zen/{ => rev1}/keymaps/xyverz/keymap.c (100%)
create mode 100644 keyboards/zen/rev1/keymaps/xyverz/rules.mk
create mode 100644 keyboards/zen/rev2/config.h
create mode 100644 keyboards/zen/rev2/keymaps/debug/keymap.c
create mode 100644 keyboards/zen/rev2/keymaps/default/keymap.c
create mode 100644 keyboards/zen/rev2/rev2.c
create mode 100644 keyboards/zen/rev2/rev2.h
create mode 100644 keyboards/zen/rev2/rules.mk
delete mode 100644 keyboards/zen/serial.c
delete mode 100644 keyboards/zen/serial.h
delete mode 100644 keyboards/zen/split_rgb.c
delete mode 100644 keyboards/zen/split_rgb.h
delete mode 100644 keyboards/zen/split_util.c
delete mode 100644 keyboards/zen/split_util.h
diff --git a/keyboards/zen/common/glcdfont.c b/keyboards/zen/common/glcdfont.c
new file mode 100644
index 00000000000..3b4ccfa95c6
--- /dev/null
+++ b/keyboards/zen/common/glcdfont.c
@@ -0,0 +1,239 @@
+// This is the SOL 6x8 font
+
+#pragma once
+
+#ifdef __AVR__
+ #include
+ #include
+#elif defined(ESP8266)
+ #include
+#else
+ #define PROGMEM
+#endif
+
+static const unsigned char font[] PROGMEM = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
+ 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
+ 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
+ 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00,
+ 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
+ 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
+ 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00,
+ 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
+ 0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
+ 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
+ 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
+ 0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
+ 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
+ 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
+ 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
+ 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
+ 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
+ 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
+ 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
+ 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
+ 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
+ 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
+ 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
+ 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
+ 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
+ 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
+ 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
+ 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
+ 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
+ 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
+ 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
+ 0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
+ 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00,
+ 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
+ 0x23, 0x13, 0x08, 0x64, 0x62, 0x00,
+ 0x36, 0x49, 0x56, 0x20, 0x50, 0x00,
+ 0x00, 0x08, 0x07, 0x03, 0x00, 0x00,
+ 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00,
+ 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00,
+ 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00,
+ 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
+ 0x00, 0x80, 0x70, 0x30, 0x00, 0x00,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
+ 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
+ 0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
+ 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00,
+ 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
+ 0x72, 0x49, 0x49, 0x49, 0x46, 0x00,
+ 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00,
+ 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00,
+ 0x27, 0x45, 0x45, 0x45, 0x39, 0x00,
+ 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00,
+ 0x41, 0x21, 0x11, 0x09, 0x07, 0x00,
+ 0x36, 0x49, 0x49, 0x49, 0x36, 0x00,
+ 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00,
+ 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x40, 0x34, 0x00, 0x00, 0x00,
+ 0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x00,
+ 0x00, 0x41, 0x22, 0x14, 0x08, 0x00,
+ 0x02, 0x01, 0x59, 0x09, 0x06, 0x00,
+ 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00,
+ 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00,
+ 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
+ 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
+ 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00,
+ 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
+ 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
+ 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00,
+ 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
+ 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00,
+ 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
+ 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
+ 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
+ 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00,
+ 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00,
+ 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
+ 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00,
+ 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00,
+ 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00,
+ 0x26, 0x49, 0x49, 0x49, 0x32, 0x00,
+ 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00,
+ 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00,
+ 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00,
+ 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00,
+ 0x63, 0x14, 0x08, 0x14, 0x63, 0x00,
+ 0x03, 0x04, 0x78, 0x04, 0x03, 0x00,
+ 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00,
+ 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00,
+ 0x02, 0x04, 0x08, 0x10, 0x20, 0x00,
+ 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00,
+ 0x04, 0x02, 0x01, 0x02, 0x04, 0x00,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00,
+ 0x00, 0x03, 0x07, 0x08, 0x00, 0x00,
+ 0x20, 0x54, 0x54, 0x78, 0x40, 0x00,
+ 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00,
+ 0x38, 0x44, 0x44, 0x44, 0x28, 0x00,
+ 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00,
+ 0x38, 0x54, 0x54, 0x54, 0x18, 0x00,
+ 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00,
+ 0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00,
+ 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00,
+ 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00,
+ 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00,
+ 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00,
+ 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00,
+ 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00,
+ 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00,
+ 0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
+ 0xFC, 0x18, 0x24, 0x24, 0x18, 0x00,
+ 0x18, 0x24, 0x24, 0x18, 0xFC, 0x00,
+ 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
+ 0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
+ 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
+ 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
+ 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
+ 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
+ 0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
+ 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
+ 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
+ 0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
+ 0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
+ 0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
+ 0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
+ 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x80, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0x00, 0x00, 0x0C, 0x90,
+ 0xB0, 0xE0, 0x72, 0x31, 0x9B, 0xDE,
+ 0xCE, 0xEC, 0xEE, 0xE9, 0xE9, 0xEC,
+ 0xCF, 0xDA, 0x99, 0x3E, 0x62, 0xE4,
+ 0xC4, 0x70, 0x10, 0x10, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
+ 0xC0, 0xC0, 0x80, 0x80, 0x02, 0x85,
+ 0x85, 0x87, 0x85, 0x89, 0x89, 0x92,
+ 0xEA, 0xC6, 0xC4, 0x48, 0x50, 0x60,
+ 0x40, 0x40, 0x40, 0x40, 0xC0, 0xE0,
+ 0x50, 0x28, 0x10, 0x10, 0x60, 0xC0,
+ 0x40, 0x40, 0x40, 0x40, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0xE0, 0xF8, 0xFC,
+ 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00,
+ 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC,
+ 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00,
+ 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E,
+ 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
+ 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
+ 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
+ 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
+ 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
+ 0x00, 0x00, 0x00, 0xE0, 0xEC, 0xDF,
+ 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x7F, 0x80, 0x80,
+ 0x80, 0x70, 0x0F, 0x00, 0x00, 0x80,
+ 0x7F, 0x00, 0x00, 0x7F, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x7F,
+ 0x00, 0x00, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0xFF, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x40, 0x21, 0x33, 0x3B, 0x7B,
+ 0xFF, 0x00, 0x7C, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x7C, 0x01,
+ 0xFF, 0xDE, 0x8C, 0x04, 0x0C, 0x08,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x01, 0x01, 0x7F, 0x80,
+ 0x80, 0xBE, 0xBE, 0x80, 0x80, 0x80,
+ 0xC1, 0xFF, 0x80, 0x04, 0x32, 0x5E,
+ 0x1C, 0x3D, 0x26, 0x10, 0xC1, 0xFF,
+ 0x3E, 0x00, 0x00, 0x08, 0x36, 0xC1,
+ 0x08, 0x08, 0x14, 0x77, 0x94, 0x94,
+ 0x94, 0xF7, 0x94, 0xF7, 0x9C, 0x9C,
+ 0xFF, 0xFF, 0x1E, 0x00, 0x00, 0x00,
+ 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
+ 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00,
+ 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F,
+ 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
+ 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
+ 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
+ 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
+ 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
+ 0x40, 0x7C, 0x3F, 0x3F, 0x23, 0x01,
+ 0x23, 0x3F, 0x37, 0x6C, 0x40, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x02, 0x06,
+ 0x4D, 0x4F, 0x8C, 0xF9, 0x73, 0x37,
+ 0x27, 0x2F, 0x2F, 0xAF, 0xEF, 0x6F,
+ 0x77, 0x17, 0x33, 0x79, 0xCC, 0x1F,
+ 0x31, 0x20, 0x21, 0x02, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0xE0,
+ 0xA0, 0xA0, 0xD0, 0x90, 0x48, 0x48,
+ 0x25, 0x2B, 0x11, 0x09, 0x05, 0x03,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x03, 0x02, 0x04, 0x03, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F,
+ 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
diff --git a/keyboards/zen/config.h b/keyboards/zen/config.h
index 4478062eb0e..6868dc13541 100644
--- a/keyboards/zen/config.h
+++ b/keyboards/zen/config.h
@@ -15,17 +15,6 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef CONFIG_H
-#define CONFIG_H
+#pragma once
#include "config_common.h"
-
-#endif // CONFIG_H
-
-#undef RGBLED_NUM
-#define RGBLIGHT_ANIMATIONS
-#define RGBLED_NUM 16
-
-#ifndef TAPPING_TERM
-#define TAPPING_TERM 100
-#endif
diff --git a/keyboards/zen/keymaps/default/rules.mk b/keyboards/zen/keymaps/default/rules.mk
deleted file mode 100644
index 73142a16803..00000000000
--- a/keyboards/zen/keymaps/default/rules.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-RGBLIGHT_ENABLE = yes
-BACKLIGHT_ENABLE = yes
-
diff --git a/keyboards/zen/keymaps/jwlawrence/rules.mk b/keyboards/zen/keymaps/jwlawrence/rules.mk
deleted file mode 100644
index 73142a16803..00000000000
--- a/keyboards/zen/keymaps/jwlawrence/rules.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-RGBLIGHT_ENABLE = yes
-BACKLIGHT_ENABLE = yes
-
diff --git a/keyboards/zen/keymaps/xyverz/rules.mk b/keyboards/zen/keymaps/xyverz/rules.mk
deleted file mode 100644
index 73142a16803..00000000000
--- a/keyboards/zen/keymaps/xyverz/rules.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-RGBLIGHT_ENABLE = yes
-BACKLIGHT_ENABLE = yes
-
diff --git a/keyboards/zen/matrix.c b/keyboards/zen/matrix.c
deleted file mode 100644
index 34655237b55..00000000000
--- a/keyboards/zen/matrix.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
-Copyright 2017 Danny Nguyen
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*/
-
-/*
- * scan matrix
- */
-#include
-#include
-#include
-#include "wait.h"
-#include "print.h"
-#include "debug.h"
-#include "util.h"
-#include "matrix.h"
-#include "split_util.h"
-#include "pro_micro.h"
-#include "config.h"
-#include "timer.h"
-#include "backlight.h"
-
-#ifdef USE_I2C
-# include "i2c.h"
-#else // USE_SERIAL
-# include "serial.h"
-#endif
-
-#ifndef DEBOUNCING_DELAY
-# define DEBOUNCING_DELAY 5
-#endif
-
-#if (DEBOUNCING_DELAY > 0)
- static uint16_t debouncing_time;
- static bool debouncing = false;
-#endif
-
-#if (MATRIX_COLS <= 8)
-# define print_matrix_header() print("\nr/c 01234567\n")
-# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
-# define matrix_bitpop(i) bitpop(matrix[i])
-# define ROW_SHIFTER ((uint8_t)1)
-#else
-# error "Currently only supports 8 COLS"
-#endif
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-#define ERROR_DISCONNECT_COUNT 5
-
-#define SERIAL_LED_ADDR 0x00
-
-#define ROWS_PER_HAND (MATRIX_ROWS/2)
-
-static uint8_t error_count = 0;
-
-static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
-static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
-
-/* matrix state(1:on, 0:off) */
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-#if (DIODE_DIRECTION == COL2ROW)
- static void init_cols(void);
- static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
- static void unselect_rows(void);
- static void select_row(uint8_t row);
- static void unselect_row(uint8_t row);
-#elif (DIODE_DIRECTION == ROW2COL)
- static void init_rows(void);
- static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
- static void unselect_cols(void);
- static void unselect_col(uint8_t col);
- static void select_col(uint8_t col);
-#endif
-
-__attribute__ ((weak))
-void matrix_init_kb(void) {
- matrix_init_user();
-}
-
-__attribute__ ((weak))
-void matrix_scan_kb(void) {
- matrix_scan_user();
-}
-
-__attribute__ ((weak))
-void matrix_init_user(void) {
-}
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {
-}
-
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
-
-void matrix_init(void)
-{
- debug_enable = true;
- debug_matrix = true;
- debug_mouse = true;
- // initialize row and col
- unselect_rows();
- init_cols();
-
- TX_RX_LED_INIT;
-
- // initialize matrix state: all keys off
- for (uint8_t i=0; i < MATRIX_ROWS; i++) {
- matrix[i] = 0;
- matrix_debouncing[i] = 0;
- }
-
- matrix_init_quantum();
-}
-
-uint8_t _matrix_scan(void)
-{
- int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
-#if (DIODE_DIRECTION == COL2ROW)
- // Set row, read cols
- for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
-# if (DEBOUNCING_DELAY > 0)
- bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row);
-
- if (matrix_changed) {
- debouncing = true;
- debouncing_time = timer_read();
- }
-
-# else
- read_cols_on_row(matrix+offset, current_row);
-# endif
-
- }
-
-#elif (DIODE_DIRECTION == ROW2COL)
- // Set col, read rows
- for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
-# if (DEBOUNCING_DELAY > 0)
- bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col);
- if (matrix_changed) {
- debouncing = true;
- debouncing_time = timer_read();
- }
-# else
- read_rows_on_col(matrix+offset, current_col);
-# endif
-
- }
-#endif
-
-# if (DEBOUNCING_DELAY > 0)
- if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
- for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
- matrix[i+offset] = matrix_debouncing[i+offset];
- }
- debouncing = false;
- }
-# endif
-
- return 1;
-}
-
-#ifdef USE_I2C
-
-// Get rows from other half over i2c
-int i2c_transaction(void) {
- int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
-
- int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
- if (err) goto i2c_error;
-
- // start of matrix stored at 0x00
- err = i2c_master_write(0x00);
- if (err) goto i2c_error;
-
- // Start read
- err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
- if (err) goto i2c_error;
-
- if (!err) {
- int i;
- for (i = 0; i < ROWS_PER_HAND-1; ++i) {
- matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
- }
- matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
- i2c_master_stop();
- } else {
-i2c_error: // the cable is disconnceted, or something else went wrong
- i2c_reset_state();
- return err;
- }
-
- return 0;
-}
-
-#else // USE_SERIAL
-
-int serial_transaction(void) {
- int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
-
- if (serial_update_buffers()) {
- return 1;
- }
-
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- matrix[slaveOffset+i] = serial_slave_buffer[i];
- }
-
-#ifdef BACKLIGHT_ENABLE
- // Write backlight level for slave to read
- serial_master_buffer[SERIAL_LED_ADDR] = get_backlight_level();
-#endif
- return 0;
-}
-#endif
-
-uint8_t matrix_scan(void)
-{
- uint8_t ret = _matrix_scan();
-
-#ifdef USE_I2C
- if( i2c_transaction() ) {
-#else // USE_SERIAL
- if( serial_transaction() ) {
-#endif
- // turn on the indicator led when halves are disconnected
- TXLED1;
-
- error_count++;
-
- if (error_count > ERROR_DISCONNECT_COUNT) {
- // reset other half if disconnected
- int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- matrix[slaveOffset+i] = 0;
- }
- }
- } else {
- // turn off the indicator led on no error
- TXLED0;
- error_count = 0;
- }
- matrix_scan_quantum();
- return ret;
-}
-
-void matrix_slave_scan(void) {
- _matrix_scan();
-
- int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
-
-#ifdef USE_I2C
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- i2c_slave_buffer[i] = matrix[offset+i];
- }
-#else // USE_SERIAL
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- serial_slave_buffer[i] = matrix[offset+i];
- }
-
-#ifdef BACKLIGHT_ENABLE
- // Read backlight level sent from master and update level on slave
- backlight_set(serial_master_buffer[SERIAL_LED_ADDR]);
-#endif
-#endif
-}
-
-bool matrix_is_modified(void)
-{
- if (debouncing) return false;
- return true;
-}
-
-inline
-bool matrix_is_on(uint8_t row, uint8_t col)
-{
- return (matrix[row] & ((matrix_row_t)1<> 4) + 1) &= ~_BV(pin & 0xF); // IN
- _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
- }
-}
-
-static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
-{
- // Store last value of row prior to reading
- matrix_row_t last_row_value = current_matrix[current_row];
-
- // Clear data in matrix row
- current_matrix[current_row] = 0;
-
- // Select row and wait for row selecton to stabilize
- select_row(current_row);
- wait_us(30);
-
- // For each col...
- for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
-
- // Select the col pin to read (active low)
- uint8_t pin = col_pins[col_index];
- uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
-
- // Populate the matrix row with the state of the col pin
- current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
- }
-
- // Unselect row
- unselect_row(current_row);
-
- return (last_row_value != current_matrix[current_row]);
-}
-
-static void select_row(uint8_t row)
-{
- uint8_t pin = row_pins[row];
- _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
- _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
-}
-
-static void unselect_row(uint8_t row)
-{
- uint8_t pin = row_pins[row];
- _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
- _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
-}
-
-static void unselect_rows(void)
-{
- for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
- uint8_t pin = row_pins[x];
- _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
- _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
- }
-}
-
-#elif (DIODE_DIRECTION == ROW2COL)
-
-static void init_rows(void)
-{
- for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
- uint8_t pin = row_pins[x];
- _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
- _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
- }
-}
-
-static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
-{
- bool matrix_changed = false;
-
- // Select col and wait for col selecton to stabilize
- select_col(current_col);
- wait_us(30);
-
- // For each row...
- for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++)
- {
-
- // Store last value of row prior to reading
- matrix_row_t last_row_value = current_matrix[row_index];
-
- // Check row pin state
- if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0)
- {
- // Pin LO, set col bit
- current_matrix[row_index] |= (ROW_SHIFTER << current_col);
- }
- else
- {
- // Pin HI, clear col bit
- current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
- }
-
- // Determine if the matrix changed state
- if ((last_row_value != current_matrix[row_index]) && !(matrix_changed))
- {
- matrix_changed = true;
- }
- }
-
- // Unselect col
- unselect_col(current_col);
-
- return matrix_changed;
-}
-
-static void select_col(uint8_t col)
-{
- uint8_t pin = col_pins[col];
- _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
- _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
-}
-
-static void unselect_col(uint8_t col)
-{
- uint8_t pin = col_pins[col];
- _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
- _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
-}
-
-static void unselect_cols(void)
-{
- for(uint8_t x = 0; x < MATRIX_COLS; x++) {
- uint8_t pin = col_pins[x];
- _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
- _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
- }
-}
-
-#endif
diff --git a/keyboards/zen/readme.md b/keyboards/zen/readme.md
index 0fb0ffb3b6a..7ca7c69fe54 100644
--- a/keyboards/zen/readme.md
+++ b/keyboards/zen/readme.md
@@ -2,19 +2,26 @@
A split ergo keyboard with a few goals in mind:
-- Be as thin as possible. Other split KBs (Let's Split, Nyquist, Iris) are 15.2mm thick. The Zen is only 8.0mm thick.
+- Be as thin as possible. Other split KBs (Let's Split, Nyquist, Iris) are 15.2mm thick. The Zen rev2 is only 13.2mm thick *including switches and caps* when using Kailh Choc low-profile switches, and 22.1mm using standard MX switches and DSA keycaps.
- Layout designed for gaming. 1.5u pinky keys, ortho alphas, and angled thumb keys. After trying Ortholinear, Atreus62, and Ergodox, this is the best layout for gaming and typing.
-- RGB backlighting. 16 WS2812b LEDs shine through the perimeter switches. The SK6812 variant are cheap and easy to solder.
+- Per-key RGB lighting. 34 WS2812b LEDs per side make it exceptionally bright
- Price. Using Arduino Pro Micro, SK6812 LEDs, and PCB FR4 for the case, the cost of each half without switches or caps can be reduced to under $20 when purchased at volume.
+- Options. The Zen rev2 comes with rotary encoder support, SSD1306 OLED pinout, USB-C or TRRS interconnect, and jumpers to enable compatibility with the [QMK Proton-C](https://olkb.com/parts/qmk-proton-c) and the [Keeb.io Elite-C](https://keeb.io/products/elite-c-usb-c-pro-micro-replacement-arduino-compatible-atmega32u4)
-Keyboard Maintainer: [Legonut](https://github.com/Legonut)
-Hardware Supported: Zen rev1
+Keyboard Maintainer: [Legonut](https://github.com/Legonut)
+Hardware Supported: Zen rev1, Zen rev2
Hardware Availability: [RGBKB.net](https://www.rgbkb.net/)
-A build guide and more info for this keyboard can be found here: [Zen Build Guide](https://legonut.gitbooks.io/zen-keyboard/content/).
+A build guide and more info for this keyboard can be found here: [Zen Build Guide](https://rgbkb.gitbook.io/sol-build-guide/zygomorph-build-guide/untitled).
Make example for this keyboard (after setting up your build environment):
- make zen/rev1:default
+ make zen/rev2:default
+
+To build for a Proton-C:
+
+ make zen/rev2:default CTPC=yes
+
+**Note:** The Proton-C does not have split keyboard, or encoder support. Also OLED driver support is untested. Will update as status changes.
See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/zen/rev1/config.h b/keyboards/zen/rev1/config.h
index f480cadcc51..88f39af4842 100644
--- a/keyboards/zen/rev1/config.h
+++ b/keyboards/zen/rev1/config.h
@@ -15,15 +15,12 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef REV1_CONFIG_H
-#define REV1_CONFIG_H
-
-#include QMK_KEYBOARD_CONFIG_H
+#pragma once
/* USB Device descriptor parameter */
-#define VENDOR_ID 0xCEEB
-#define PRODUCT_ID 0x1256
-#define DEVICE_VER 0x0200
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x3060
+#define DEVICE_VER 0x0001
#define MANUFACTURER Legonut
#define PRODUCT Project Zen
#define DESCRIPTION Split gaming keyboard
@@ -40,12 +37,11 @@ along with this program. If not, see .
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
+#define SOFT_SERIAL_PIN D0
+
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
-/* number of backlight levels */
-// #define BACKLIGHT_LEVELS 3
-
/* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5
@@ -54,9 +50,6 @@ along with this program. If not, see .
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
-#define BACKLIGHT_PIN F4
-#define BACKLIGHT_LEVELS 5
-
/* ws2812 RGB LED */
#define RGB_DI_PIN D1
@@ -79,5 +72,3 @@ along with this program. If not, see .
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
-
-#endif
diff --git a/keyboards/zen/keymaps/333fred/config.h b/keyboards/zen/rev1/keymaps/333fred/config.h
similarity index 100%
rename from keyboards/zen/keymaps/333fred/config.h
rename to keyboards/zen/rev1/keymaps/333fred/config.h
diff --git a/keyboards/zen/keymaps/333fred/keymap.c b/keyboards/zen/rev1/keymaps/333fred/keymap.c
similarity index 100%
rename from keyboards/zen/keymaps/333fred/keymap.c
rename to keyboards/zen/rev1/keymaps/333fred/keymap.c
diff --git a/keyboards/zen/keymaps/333fred/rules.mk b/keyboards/zen/rev1/keymaps/333fred/rules.mk
similarity index 85%
rename from keyboards/zen/keymaps/333fred/rules.mk
rename to keyboards/zen/rev1/keymaps/333fred/rules.mk
index 38b71555042..1359e81c09f 100644
--- a/keyboards/zen/keymaps/333fred/rules.mk
+++ b/keyboards/zen/rev1/keymaps/333fred/rules.mk
@@ -1,5 +1,4 @@
RGBLIGHT_ENABLE = yes
-BACKLIGHT_ENABLE = no
NKRO_ENABLE = yes
KEY_LOCK_ENABLE = yes
TAP_DANCE_ENABLE = yes
diff --git a/keyboards/zen/keymaps/jwlawrence/config.h b/keyboards/zen/rev1/keymaps/default/config.h
similarity index 95%
rename from keyboards/zen/keymaps/jwlawrence/config.h
rename to keyboards/zen/rev1/keymaps/default/config.h
index 38e4d73f0d8..4a549c5b1f7 100644
--- a/keyboards/zen/keymaps/jwlawrence/config.h
+++ b/keyboards/zen/rev1/keymaps/default/config.h
@@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef CONFIG_USER_H
-#define CONFIG_USER_H
+#pragma once
#include "config_common.h"
@@ -37,5 +36,3 @@ along with this program. If not, see .
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
-
-#endif
diff --git a/keyboards/zen/keymaps/default/keymap.c b/keyboards/zen/rev1/keymaps/default/keymap.c
similarity index 100%
rename from keyboards/zen/keymaps/default/keymap.c
rename to keyboards/zen/rev1/keymaps/default/keymap.c
diff --git a/keyboards/zen/rev1/keymaps/default/rules.mk b/keyboards/zen/rev1/keymaps/default/rules.mk
new file mode 100644
index 00000000000..1e3cebb1451
--- /dev/null
+++ b/keyboards/zen/rev1/keymaps/default/rules.mk
@@ -0,0 +1 @@
+RGBLIGHT_ENABLE = yes
diff --git a/keyboards/zen/keymaps/default/config.h b/keyboards/zen/rev1/keymaps/jwlawrence/config.h
similarity index 100%
rename from keyboards/zen/keymaps/default/config.h
rename to keyboards/zen/rev1/keymaps/jwlawrence/config.h
diff --git a/keyboards/zen/keymaps/jwlawrence/keymap.c b/keyboards/zen/rev1/keymaps/jwlawrence/keymap.c
similarity index 100%
rename from keyboards/zen/keymaps/jwlawrence/keymap.c
rename to keyboards/zen/rev1/keymaps/jwlawrence/keymap.c
diff --git a/keyboards/zen/rev1/keymaps/jwlawrence/rules.mk b/keyboards/zen/rev1/keymaps/jwlawrence/rules.mk
new file mode 100644
index 00000000000..1e3cebb1451
--- /dev/null
+++ b/keyboards/zen/rev1/keymaps/jwlawrence/rules.mk
@@ -0,0 +1 @@
+RGBLIGHT_ENABLE = yes
diff --git a/keyboards/zen/keymaps/kageurufu/keymap.c b/keyboards/zen/rev1/keymaps/kageurufu/keymap.c
similarity index 98%
rename from keyboards/zen/keymaps/kageurufu/keymap.c
rename to keyboards/zen/rev1/keymaps/kageurufu/keymap.c
index 761100dbe58..75884635cdc 100644
--- a/keyboards/zen/keymaps/kageurufu/keymap.c
+++ b/keyboards/zen/rev1/keymaps/kageurufu/keymap.c
@@ -1,8 +1,8 @@
#include QMK_KEYBOARD_H
#include "kageurufu.h"
#ifdef PROTOCOL_LUFA
-#include "lufa.h"
-#include "split_util.h"
+ #include "lufa.h"
+ #include "split_util.h"
#endif
extern keymap_config_t keymap_config;
diff --git a/keyboards/zen/keymaps/xyverz/config.h b/keyboards/zen/rev1/keymaps/xyverz/config.h
similarity index 94%
rename from keyboards/zen/keymaps/xyverz/config.h
rename to keyboards/zen/rev1/keymaps/xyverz/config.h
index 818f8998974..d3e21ea1726 100644
--- a/keyboards/zen/keymaps/xyverz/config.h
+++ b/keyboards/zen/rev1/keymaps/xyverz/config.h
@@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef CONFIG_USER_H
-#define CONFIG_USER_H
+#pragma once
#include "config_common.h"
@@ -31,5 +30,3 @@ along with this program. If not, see .
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
-
-#endif
diff --git a/keyboards/zen/keymaps/xyverz/keymap.c b/keyboards/zen/rev1/keymaps/xyverz/keymap.c
similarity index 100%
rename from keyboards/zen/keymaps/xyverz/keymap.c
rename to keyboards/zen/rev1/keymaps/xyverz/keymap.c
diff --git a/keyboards/zen/rev1/keymaps/xyverz/rules.mk b/keyboards/zen/rev1/keymaps/xyverz/rules.mk
new file mode 100644
index 00000000000..1e3cebb1451
--- /dev/null
+++ b/keyboards/zen/rev1/keymaps/xyverz/rules.mk
@@ -0,0 +1 @@
+RGBLIGHT_ENABLE = yes
diff --git a/keyboards/zen/rev1/rev1.h b/keyboards/zen/rev1/rev1.h
index c2444f047f6..a12f2ea789a 100644
--- a/keyboards/zen/rev1/rev1.h
+++ b/keyboards/zen/rev1/rev1.h
@@ -1,5 +1,4 @@
-#ifndef REV1_H
-#define REV1_H
+#pragma once
#include "zen.h"
@@ -36,5 +35,3 @@
{ k80, k81, k82, k83, k84, k85, KC_NO }, \
{ k90, k91, k92, k93, k94, k95, k96 } \
}
-
-#endif
diff --git a/keyboards/zen/rev1/rules.mk b/keyboards/zen/rev1/rules.mk
index d7463419b4f..e69de29bb2d 100644
--- a/keyboards/zen/rev1/rules.mk
+++ b/keyboards/zen/rev1/rules.mk
@@ -1,2 +0,0 @@
-RGBLIGHT_ENABLE = yes
-BACKLIGHT_ENABLE = yes
diff --git a/keyboards/zen/rev2/config.h b/keyboards/zen/rev2/config.h
new file mode 100644
index 00000000000..dc37472f6b9
--- /dev/null
+++ b/keyboards/zen/rev2/config.h
@@ -0,0 +1,98 @@
+/*
+Copyright 2017 Danny Nguyen
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+#pragma once
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x3061
+#define DEVICE_VER 0x0002
+#define MANUFACTURER Legonut
+#define PRODUCT "Project Zen"
+#define DESCRIPTION "Split gaming keyboard"
+
+/* key matrix size */
+// Rows are doubled-up
+
+// wiring of each half
+#ifdef CONVERT_TO_PROTON_C
+ #define MATRIX_ROWS 5
+ #define MATRIX_COLS 7
+#else
+ #define MATRIX_ROWS 10
+ #define MATRIX_COLS 7
+#endif
+
+// Proton-C does pin conversion
+#define MATRIX_ROW_PINS { C6, E6, B5, D7, B4 }
+#define MATRIX_COL_PINS { F4, F5, F6, F7, B3, B1, B2 }
+
+#define NUMBER_OF_ENCODERS 1
+
+#define ENCODERS_PAD_A { D4 }
+#define ENCODERS_PAD_B { D2 }
+
+#define RGB_DI_PIN B6
+#define SOFT_SERIAL_PIN D3
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCING_DELAY 5
+
+/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
+#define LOCKING_SUPPORT_ENABLE
+/* Locking resynchronize hack */
+#define LOCKING_RESYNC_ENABLE
+
+/* ws2812 RGB LED */
+#define RGBLED_NUM 34 // Number of LEDs
+
+// If using 90 Degree rotation, increase block cout
+#ifdef OLED_ROTATE90
+ #define OLED_DISPLAY_CUSTOM
+ #define OLED_DISPLAY_WIDTH 128
+ #define OLED_DISPLAY_HEIGHT 32
+ #define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed)
+ #define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only
+ #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 8 (compile time mathed)
+ #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
+ #define OLED_SOURCE_MAP { 0, 8, 16, 24 }
+ #define OLED_TARGET_MAP { 24, 16, 8, 0 }
+#endif
+
+/*
+ * Feature disable options
+ * These options are also useful to firmware size reduction.
+ */
+
+/* disable debug print */
+// #define NO_DEBUG
+
+/* disable print */
+// #define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
+//#define NO_ACTION_MACRO
+//#define NO_ACTION_FUNCTION
diff --git a/keyboards/zen/rev2/keymaps/debug/keymap.c b/keyboards/zen/rev2/keymaps/debug/keymap.c
new file mode 100644
index 00000000000..e2d3d6a3567
--- /dev/null
+++ b/keyboards/zen/rev2/keymaps/debug/keymap.c
@@ -0,0 +1,19 @@
+#include QMK_KEYBOARD_H
+#include
+
+// extern keymap_config_t keymap_config;
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { { KC_TRNS } } };
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ static char buf[10] = " ";
+
+ if (record->event.pressed) {
+ snprintf(buf, 10, "C%dR%d ", record->event.key.col, record->event.key.row);
+
+ send_string(buf);
+ }
+ return false;
+
+ return true;
+}
diff --git a/keyboards/zen/rev2/keymaps/default/keymap.c b/keyboards/zen/rev2/keymaps/default/keymap.c
new file mode 100644
index 00000000000..41003e4a557
--- /dev/null
+++ b/keyboards/zen/rev2/keymaps/default/keymap.c
@@ -0,0 +1,117 @@
+#include QMK_KEYBOARD_H
+
+extern keymap_config_t keymap_config;
+
+// Each layer gets a name for readability, which is then used in the keymap matrix below.
+// The underscores don't mean anything - you can have a layer called STUFF or any other name.
+// Layer names don't all need to be of the same length, obviously, and you can also skip them
+// entirely and just use numbers.
+#define _QWERTY 0
+#define _NAV 2
+
+
+enum custom_keycodes {
+ QWERTY = SAFE_RANGE,
+ NAV,
+
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ /* Qwerty
+ * ,-----------------------------------------. .-----------------------------------------.
+ * | GESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
+ * |------+------+------+------+------+------| |------+------+------+------+------+------|
+ * | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ |
+ * |------+------+------+------+------+------| |------+------+------+------+------+------|
+ * |CAPS(NAV)|A | S | D | F | G | | H | J | K | L | ; | " |
+ * |------+------+------+------+------+------+------..------+------+------+------+------+------+------|
+ * | Shift| Z | X | C | V | B |RGBPrv||RGBNxt| N | M | , | . | / |Enter |
+ * |------+------+------+------+------+------+------||------+------+------+------+------+------+------|
+ * | Ctrl | GUI | Alt |RGBTOG| NAV |Space |Delete||Enter |Space | NAV | - | = | PGUP | PGDN |
+ * `----------------------------------+-------------''------------------------------------------------'
+ * |Space |Delete||Enter |Space |
+ * '-------------''-------------'
+ */
+ [_QWERTY] = LAYOUT( \
+ KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, \
+ LT(_NAV, KC_CAPS),KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, RGB_RMOD,RGB_MOD, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, \
+ KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, MO(_NAV), KC_SPC, KC_DEL, KC_ENT, KC_SPACE, MO(_NAV), KC_MINS, KC_EQL, KC_PGUP, KC_PGDN, \
+ KC_SPC, KC_DEL, KC_ENT, KC_SPACE \
+ ),
+
+ /* NAV
+ * ,-----------------------------------------. .-----------------------------------------.
+ * | GESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
+ * |------+------+------+------+------+------| |------+------+------+------+------+------|
+ * | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ |
+ * |------+------+------+------+------+------| |------+------+------+------+------+------|
+ * |CAPS(NAV)|A | S | D | F | G | | H | J | K | L | ; | " |
+ * |------+------+------+------+------+------+------..------+------+------+------+------+------+------|
+ * | Shift| Z | X | C | V | B | || | N | M | , | . | / |Enter |
+ * |------+------+------+------+------+------+------||------+------+------+------+------+------+------|
+ * | Ctrl | GUI | Alt |RGBTOG| NAV |Space |Delete||Enter |Space | NAV | - | = | PGUP | PGDN |
+ * `----------------------------------+-------------''------------------------------------------------'
+ * |Space |Delete||Enter |Space |
+ * '-------------''-------------'
+ */
+ [_NAV] = LAYOUT( \
+ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
+ _______, RGB_SAI, RGB_VAI, RGB_SAD, RESET, KC_LBRC, KC_RBRC, KC_PGUP, KC_UP, KC_PGDN, KC_INS, KC_HOME, \
+ _______, RGB_HUD, RGB_VAD, RGB_HUI, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, KC_END, \
+ KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MPRV, KC_MNXT, \
+ KC_LCTL, KC_LGUI, KC_LALT, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLU, KC_VOLD, \
+ _______, _______, _______, _______
+ ),
+
+};
+
+void encoder_update_user(uint8_t index, bool clockwise) {
+ if (index == 0) { /* First encoder */
+ if (clockwise) {
+ tap_code(KC_PGDN);
+ } else {
+ tap_code(KC_PGUP);
+ }
+ } else if (index == 1) { /* Second encoder from slave */
+ if (clockwise) {
+ tap_code(KC_UP);
+ } else {
+ tap_code(KC_DOWN);
+ }
+ }
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case QWERTY:
+ if (record->event.pressed) {
+ set_single_persistent_default_layer(1UL<<_QWERTY);
+ }
+ return false;
+ break;
+ //case COLEMAK:
+ //if (record->event.pressed) {
+ //set_single_persistent_default_layer(1UL<<_COLEMAK);
+ //}
+ //return false;
+ //break;
+ }
+ return true;
+}
+
+
+#if OLED_DRIVER_ENABLE
+const char* layer_name_user(uint32_t layer) {
+ switch (layer) {
+ case _QWERTY:
+ return PSTR("QWRTY");
+ case _NAV:
+ return PSTR("NAV\n");
+ default:
+ return PSTR("UNDEF");
+ }
+}
+#endif
diff --git a/keyboards/zen/rev2/rev2.c b/keyboards/zen/rev2/rev2.c
new file mode 100644
index 00000000000..4104460db1a
--- /dev/null
+++ b/keyboards/zen/rev2/rev2.c
@@ -0,0 +1,66 @@
+#include "rev2.h"
+
+#ifdef OLED_DRIVER_ENABLE
+#include "split_util.h"
+#include "oled_driver.h"
+
+__attribute__((weak))
+void render_logo(void) {
+ static const char PROGMEM sol_logo[] = {
+ 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
+ 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
+ 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
+
+ oled_write_P(sol_logo, false);
+}
+
+__attribute__((weak))
+const char* layer_name_user(uint32_t layer) {
+ switch (layer) {
+ default:
+ return PSTR("UNDEF\n");
+ }
+}
+
+__attribute__((weak))
+void render_status(void) {
+ // Setup for 90 degree rendering because it's awesome!
+ // It can house 16 lines of text, with 5 letters each line
+ // Render to mode icon
+ static const char PROGMEM mode_logo[2][4] = {
+ {0x97,0x98,0x0a,0},
+ {0xb7,0xb8,0x0a,0} };
+
+ oled_write_P(mode_logo[0], false); // Line 1
+ oled_write_P(mode_logo[1], false); // Line 2
+
+ // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
+ oled_set_cursor(0, 3); // Line 3
+ oled_write_P(PSTR("Layer"), false); // Line 4
+ oled_write_P(layer_name_user(biton32(layer_state)), false);
+
+ // Host Keyboard LED Status
+ uint8_t led_usb_state = host_keyboard_leds();
+ oled_set_cursor(0, OLED_MAX_LINES - 4); // Line 13
+ oled_write_P(led_usb_state & (1<
+#ifdef __AVR__
+ #include
+ #include
+#endif
+#endif
+
+//void promicro_bootloader_jmp(bool program);
+
+#ifdef CONVERT_TO_PROTON_C
+ #define LAYOUT( \
+ k00, k01, k02, k03, k04, k05, k55, k54, k53, k52, k51, k50, \
+ k10, k11, k12, k13, k14, k15, k65, k64, k63, k62, k61, k60, \
+ k20, k21, k22, k23, k24, k25, k75, k74, k73, k72, k71, k70, \
+ k30, k31, k32, k33, k34, k35, k16, k66, k85, k84, k83, k82, k81, k80, \
+ k40, k41, k42, k43, k44, k36, k26, k76, k86, k94, k93, k92, k91, k90, \
+ k45, k46, k96, k95 \
+ ) \
+ { \
+ { k00, k01, k02, k03, k04, k05, KC_NO }, \
+ { k10, k11, k12, k13, k14, k15, k16 }, \
+ { k20, k21, k22, k23, k24, k25, k26 }, \
+ { k30, k31, k32, k33, k34, k35, k36 }, \
+ { k40, k41, k42, k43, k44, k45, k46 } \
+ }
+#else
+ #define LAYOUT( \
+ k00, k01, k02, k03, k04, k05, k55, k54, k53, k52, k51, k50, \
+ k10, k11, k12, k13, k14, k15, k65, k64, k63, k62, k61, k60, \
+ k20, k21, k22, k23, k24, k25, k75, k74, k73, k72, k71, k70, \
+ k30, k31, k32, k33, k34, k35, k16, k66, k85, k84, k83, k82, k81, k80, \
+ k40, k41, k42, k43, k44, k36, k26, k76, k86, k94, k93, k92, k91, k90, \
+ k45, k46, k96, k95 \
+ ) \
+ { \
+ { k00, k01, k02, k03, k04, k05, KC_NO }, \
+ { k10, k11, k12, k13, k14, k15, k16 }, \
+ { k20, k21, k22, k23, k24, k25, k26 }, \
+ { k30, k31, k32, k33, k34, k35, k36 }, \
+ { k40, k41, k42, k43, k44, k45, k46 }, \
+ { k50, k51, k52, k53, k54, k55, KC_NO }, \
+ { k60, k61, k62, k63, k64, k65, k66 }, \
+ { k70, k71, k72, k73, k74, k75, k76 }, \
+ { k80, k81, k82, k83, k84, k85, k86 }, \
+ { k90, k91, k92, k93, k94, k95, k96 } \
+ }
+#endif
diff --git a/keyboards/zen/rev2/rules.mk b/keyboards/zen/rev2/rules.mk
new file mode 100644
index 00000000000..d1fe410525f
--- /dev/null
+++ b/keyboards/zen/rev2/rules.mk
@@ -0,0 +1,14 @@
+ENCODER_ENABLE = yes
+
+OLED_DRIVER_ENABLE = no
+OLED_ROTATE90 = yes
+
+# Setup so that OLED and 90 degree rotation can be turned on/off easily
+# with "OLED_DRIVER_ENABLE = yes" or "OLED_ROTATE90 = no" in user's rules.mk file
+ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
+ # Custom local font file
+ OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
+ ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
+ OPT_DEFS += -DOLED_ROTATE90
+ endif
+endif
diff --git a/keyboards/zen/rules.mk b/keyboards/zen/rules.mk
index 4e82689111d..f5d64a7f03b 100644
--- a/keyboards/zen/rules.mk
+++ b/keyboards/zen/rules.mk
@@ -1,52 +1,27 @@
-SRC += matrix.c \
- split_util.c \
- serial.c
-
-# MCU name
-#MCU = at90usb1287
+# Pro Micro or Elite-C
+# Automagically converted to Proton-C
MCU = atmega32u4
-
-# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
-# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
-# automatically to create a 32-bit value in your source code.
-#
-# This will be an integer division of F_USB below, as it is sourced by
-# F_USB after it has run through any CPU prescalers. Note that this value
-# does not *change* the processor frequency - it should merely be updated to
-# reflect the processor speed set externally so that the code can use accurate
-# software delays.
F_CPU = 16000000
-
-#
-# LUFA specific
-#
-# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
-
-# Input clock frequency.
-# This will define a symbol, F_USB, in all source code files equal to the
-# input clock frequency (before any prescaling is performed) in Hz. This value may
-# differ from F_CPU if prescaling is used on the latter, and is required as the
-# raw input clock is fed directly to the PLL sections of the AVR for high speed
-# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-# at the end, this will be done automatically to create a 32-bit value in your
-# source code.
-#
-# If no clock division is performed on the input clock inside the AVR (via the
-# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
-
-# Bootloader
-# This definition is optional, and if your keyboard supports multiple bootloaders of
-# different sizes, comment this out, and the correct address will be loaded
-# automatically (+60). See bootloader.mk for all options.
-BOOTLOADER = caterina
-
-# Interrupt driven control endpoint task(+60)
+BOOTLOADER = dfu
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+ifeq ($(strip $(CTPC)), yes)
+ CONVERT_TO_PROTON_C=yes
+endif
+
+ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
+ SPLIT_KEYBOARD = no # currently unsupported on ARM
+ RGBLIGHT_ENABLE = no # currently unsupported on ARM
+
+ EXTRAFLAGS += -DUSE_PROTON_C
+else
+ # Currently moved to Pro Micro only section because of lack of Proton-C support
+ SPLIT_KEYBOARD = yes
+ RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
+endif
+
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
@@ -57,17 +32,11 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
-RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
-SUBPROJECT_rev1 = yes
-USE_I2C = no
-# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
-CUSTOM_MATRIX = yes
-
-DEFAULT_FOLDER = zen/rev1
+DEFAULT_FOLDER = zen/rev2
diff --git a/keyboards/zen/serial.c b/keyboards/zen/serial.c
deleted file mode 100644
index 74bcbb6bf6e..00000000000
--- a/keyboards/zen/serial.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * WARNING: be careful changing this code, it is very timing dependent
- */
-
-#ifndef F_CPU
-#define F_CPU 16000000
-#endif
-
-#include
-#include
-#include
-#include
-#include "serial.h"
-
-#ifndef USE_I2C
-
-// Serial pulse period in microseconds. Its probably a bad idea to lower this
-// value.
-#define SERIAL_DELAY 24
-
-uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
-uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
-
-#define SLAVE_DATA_CORRUPT (1<<0)
-volatile uint8_t status = 0;
-
-inline static
-void serial_delay(void) {
- _delay_us(SERIAL_DELAY);
-}
-
-inline static
-void serial_output(void) {
- SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
-}
-
-// make the serial pin an input with pull-up resistor
-inline static
-void serial_input(void) {
- SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
- SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
-}
-
-inline static
-uint8_t serial_read_pin(void) {
- return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
-}
-
-inline static
-void serial_low(void) {
- SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
-}
-
-inline static
-void serial_high(void) {
- SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
-}
-
-void serial_master_init(void) {
- serial_output();
- serial_high();
-}
-
-void serial_slave_init(void) {
- serial_input();
-
- // Enable INT0
- EIMSK |= _BV(INT0);
- // Trigger on falling edge of INT0
- EICRA &= ~(_BV(ISC00) | _BV(ISC01));
-}
-
-// Used by the master to synchronize timing with the slave.
-static
-void sync_recv(void) {
- serial_input();
- // This shouldn't hang if the slave disconnects because the
- // serial line will float to high if the slave does disconnect.
- while (!serial_read_pin());
- serial_delay();
-}
-
-// Used by the slave to send a synchronization signal to the master.
-static
-void sync_send(void) {
- serial_output();
-
- serial_low();
- serial_delay();
-
- serial_high();
-}
-
-// Reads a byte from the serial line
-static
-uint8_t serial_read_byte(void) {
- uint8_t byte = 0;
- serial_input();
- for ( uint8_t i = 0; i < 8; ++i) {
- byte = (byte << 1) | serial_read_pin();
- serial_delay();
- _delay_us(1);
- }
-
- return byte;
-}
-
-// Sends a byte with MSB ordering
-static
-void serial_write_byte(uint8_t data) {
- uint8_t b = 8;
- serial_output();
- while( b-- ) {
- if(data & (1 << b)) {
- serial_high();
- } else {
- serial_low();
- }
- serial_delay();
- }
-}
-
-// interrupt handle to be used by the slave device
-ISR(SERIAL_PIN_INTERRUPT) {
- sync_send();
-
- uint8_t checksum = 0;
- for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
- serial_write_byte(serial_slave_buffer[i]);
- sync_send();
- checksum += serial_slave_buffer[i];
- }
- serial_write_byte(checksum);
- sync_send();
-
- // wait for the sync to finish sending
- serial_delay();
-
- // read the middle of pulses
- _delay_us(SERIAL_DELAY/2);
-
- uint8_t checksum_computed = 0;
- for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
- serial_master_buffer[i] = serial_read_byte();
- sync_send();
- checksum_computed += serial_master_buffer[i];
- }
- uint8_t checksum_received = serial_read_byte();
- sync_send();
-
- serial_input(); // end transaction
-
- if ( checksum_computed != checksum_received ) {
- status |= SLAVE_DATA_CORRUPT;
- } else {
- status &= ~SLAVE_DATA_CORRUPT;
- }
-}
-
-inline
-bool serial_slave_DATA_CORRUPT(void) {
- return status & SLAVE_DATA_CORRUPT;
-}
-
-// Copies the serial_slave_buffer to the master and sends the
-// serial_master_buffer to the slave.
-//
-// Returns:
-// 0 => no error
-// 1 => slave did not respond
-int serial_update_buffers(void) {
- // this code is very time dependent, so we need to disable interrupts
- cli();
-
- // signal to the slave that we want to start a transaction
- serial_output();
- serial_low();
- _delay_us(1);
-
- // wait for the slaves response
- serial_input();
- serial_high();
- _delay_us(SERIAL_DELAY);
-
- // check if the slave is present
- if (serial_read_pin()) {
- // slave failed to pull the line low, assume not present
- sei();
- return 1;
- }
-
- // if the slave is present syncronize with it
- sync_recv();
-
- uint8_t checksum_computed = 0;
- // receive data from the slave
- for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
- serial_slave_buffer[i] = serial_read_byte();
- sync_recv();
- checksum_computed += serial_slave_buffer[i];
- }
- uint8_t checksum_received = serial_read_byte();
- sync_recv();
-
- if (checksum_computed != checksum_received) {
- sei();
- return 1;
- }
-
- uint8_t checksum = 0;
- // send data to the slave
- for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
- serial_write_byte(serial_master_buffer[i]);
- sync_recv();
- checksum += serial_master_buffer[i];
- }
- serial_write_byte(checksum);
- sync_recv();
-
- // always, release the line when not in use
- serial_output();
- serial_high();
-
- sei();
- return 0;
-}
-
-#endif
diff --git a/keyboards/zen/serial.h b/keyboards/zen/serial.h
deleted file mode 100644
index 15fe4db7b4c..00000000000
--- a/keyboards/zen/serial.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef MY_SERIAL_H
-#define MY_SERIAL_H
-
-#include "config.h"
-#include
-
-/* TODO: some defines for interrupt setup */
-#define SERIAL_PIN_DDR DDRD
-#define SERIAL_PIN_PORT PORTD
-#define SERIAL_PIN_INPUT PIND
-#define SERIAL_PIN_MASK _BV(PD0)
-#define SERIAL_PIN_INTERRUPT INT0_vect
-
-#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
-#define SERIAL_MASTER_BUFFER_LENGTH 1
-
-// Buffers for master - slave communication
-extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
-extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
-
-void serial_master_init(void);
-void serial_slave_init(void);
-int serial_update_buffers(void);
-bool serial_slave_data_corrupt(void);
-
-#endif
diff --git a/keyboards/zen/split_rgb.c b/keyboards/zen/split_rgb.c
deleted file mode 100644
index 6d7cb44cf0d..00000000000
--- a/keyboards/zen/split_rgb.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include
-#include
-#include "split_util.h"
-#include "progmem.h"
-#include "print.h"
-#include "rgblight.h"
-
-#ifdef USE_I2C
-# include "i2c.h"
-#else // USE_SERIAL
-# include "serial.h"
-#endif
-
-
-rgblight_config_t rgblight_config;
-
-void rgblight_slave_update(void) {
- //rgblight_effect_christmas();
-}
-
-
-void rgblight_set(void) {
- if (rgblight_config.enable) {
- #ifdef RGBW
- ws2812_setleds_rgbw(led, RGBLED_NUM);
- #else
- ws2812_setleds(led, RGBLED_NUM);
- #endif
- } else {
- for (uint8_t i = 0; i < RGBLED_NUM; i++) {
- led[i].r = 0;
- led[i].g = 0;
- led[i].b = 0;
- }
- #ifdef RGBW
- ws2812_setleds_rgbw(led, RGBLED_NUM);
- #else
- ws2812_setleds(led, RGBLED_NUM);
- #endif
- }
-}
diff --git a/keyboards/zen/split_rgb.h b/keyboards/zen/split_rgb.h
deleted file mode 100644
index 5f552890afd..00000000000
--- a/keyboards/zen/split_rgb.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef SPLIT_RGB_H
-#define SPLIT_RGB_H
-
-void rgblight_slave_update(void);
-
-#endif
diff --git a/keyboards/zen/split_util.c b/keyboards/zen/split_util.c
deleted file mode 100644
index 346cbc90894..00000000000
--- a/keyboards/zen/split_util.c
+++ /dev/null
@@ -1,86 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include "split_util.h"
-#include "matrix.h"
-#include "keyboard.h"
-#include "config.h"
-#include "timer.h"
-
-#ifdef USE_I2C
-# include "i2c.h"
-#else
-# include "serial.h"
-#endif
-
-volatile bool isLeftHand = true;
-
-static void setup_handedness(void) {
- #ifdef EE_HANDS
- isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
- #else
- // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
- #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
- isLeftHand = !has_usb();
- #else
- isLeftHand = has_usb();
- #endif
- #endif
-}
-
-static void keyboard_master_setup(void) {
-#ifdef USE_I2C
- i2c_master_init();
-#ifdef SSD1306OLED
- matrix_master_OLED_init ();
-#endif
-#else
- serial_master_init();
-#endif
-}
-
-static void keyboard_slave_setup(void) {
- timer_init();
-#ifdef USE_I2C
- i2c_slave_init(SLAVE_I2C_ADDRESS);
-#else
- serial_slave_init();
-#endif
-}
-
-bool has_usb(void) {
- USBCON |= (1 << OTGPADE); //enables VBUS pad
- _delay_us(5);
- return (USBSTA & (1<
-#include "eeconfig.h"
-
-#define SLAVE_I2C_ADDRESS 0x32
-
-extern volatile bool isLeftHand;
-
-// slave version of matix scan, defined in matrix.c
-void matrix_slave_scan(void);
-
-void split_keyboard_setup(void);
-bool has_usb(void);
-void keyboard_slave_loop(void);
-
-void matrix_master_OLED_init (void);
-
-#endif
diff --git a/keyboards/zen/zen.h b/keyboards/zen/zen.h
index 56fc64fe26b..cee7652d628 100644
--- a/keyboards/zen/zen.h
+++ b/keyboards/zen/zen.h
@@ -1,7 +1,8 @@
-#ifndef ZEN_H
-#define ZEN_H
-
-#include "rev1.h"
-#include "quantum.h"
+#pragma once
+#if KEYBOARD_zen_rev1
+ #include "rev1.h"
+#elif KEYBOARD_zen_rev2
+ #include "rev2.h"
#endif
+#include "quantum.h"
From d0fb7005d51be7c876e63e87778d080c8a733a13 Mon Sep 17 00:00:00 2001
From: Alex Ong
Date: Tue, 16 Apr 2019 05:58:03 +1000
Subject: [PATCH 3/3] Eager pk/pr optimization (#5621)
* Optimizations to eager_pk
* eager_pr also uses changed boolean now.
---
quantum/debounce/eager_pk.c | 89 ++++++++++++++++---------------------
quantum/debounce/eager_pr.c | 74 ++++++++++++++----------------
2 files changed, 72 insertions(+), 91 deletions(-)
diff --git a/quantum/debounce/eager_pk.c b/quantum/debounce/eager_pk.c
index b8ad09cee30..aa0f63a9d4e 100644
--- a/quantum/debounce/eager_pk.c
+++ b/quantum/debounce/eager_pk.c
@@ -24,23 +24,21 @@ No further inputs are accepted until DEBOUNCE milliseconds have occurred.
#include
#ifndef DEBOUNCE
- #define DEBOUNCE 5
+# define DEBOUNCE 5
#endif
-
#if (MATRIX_COLS <= 8)
-# define ROW_SHIFTER ((uint8_t)1)
+# define ROW_SHIFTER ((uint8_t)1)
#elif (MATRIX_COLS <= 16)
-# define ROW_SHIFTER ((uint16_t)1)
+# define ROW_SHIFTER ((uint16_t)1)
#elif (MATRIX_COLS <= 32)
-# define ROW_SHIFTER ((uint32_t)1)
+# define ROW_SHIFTER ((uint32_t)1)
#endif
-
-
#define debounce_counter_t uint8_t
static debounce_counter_t *debounce_counters;
+static bool counters_need_update;
#define DEBOUNCE_ELAPSED 251
#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1)
@@ -48,39 +46,39 @@ static debounce_counter_t *debounce_counters;
void update_debounce_counters(uint8_t num_rows, uint8_t current_time);
void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time);
-//we use num_rows rather than MATRIX_ROWS to support split keyboards
-void debounce_init(uint8_t num_rows)
-{
- debounce_counters = (debounce_counter_t*)malloc(num_rows*MATRIX_COLS * sizeof(debounce_counter_t));
- int i = 0;
- for (uint8_t r = 0; r < num_rows; r++)
- {
- for (uint8_t c = 0; c < MATRIX_COLS; c++)
- {
+// we use num_rows rather than MATRIX_ROWS to support split keyboards
+void debounce_init(uint8_t num_rows) {
+ debounce_counters = (debounce_counter_t *)malloc(num_rows * MATRIX_COLS * sizeof(debounce_counter_t));
+ int i = 0;
+ for (uint8_t r = 0; r < num_rows; r++) {
+ for (uint8_t c = 0; c < MATRIX_COLS; c++) {
debounce_counters[i++] = DEBOUNCE_ELAPSED;
}
}
}
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
-{
+void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
uint8_t current_time = timer_read() % MAX_DEBOUNCE;
- update_debounce_counters(num_rows, current_time);
- transfer_matrix_values(raw, cooked, num_rows, current_time);
+ if (counters_need_update) {
+ update_debounce_counters(num_rows, current_time);
+ }
+
+ if (changed) {
+ transfer_matrix_values(raw, cooked, num_rows, current_time);
+ }
}
-//If the current time is > debounce counter, set the counter to enable input.
-void update_debounce_counters(uint8_t num_rows, uint8_t current_time)
-{
+// If the current time is > debounce counter, set the counter to enable input.
+void update_debounce_counters(uint8_t num_rows, uint8_t current_time) {
+ counters_need_update = false;
debounce_counter_t *debounce_pointer = debounce_counters;
- for (uint8_t row = 0; row < num_rows; row++)
- {
- for (uint8_t col = 0; col < MATRIX_COLS; col++)
- {
- if (*debounce_pointer != DEBOUNCE_ELAPSED)
- {
+ for (uint8_t row = 0; row < num_rows; row++) {
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ if (*debounce_pointer != DEBOUNCE_ELAPSED) {
if (TIMER_DIFF(current_time, *debounce_pointer, MAX_DEBOUNCE) >= DEBOUNCE) {
*debounce_pointer = DEBOUNCE_ELAPSED;
+ } else {
+ counters_need_update = true;
}
}
debounce_pointer++;
@@ -89,33 +87,22 @@ void update_debounce_counters(uint8_t num_rows, uint8_t current_time)
}
// upload from raw_matrix to final matrix;
-void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time)
-{
+void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time) {
debounce_counter_t *debounce_pointer = debounce_counters;
- for (uint8_t row = 0; row < num_rows; row++)
- {
- matrix_row_t existing_row = cooked[row];
- matrix_row_t raw_row = raw[row];
-
- for (uint8_t col = 0; col < MATRIX_COLS; col++)
- {
+ for (uint8_t row = 0; row < num_rows; row++) {
+ matrix_row_t delta = raw[row] ^ cooked[row];
+ matrix_row_t existing_row = cooked[row];
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
matrix_row_t col_mask = (ROW_SHIFTER << col);
- bool final_value = raw_row & col_mask;
- bool existing_value = existing_row & col_mask;
- if (*debounce_pointer == DEBOUNCE_ELAPSED &&
- (existing_value != final_value))
- {
- *debounce_pointer = current_time;
- existing_row ^= col_mask; //flip the bit.
+ if ((delta & col_mask) && *debounce_pointer == DEBOUNCE_ELAPSED) {
+ *debounce_pointer = current_time;
+ counters_need_update = true;
+ existing_row ^= col_mask; // flip the bit.
}
debounce_pointer++;
}
cooked[row] = existing_row;
- }
-}
-
-bool debounce_active(void)
-{
- return true;
+ }
}
+bool debounce_active(void) { return true; }
diff --git a/quantum/debounce/eager_pr.c b/quantum/debounce/eager_pr.c
index 9eb9480a798..5b460f6630a 100644
--- a/quantum/debounce/eager_pr.c
+++ b/quantum/debounce/eager_pr.c
@@ -24,13 +24,13 @@ No further inputs are accepted until DEBOUNCE milliseconds have occurred.
#include
#ifndef DEBOUNCE
- #define DEBOUNCE 5
+# define DEBOUNCE 5
#endif
-
#define debounce_counter_t uint8_t
static debounce_counter_t *debounce_counters;
+static bool counters_need_update;
#define DEBOUNCE_ELAPSED 251
#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1)
@@ -38,33 +38,35 @@ static debounce_counter_t *debounce_counters;
void update_debounce_counters(uint8_t num_rows, uint8_t current_time);
void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time);
-//we use num_rows rather than MATRIX_ROWS to support split keyboards
-void debounce_init(uint8_t num_rows)
-{
- debounce_counters = (debounce_counter_t*)malloc(num_rows*sizeof(debounce_counter_t));
- for (uint8_t r = 0; r < num_rows; r++)
- {
+// we use num_rows rather than MATRIX_ROWS to support split keyboards
+void debounce_init(uint8_t num_rows) {
+ debounce_counters = (debounce_counter_t *)malloc(num_rows * sizeof(debounce_counter_t));
+ for (uint8_t r = 0; r < num_rows; r++) {
debounce_counters[r] = DEBOUNCE_ELAPSED;
}
}
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
-{
+void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
uint8_t current_time = timer_read() % MAX_DEBOUNCE;
- update_debounce_counters(num_rows, current_time);
- transfer_matrix_values(raw, cooked, num_rows, current_time);
+ if (counters_need_update) {
+ update_debounce_counters(num_rows, current_time);
+ }
+
+ if (changed) {
+ transfer_matrix_values(raw, cooked, num_rows, current_time);
+ }
}
-//If the current time is > debounce counter, set the counter to enable input.
-void update_debounce_counters(uint8_t num_rows, uint8_t current_time)
-{
+// If the current time is > debounce counter, set the counter to enable input.
+void update_debounce_counters(uint8_t num_rows, uint8_t current_time) {
+ counters_need_update = false;
debounce_counter_t *debounce_pointer = debounce_counters;
- for (uint8_t row = 0; row < num_rows; row++)
- {
- if (*debounce_pointer != DEBOUNCE_ELAPSED)
- {
+ for (uint8_t row = 0; row < num_rows; row++) {
+ if (*debounce_pointer != DEBOUNCE_ELAPSED) {
if (TIMER_DIFF(current_time, *debounce_pointer, MAX_DEBOUNCE) >= DEBOUNCE) {
*debounce_pointer = DEBOUNCE_ELAPSED;
+ } else {
+ counters_need_update = true;
}
}
debounce_pointer++;
@@ -72,29 +74,21 @@ void update_debounce_counters(uint8_t num_rows, uint8_t current_time)
}
// upload from raw_matrix to final matrix;
-void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time)
-{
+void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time) {
debounce_counter_t *debounce_pointer = debounce_counters;
- for (uint8_t row = 0; row < num_rows; row++)
- {
- matrix_row_t existing_row = cooked[row];
- matrix_row_t raw_row = raw[row];
-
- //determine new value basd on debounce pointer + raw value
- if (*debounce_pointer == DEBOUNCE_ELAPSED &&
- (existing_row != raw_row))
- {
- *debounce_pointer = current_time;
- existing_row = raw_row;
+ for (uint8_t row = 0; row < num_rows; row++) {
+ matrix_row_t existing_row = cooked[row];
+ matrix_row_t raw_row = raw[row];
+
+ // determine new value basd on debounce pointer + raw value
+ if (*debounce_pointer == DEBOUNCE_ELAPSED && (existing_row != raw_row)) {
+ *debounce_pointer = current_time;
+ cooked[row] = raw_row;
+ counters_need_update = true;
}
- cooked[row] = existing_row;
-
+
debounce_pointer++;
- }
-}
-
-bool debounce_active(void)
-{
- return true;
+ }
}
+bool debounce_active(void) { return true; }