Merge remote-tracking branch 'origin/master' into develop

Resolved Conflicts:
	keyboards/checkerboards/nop60/info.json
This commit is contained in:
Zach White 2021-07-14 10:30:28 -07:00
commit 44d322623e
168 changed files with 10369 additions and 1476 deletions

View file

@ -2,101 +2,106 @@
"keyboard_name": "Ergonomic Vertical Keyboard (EVK) version 1.3 with Teensy 2.0",
"url": "https://github.com/YangPiCui/ErgonomicVerticalKeyboard",
"maintainer": "YangPiCui",
"width": 22.75,
"height": 8,
"width": 18.2,
"height": 6.4,
"layouts": {
"LAYOUT": {
"layout": [
{"label":"k0A", "x":0, "y":0.5, "w":1.25, "h":1.25},
{"label":"k0B", "x":1.25, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0C", "x":2.5, "y":0, "w":1.25, "h":1.25},
{"label":"k0D", "x":3.75, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0E", "x":5, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0F", "x":6.25, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0G", "x":8.75, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0H", "x":10, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0I", "x":11.25, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0J", "x":12.5, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0K", "x":15.25, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0L", "x":16.5, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0M", "x":17.75, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0N", "x":19, "y":0, "w":1.25, "h":1.25},
{"label":"k0O", "x":20.25, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0P", "x":21.5, "y":0.5, "w":1.25, "h":1.25},
{"label":"k1A", "x":0, "y":1.75, "w":1.25, "h":1.25},
{"label":"k1B", "x":1.25, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1C", "x":2.5, "y":1.25, "w":1.25, "h":1.25},
{"label":"k1D", "x":3.75, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1E", "x":5, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1F", "x":6.25, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1G", "x":8.75, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1H", "x":10, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1I", "x":11.25, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1J", "x":12.5, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1K", "x":15.25, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1L", "x":16.5, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1M", "x":17.75, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1N", "x":19, "y":1.25, "w":1.25, "h":1.25},
{"label":"k1O", "x":20.25, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1P", "x":21.5, "y":1.75, "w":1.25, "h":1.25},
{"label":"k2A", "x":0, "y":3, "w":1.25, "h":1.25},
{"label":"k2B", "x":1.25, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2C", "x":2.5, "y":2.5, "w":1.25, "h":1.25},
{"label":"k2D", "x":3.75, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2E", "x":5, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2F", "x":6.25, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2G", "x":8.75, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2H", "x":10, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2I", "x":11.25, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2J", "x":12.5, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2K", "x":15.25, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2L", "x":16.5, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2M", "x":17.75, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2N", "x":19, "y":2.5, "w":1.25, "h":1.25},
{"label":"k2O", "x":20.25, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2P", "x":21.5, "y":3, "w":1.25, "h":1.25},
{"label":"k3A", "x":0, "y":4.25, "w":1.25, "h":1.25},
{"label":"k3B", "x":1.25, "y":4, "w":1.25, "h":1.25},
{"label":"k3C", "x":2.5, "y":3.75, "w":1.25, "h":1.25},
{"label":"k3D", "x":3.75, "y":4, "w":1.25, "h":1.25},
{"label":"k3E", "x":5, "y":4, "w":1.25, "h":1.25},
{"label":"k3G", "x":8.75, "y":4, "w":1.25, "h":1.25},
{"label":"k3H", "x":10, "y":4, "w":1.25, "h":1.25},
{"label":"k3I", "x":11.25, "y":4, "w":1.25, "h":1.25},
{"label":"k3J", "x":12.5, "y":4, "w":1.25, "h":1.25},
{"label":"k3L", "x":16.5, "y":4, "w":1.25, "h":1.25},
{"label":"k3M", "x":17.75, "y":4, "w":1.25, "h":1.25},
{"label":"k3N", "x":19, "y":3.75, "w":1.25, "h":1.25},
{"label":"k3O", "x":20.25, "y":4, "w":1.25, "h":1.25},
{"label":"k3P", "x":21.5, "y":4.25, "w":1.25, "h":1.25},
{"label":"k4A", "x":0, "y":5.5, "w":1.25, "h":1.25},
{"label":"k4B", "x":1.25, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4C", "x":2.5, "y":5, "w":1.25, "h":1.25},
{"label":"k4D", "x":3.75, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4E", "x":5, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4F", "x":6.5, "y":5.5, "w":1.25, "h":1.25},
{"label":"k4G", "x":8.75, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4H", "x":10, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4I", "x":11.25, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4J", "x":12.5, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4K", "x":15, "y":5.5, "w":1.25, "h":1.25},
{"label":"k4L", "x":16.5, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4M", "x":17.75, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4N", "x":19, "y":5, "w":1.25, "h":1.25},
{"label":"k4O", "x":20.25, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4P", "x":21.5, "y":5.5, "w":1.25, "h":1.25},
{"label":"k5B", "x":1.25, "y":6.5, "w":1.25, "h":1.25},
{"label":"k5C", "x":2.5, "y":6.25, "w":1.25, "h":1.25},
{"label":"k5E", "x":5.25, "y":6.75, "w":1.25, "h":1.25},
{"label":"k5F", "x":6.55, "y":6.75, "w":1.25, "h":1.25},
{"label":"k5G", "x":8.75, "y":6.5, "w":1.25, "h":1.25},
{"label":"k5H", "x":10, "y":6.5, "w":1.25, "h":1.25},
{"label":"k5I", "x":11.25, "y":6.5, "w":1.25, "h":1.25},
{"label":"k5J", "x":12.5, "y":6.5, "w":1.25, "h":1.25},
{"label":"k5K", "x":15, "y":6.75, "w":1.25, "h":1.25},
{"label":"k5L", "x":16.25, "y":6.75, "w":1.25, "h":1.25},
{"label":"k5N", "x":19, "y":6.25, "w":1.25, "h":1.25},
{"label":"k5O", "x":20.25, "y":6.5, "w":1.25, "h":1.25}
{"label":"k0A", "x":0, "y":0.4},
{"label":"k0B", "x":1, "y":0.2},
{"label":"k0C", "x":2, "y":0},
{"label":"k0D", "x":3, "y":0.2},
{"label":"k0E", "x":4, "y":0.2},
{"label":"k0F", "x":5, "y":0.2},
{"label":"k0G", "x":7, "y":0.2},
{"label":"k0H", "x":8, "y":0.2},
{"label":"k0I", "x":9, "y":0.2},
{"label":"k0J", "x":10, "y":0.2},
{"label":"k0K", "x":12.2, "y":0.2},
{"label":"k0L", "x":13.2, "y":0.2},
{"label":"k0M", "x":14.2, "y":0.2},
{"label":"k0N", "x":15.2, "y":0},
{"label":"k0O", "x":16.2, "y":0.2},
{"label":"k0P", "x":17.2, "y":0.4},
{"label":"k1A", "x":0, "y":1.4},
{"label":"k1B", "x":1, "y":1.2},
{"label":"k1C", "x":2, "y":1},
{"label":"k1D", "x":3, "y":1.2},
{"label":"k1E", "x":4, "y":1.2},
{"label":"k1F", "x":5, "y":1.2},
{"label":"k1G", "x":7, "y":1.2},
{"label":"k1H", "x":8, "y":1.2},
{"label":"k1I", "x":9, "y":1.2},
{"label":"k1J", "x":10, "y":1.2},
{"label":"k1K", "x":12.2, "y":1.2},
{"label":"k1L", "x":13.2, "y":1.2},
{"label":"k1M", "x":14.2, "y":1.2},
{"label":"k1N", "x":15.2, "y":1},
{"label":"k1O", "x":16.2, "y":1.2},
{"label":"k1P", "x":17.2, "y":1.4},
{"label":"k2A", "x":0, "y":2.4},
{"label":"k2B", "x":1, "y":2.2},
{"label":"k2C", "x":2, "y":2},
{"label":"k2D", "x":3, "y":2.2},
{"label":"k2E", "x":4, "y":2.2},
{"label":"k2F", "x":5, "y":2.2},
{"label":"k2G", "x":7, "y":2.2},
{"label":"k2H", "x":8, "y":2.2},
{"label":"k2I", "x":9, "y":2.2},
{"label":"k2J", "x":10, "y":2.2},
{"label":"k2K", "x":12.2, "y":2.2},
{"label":"k2L", "x":13.2, "y":2.2},
{"label":"k2M", "x":14.2, "y":2.2},
{"label":"k2N", "x":15.2, "y":2},
{"label":"k2O", "x":16.2, "y":2.2},
{"label":"k2P", "x":17.2, "y":2.4},
{"label":"k3A", "x":0, "y":3.4},
{"label":"k3B", "x":1, "y":3.2},
{"label":"k3C", "x":2, "y":3},
{"label":"k3D", "x":3, "y":3.2},
{"label":"k3E", "x":4, "y":3.2},
{"label":"k3G", "x":7, "y":3.2},
{"label":"k3H", "x":8, "y":3.2},
{"label":"k3I", "x":9, "y":3.2},
{"label":"k3J", "x":10, "y":3.2},
{"label":"k3L", "x":13.2, "y":3.2},
{"label":"k3M", "x":14.2, "y":3.2},
{"label":"k3N", "x":15.2, "y":3},
{"label":"k3O", "x":16.2, "y":3.2},
{"label":"k3P", "x":17.2, "y":3.4},
{"label":"k4A", "x":0, "y":4.4},
{"label":"k4B", "x":1, "y":4.2},
{"label":"k4C", "x":2, "y":4},
{"label":"k4D", "x":3, "y":4.2},
{"label":"k4E", "x":4, "y":4.2},
{"label":"k4F", "x":5.2, "y":4.4},
{"label":"k4G", "x":7, "y":4.2},
{"label":"k4H", "x":8, "y":4.2},
{"label":"k4I", "x":9, "y":4.2},
{"label":"k4J", "x":10, "y":4.2},
{"label":"k4K", "x":12, "y":4.4},
{"label":"k4L", "x":13.2, "y":4.2},
{"label":"k4M", "x":14.2, "y":4.2},
{"label":"k4N", "x":15.2, "y":4},
{"label":"k4O", "x":16.2, "y":4.2},
{"label":"k4P", "x":17.2, "y":4.4},
{"label":"k5B", "x":1, "y":5.2},
{"label":"k5C", "x":2, "y":5},
{"label":"k5E", "x":4.2, "y":5.4},
{"label":"k5F", "x":5.24, "y":5.4},
{"label":"k5G", "x":7, "y":5.2},
{"label":"k5H", "x":8, "y":5.2},
{"label":"k5I", "x":9, "y":5.2},
{"label":"k5J", "x":10, "y":5.2},
{"label":"k5K", "x":12, "y":5.4},
{"label":"k5L", "x":13, "y":5.4},
{"label":"k5N", "x":15.2, "y":5},
{"label":"k5O", "x":16.2, "y":5.2}
]
}
}

View file

@ -39,21 +39,22 @@
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define MATRIX_ROW_PINS { D0, D4, C6, D7, E6, B4, B5, B7, D5, C7, F1, F0 }
#define MATRIX_ROW_PINS { D2, D4, C6, D7, E6, B4, B5, B7, D5, C7, F1, F0 }
#define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6, F5, F4, B0 }
#define DIODE_DIRECTION COL2ROW
#define RGB_DI_PIN D1
#define LAYER_STATE_8BIT
#define USB_POLLING_INTERVAL_MS 1 //1000Hz polling rate
#define QMK_KEYS_PER_SCAN 12 // moar gaming code
#define RGB_DI_PIN D3
#ifdef RGB_DI_PIN
#define RGBLED_NUM 20
#define RGBLED_NUM 7
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
/*== all animations enable ==*/
#define RGBLIGHT_ANIMATIONS
// #define RGBLIGHT_ANIMATIONS
// /*== or choose animations ==*/
// #define RGBLIGHT_EFFECT_BREATHING
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD

View file

@ -0,0 +1,198 @@
/* Copyright 2021 BB-66
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
bool is_alt_tab_active = false;
uint16_t alt_tab_timer = 0;
char wpm_str[4];
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
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_PAUS, KC_PSCR, KC_SLCK, KC_ESC,
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_NLCK, KC_KP_SLASH, KC_KP_ASTERISK, KC_KP_MINUS,
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_KP_7, KC_KP_8, KC_KP_9, KC_KP_PLUS,
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_ENT, KC_KP_4, KC_KP_5, KC_KP_6,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_ENTER,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_KP_0, KC_KP_DOT
),
[1] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO
),
[2] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO
),
[3] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO
),
};
#ifdef OLED_DRIVER_ENABLE
// WPM-responsive animation stuff here
# define IDLE_FRAMES 5
# define IDLE_SPEED 20 // below this wpm value your animation will idle
// #define PREP_FRAMES 1 // uncomment if >1
# define TAP_FRAMES 2
# define TAP_SPEED 40 // above this wpm value typing animation to trigger
# define ANIM_FRAME_DURATION 200 // how long each frame lasts in ms
// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing
# define ANIM_SIZE 610 // number of bytes in array, minimize for adequate firmware size, max is 1024
uint32_t anim_timer = 0;
uint32_t anim_sleep = 0;
uint8_t current_idle_frame = 0;
// uint8_t current_prep_frame = 0; // uncomment if PREP_FRAMES >1
uint8_t current_tap_frame = 0;
// Code containing pixel art, contains:
// 5 idle frames, 1 prep frame, and 2 tap frames
// To make your own pixel art:
// save a png/jpeg of an 128x32 image (resource: https://www.pixilart.com/draw )
// follow this guide up to and including "CONVERT YOUR IMAGE" https://docs.splitkb.com/hc/en-us/articles/360013811280-How-do-I-convert-an-image-for-use-on-an-OLED-display-
// replace numbers in brackets with your own
// if you start getting errors when compiling make sure you didn't accedentally delete a bracket
static void render_anim(void) {
static const char PROGMEM idle[IDLE_FRAMES][ANIM_SIZE] = {{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, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x18, 0x04, 0x02, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xc1, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x40, 0x80, 0x80, 0x40, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
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, 0xe0, 0x18, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x83, 0x40, 0x40, 0x40, 0x40, 0x20, 0x21, 0x21, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x30, 0x40, 0x80, 0x80, 0x00, 0x00, 0x01, 0x86, 0x98, 0x60, 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, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x0f, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x41, 0x42, 0x24, 0x18, 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, 0x01, 0x01, 0x01, 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, 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, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xc1, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
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, 0xc0, 0x30, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x86, 0x86, 0x40, 0x40, 0x40, 0x40, 0x21, 0x22, 0x22, 0x20, 0x11, 0x11, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x30, 0x40, 0x80, 0x80, 0x00, 0x00, 0x01, 0x86, 0x98, 0x60, 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, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x0f, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x41, 0x42, 0x24, 0x18, 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, 0x01, 0x01, 0x01, 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, 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, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 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, 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, 0x7e, 0x82, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x60, 0x60, 0x00, 0x01, 0x01, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
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, 0xc0, 0x30, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x86, 0x86, 0x40, 0x40, 0x40, 0x40, 0x21, 0x22, 0x22, 0x20, 0x11, 0x11, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x30, 0x40, 0x80, 0x80, 0x00, 0x00, 0x01, 0x86, 0x98, 0x60, 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, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x0f, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x41, 0x42, 0x24, 0x18, 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, 0x01, 0x01, 0x01, 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, 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, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x34, 0xc4, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x40, 0x80, 0x80, 0x40, 0x00, 0x00, 0x30, 0x30, 0x00, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x04, 0x08, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
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, 0xe0, 0x18, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x83, 0x40, 0x40, 0x40, 0x40, 0x20, 0x21, 0x21, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x30, 0x40, 0x80, 0x80, 0x00, 0x00, 0x01, 0x86, 0x98, 0x60, 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, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x0f, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x41, 0x42, 0x24, 0x18, 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, 0x01, 0x01, 0x01, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x18, 0x04, 0x02, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0d, 0x31, 0xc1, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x04, 0x04, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x40, 0x80, 0x80, 0x40, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
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, 0xe0, 0x18, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x83, 0x40, 0x40, 0x40, 0x40, 0x20, 0x21, 0x21, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x30, 0x40, 0x80, 0x80, 0x00, 0x00, 0x01, 0x86, 0x98, 0x60, 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, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x0f, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x41, 0x42, 0x24, 0x18, 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, 0x01, 0x01, 0x01, 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}};
static const char PROGMEM prep[][ANIM_SIZE] = {{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, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xc1, 0x01, 0x01, 0x02, 0x02, 0x04, 0x84, 0x44, 0x44, 0x42, 0x82, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x40, 0x80, 0x80, 0x40, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x64, 0x18, 0x04, 0x12, 0xc2, 0xca, 0x24, 0x88, 0xf0, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
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, 0xe0, 0x18, 0x06, 0x01, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x02, 0x18, 0x19, 0x00, 0x05, 0xfe, 0x80, 0x83, 0x83, 0x40, 0x40, 0x40, 0x40, 0x20, 0x21, 0x21, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 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, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x0f, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 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}};
static const char PROGMEM tap[TAP_FRAMES][ANIM_SIZE] = {
{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, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xc1, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x40, 0x80, 0x80, 0x40, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x64, 0x18, 0x04, 0x12, 0xc2, 0xca, 0x24, 0x88, 0xf0, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
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, 0xe0, 0x18, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x83, 0x40, 0x40, 0x40, 0x40, 0x20, 0x21, 0x21, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 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, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x0f, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x41, 0x42, 0x24, 0x98, 0xc0, 0x88, 0x88, 0x8c, 0x9c, 0x1c, 0x1e, 0x0e, 0x06, 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, 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, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xc1, 0x01, 0x01, 0x02, 0x02, 0x04, 0x84, 0x44, 0x44, 0x42, 0x82, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x40, 0x80, 0x80, 0x40, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
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, 0xe0, 0x18, 0x06, 0x01, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x02, 0x18, 0x19, 0x00, 0x05, 0xfe, 0x80, 0x83, 0x83, 0x40, 0x40, 0x40, 0x40, 0x20, 0x21, 0x21, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x30, 0x40, 0x80, 0x80, 0x00, 0x00, 0x01, 0x86, 0x98, 0x60, 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, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x08, 0x0f, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0f, 0x0f, 0x07, 0x03, 0x03, 0x61, 0xf0, 0xf8, 0xfc, 0x60, 0x01, 0x01, 0x01, 0x3c, 0x78, 0xf8, 0xf0, 0x70, 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},
};
// assumes 1 frame prep stage
void animation_phase(void) {
if (get_current_wpm() <= IDLE_SPEED) {
current_idle_frame = (current_idle_frame + 1) % IDLE_FRAMES;
oled_write_raw_P(idle[abs((IDLE_FRAMES - 1) - current_idle_frame)], ANIM_SIZE);
}
if (get_current_wpm() > IDLE_SPEED && get_current_wpm() < TAP_SPEED) {
// oled_write_raw_P(prep[abs((PREP_FRAMES-1)-current_prep_frame)], ANIM_SIZE); // uncomment if IDLE_FRAMES >1
oled_write_raw_P(prep[0], ANIM_SIZE); // remove if IDLE_FRAMES >1
}
if (get_current_wpm() >= TAP_SPEED) {
current_tap_frame = (current_tap_frame + 1) % TAP_FRAMES;
oled_write_raw_P(tap[abs((TAP_FRAMES - 1) - current_tap_frame)], ANIM_SIZE);
}
}
if (get_current_wpm() != 000) {
oled_on(); // not essential but turns on animation OLED with any alpha keypress
if (timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
anim_timer = timer_read32();
animation_phase();
}
anim_sleep = timer_read32();
} else {
if (timer_elapsed32(anim_sleep) > OLED_TIMEOUT) {
oled_off();
} else {
if (timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
anim_timer = timer_read32();
animation_phase();
}
}
}
}
// Used to draw on to the oled screen
void oled_task_user(void) {
render_anim(); // renders pixelart
oled_set_cursor(0, 0); // sets cursor to (row, column) using charactar spacing (4 rows, 21 full columns on a 128x32 screen, anything more will overflow back to the top)
uint8_t n = get_current_wpm();
wpm_str[3] = '\0';
wpm_str[2] = '0' + n % 10;
wpm_str[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
wpm_str[0] = n / 10 ? '0' + n / 10 : ' ';
oled_write_P(PSTR("WPM:"), false);
oled_write(wpm_str, false);
led_t led_state = host_keyboard_led_state(); // caps lock stuff, prints CAPS on new line if caps led is on
oled_set_cursor(0, 1);
oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
oled_set_cursor(0, 2);
oled_write_P(led_state.num_lock ? PSTR("NUM") : PSTR(" "), false);
oled_set_cursor(4, 2);
oled_write_P(led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "), false);
oled_set_cursor(0, 3);
switch (get_highest_layer(layer_state)) {
case 0:
oled_write_P(PSTR("Base Layer\n"), false);
break;
case 1:
oled_write_P(PSTR("Base Enhanced\n"), false);
break;
case 2:
oled_write_P(PSTR("Gaming\n"), false);
break;
case 3:
oled_write_P(PSTR("Gaming Enh\n"), false);
break;
default:
oled_write_ln_P(PSTR("Undefined"), false);
}
oled_set_cursor(17, 3);
oled_write_P(PSTR("NKRO"), keymap_config.nkro);
}
#endif

View file

@ -0,0 +1,3 @@
VIA_ENABLE = yes
OLED_DRIVER_ENABLE = yes # OLED Driver Enable
WPM_ENABLE = yes # WPM counting Enable

View file

@ -0,0 +1,52 @@
/* Copyright 2021 BB-66
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
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_PAUS, KC_PSCR, KC_SLCK, KC_ESC,
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_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_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_ENT, KC_P4, KC_P5, KC_P6,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_P0, KC_PDOT
),
[1] = LAYOUT(
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_PAUS, KC_PSCR, KC_SLCK, KC_ESC,
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_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_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_ENT, KC_P4, KC_P5, KC_P6,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_P0, KC_PDOT
),
[2] = LAYOUT(
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_PAUS, KC_PSCR, KC_SLCK, KC_ESC,
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_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_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_ENT, KC_P4, KC_P5, KC_P6,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_P0, KC_PDOT
),
[3] = LAYOUT(
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_PAUS, KC_PSCR, KC_SLCK, KC_ESC,
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_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_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_ENT, KC_P4, KC_P5, KC_P6,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_P0, KC_PDOT
),
};

View file

@ -0,0 +1 @@
VIA_ENABLE = yes

View file

@ -1,10 +1,10 @@
# Marauder
90% hand-wired mechanical keyboard in an old Razer case; built around an Elite-C v3.1 controller.
90% hand-wired mechanical keyboard in an old Razer case; built around an Elite-C v3.1 controller. Features a 128x32 OLED screen and RGB.
[Build Log](https://imgur.com/a/TvsXpq5)
* Keyboard Maintainer: [%YOUR_NAME%](https://github.com/BB-66)
* Keyboard Maintainer: [BB-66](https://github.com/BB-66)
* Hardware Supported: Elite-C, Razer Marauder
Make example for this keyboard (after setting up your build environment):

View file

@ -10,8 +10,8 @@ BOOTLOADER = atmel-dfu
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
CONSOLE_ENABLE = no # Console for debug
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

View file

@ -80,7 +80,7 @@
{"label":"Alt", "x":10, "y":4},
{"label":"Prop", "x":11, "y":4},
{"label":"Ctrl", "x":12, "y":4},
{"label":"Esc", "x":13, "y":0}
{"label":"Esc", "x":13, "y":4}
]
}
}

View file

@ -1,4 +1,4 @@
# ortho5x13 handwired
# ortho5x14 handwired
Custom handwired ortho5x14 keyboard.

View file

@ -0,0 +1,33 @@
/*
* matrix.c testing macros
* MATRIX_DEBUG_SCAN: Measuring execution time of `matrix_scan()`
* MATRIX_DEBUG_DELAY: Observation of delay after `unselect_row()`
*/
#pragma once
#ifndef __ASSEMBLER__
#include <gpio.h>
static inline void setDebugPinOutput_Low(void) {
setPinOutput(MATRIX_DEBUG_PIN);
writePinLow(MATRIX_DEBUG_PIN);
}
#define MATRIX_DEBUG_PIN_INIT() setDebugPinOutput_Low()
#ifdef MATRIX_DEBUG_SCAN
# define MATRIX_DEBUG_SCAN_START() writePinHigh(MATRIX_DEBUG_PIN)
# define MATRIX_DEBUG_SCAN_END() writePinLow(MATRIX_DEBUG_PIN)
#else
# define MATRIX_DEBUG_SCAN_START()
# define MATRIX_DEBUG_SCAN_END()
#endif
#ifdef MATRIX_DEBUG_DELAY
# define MATRIX_DEBUG_DELAY_START() writePinHigh(MATRIX_DEBUG_PIN)
# define MATRIX_DEBUG_DELAY_END() writePinLow(MATRIX_DEBUG_PIN)
#else
# define MATRIX_DEBUG_DELAY_START()
# define MATRIX_DEBUG_DELAY_END()
#endif
#endif // __ASSEMBLER__

View file

@ -0,0 +1,108 @@
# matrix.c testing options
# set MATRIX_IO_DELAY macro
# make MTEST=mdelay0 symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
# make MTEST=mdelay=1 symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
# make MTEST=mdelay=10 symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
# set DEBUG_MATRIX_SCAN_RATE_ENABLE yes
# make MTEST=scan symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
# set MATRIX_DEBUG_DELAY and MATRIX_IO_DELAY macro
# make MTEST=matrix_debug_delay,mdelay0 symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
# set MATRIX_DEBUG_SCAN
# make MTEST=matrix_debug_scan symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
ifneq ($(strip $(MTEST)),)
define KEYBOARD_OPTION_PARSE
# parse 'consle', 'scan', 'no-scan', 'mdelay=?', 'mdelay0',
# 'adaptive_delay', 'always_delay', 'matrix_debug_delay', 'matrix_debug_scan'
$(if $(SHOW_PARSE),$(info parse .$1.)) #for debug 'make SHOW_PARSE=y ...'
ifeq ($(strip $1),console)
CONSOLE_ENABLE = yes
endif
ifeq ($(strip $1),scan)
DEBUG_MATRIX_SCAN_RATE_ENABLE = yes
endif
ifeq ($(strip $1),no-scan)
DEBUG_MATRIX_SCAN_RATE_ENABLE = no
endif
ifneq ($(filter mdelay=%,$1),)
MDELAY = $(patsubst mdelay=%,%,$1)
endif
ifeq ($(strip $1),mdelay0)
MDELAY = 0
endif
ifeq ($(strip $1),common_delay)
MATRIX_COMMON_DELAY = yes
endif
ifeq ($(strip $1),adaptive_delay)
ADAPTIVE_DELAY = yes
endif
ifeq ($(strip $1),adaptive_delay2)
ADAPTIVE_DELAY2 = yes
endif
ifeq ($(strip $1),adaptive_delay_fast)
ADAPTIVE_DELAY_FAST = yes
endif
ifeq ($(strip $1),always_delay)
ALWAYS_DELAY = yes
endif
ifeq ($(strip $1),matrix_debug_delay)
MATRIX_DEBUG_DELAY = yes
MATRIX_DEBUG_SCAN = no
endif
ifeq ($(strip $1),matrix_debug_scan)
MATRIX_DEBUG_DELAY = no
MATRIX_DEBUG_SCAN = yes
endif
endef # end of KEYMAP_OPTION_PARSE
COMMA=,
$(eval $(foreach A_OPTION_NAME,$(subst $(COMMA), ,$(MTEST)), \
$(call KEYBOARD_OPTION_PARSE,$(A_OPTION_NAME))))
endif
ifneq ($(strip $(MDELAY)),)
OPT_DEFS += -DMATRIX_IO_DELAY=$(strip $(MDELAY))
endif
ifeq ($(strip $(ADAPTIVE_DELAY)),yes)
OPT_DEFS += -DMATRIX_IO_DELAY_ADAPTIVE
endif
ifeq ($(strip $(ADAPTIVE_DELAY2)),yes)
OPT_DEFS += -DMATRIX_IO_DELAY_ADAPTIVE2
endif
ifeq ($(strip $(ADAPTIVE_DELAY_FAST)),yes)
OPT_DEFS += -DMATRIX_IO_DELAY_ADAPTIVE_FAST
endif
ifeq ($(strip $(ALWAYS_DELAY)),yes)
OPT_DEFS += -DMATRIX_IO_DELAY_ALWAYS
endif
ifeq ($(strip $(MATRIX_DEBUG_DELAY)),yes)
OPT_DEFS += -DMATRIX_DEBUG_DELAY
DEBUG_CONFIG = yes
endif
ifeq ($(strip $(MATRIX_DEBUG_SCAN)),yes)
OPT_DEFS += -DMATRIX_DEBUG_SCAN
DEBUG_CONFIG = yes
endif
ifeq ($(strip $(DEBUG_CONFIG)),yes)
# include "debug_config.h" from {promicro|proton_c}/config.h
OPT_DEFS += -DDEBUG_CONFIG
endif
ifeq ($(strip $(MATRIX_COMMON_DELAY)),yes)
# use matrix_output_unselect_delay() in matrix_common.c
OPT_DEFS += -DMATRIX_IO_DELAY_DEFAULT
endif
$(info -)
$(info - DEBUG_MATRIX_SCAN_RATE_ENABLE = $(DEBUG_MATRIX_SCAN_RATE_ENABLE))
$(info - CONSOLE_ENABLE = $(CONSOLE_ENABLE))
$(info - MDELAY = $(MDELAY))
$(info - MATRIX_COMMON_DELAY = $(MATRIX_COMMON_DELAY))
$(info - OPT_DEFS = $(OPT_DEFS))

View file

@ -0,0 +1,10 @@
#pragma once
// clang-format off
#if defined(__AVR__)
# define readPort(port) PINx_ADDRESS(port)
typedef uint8_t port_data_t;
#else
# define readPort(qmk_pin) palReadPort(PAL_PORT(qmk_pin))
typedef uint16_t port_data_t;
#endif

View file

@ -20,6 +20,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "matrix.h"
#include "debounce.h"
#include "quantum.h"
#ifndef readPort
# include "gpio_extr.h"
#endif
#ifndef MATRIX_DEBUG_PIN
# define MATRIX_DEBUG_PIN_INIT()
# define MATRIX_DEBUG_SCAN_START()
# define MATRIX_DEBUG_SCAN_END()
# define MATRIX_DEBUG_DELAY_START()
# define MATRIX_DEBUG_DELAY_END()
# define MATRIX_DEBUG_GAP()
#else
# define MATRIX_DEBUG_GAP() asm volatile("nop \n nop":::"memory")
#endif
#ifndef MATRIX_IO_DELAY_ALWAYS
# define MATRIX_IO_DELAY_ALWAYS 0
#endif
#ifdef DIRECT_PINS
static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
@ -28,16 +46,32 @@ static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
# ifdef MATRIX_MUL_SELECT
static const pin_t col_sel[MATRIX_COLS] = MATRIX_MUL_SEL;
# ifndef MATRIX_MUL_SELECT_DELAY
# define MATRIX_MUL_SELECT_DELAY 1
# endif
# endif
#endif
#ifdef MATRIX_IO_DELAY_PORTS
static const pin_t delay_ports[] = { MATRIX_IO_DELAY_PORTS };
static const port_data_t delay_masks[] = { MATRIX_IO_DELAY_MASKS };
# ifdef MATRIX_IO_DELAY_MULSEL
static const uint8_t delay_sel[] = { MATRIX_IO_DELAY_MULSEL };
# endif
#endif
/* matrix state(1:on, 0:off) */
extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values
static inline void setPinOutput_writeLow(pin_t pin) {
ATOMIC_BLOCK_FORCEON {
setPinOutput(pin);
writePinLow(pin);
}
}
static inline void setPinInputHigh_atomic(pin_t pin) {
ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); }
}
// matrix code
#ifdef DIRECT_PINS
@ -75,16 +109,13 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
#elif defined(DIODE_DIRECTION)
# if (DIODE_DIRECTION == COL2ROW)
static void select_row(uint8_t row) {
setPinOutput(row_pins[row]);
writePinLow(row_pins[row]);
}
static void select_row(uint8_t row) { setPinOutput_writeLow(row_pins[row]); }
static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); }
static void unselect_row(uint8_t row) { setPinInputHigh_atomic(row_pins[row]); }
static void unselect_rows(void) {
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
setPinInputHigh(row_pins[x]);
setPinInputHigh_atomic(row_pins[x]);
}
}
@ -95,7 +126,7 @@ static void init_pins(void) {
#endif
unselect_rows();
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
setPinInputHigh(col_pins[x]);
setPinInputHigh_atomic(col_pins[x]);
}
}
@ -103,16 +134,16 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
// Start with a clear matrix row
matrix_row_t current_row_value = 0;
// Select row and wait for row selecton to stabilize
// Select row
select_row(current_row);
matrix_io_delay();
matrix_output_select_delay();
// For each col...
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
// Select the col pin to read (active low)
#ifdef MATRIX_MUL_SELECT
writePin(MATRIX_MUL_SELECT,col_sel[col_index]);
__builtin_avr_delay_cycles(MATRIX_MUL_SELECT_DELAY);
waitInputPinDelay();
#endif
uint8_t pin_state = readPin(col_pins[col_index]);
@ -122,6 +153,60 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
// Unselect row
unselect_row(current_row);
#ifdef MATRIX_IO_DELAY_PORTS
if (current_row_value) { // wait for col signal to go HIGH
bool is_pressed;
do {
MATRIX_DEBUG_DELAY_START();
is_pressed = false;
for (uint8_t i = 0; i < sizeof(delay_ports)/sizeof(pin_t); i++ ) {
# ifdef MATRIX_IO_DELAY_MULSEL
writePin(MATRIX_MUL_SELECT, delay_sel[i]);
waitInputPinDelay();
# endif
is_pressed |= ( (readPort(delay_ports[i]) & delay_masks[i]) != delay_masks[i] );
}
MATRIX_DEBUG_DELAY_END();
} while (is_pressed);
}
#endif
#ifdef MATRIX_IO_DELAY_ADAPTIVE
if (current_row_value) { // wait for col signal to go HIGH
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
MATRIX_DEBUG_DELAY_START();
#ifdef MATRIX_MUL_SELECT
writePin(MATRIX_MUL_SELECT,col_sel[col_index]);
waitInputPinDelay();
#endif
while (readPin(col_pins[col_index]) == 0) {}
MATRIX_DEBUG_DELAY_END();
}
}
#endif
#ifdef MATRIX_IO_DELAY_ADAPTIVE2
if (current_row_value) { // wait for col signal to go HIGH
pin_t state;
do {
MATRIX_DEBUG_DELAY_START();
state = 0;
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
MATRIX_DEBUG_DELAY_END();
MATRIX_DEBUG_DELAY_START();
#ifdef MATRIX_MUL_SELECT
writePin(MATRIX_MUL_SELECT,col_sel[col_index]);
waitInputPinDelay();
#endif
state |= (readPin(col_pins[col_index]) == 0);
}
MATRIX_DEBUG_DELAY_END();
} while (state);
}
#endif
if (MATRIX_IO_DELAY_ALWAYS || current_row + 1 < MATRIX_ROWS) {
MATRIX_DEBUG_DELAY_START();
matrix_output_unselect_delay(); // wait for col signal to go HIGH
MATRIX_DEBUG_DELAY_END();
}
// If the row has changed, store the row and return the changed flag.
if (current_matrix[current_row] != current_row_value) {
@ -133,32 +218,29 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
# elif (DIODE_DIRECTION == ROW2COL)
static void select_col(uint8_t col) {
setPinOutput(col_pins[col]);
writePinLow(col_pins[col]);
}
static void select_col(uint8_t col) { setPinOutput_writeLow(col_pins[col]); }
static void unselect_col(uint8_t col) { setPinInputHigh(col_pins[col]); }
static void unselect_col(uint8_t col) { setPinInputHigh_atomic(col_pins[col]); }
static void unselect_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
setPinInputHigh(col_pins[x]);
setPinInputHigh_atomic(col_pins[x]);
}
}
static void init_pins(void) {
unselect_cols();
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
setPinInputHigh(row_pins[x]);
setPinInputHigh_atomic(row_pins[x]);
}
}
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
select_col(current_col);
matrix_io_delay();
matrix_output_select_delay();
// For each row...
for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
@ -184,6 +266,9 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
// Unselect col
unselect_col(current_col);
if (MATRIX_IO_DELAY_ALWAYS || current_col + 1 < MATRIX_COLS) {
matrix_output_unselect_delay(); // wait for col signal to go HIGH
}
return matrix_changed;
}
@ -195,7 +280,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
# error DIODE_DIRECTION is not defined!
#endif
void matrix_init_custom(void) {
void matrix_init(void) {
// initialize key pins
init_pins();
@ -205,22 +290,35 @@ void matrix_init_custom(void) {
matrix[i] = 0;
}
debounce_init(MATRIX_ROWS);
matrix_init_quantum();
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
uint8_t matrix_scan(void) {
bool changed = false;
MATRIX_DEBUG_PIN_INIT();
MATRIX_DEBUG_SCAN_START();
#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
// Set row, read cols
for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
changed |= read_cols_on_row(current_matrix, current_row);
changed |= read_cols_on_row(raw_matrix, current_row);
}
#elif (DIODE_DIRECTION == ROW2COL)
// Set col, read rows
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
changed |= read_rows_on_col(current_matrix, current_col);
changed |= read_rows_on_col(raw_matrix, current_col);
}
#endif
MATRIX_DEBUG_SCAN_END(); MATRIX_DEBUG_GAP();
return changed;
MATRIX_DEBUG_SCAN_START();
debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
MATRIX_DEBUG_SCAN_END(); MATRIX_DEBUG_GAP();
MATRIX_DEBUG_SCAN_START();
matrix_scan_quantum();
MATRIX_DEBUG_SCAN_END();
return (uint8_t)changed;
}

View file

@ -0,0 +1,200 @@
# Debug version matrix.c
This matrix.c is quantum/matrix.c with the following additions:
* Added the MATRIX_DEBUG_SCAN_{START/END} macro to measure the execution time of matrix_scan().
* Added the MATRIX_DEBUG_DELAY_{START/END} macro to measure delay time.
* Added the MATRIX_MUL_SELECT handling for symmetric70_proto.
## Compile
* Set MATRIX_IO_DELAY value
* `make MTEST=mdelay0 handwired/symmetric70_proto/promicro/normal:default:flash`
* `make MTEST=mdelay=1 handwired/symmetric70_proto/promicro/normal:default:flash`
* `make MTEST=mdelay=2 handwired/symmetric70_proto/promicro/normal:default:flash`
* `make MTEST=mdelay=3 handwired/symmetric70_proto/promicro/normal:default:flash`
* `make MTEST=mdelay=4 handwired/symmetric70_proto/promicro/normal:default:flash`
* `make MTEST=mdelay=5 handwired/symmetric70_proto/promicro/normal:default:flash`
* `make MTEST=mdelay=10 handwired/symmetric70_proto/promicro/normal:default:flash`
* `make MTEST=mdelay=20 handwired/symmetric70_proto/promicro/normal:default:flash`
* `make MTEST=mdelay=30 handwired/symmetric70_proto/promicro/normal:default:flash`
* Measure the execution time of matrix_scan()
* `make MTEST=matrix_debug_scan[,<other options>..] handwired/symmetric70_proto/promicro/normal:default:flash`
* Measure delay time.
* `make MTEST=matrix_debug_delay[,<other options>..] handwired/symmetric70_proto/promicro/normal:default:flash`
* Change the behavior of delay
* `make MTEST=matrix_debug_delay,always_delay handwired/symmetric70_proto/promicro/normal:default:flash`
* `make MTEST=matrix_debug_delay,adaptive_delay,mdelay0 handwired/symmetric70_proto/promicro/normal:default:flash`
* `make MTEST=matrix_debug_delay,adaptive_delay_fast,mdelay0 handwired/symmetric70_proto/promicro/normal:default:flash`
## Measurement result
### Pro Micro (ATmega32u4 16Mhz)
#### Default setting (show `matrix_scan()` time)
- `make MTEST=matrix_debug_scan handwired/symmetric70_proto/promicro/normal:default:flash`
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: matrix_scan()
- Execution time of matrix_scan() 503us
- Frequency of matrix scan 1.81kHz (551.0us)
![DS1Z_QuickPrint2](https://user-images.githubusercontent.com/2170248/115994477-0ba64400-a612-11eb-98ba-b8cc362f26ac.png)
#### Always call `matrix_output_unselect_delay()` (show `matrix_scan()` time, default MATRIX_IO_DELAY)
- `make MTEST=matrix_debug_scan,always_delay handwired/symmetric70_proto/promicro/normal:default:flash`
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: matrix_scan()
- Execution time of matrix_scan() 521us
- Frequency of matrix scan 1.76kHz (568.5us)
![DS1Z_QuickPrint1](https://user-images.githubusercontent.com/2170248/115994488-1660d900-a612-11eb-83b1-cd820607db03.png)
#### Adaptive delay (show `matrix_scan()` time, MATRIX_IO_DELAY = 0)
- `make MTEST=matrix_debug_scan,mdelay0,adaptive_delay handwired/symmetric70_proto/promicro/normal:default:flash`
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: matrix_scan()
- Execution time of matrix_scan() 383us
- Frequency of matrix scan 2.32kHz (431us)
![DS1Z_QuickPrint3](https://user-images.githubusercontent.com/2170248/115994939-034f0880-a614-11eb-861f-b83a31efa51a.png)
#### Adaptive delay (show delay time, MATRIX_IO_DELAY = 0)
- `make MTEST=matrix_debug_delay,mdelay0,adaptive_delay handwired/symmetric70_proto/promicro/normal:default:flash`
##### Press R0C1, R1C1 key
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: delay time
- Delay time 68us
- Frequency of matrix scan 1.77kHz (565us)
![DS1Z_QuickPrint55](https://user-images.githubusercontent.com/2170248/119561268-ead33900-bddf-11eb-9cc4-7e04826486cf.png)
#### Fast adaptive delay (show `matrix_scan()` time, MATRIX_IO_DELAY = 0)
- `make MTEST=matrix_debug_scan,mdelay0,adaptive_delay_fast handwired/symmetric70_proto/promicro/normal:default:flash`
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: matrix_scan()
- Execution time of matrix_scan() 382us
- Frequency of matrix scan 2.33kHz (428us)
![DS1Z_QuickPrint56](https://user-images.githubusercontent.com/2170248/119561280-eeff5680-bddf-11eb-9576-e4cf64751955.png)
#### Fast adaptive delay (show delay time, MATRIX_IO_DELAY = 0)
- `make MTEST=matrix_debug_delay,mdelay0,adaptive_delay_fast handwired/symmetric70_proto/promicro/normal:default:flash`
##### Press R0C1, R1C1 key
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: delay time
- Delay time 11us
- Frequency of matrix scan 2.21kHz (452us)
![DS1Z_QuickPrint57](https://user-images.githubusercontent.com/2170248/119561318-faeb1880-bddf-11eb-8592-694f9ecb2248.png)
### Proton C (STM32F303 72MHz)
#### Default setting (show `matrix_scan()` time)
- `make MTEST=matrix_debug_scan handwired/symmetric70_proto/proton_c/normal:default:flash`
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: matrix_scan()
- Execution time of matrix_scan() 210us
- Frequency of matrix scan 4.35kHz (230.0us)
![DS1Z_QuickPrint16](https://user-images.githubusercontent.com/2170248/116131295-2ad2cd80-a707-11eb-8d0a-6f7912456e03.png)
#### Always call `matrix_output_unselect_delay()` (show `matrix_scan()` time, default MATRIX_IO_DELAY)
- `make MTEST=matrix_debug_scan,always_delay handwired/symmetric70_proto/proton_c/normal:default:flash`
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: matrix_scan()
- Execution time of matrix_scan() 242us
- Frequency of matrix scan 3.85kHz (260.0us)
![DS1Z_QuickPrint17](https://user-images.githubusercontent.com/2170248/116131308-31f9db80-a707-11eb-8db7-d1960fa7b068.png)
#### Adaptive delay (show `matrix_scan()` time, MATRIX_IO_DELAY = 0)
- `make MTEST=matrix_debug_scan,mdelay0,adaptive_delay handwired/symmetric70_proto/proton_c/normal:default:flash`
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: matrix_scan()
- Execution time of matrix_scan() 76.4us
- Frequency of matrix scan 10.6kHz (94.4us)
![DS1Z_QuickPrint18](https://user-images.githubusercontent.com/2170248/116131369-44741500-a707-11eb-9c74-fa39d9e80947.png)
#### Adaptive delay (show delay time, MATRIX_IO_DELAY = 0)
- `make MTEST=matrix_debug_delay,mdelay0,adaptive_delay handwired/symmetric70_proto/proton_c/normal:default:flash`
##### Press R0C1, R1C1 key
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: delay time
- Delay time 7.6us
- Frequency of matrix scan 9.47kHz (105.6us)
![DS1Z_QuickPrint58](https://user-images.githubusercontent.com/2170248/119666783-a3e15400-be70-11eb-9a58-220032117efd.png)
##### Connect a 500pF capacitor between C2 line and GND, Press R0C2, R1C2, R2C2, R3C2, R4C2 keys
- CH1: Row 0
- CH2: Row 1
- CH3: Col 2
- CH4: delay time
- Delay time 12us + alpha
- Frequency of matrix scan 5.45kHz (183us)
- Threshold Voltage 1.9V
![DS1Z_QuickPrint59](https://user-images.githubusercontent.com/2170248/119666946-cc694e00-be70-11eb-9b97-4c500416d774.png)
##### Connect a 1000pF capacitor between C2 line and GND, Press R0C2, R1C2, R2C2, R3C2, R4C2 keys
- CH1: Row 0
- CH2: Row 1
- CH3: Col 2
- CH4: delay time
- Delay time 20us + alpha
- Frequency of matrix scan 4.48kHz (223us)
- Threshold Voltage 1.9V
![DS1Z_QuickPrint60](https://user-images.githubusercontent.com/2170248/119667127-f3c01b00-be70-11eb-8e7f-6f0a81f95e97.png)
#### Fast adaptive delay (show `matrix_scan()` time, MATRIX_IO_DELAY = 0)
- `make MTEST=matrix_debug_scan,mdelay0,adaptive_delay_fast handwired/symmetric70_proto/proton_c/normal:default:flash`
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: matrix_scan()
- Execution time of matrix_scan() 75.6us
- Frequency of matrix scan 10.8kHz (92.2us)
![DS1Z_QuickPrint62](https://user-images.githubusercontent.com/2170248/119667218-0b979f00-be71-11eb-946c-16f0a0454056.png)
#### Fast adaptive delay (show delay time, MATRIX_IO_DELAY = 0)
- `make MTEST=matrix_debug_delay,mdelay0,adaptive_delay_fast handwired/symmetric70_proto/proton_c/normal:default:flash`
##### Press R0C1, R1C1 key
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: delay time
- Delay time 1.6us
- Frequency of matrix scan 10.6kHz (94.4us)
![DS1Z_QuickPrint63](https://user-images.githubusercontent.com/2170248/119667378-33870280-be71-11eb-95aa-64213138ddac.png)
![DS1Z_QuickPrint64](https://user-images.githubusercontent.com/2170248/119667504-52859480-be71-11eb-963e-eebc6e3da9dc.png)
##### Connect a 500pF capacitor between C2 line and GND, Press R0C2, R1C2, R2C2, R3C2, R4C2 keys
- CH1: Row 0
- CH2: Row 1
- CH3: Col 2
- CH4: delay time
- Delay time 13.2us
- Frequency of matrix scan 6.58kHz (152.6us)
- Threshold Voltage 1.9V
![DS1Z_QuickPrint65](https://user-images.githubusercontent.com/2170248/119667644-72b55380-be71-11eb-8030-854de1900408.png)
##### Connect a 1000pF capacitor between C2 line and GND, Press R0C2, R1C2, R2C2, R3C2, R4C2 keys
- CH1: Row 0
- CH2: Row 1
- CH3: Col 2
- CH4: delay time
- Delay time 20us
- Frequency of matrix scan 5.30kHz (188.8us)
- Threshold Voltage 1.9V
![DS1Z_QuickPrint66](https://user-images.githubusercontent.com/2170248/119667785-8f518b80-be71-11eb-8d40-fc3293aa072b.png)

View file

@ -0,0 +1,53 @@
/* Copyright 2021 mtei
*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
// clang-format off
#define _MAP1(E, _1) E(_1)
#define _MAP2(E, _1,_2) E(_1) E(_2)
#define _MAP3(E, _1,_2,_3) E(_1) E(_2) E(_3)
#define _MAP4(E, _1,_2,_3,_4) E(_1) E(_2) E(_3) E(_4)
#define _MAP5(E, _1,_2,_3,_4,_5) E(_1) E(_2) E(_3) E(_4) E(_5)
#define _MAP6(E, _1,_2,_3,_4,_5,_6) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6)
#define _MAP7(E, _1,_2,_3,_4,_5,_6,_7) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7)
#define _MAP8(E, _1,_2,_3,_4,_5,_6,_7,_8) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8)
#define _MAP9(E, _1,_2,_3,_4,_5,_6,_7,_8,_9) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9)
#define _MAP10(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10)
#define _MAP11(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11)
#define _MAP12(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12)
#define _MAP13(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13)
#define _MAP14(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14)
#define _MAP15(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15)
#define _MAP16(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16)
#define _MAP17(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17)
#define _MAP18(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18)
#define _MAP19(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19)
#define _MAP20(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20)
#define _MAP21(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21)
#define _MAP22(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22)
#define _MAP23(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23)
#define _MAP24(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24)
#define _MAP25(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25)
#define _MAP26(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26)
#define _MAP27(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27)
#define _MAP28(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27) E(_28)
#define _MAP29(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27) E(_28) E(_29)
#define _MAP30(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27) E(_28) E(_29) E(_30)
#define _MAP31(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27) E(_28) E(_29) E(_30) E(_31)
#define _MAP32(E, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32) E(_1) E(_2) E(_3) E(_4) E(_5) E(_6) E(_7) E(_8) E(_9) E(_10) E(_11) E(_12) E(_13) E(_14) E(_15) E(_16) E(_17) E(_18) E(_19) E(_20) E(_21) E(_22) E(_23) E(_24) E(_25) E(_26) E(_27) E(_28) E(_29) E(_30) E(_31) E(_32)
#define SELECT_MAP(e,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,NAME,...) NAME
#define MAP(E,...) SELECT_MAP(E,__VA_ARGS__,_MAP32,_MAP31,_MAP30,_MAP29,_MAP28,_MAP27,_MAP26,_MAP25,_MAP24,_MAP23,_MAP22,_MAP21,_MAP20,_MAP19,_MAP18,_MAP17,_MAP16,_MAP15,_MAP14,_MAP13,_MAP12,_MAP11,_MAP10,_MAP9,_MAP8,_MAP7,_MAP6,_MAP5,_MAP4,_MAP3,_MAP2,_MAP1)(E,__VA_ARGS__)

View file

@ -0,0 +1,28 @@
#pragma once
// clang-format off
#if defined(__AVR__)
typedef uint8_t port_data_t;
#define readPort(port) PINx_ADDRESS(port)
#define setPortBitInput(port, bit) (DDRx_ADDRESS(port) &= ~_BV((bit)&0xF), PORTx_ADDRESS(port) &= ~_BV((bit)&0xF))
#define setPortBitInputHigh(port, bit) (DDRx_ADDRESS(port) &= ~_BV((bit)&0xF), PORTx_ADDRESS(port) |= _BV((bit)&0xF))
#define setPortBitOutput(port, bit) (DDRx_ADDRESS(port) |= _BV((bit)&0xF))
#define writePortBitLow(port, bit) (PORTx_ADDRESS(port) &= ~_BV((bit)&0xF))
#define writePortBitHigh(port, bit) (PORTx_ADDRESS(port) |= _BV((bit)&0xF))
#else
typedef uint16_t port_data_t;
#define readPort(qmk_pin) palReadPort(PAL_PORT(qmk_pin))
#define setPortBitInput(qmk_pin, bit) palSetPadMode(PAL_PORT(qmk_pin), bit, PAL_MODE_INPUT)
#define setPortBitInputHigh(qmk_pin, bit) palSetPadMode(PAL_PORT(qmk_pin), bit, PAL_MODE_INPUT_PULLUP)
#define setPortBitInputLow(qmk_pin, bit) palSetPadMode(PAL_PORT(qmk_pin), bit, PAL_MODE_INPUT_PULLDOWN)
#define setPortBitOutput(qmk_pin, bit) palSetPadMode(PAL_PORT(qmk_pin), bit, PAL_MODE_OUTPUT_PUSHPULL)
#define writePortBitLow(qmk_pin, bit) palClearLine(PAL_LINE(PAL_PORT(qmk_pin), bit))
#define writePortBitHigh(qmk_pin, bit) palSetLine(PAL_LINE(PAL_PORT(qmk_pin), bit))
#endif

View file

@ -0,0 +1,234 @@
/*
Copyright 2021 mtei
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 <http://www.gnu.org/licenses/>.
*/
// clang-format off
#include <stdint.h>
#include <stdbool.h>
#include <gpio.h>
#ifndef readPort
# include "gpio_extr.h"
#endif
#include "util.h"
#include "matrix.h"
#include "matrix_extr.h"
#include "debounce.h"
#include "quantum.h"
#define ALWAYS_INLINE inline __attribute__((always_inline))
#define NO_INLINE __attribute__((noinline))
#define LOCAL_FUNC static
#define LOCAL_DATA static
#ifndef _BV
# define _BV(bit) (1 << (bit))
#endif
#ifndef MATRIX_DEBUG_PIN
# define MATRIX_DEBUG_PIN_INIT()
# define MATRIX_DEBUG_SCAN_START()
# define MATRIX_DEBUG_SCAN_END()
# define MATRIX_DEBUG_DELAY_START()
# define MATRIX_DEBUG_DELAY_END()
# define MATRIX_DEBUG_GAP()
#else
# define MATRIX_DEBUG_GAP() asm volatile("nop \n nop":::"memory")
#endif
typedef uint16_t port_width_t;
#if MATRIX_TYPE == DIRECT_SWITCH || MATRIX_TYPE == DIODE_COL2ROW
# define MATRIX_LINES MATRIX_ROWS
typedef matrix_row_t matrix_line_t;
#endif
#if MATRIX_TYPE == DIODE_ROW2COL
# define MATRIX_LINES MATRIX_COLS
typedef matrix_col_t matrix_line_t;
#endif
typedef struct _port_descriptor {
int device;
pin_t port;
} port_descriptor;
/* matrix state(1:on, 0:off) */
extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values
#define setPortBitOutput_writeLow(port, bit) \
do { setPortBitOutput(port, bit); writePortBitLow(port, bit); } while(0)
#define setPortBitOutput_writeLow_atomic(port, bit) \
do { ATOMIC_BLOCK_FORCEON { setPortBitOutput_writeLow(port, bit); } } while(0)
#define setPortBitInputHigh_atomic(port, bit) \
do { ATOMIC_BLOCK_FORCEON { setPortBitInputHigh(port, bit); } } while(0)
#if defined(MATRIX_IN_PORTS) && defined(MATRIX_IN_PINS)
# include "matrix_config_expand.c"
#else
# error matrix.c need defined MATRIX_IN_PORTS and MATRIX_IN_PINS
#endif
LOCAL_FUNC
void unselect_output(uint8_t out_index) {
unselect_output_inline(out_index);
}
LOCAL_FUNC
void init_output_ports(void) {
for (int i = 0; i < END_outpin_index; i++) {
unselect_output(i);
}
}
LOCAL_FUNC
void init_all_ports(void) {
init_input_ports();
init_output_ports();
init_inport_mask();
init_extension();
}
LOCAL_FUNC ALWAYS_INLINE void select_line_and_read_input_ports(uint8_t current_line, port_width_t port_buffer[NUM_OF_INPUT_PORTS]);
LOCAL_FUNC void select_line_and_read_input_ports(uint8_t current_line, port_width_t port_buffer[NUM_OF_INPUT_PORTS]) {
// Select row (or col)
select_output(current_line);
matrix_output_select_delay();
// Read ports
read_all_input_ports(port_buffer, false);
// Unselect row (or col)
unselect_output_inline(current_line);
}
LOCAL_FUNC ALWAYS_INLINE void read_matrix_line(matrix_line_t phy_matrix[], uint8_t current_line);
#if MATRIX_TYPE == DIODE_ROW2COL || MATRIX_TYPE == DIODE_COL2ROW
LOCAL_FUNC void read_matrix_line(matrix_line_t phy_matrix[], uint8_t current_line) {
// Start with a clear matrix row
matrix_line_t current_line_value = 0;
port_width_t port_buffer[NUM_OF_INPUT_PORTS];
#ifdef MATRIX_GPIO_NEED_SEPARATE_ATOMIC
select_line_and_read_input_ports(current_line, port_buffer);
#else
ATOMIC_BLOCK_FORCEON {
select_line_and_read_input_ports(current_line, port_buffer);
}
#endif
// Build row (or col)
current_line_value = build_matrix_line(port_buffer);
// Wait signal raise up
if (current_line_value) {
MATRIX_DEBUG_DELAY_START();
wait_unselect_done();
MATRIX_DEBUG_DELAY_END();
}
phy_matrix[current_line] = current_line_value;
}
#endif // MATRIX_TYPE == DIODE_ROW2COL || MATRIX_TYPE == DIODE_COL2ROW
#if MATRIX_TYPE == DIRECT_SWITCH
LOCAL_FUNC void read_matrix_line(matrix_line_t phy_matrix[], uint8_t current_line) {
port_width_t port_buffer[NUM_OF_INPUT_PORTS];
if (current_line != 0) {
return;
}
for (uint8_t i = 0; i < MATRIX_LINES; i++) {
phy_matrix[i] = 0;
}
read_all_input_ports(port_buffer, false);
// Build matrix
build_matrix_direct(port_buffer, phy_matrix);
}
#endif // MATRIX_TYPE == DIRECT_SWITCH
void matrix_init(void) {
// initialize key pins
init_all_ports();
// initialize matrix state: all keys off
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
raw_matrix[i] = 0;
matrix[i] = 0;
}
debounce_init(MATRIX_ROWS);
matrix_init_quantum();
}
uint8_t matrix_scan(void) {
matrix_line_t phy_matrix[MATRIX_LINES];
MATRIX_DEBUG_PIN_INIT();
MATRIX_DEBUG_SCAN_START();
// read I/O port to phy_matrix[] (physical matrix)
//select line, read inputs
for (uint8_t current_line = 0; current_line < MATRIX_LINES; current_line++) {
read_matrix_line(phy_matrix, current_line);
}
MATRIX_DEBUG_SCAN_END(); MATRIX_DEBUG_GAP(); MATRIX_DEBUG_SCAN_START();
bool changed = false;
#if MATRIX_TYPE == DIRECT_SWITCH || MATRIX_TYPE == DIODE_COL2ROW
// copy phy_matrix[] to raw_matrix[]
for (uint8_t current_line = 0; current_line < MATRIX_ROWS; current_line++) {
if (raw_matrix[current_line] != phy_matrix[current_line]) {
changed = true;
raw_matrix[current_line] = phy_matrix[current_line];
}
}
#endif
#if MATRIX_TYPE == DIODE_ROW2COL
// transpose phy_matrix[] to raw_matrix[]
matrix_row_t trans_matrix[MATRIX_ROWS];
for (uint8_t i = 0; i < MATRIX_ROWS; i++ ) {
trans_matrix[i] = 0;
}
for (uint8_t src_line = 0; src_line < MATRIX_LINES; src_line++) {
matrix_line_t src_line_data = phy_matrix[src_line];
matrix_row_t dist_bit = MATRIX_ROW_SHIFTER << src_line;
for (uint8_t dist_rows = 0; dist_rows < MATRIX_ROWS; dist_rows++) {
if ((src_line_data & 1) == 1) {
trans_matrix[dist_rows] |= dist_bit;
}
src_line_data >>= 1;
}
}
for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
if (raw_matrix[current_row] != trans_matrix[current_row]) {
changed = true;
raw_matrix[current_row] = trans_matrix[current_row];
}
}
#endif
MATRIX_DEBUG_SCAN_END(); MATRIX_DEBUG_GAP(); MATRIX_DEBUG_SCAN_START();
// debounce raw_matrix[] to matrix[]
debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
MATRIX_DEBUG_SCAN_END(); MATRIX_DEBUG_GAP();
MATRIX_DEBUG_SCAN_START();
matrix_scan_quantum();
MATRIX_DEBUG_SCAN_END();
return (uint8_t)changed;
}

View file

@ -0,0 +1,234 @@
/*
Copyright 2021 mtei
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 <http://www.gnu.org/licenses/>.
*/
// clang-format off
#include "matrix_extr.h"
#ifdef DEBUG_MATRIX_CONFIG
// config expand debug
// avr-gcc -DDEBUG_MATRIX_CONFIG=\"test_config.h\" -E -C matrix_config_expand.c
# include DEBUG_MATRIX_CONFIG
#endif
#undef NO_PIN /* cancel NO_PIN define in tmk_core/common/pin_defs.h */
#define NO_PIN NO_PORT, 0
#if MATRIX_TYPE == DIRECT_SWITCH
# undef MATRIX_OUT_PORTS
# define MATRIX_OUT_PINS (0, NO_PIN)
#endif
#include "cpp_map.h"
#if defined(MATRIX_EXTENSION_74HC157) || defined(MATRIX_EXTENSION_74HC153)
# define MATRIX_EXTENSION "matrix_extension_74hc15x.c"
#endif
#ifdef MATRIX_EXTENSION
# include MATRIX_EXTENSION
#endif
#ifdef MATRIX_GPIO_NEED_SEPARATE_ATOMIC
# ifndef setMatrixInputHigh
# define setMatrixInputHigh(dev, port, bit) do { if ((dev) == MCU_GPIO) { setPortBitInputHigh_atomic(port, bit); }} while(0)
# endif
# ifndef setMatrixOutput_writeHighZ
# define setMatrixOutput_writeHighZ(dev, port, bit) do { if ((dev) == MCU_GPIO) { setPortBitInputHigh_atomic(port, bit); }} while(0)
# endif
# ifndef setMatrixOutput_writeLow
# define setMatrixOutput_writeLow(dev, port, bit) do { if ((dev) == MCU_GPIO) { setPortBitOutput_writeLow_atomic(port, bit); }} while(0)
# endif
#else
# ifndef setMatrixInputHigh
# define setMatrixInputHigh(dev, port, bit) do { if ((dev) == MCU_GPIO) { setPortBitInputHigh(port, bit); }} while(0)
# endif
# ifndef setMatrixOutput_writeHighZ
# define setMatrixOutput_writeHighZ(dev, port, bit) do { if ((dev) == MCU_GPIO) { setPortBitInputHigh(port, bit); }} while(0)
# endif
# ifndef setMatrixOutput_writeLow
# define setMatrixOutput_writeLow(dev, port, bit) do { if ((dev) == MCU_GPIO) { setPortBitOutput_writeLow(port, bit); }} while(0)
# endif
#endif
#ifndef readMatrixPort
# define readMatrixPort(dev, port) (((dev) == MCU_GPIO) ? readPort(port) : 0)
#endif
#ifndef getMatrixInputMaskBit
# define getMatrixInputMaskBit(dev, bit) (((dev) != NO_DEVICE) ? _BV((bit)&0xF) : 0)
#endif
#ifndef init_extension
# define init_extension()
#endif
enum DEVICE_NAME {
MCU_GPIO,
NO_DEVICE,
#ifdef MATRIX_DEVICES
MATRIX_DEVICES
#endif
};
#define _INPUT_PORTS_ENUM_ELEMENT(name, dev, port) inport_index_##name,
#define INPUT_PORTS_ENUM_ELEMENT(x) _INPUT_PORTS_ENUM_ELEMENT x
enum INPUT_PORTS {
INPUT_PORTS_ENUM_ELEMENT((NO_PORT, NO_DEVICE, 0))
MAP(INPUT_PORTS_ENUM_ELEMENT, MATRIX_IN_PORTS)
NUM_OF_INPUT_PORTS
};
#define _INPUT_PINS_ENUM_ELEMENT(index, port, bit) inpin_index_##index,
#define INPUT_PINS_ENUM_ELEMENT(x) _INPUT_PINS_ENUM_ELEMENT x
enum INPUT_PINS {
MAP(INPUT_PINS_ENUM_ELEMENT, MATRIX_IN_PINS)
END_inpin_index
};
#define _OUTPUT_PORTS_ENUM_ELEMENT(name, dev, port) outport_index_##name,
#define OUTPUT_PORTS_ENUM_ELEMENT(x) _OUTPUT_PORTS_ENUM_ELEMENT x
enum OUTPUT_PORTS {
OUTPUT_PORTS_ENUM_ELEMENT((NO_PORT, NO_DEVICE, 0))
#ifdef MATRIX_OUT_PORTS
MAP(OUTPUT_PORTS_ENUM_ELEMENT, MATRIX_OUT_PORTS)
#endif
NUM_OF_OUTPUT_PORTS
};
#define _OUTPUT_PINS_ENUM_ELEMENT(index, port, bit) outpin_index_##index,
#define OUTPUT_PINS_ENUM_ELEMENT(x) _OUTPUT_PINS_ENUM_ELEMENT x
enum OUTPUT_PINS {
MAP(OUTPUT_PINS_ENUM_ELEMENT, MATRIX_OUT_PINS)
END_outpin_index
};
port_width_t iport_mask[NUM_OF_INPUT_PORTS];
#define _INPUT_PORTS_LIST_ELEMENT(name, dev, port) \
[inport_index_##name] = { dev, port },
#define INPUT_PORTS_LIST_ELEMENT(x) _INPUT_PORTS_LIST_ELEMENT x
LOCAL_DATA
const port_descriptor inport_list[NUM_OF_INPUT_PORTS] = {
INPUT_PORTS_LIST_ELEMENT((NO_PORT, NO_DEVICE, 0))
MAP(INPUT_PORTS_LIST_ELEMENT, MATRIX_IN_PORTS)
};
#define _OUTPUT_PORTS_LIST_ELEMENT(name, dev, port) \
[outport_index_##name] = { dev, port },
#define OUTPUT_PORTS_LIST_ELEMENT(x) _OUTPUT_PORTS_LIST_ELEMENT x
LOCAL_DATA
const port_descriptor outport_list[NUM_OF_OUTPUT_PORTS] = {
OUTPUT_PORTS_LIST_ELEMENT((NO_PORT, NO_DEVICE, 0))
#ifdef MATRIX_OUT_PORTS
MAP(OUTPUT_PORTS_LIST_ELEMENT, MATRIX_OUT_PORTS)
#endif
};
#define _SELECT_OUTPUT_PIN(index, pname, bit) \
case outpin_index_##index: \
setMatrixOutput_writeLow(outport_list[outport_index_##pname].device, \
outport_list[outport_index_##pname].port, bit); \
break;
#define SELECT_OUTPUT_PIN(x) _SELECT_OUTPUT_PIN x
LOCAL_FUNC ALWAYS_INLINE void select_output(uint8_t out_index);
LOCAL_FUNC
void select_output(uint8_t out_index) {
switch (out_index) {
MAP(SELECT_OUTPUT_PIN, MATRIX_OUT_PINS)
}
}
#define _UNSELECT_OUTPUT_PIN(index, pname, bit) \
case outpin_index_##index: \
setMatrixOutput_writeHighZ(outport_list[outport_index_##pname].device, \
outport_list[outport_index_##pname].port, bit); \
break;
#define UNSELECT_OUTPUT_PIN(x) _UNSELECT_OUTPUT_PIN x
LOCAL_FUNC ALWAYS_INLINE void unselect_output_inline(uint8_t out_index);
LOCAL_FUNC
void unselect_output_inline(uint8_t out_index) {
switch (out_index) {
MAP(UNSELECT_OUTPUT_PIN, MATRIX_OUT_PINS)
}
}
#define _INIT_INPUT_PIN(index, pname, bit) \
setMatrixInputHigh(inport_list[inport_index_##pname].device, \
inport_list[inport_index_##pname].port, bit);
#define INIT_INPUT_PIN(x) _INIT_INPUT_PIN x
LOCAL_FUNC
void init_input_ports(void) {
MAP(INIT_INPUT_PIN, MATRIX_IN_PINS)
}
#define _INIT_INPORT_MASK(index, pname, bit) \
iport_mask[inport_index_##pname] |= getMatrixInputMaskBit(inport_list[inport_index_##pname].device, bit);
#define INIT_INPORT_MASK(x) _INIT_INPORT_MASK x
LOCAL_FUNC
void init_inport_mask(void) {
for (int i = 0; i < NUM_OF_INPUT_PORTS; i++ ) {
iport_mask[i] = 0;
}
MAP(INIT_INPORT_MASK, MATRIX_IN_PINS)
}
#define _READ_INPUT_PORT(name, dev, port) \
buffer[inport_index_##name] = readMatrixPort(dev, port);
#define READ_INPUT_PORT(x) _READ_INPUT_PORT x
LOCAL_FUNC
ALWAYS_INLINE void read_all_input_ports(port_width_t buffer[NUM_OF_INPUT_PORTS], bool wait_unselect);
LOCAL_FUNC
void read_all_input_ports(port_width_t buffer[NUM_OF_INPUT_PORTS], bool wait_unselect) {
READ_INPUT_PORT((NO_PORT, NO_DEVICE, 0))
MAP(READ_INPUT_PORT, MATRIX_IN_PORTS)
}
#define _MASK_INPUT(name, dev, port) \
mask |= ((~buffer[inport_index_##name]) & iport_mask[inport_index_##name]);
#define MASK_INPUT(x) _MASK_INPUT x
LOCAL_FUNC ALWAYS_INLINE void wait_unselect_done(void);
LOCAL_FUNC
void wait_unselect_done(void) {
port_width_t mask;
port_width_t buffer[NUM_OF_INPUT_PORTS];
do {
read_all_input_ports(buffer, true);
MATRIX_DEBUG_DELAY_END();
mask = 0;
MAP(MASK_INPUT, MATRIX_IN_PORTS);
MATRIX_DEBUG_DELAY_START();
} while (mask != 0);
}
#define _BUILD_INPUT_PORT(index, pname, bit) \
result |= (buffer[inport_index_##pname] & _BV(bit)) ? 0 : _BV(inpin_index_##index);
#define BUILD_INPUT_PORT(x) _BUILD_INPUT_PORT x
LOCAL_FUNC ALWAYS_INLINE matrix_line_t build_matrix_line(port_width_t buffer[NUM_OF_INPUT_PORTS]);
LOCAL_FUNC
matrix_line_t build_matrix_line(port_width_t buffer[NUM_OF_INPUT_PORTS]) {
matrix_line_t result = 0;
MAP(BUILD_INPUT_PORT, MATRIX_IN_PINS);
return result;
}
#define _BUILD_INPUT_PORT_DIRECT(index, pname, bit) \
matrix[(inpin_index_##index)/MATRIX_COLS] \
|= (buffer[inport_index_##pname] & _BV(bit)) ? 0 : _BV((inpin_index_##index)%MATRIX_COLS);
#define BUILD_INPUT_PORT_DIRECT(x) _BUILD_INPUT_PORT_DIRECT x
LOCAL_FUNC ALWAYS_INLINE void build_matrix_direct(port_width_t buffer[NUM_OF_INPUT_PORTS], matrix_line_t matrix[]);
LOCAL_FUNC
void build_matrix_direct(port_width_t buffer[NUM_OF_INPUT_PORTS], matrix_line_t matrix[]) {
MAP(BUILD_INPUT_PORT_DIRECT, MATRIX_IN_PINS);
}

View file

@ -0,0 +1,72 @@
/*
Copyright 2021 mtei
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 <http://www.gnu.org/licenses/>.
*/
// clang-format off
#if defined(MATRIX_EXTENSION_74HC157)
# define MATRIX_DEVICES MCU_GPIOa, MCU_GPIOb
# define IS_74HC15x(dev) ((dev)==MCU_GPIOa || (dev)==MCU_GPIOb)
# define MATRIX_EXT_74HC15x MATRIX_EXTENSION_74HC157
#elif defined(MATRIX_EXTENSION_74HC153)
# define MATRIX_DEVICES MCU_GPIOa, MCU_GPIOb, MCU_GPIOc, MCU_GPIOd
# define IS_74HC15x(dev) ((dev)==MCU_GPIOa || (dev)==MCU_GPIOb || (dev)==MCU_GPIOc || (dev)==MCU_GPIOd)
# define MATRIX_EXT_74HC15x MATRIX_EXTENSION_74HC153
#endif
static const pin_t sel_pins[] = { MATRIX_EXT_74HC15x };
#ifdef MATRIX_GPIO_NEED_SEPARATE_ATOMIC
# define setMatrixInputHigh(dev, port, bit) \
do { \
if ((dev) == MCU_GPIO || IS_74HC15x(dev)) { \
setPortBitInputHigh_atomic(port, bit); \
}
} while(0)
#else
# define setMatrixInputHigh(dev, port, bit) \
do { \
if ((dev) == MCU_GPIO || IS_74HC15x(dev)) { \
setPortBitInputHigh(port, bit); \
} \
} while(0)
#endif
LOCAL_FUNC ALWAYS_INLINE void select74HC15x(uint8_t devid);
LOCAL_FUNC
void select74HC15x(uint8_t devid) {
writePin(sel_pins[0], devid&1);
#if defined(MATRIX_EXTENSION_74HC153)
writePin(sel_pins[1], devid&2);
#endif
}
LOCAL_FUNC ALWAYS_INLINE port_width_t readPortMultiplexer(uint8_t devid, pin_t port);
LOCAL_FUNC port_width_t readPortMultiplexer(uint8_t devid, pin_t port) {
select74HC15x(devid);
waitInputPinDelay();
return readPort(port);
}
#define readMatrixPort(dev, port) \
((dev) == MCU_GPIO)? readPort(port): (IS_74HC15x(dev))? readPortMultiplexer((dev)-MCU_GPIOa, port):0
#define INIT_74HC15X(x) setPinOutput(x); writePinLow(x);
LOCAL_FUNC
void init_74hc15x(void) {
MAP(INIT_74HC15X, MATRIX_EXT_74HC15x)
}
#define init_extension() init_74hc15x()

View file

@ -0,0 +1,36 @@
#pragma once
// clang-format off
#define DIRECT_SWITCH 1
#define DIODE_ROW2COL 2
#define DIODE_COL2ROW 3
#ifndef ROW2COL
# define COL2ROW 0
# define ROW2COL 1
#endif
#ifdef DIRECT_PINS
# define MATRIX_TYPE DIRECT_SWITCH
#else
# if DIODE_DIRECTION == ROW2COL
# define MATRIX_TYPE DIODE_ROW2COL
# endif
# if DIODE_DIRECTION == COL2ROW
# define MATRIX_TYPE DIODE_COL2ROW
# endif
#endif
#ifndef MATRIX_TYPE
# error "MATRIX_TYPE could not be determined."
#endif
#if (MATRIX_ROWS <= 8)
typedef uint8_t matrix_col_t;
#elif (MATRIX_ROWS <= 16)
typedef uint16_t matrix_col_t;
#elif (MATRIX_ROWS <= 32)
typedef uint32_t matrix_col_t;
#else
# error "MATRIX_ROWS: invalid value"
#endif

View file

@ -0,0 +1,168 @@
# Fast and extensible matrix.c
This matrix.c is faster and more extensible than the standard quantum/matrix.c.
* The execution speed of the `matrix_scan()` function is several times faster than quantum/matrix.c.
* In addition to handling MCU GPIOs, it can be extended to handle I/O extenders.
## ToDo list
- [x] support Pro Micro
- [x] support Proton-C
- [x] support DIRECT_PINS
- [x] support DIODE_DIRECTION == ROW2COL
- [x] support 74HC157: quadruple 2-line to 1-line data selectors / multiplexers
- [x] support 74HC153: dual 4-line to 1-line data selectors / multiplexers
- [ ] support I/O expander (MCP23018)
- [ ] support MCU & I/O expander (MCP23018) mixture like ErgoDox
## Configuration
This matrix.c requires a different configuration than quantum/matrix.c.
### Output pins configuration
The output pins is the Row pins if `DIODE_DIRECTION == COL2ROW`, and the Col pins if `DIODE_DIRECTION == ROW2COL`. When DIRECT_PINS is defined, the output pins do not need to be set.
Example:
```c
// list of OUTPUT(row) ports
#define MATRIX_OUT_PORTS \
(Port_D, MCU_GPIO, D0), \
(Port_C, MCU_GPIO, C0), \
(Port_E, MCU_GPIO, E0), \
(Port_B, MCU_GPIO, B0)
// list of OUTPUT pins
#define MATRIX_OUT_PINS \
(0, Port_D, 4), \
(1, Port_C, 6), \
(2, Port_D, 7), \
(3, Port_E, 6), \
(4, Port_B, 4), \
(5, Port_B, 5)
```
### Input pins configuration
The input pins is the Col pins if `DIODE_DIRECTION == COL2ROW`, and the Row pins if `DIODE_DIRECTION == ROW2COL`. When DIRECT_PINS is defined, the input pin settings will enumerate the connection pins of all switches.
Example:
```c
// list of INPUT ports
#define MATRIX_IN_PORTS (Port_F, MCU_GPIO, F0), (Port_B, MCU_GPIO, B0)
// list of INPUT pins
#define MATRIX_IN_PINS \
(0, Port_F, 4), \
(1, Port_F, 5), \
(2, Port_F, 6), \
(3, Port_F, 7), \
(4, Port_B, 1), \
(5, Port_B, 3)
```
### Multiplexer Extension
By defining the `MATRIX_EXTENSION_74HC157` macro or `MATRIX_EXTENSION_74HC153` macro, you can connect a multiplexer to the GPIO to extend the input pins.
Example:
```c
#define MATRIX_EXTENSION_74HC157 B2 /* or #define MATRIX_EXTENSION_74HC153 B2, B6 */
// list of OUTPUT ports
#define MATRIX_OUT_PORTS (Port_D, MCU_GPIO, D0), (Port_C, MCU_GPIO, C0), (Port_E, MCU_GPIO, E0), (Port_B, MCU_GPIO, B0)
// list of OUTPUT pins
#define MATRIX_OUT_PINS (0, Port_D, 4), (1, Port_C, 6), (2, Port_D, 7), (3, Port_E, 6), (4, Port_B, 4), (5, Port_B, 5)
// list of INPUT ports
#define MATRIX_IN_PORTS \
(Port_Fa, MCU_GPIOa, F0), \
(Port_Ba, MCU_GPIOa, B0), \
(Port_Fb, MCU_GPIOb, F0), \
(Port_Bb, MCU_GPIOb, B0)
// list of INPUT pins
#define MATRIX_IN_PINS \
(0, Port_Fa, 4), \
(1, Port_Fb, 5), \
(2, Port_Fb, 6), \
(3, Port_Fa, 7), \
(4, Port_Ba, 1), \
(5, Port_Bb, 3)
```
### I/O expander Extension
I plan to provide extensions to support I/O expanders such as MCP23018 and PCA9555.
## Compile
* Measure the execution time of matrix_scan()
* `make MTEST=matrix_debug_scan[,<other options>..] handwired/symmetric70_proto/promicro/fast:default:flash`
* Measure delay time.
* `make MTEST=matrix_debug_delay[,<other options>..] handwired/symmetric70_proto/promicro/fast:default:flash`
## Measurement result
### Pro Micro (ATmega32u4 16Mhz)
#### Default setting (show `matrix_scan()` time)
- `make MTEST=matrix_debug_scan handwired/symmetric70_proto/promicro/fast:default:flash`
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: matrix_scan()
- Execution time of matrix_scan() 75.6us
- Frequency of matrix scan 8.09kHz (123.6us)
![DS1Z_QuickPrint7](https://user-images.githubusercontent.com/2170248/116003927-538d9100-a63b-11eb-9b36-7db47d9b1541.png)
#### Default setting (show delay time)
- `make MTEST=matrix_debug_delay handwired/symmetric70_proto/promicro/fast:default:flash`
##### Press R0C0 key
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: delay time
- Frequency of matrix scan 7.84kHz (127.6us)
![DS1Z_QuickPrint9](https://user-images.githubusercontent.com/2170248/116003974-99e2f000-a63b-11eb-9c9e-3b3b1025db66.png)
![DS1Z_QuickPrint10](https://user-images.githubusercontent.com/2170248/116003978-a1a29480-a63b-11eb-97d8-5a6e11c0db2f.png)
### Proton C
#### Default setting (show `matrix_scan()` time)
- `make MTEST=matrix_debug_scan handwired/symmetric70_proto/proton_c/fast:default:flash`
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: matrix_scan()
- Execution time of matrix_scan() 49.8us
- Frequency of matrix scan 15.1kHz (66.2.6us)
![DS1Z_QuickPrint11](https://user-images.githubusercontent.com/2170248/116088141-8cca0d80-a6dc-11eb-8782-1d29c57690b8.png)
#### Default setting (show delay time)
- `make MTEST=matrix_debug_delay handwired/symmetric70_proto/proton_c/fast:default:flash`
##### Press R0C0 key
- CH1: Row 0
- CH2: Row 1
- CH3: Row 4
- CH4: delay time
- Frequency of matrix scan 13.9kHz (71.8us)
![DS1Z_QuickPrint12](https://user-images.githubusercontent.com/2170248/116088247-a8cdaf00-a6dc-11eb-8a47-104694a40117.png)
![DS1Z_QuickPrint13](https://user-images.githubusercontent.com/2170248/116088262-ac613600-a6dc-11eb-804c-7dcbd71c83d5.png)
##### Connect a 500pF capacitor between C0 line and GND, Press R0C0, R1C0, R2C0, R3C0, R4C0 keys
- CH1: Row 0
- CH2: Row 1
- CH3: Col 0
- CH4: delay time
- Delay time 11.6us
- Threshold Voltage 1.9V
![DS1Z_QuickPrint14](https://user-images.githubusercontent.com/2170248/116089205-90aa5f80-a6dd-11eb-89c4-72315c80ba0e.png)
##### Connect a 1000pF capacitor between C0 line and GND, Press R0C0, R1C0, R2C0, R3C0, R4C0 keys
- CH1: Row 0
- CH2: Row 1
- CH3: Col 0
- CH4: delay time
- Delay time 18.6us
- Threshold Voltage 1.9V
![DS1Z_QuickPrint15](https://user-images.githubusercontent.com/2170248/116089229-96a04080-a6dd-11eb-8b63-f91b03a9db0c.png)

View file

@ -0,0 +1,21 @@
// list of OUTPUT(row) ports
#define MATRIX_OUT_PORTS (Port_D, MCU_GPIO, D0), (Port_C, MCU_GPIO, C0), (Port_E, MCU_GPIO, E0), (Port_B, MCU_GPIO, B0)
// list of OUTPUT(row) pins
#define MATRIX_OUT_PINS \
(0, Port_D, 4), \
(1, Port_C, 6), \
(2, Port_D, 7), \
(3, Port_E, 6), \
(4, Port_B, 4), \
(5, Port_B, 5)
// list of INPUT(col) ports
#define MATRIX_IN_PORTS (Port_F, MCU_GPIO, F0), (Port_B, MCU_GPIO, B0)
// list of INPUT(col) pins
#define MATRIX_IN_PINS \
(0, Port_F, 4), \
(1, Port_F, 5), \
(2, Port_F, 6), \
(3, Port_F, 7), \
(4, Port_B, 1), \
(5, Port_B, 3)

View file

@ -0,0 +1,28 @@
#define MATRIX_EXTENSION_74HC157 B2
// #define MATRIX_EXTENSION_74HC153 B2, B6
// list of OUTPUT(row) ports
#define MATRIX_OUT_PORTS (Port_D, MCU_GPIO, D0), (Port_C, MCU_GPIO, C0), (Port_E, MCU_GPIO, E0), (Port_B, MCU_GPIO, B0)
// list of OUTPUT(row) pins
#define MATRIX_OUT_PINS \
(0, Port_D, 4), \
(1, Port_C, 6), \
(2, Port_D, 7), \
(3, Port_E, 6), \
(4, Port_B, 4), \
(5, Port_B, 5)
// list of INPUT(col) ports
#define MATRIX_IN_PORTS \
(Port_Fa, MCU_GPIOa, F0), \
(Port_Ba, MCU_GPIOa, B0), \
(Port_Fb, MCU_GPIOb, F0), \
(Port_Bb, MCU_GPIOb, B0)
// list of INPUT(col) pins
#define MATRIX_IN_PINS \
(0, Port_Fa, 4), \
(1, Port_Fb, 5), \
(2, Port_Fb, 6), \
(3, Port_Fa, 7), \
(4, Port_Ba, 1), \
(5, Port_Bb, 3)

View file

@ -0,0 +1,34 @@
#if defined(__AVR__)
/* -------------------- AVR (Pro Micro) ----------------------- */
// old style
#define DIRECT_PINS { { F4, NO_PIN, F5 }, { NO_PIN, F6, F7 }, { B1, B3, NO_PIN } }
// new style
// #define DIRECT_PINS
#define MATRIX_IN_PORTS \
(Port_F, MCU_GPIO, F0), \
(Port_B, MCU_GPIO, B0)
#define MATRIX_IN_PINS \
(0, Port_F, 4), (1, NO_PIN ), (2, Port_F, 5), \
(3, NO_PIN ), (4, Port_F, 6), (5, Port_F, 7), \
(6, Port_B, 1), (7, Port_B, 3), (8, NO_PIN )
#else
/* -------------------- ARM (PROTON-C) ----------------------- */
// old style
#define DIRECT_PINS { { A2, NO_PIN, A1 }, { NO_PIN, A0, B8 }, { B13, B14, NO_PIN } }
// new style
// #define DIRECT_PINS
#define MATRIX_IN_PORTS \
(Port_A, MCU_GPIO, A0), \
(Port_B, MCU_GPIO, B0)
#define MATRIX_IN_PINS \
(0, Port_A, 2), (1, NO_PIN ), (2, Port_A, 1), \
(3, NO_PIN ), (4, Port_A, 0), (5, Port_B, 8), \
(6, Port_B, 13), (7, Port_B, 14), (8, NO_PIN )
#endif

View file

@ -1,5 +1,5 @@
/*
Copyright 2020 mtei
Copyright 2020-2021 mtei
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
@ -24,29 +24,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PRODUCT_ID 0x2BE5
#define DEVICE_VER 0x0001
#define MANUFACTURER mtei
#define PRODUCT Symmetric70 prototype
#define PRODUCT Symmetric70 prototype promicro
/* key matrix size */
#define MATRIX_ROWS 5
#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 { D4, C6, D7, E6, B4 }
#define MATRIX_COL_PINS { F4,F4,F5,F5, F6,F6,F7,F7, B6,B6,B2,B2, B3,B3,B1,B1 }
#define UNUSED_PINS
/* Pro Micro **************************
====
+-------====------+
MDEBUG | D3/TXO RAW |
| D2/RXI GND |
| GND RST |
| GND Vcc |
| D1/SDA F4 | COL_0_1_L
| D0/SCL F5 | COL_2_3_L
ROW_0 | D4 F6 | COL_4_5_L
ROW_1 | C6 F7 | COL_6_7_L
ROW_2 | D7 SCK/B1 | COL_6_7_R
ROW_3 | E6 MISO/B3 | COL_4_5_R
ROW_4 | B4 MOSI/B2 | COL_2_3_R
SEL_AB | B5 B6 | COL_0_1_R
+-----------------+
***************************************/
#define MATRIX_MUL_SEL { 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 }
/* use 74HC157: quadruple 2-line to 1-line data selectors / multiplexers */
#define MATRIX_MUL_SELECT B5 /* 74HC157 pin1:~A/B */
#define UNUSED_PINS
/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW
@ -148,3 +150,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Bootmagic Lite key configuration */
//#define BOOTMAGIC_LITE_ROW 0
//#define BOOTMAGIC_LITE_COLUMN 0
#ifdef DEBUG_CONFIG
# define MATRIX_DEBUG_PIN D3
# include "../debug_config.h"
#endif

View file

@ -0,0 +1,52 @@
/*
Copyright 2021 mtei
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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#define MATRIX_OUT_PORTS \
(Port_D, MCU_GPIO, D0), \
(Port_C, MCU_GPIO, C0), \
(Port_E, MCU_GPIO, E0), \
(Port_B, MCU_GPIO, B0)
#define MATRIX_OUT_PINS \
(0, Port_D, 4), \
(1, Port_C, 6), \
(2, Port_D, 7), \
(3, Port_E, 6), \
(4, Port_B, 4)
#define MATRIX_EXTENSION_74HC157 B5
#define MATRIX_IN_PORTS \
(Port_Fa, MCU_GPIOa, F0), \
(Port_Fb, MCU_GPIOb, F0), \
(Port_Ba, MCU_GPIOa, B0), \
(Port_Bb, MCU_GPIOb, B0)
#define MATRIX_IN_PINS \
(0, Port_Fa, 4), \
(1, Port_Fb, 4), \
(2, Port_Fa, 5), \
(3, Port_Fb, 5), \
(4, Port_Fa, 6), \
(5, Port_Fb, 6), \
(6, Port_Fa, 7), \
(7, Port_Fb, 7), \
(8, Port_Bb, 6), \
(9, Port_Ba, 6), \
(10, Port_Bb, 2), \
(11, Port_Ba, 2), \
(12, Port_Bb, 3), \
(13, Port_Ba, 3), \
(14, Port_Bb, 1), \
(15, Port_Ba, 1)

View file

@ -0,0 +1 @@
[Look here](../readme.md)

View file

@ -0,0 +1,6 @@
CUSTOM_MATRIX = yes
SRC += matrix_common.c
SRC += matrix_fast/matrix.c
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))../../local_features.mk
include $(KEYBOARD_LOCAL_FEATURES_MK)

View file

@ -0,0 +1,41 @@
/*
Copyright 2021 mtei
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 <http://www.gnu.org/licenses/>.
*/
#pragma once
/*
* 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 { D4, C6, D7, E6, B4 }
#define MATRIX_COL_PINS { F4,F4,F5,F5, F6,F6,F7,F7, B6,B6,B2,B2, B3,B3,B1,B1 }
#define MATRIX_MUL_SEL { 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 }
/* use 74HC157: quadruple 2-line to 1-line data selectors / multiplexers */
#define MATRIX_MUL_SELECT B5 /* 74HC157 pin1:~A/B */
#ifdef MATRIX_IO_DELAY_ADAPTIVE_FAST
# define MATRIX_IO_DELAY_PORTS B0, B0, F0, F0
# define MATRIX_IO_DELAY_MULSEL 0, 1, 0, 1
// 76543210 76543210 76543210 76543210
# define MATRIX_IO_DELAY_MASKS 0b01001110, 0b01001110, 0b11110000, 0b11110000
#endif

View file

@ -0,0 +1 @@
[Look here](../readme.md)

View file

@ -0,0 +1,6 @@
CUSTOM_MATRIX = yes
SRC += matrix_common.c
SRC += matrix_debug/matrix.c
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))../../local_features.mk
include $(KEYBOARD_LOCAL_FEATURES_MK)

View file

@ -0,0 +1,27 @@
# Pro Micro version of symmetric70_proto
![symmetric70_proto](https://i.imgur.com/Br4pH9ol.jpg)
<img width="80%" alt="matrix_74HC157d" src="https://user-images.githubusercontent.com/2170248/115988014-a3943580-a5f2-11eb-9a0a-038f7ea6a8d9.png">
A compact 70keys keyboard (prototype) designed by mtei
* Keyboard Maintainer: [mtei](https://github.com/mtei)
* Hardware Supported: Pro Micro (ATmega32U4) & 74HC157
* Hardware Availability: This is just prototype
Make example for this keyboard (after setting up your build environment):
make handwired/symmetric70_proto/promicro/normal:default
make handwired/symmetric70_proto/promicro/fast:default
Flashing example for this keyboard:
make handwired/symmetric70_proto/promicro/normal:default:flash
make handwired/symmetric70_proto/promicro/fast:default:flash
Testing options: (see more options: [local_features.mk](../local_features.mk), [matrix_debug](../matrix_debug/readme.md) and [matrix_fast](../matrix_fast/readme.md) )
make MTEST=mdelay0 handwired/symmetric70_proto/promicro/normal:default:flash
make MTEST=mdelay0 handwired/symmetric70_proto/promicro/fast:default:flash
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).

View file

@ -20,8 +20,3 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output
CUSTOM_MATRIX = lite
SRC += matrix.c
## CONSOLE_ENABLE = yes # matrix dump

View file

@ -0,0 +1,165 @@
/*
Copyright 2021 mtei
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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x2BE5
#define DEVICE_VER 0x0001
#define MANUFACTURER mtei
#define PRODUCT Symmetric70 prototype proton-c
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 16
/* Proton-C **************************
====
+-------====------+
DEBUG | A9/TX/SCL2 5V | (VUSB)
| A10/RX/SDA2 GND |
| GND FLASH |
| GND 3.3V | (VCC)
C15 | B7/SDA1 A2 | C0
C14 | B6/SCL1 A1 | C1
C13 | B5 A0 | C2
C12 | B4 SCL1/B8 | C3
C11 | B3 SCLK/B13 | C4
C10 | B2 MISO/B14 | C5
C9 | B1 MOSI/B15 | C6
C8 | B0 SDA1/B9 | C7
+---+ +---+
+---+ +---+
R0 | A4 B10 |
R1 | A5 B11 |
R2 | A6 B12 |
R3 | A7 A14 |
R4 | A8 A13 |
| A15 RST |
+-----------------+
***************************************/
#define UNUSED_PINS
/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW
/*
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
*/
//#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
//#define BACKLIGHT_PIN B7
//#define BACKLIGHT_LEVELS 3
//#define BACKLIGHT_BREATHING
//#define RGB_DI_PIN E2
//#ifdef RGB_DI_PIN
//# define RGBLED_NUM 16
//# define RGBLIGHT_HUE_STEP 8
//# define RGBLIGHT_SAT_STEP 8
//# define RGBLIGHT_VAL_STEP 8
//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
/*== all animations enable ==*/
//# define RGBLIGHT_ANIMATIONS
/*== or choose animations ==*/
//# define RGBLIGHT_EFFECT_BREATHING
//# define RGBLIGHT_EFFECT_RAINBOW_MOOD
//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
//# define RGBLIGHT_EFFECT_SNAKE
//# define RGBLIGHT_EFFECT_KNIGHT
//# define RGBLIGHT_EFFECT_CHRISTMAS
//# define RGBLIGHT_EFFECT_STATIC_GRADIENT
//# define RGBLIGHT_EFFECT_RGB_TEST
//# define RGBLIGHT_EFFECT_ALTERNATING
/*== customize breathing effect ==*/
/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
/*==== use exp() and sin() ====*/
//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
//#endif
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* 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
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
* This is useful for the Windows task manager shortcut (ctrl+shift+esc).
*/
//#define GRAVE_ESC_CTRL_OVERRIDE
/*
* Force NKRO
*
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
* makefile for this to work.)
*
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
* until the next keyboard reset.
*
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
* fully operational during normal computer usage.
*
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
* power-up.
*
*/
//#define FORCE_NKRO
/*
* 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
/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
/* Bootmagic Lite key configuration */
//#define BOOTMAGIC_LITE_ROW 0
//#define BOOTMAGIC_LITE_COLUMN 0
#ifdef DEBUG_CONFIG
# define MATRIX_DEBUG_PIN A9
# include "../debug_config.h"
#endif

View file

@ -0,0 +1,44 @@
/*
Copyright 2021 mtei
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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#define MATRIX_OUT_PORTS (Port_A, MCU_GPIO, A0)
#define MATRIX_OUT_PINS \
(0, Port_A, 4), \
(1, Port_A, 5), \
(2, Port_A, 6), \
(3, Port_A, 7), \
(4, Port_A, 8)
#define MATRIX_IN_PORTS \
(Port_A, MCU_GPIO, A0), (Port_B, MCU_GPIO, B0)
#define MATRIX_IN_PINS \
(0, Port_A, 2), \
(1, Port_A, 1), \
(2, Port_A, 0), \
(3, Port_B, 8), \
(4, Port_B, 13), \
(5, Port_B, 14), \
(6, Port_B, 15), \
(7, Port_B, 9), \
(8, Port_B, 0), \
(9, Port_B, 1), \
(10, Port_B, 2), \
(11, Port_B, 3), \
(12, Port_B, 4), \
(13, Port_B, 5), \
(14, Port_B, 6), \
(15, Port_B, 7)

View file

@ -0,0 +1 @@
[Look here](../readme.md)

View file

@ -0,0 +1,6 @@
CUSTOM_MATRIX = yes
SRC += matrix_common.c
SRC += matrix_fast/matrix.c
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))../../local_features.mk
include $(KEYBOARD_LOCAL_FEATURES_MK)

View file

@ -0,0 +1,36 @@
/*
Copyright 2021 mtei
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 <http://www.gnu.org/licenses/>.
*/
#pragma once
/*
* 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 { A4, A5, A6, A7, A8 }
#define MATRIX_COL_PINS { A2, A1, A0, B8, B13, B14, B15, B9, B0, B1, B2, B3, B4, B5, B6, B7 }
#ifdef MATRIX_IO_DELAY_ADAPTIVE_FAST
# define MATRIX_IO_DELAY_PORTS A0, B0
// fedcba9876543210 fedcba9876543210
# define MATRIX_IO_DELAY_MASKS 0b0000000000000111, 0b1110001111111111
#endif

View file

@ -0,0 +1 @@
[Look here](../readme.md)

View file

@ -0,0 +1,6 @@
CUSTOM_MATRIX = yes
SRC += matrix_common.c
SRC += matrix_debug/matrix.c
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))../../local_features.mk
include $(KEYBOARD_LOCAL_FEATURES_MK)

View file

@ -0,0 +1,12 @@
#include "quantum.h"
#ifndef MATRIX_IO_DELAY_DEFAULT
/* In tmk_core/common/wait.h, the implementation for PROTOCOL_CHIBIOS
* calls 'chThdSleepMicroseconds(1)' when 'wait_us(0)'.
* However, 'wait_us(0)' should do nothing. */
void matrix_output_unselect_delay(void) {
# if !defined(MATRIX_IO_DELAY) || MATRIX_IO_DELAY > 0
matrix_io_delay();
# endif
}
#endif

View file

@ -0,0 +1,26 @@
# Proton C version of symmetric70_proto
![symmetric70_proto](https://i.imgur.com/SCtlXOS.jpg)
A compact 70keys keyboard (prototype) designed by mtei
* Keyboard Maintainer: [mtei](https://github.com/mtei)
* Hardware Supported: Proton C (STM32F303CCT6)
* Hardware Availability: This is just prototype
Make example for this keyboard (after setting up your build environment):
make handwired/symmetric70_proto/proton_c/normal:default
make handwired/symmetric70_proto/proton_c/fast:default
Flashing example for this keyboard:
make handwired/symmetric70_proto/proton_c/normal:default:flash
make handwired/symmetric70_proto/proton_c/fast:default:flash
Testing options: (see more options: [local_features.mk](../local_features.mk), [matrix_debug](../matrix_debug/readme.md) and [matrix_fast](../matrix_fast/readme.md) )
make MTEST=mdelay0 handwired/symmetric70_proto/proton_c/normal:default:flash
make MTEST=mdelay0 handwired/symmetric70_proto/proton_c/fast:default:flash
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).

View file

@ -0,0 +1,23 @@
# MCU name
MCU = STM32F303
BOARD = QMK_PROTON_C
# Bootloader selection
BOOTLOADER = stm32-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = no # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
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
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output

View file

@ -1,20 +1,8 @@
# symmetric70_proto
![symmetric70_proto](https://i.imgur.com/Br4pH9ol.jpg)
![74HC157_schematic](https://i.imgur.com/8IU8Jgcl.jpg)
A compact 70keys keyboard (prototype) designed by mtei
* Keyboard Maintainer: [mtei](https://github.com/mtei)
* Hardware Supported: Pro Micro (ATmega32U4) & 74HC157
* Hardware Availability: This is just prototype
Make example for this keyboard (after setting up your build environment):
make symmetric70_proto:default
Flashing example for this keyboard:
make symmetric70_proto:default:flash
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).
* [Pro Micro version of symmetric70_proto](promicro/readme.md)
* [Proton-C version of symmetric70_proto](proton_c/readme.md)

View file

@ -2,66 +2,68 @@
"keyboard_name": "Traveller",
"url": "",
"maintainer": "qmk",
"width": 13,
"height": 4,
"width": 15,
"height": 5.2,
"layouts": {
"LAYOUT": {
"layout": [
{"x": 0, "y": 0},
{"x": 1, "y": 0},
{"x": 2, "y": 0},
{"x": 0, "y": 1.2},
{"x": 1, "y": 0.8},
{"x": 2, "y": 0.4},
{"x": 3, "y": 0},
{"x": 4, "y": 0},
{"x": 5, "y": 0},
{"x": 4, "y": 0.4},
{"x": 5, "y": 0.8},
{"x": 7, "y": 0},
{"x": 8, "y": 0},
{"x": 9, "y": 0},
{"x": 10, "y": 0},
{"x": 9, "y": 0.8},
{"x": 10, "y": 0.4},
{"x": 11, "y": 0},
{"x": 12, "y": 0},
{"x": 12, "y": 0.4},
{"x": 13, "y": 0.8},
{"x": 14, "y": 1.2},
{"x": 0, "y": 1},
{"x": 1, "y": 1},
{"x": 2, "y": 1},
{"x": 0, "y": 2.2},
{"x": 1, "y": 1.8},
{"x": 2, "y": 1.4},
{"x": 3, "y": 1},
{"x": 4, "y": 1},
{"x": 5, "y": 1},
{"x": 4, "y": 1.4},
{"x": 5, "y": 1.8},
{"x": 7, "y": 1},
{"x": 8, "y": 1},
{"x": 9, "y": 1},
{"x": 10, "y": 1},
{"x": 9, "y": 1.8},
{"x": 10, "y": 1.4},
{"x": 11, "y": 1},
{"x": 12, "y": 1},
{"x": 12, "y": 1.4},
{"x": 13, "y": 1.8},
{"x": 14, "y": 2.2},
{"x": 0, "y": 2},
{"x": 1, "y": 2},
{"x": 2, "y": 2},
{"x": 0, "y": 3.2},
{"x": 1, "y": 2.8},
{"x": 2, "y": 2.4},
{"x": 3, "y": 2},
{"x": 4, "y": 2},
{"x": 5, "y": 2},
{"x": 6, "y": 2},
{"x": 7, "y": 2},
{"x": 8, "y": 2},
{"x": 9, "y": 2},
{"x": 10, "y": 2},
{"x": 11, "y": 2},
{"x": 12, "y": 2},
{"x": 4, "y": 2.4},
{"x": 5, "y": 2.8},
{"x": 0, "y": 3},
{"x": 1, "y": 3},
{"x": 2, "y": 3},
{"x": 9, "y": 2.8},
{"x": 10, "y": 2.4},
{"x": 11, "y": 2},
{"x": 12, "y": 2.4},
{"x": 13, "y": 2.8},
{"x": 14, "y": 3.2},
{"x": 0, "y": 4.2},
{"x": 1, "y": 3.8},
{"x": 2, "y": 3.4},
{"x": 3, "y": 3},
{"x": 4, "y": 3},
{"x": 5, "y": 3},
{"x": 6, "y": 3},
{"x": 7, "y": 3},
{"x": 8, "y": 3},
{"x": 9, "y": 3},
{"x": 10, "y": 3},
{"x": 4, "y": 3.4},
{"x": 5, "y": 3.8},
{"x": 6, "y": 3.05, "h": 1.5},
{"x": 8, "y": 3.05, "h": 1.5},
{"x": 9, "y": 3.8},
{"x": 10, "y": 3.4},
{"x": 11, "y": 3},
{"x": 12, "y": 3}
{"x": 12, "y": 3.4},
{"x": 13, "y": 3.8},
{"x": 14, "y": 4.2}
]
}
}

View file

@ -1,4 +1,5 @@
#include QMK_KEYBOARD_H
#include "mousekey.h"
enum layer_names {
_QW,
@ -19,117 +20,117 @@ enum custom_keycodes {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,-----------------------------------------. .-----------------------------------------.
* | NAV | ` ~ | W | E | R | T | | Y | U | I | O | - | = |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Tab | Q | S | D | F | G | | H | J | K | L | P | \ |
* |------+------+------+------+------+------|------+------+------+------+------+------+------|
* |ctrl/esc| A | X | C | V | B |Ctrl /| N | M | , | . | ; | ' |
* |------+------+------+------+------+------+ // +------+------+------+------+------+------|
* | Shift| Z | Del | GUI | Low | Bspc |/Enter| Spc | Hi | GUI | Alt | / |Shift |
* `------------------------------------------------------------------------------------------'
* ,-----------------------------------------. .-----------------------------------------.
* | NAV | ` ~ | W | E | R | T | | Y | U | I | O | - | = |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Tab | Q | S | D | F | G | | H | J | K | L | P | \ |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* |ctrl/esc| A | X | C | V | B | | N | M | , | . | ; | ' |
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
* | Shift| Z | Del | GUI | Low | Bspc | Ctrl | Enter| Spc | Hi | GUI | Alt | / |Shift |
* `-------------------------------------------------------------------------------------------------'
*/
[_QW] = LAYOUT(
TG(_NAV), KC_GRV, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_MINS, KC_EQL,
KC_TAB, KC_Q, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_P, KC_BSLS,
CTL_T(KC_ESC), KC_A, KC_X, KC_C, KC_V, KC_B, KC_RCTL, KC_N, KC_M, KC_COMM, KC_DOT, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_DEL, KC_LGUI, MO(_LW), KC_BSPC, KC_ENT, KC_SPC, MO(_HI), KC_RGUI, KC_RALT, KC_SLSH, KC_RSFT
TG(_NAV), KC_GRV, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_MINS, KC_EQL,
KC_TAB, KC_Q, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_P, KC_BSLS,
CTL_T(KC_ESC), KC_A, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_DEL, KC_LGUI, MO(_LW), KC_BSPC, KC_RCTL, KC_ENT, KC_SPC, MO(_HI), KC_RGUI, KC_RALT, KC_SLSH, KC_RSFT
),
/* LOW - numbers, missing or awkward programming keys
Doubled 1 key allows lazy reach with ring finger.
* ,-----------------------------------------. .-----------------------------------------.
* | FKeys| 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |Ctrl-alt-del|
* |------+------+------+------+------+------| +------+------+------+------+------+------|
* | Tab | 1 | ] | ( | ) | | | * | ( | ) | [ | | |
* |------+------+------+------+------+------|------+------+------+------+------+------+------|
* | Caps | [ | | { | } | ` | /| # | { | } | | ] | |
* |------+------+------+------+------+------+ // +------+------+------+------+------+------|
* | Shift| | | | Low | |/ | | Hi | | | |Shift |
* `------------------------------------------------------------------------------------------'
* ,-----------------------------------------. .-----------------------------------------.
* | FKeys| 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |Ctrl-alt-del|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Tab | 1 | ] | ( | ) | | | * | ( | ) | [ | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Caps | [ | | { | } | ` | | # | { | } | | ] | |
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
* | Shift| | | | Low | | | | | Hi | | | |Shift |
* `-------------------------------------------------------------------------------------------------'
*/
[_LW] = LAYOUT(
TG(_FKEYS), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, LCTL(LALT(KC_DEL)),
_______, KC_1, KC_RBRC, KC_LPRN, KC_RPRN, XXXXXXX, KC_ASTR, KC_LPRN, KC_RPRN, KC_LBRC, XXXXXXX, XXXXXXX,
KC_CAPS, KC_LBRC, XXXXXXX, KC_LCBR, KC_RCBR, KC_TILD, _______, KC_HASH, KC_LCBR, KC_RCBR, XXXXXXX, KC_RBRC, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
TG(_FKEYS), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, LCTL(LALT(KC_DEL)),
_______, KC_1, KC_RBRC, KC_LPRN, KC_RPRN, XXXXXXX, KC_ASTR, KC_LPRN, KC_RPRN, KC_LBRC, XXXXXXX, XXXXXXX,
KC_CAPS, KC_LBRC, XXXXXXX, KC_LCBR, KC_RCBR, KC_TILD, KC_HASH, KC_LCBR, KC_RCBR, XXXXXXX, KC_RBRC, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* HI - Punctuation, shell and
* url ://@.com row on bottom, && is opposite || ^$ are in regex order: ^.*$
* Right hand nav keys work pretty well chorded with the Right hand Hi Key
* ,-----------------------------------------. .-----------------------------------------.
* |FKEYS | ! | @ | # | $ | % | | ^ | & | * | ( | ) | + |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | ! | & | "|" | $ | % | | Vol+| Mute| | | | |
* |------+------+------+------+------+------|------+------+------+------+------+------+------|
* | CAPS | ^ | : | . | * | - | /| Vol-| Play | PgUp | Home | Up | End |
* |------+------+------+------+------+------+ // +------+------+------+------+------+------|
* | | / | | | Low | |/ | | Hi | PgDn | Left| Down | Right |
* `------------------------------------------------------------------------------------------'
* ,-----------------------------------------. .-----------------------------------------.
* |FKEYS | ! | @ | # | $ | % | | ^ | & | * | ( | ) | + |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | ! | & | "|" | $ | % | | Vol+| Mute| | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | CAPS | ^ | : | . | * | - | | Vol-| Play | PgUp | Home | Up | End |
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
* | | / | | | Low | | | | | Hi | PgDn | Left | Down |Right |
* `-------------------------------------------------------------------------------------------------'
*/
[_HI] = LAYOUT(
TG(_FKEYS), KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PLUS,
_______, KC_EXLM, KC_AMPR, KC_PIPE, KC_DLR, KC_PERC, KC_VOLU, KC_MUTE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_CAPS, KC_CIRC, KC_COLN, KC_DOT, KC_ASTR, KC_MINS, _______, KC_VOLD, KC_PPLS, KC_PGUP, KC_HOME, KC_UP, KC_END,
_______, KC_SLSH, _______, _______, TT(_LW), _______, _______, _______, _______, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT
TG(_FKEYS), KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PLUS,
_______, KC_EXLM, KC_AMPR, KC_PIPE, KC_DLR, KC_PERC, KC_VOLU, KC_MUTE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_CAPS, KC_CIRC, KC_COLN, KC_DOT, KC_ASTR, KC_MINS, KC_VOLD, KC_PPLS, KC_PGUP, KC_HOME, KC_UP, KC_END,
_______, KC_SLSH, _______, _______, TT(_LW), _______, _______, _______, _______, _______, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT
),
/* NAV - mouse & navigation
* gui left and right are line home/end, or fore & back in browser
* Mouse buttons are reversed for comfort - bigger stretch is to the right button.
*
* ,-----------------------------------------. .-----------------------------------------.
* | NAV | | | Up | |Gui-> | | MwU | MS_UL| MS_U |MS_UR | |Ms Norm|
* |------+------+------+------+------+------| |------+------+------+------+------+--------|
* | |Gui<- | Left | Down |Right | C^E | | BTN3 | MS_L |MS Up | MS_R | |Ms Fast |
* |------+------+------+------+------+------|------|------+------+------+------+------+--------|
* | | C^A | GUI X| GUI C| GUI_V| |Enter/| MWD | M_DL |MS Dwn|MS_DR | Up |Ms Slow |
* |------+------+------+------+------+------+ // +------+------+------+------+------+------|
* | | GuiZ | | | Low | |/ButnR|ButnL | Hi | | Left | Down | Right |
* `------------------------------------------------------------------------------------------'
* ,-----------------------------------------. .-----------------------------------------.
* | NAV | | | Up | |Gui-> | | MwU | MS_UL| MS_U |MS_UR | |MsNorm|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | |Gui<- | Left | Down |Right | C^E | | BTN3 | MS_L |MS Up | MS_R | |MsFast|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | C^A | GUI X| GUI C| GUI_V| | | MWD | M_DL |MS Dwn|MS_DR | Up |MsSlow|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | | GuiZ | | | Low | |Enter | ButnR|ButnL | Hi | | Left | Down | Right|
* `-------------------------------------------------------------------------------------------------'
*/
[_NAV] = LAYOUT(
TG(_NAV), XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, RGUI(KC_RGHT), KC_WH_U, M_MUL, KC_MS_U, M_MUR, XXXXXXX, KC_ACL2,
_______, RGUI(KC_LEFT), KC_LEFT, KC_DOWN, KC_RGHT, LCTL(KC_E), KC_BTN3, KC_MS_L, KC_MS_U, KC_MS_R, XXXXXXX, KC_ACL1,
_______, LCTL(KC_A), LGUI(KC_X), RGUI(KC_C), RGUI(KC_V), XXXXXXX, KC_ENT, KC_WH_D, M_MDL, KC_MS_D, M_MDR, KC_UP, KC_ACL0,
_______, RGUI(KC_Z), _______, _______, _______, _______, KC_BTN2, KC_BTN1, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT
TG(_NAV), XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, RGUI(KC_RGHT), KC_WH_U, M_MUL, KC_MS_U, M_MUR, XXXXXXX, KC_ACL2,
_______, RGUI(KC_LEFT), KC_LEFT, KC_DOWN, KC_RGHT, LCTL(KC_E), KC_BTN3, KC_MS_L, KC_MS_U, KC_MS_R, XXXXXXX, KC_ACL1,
_______, LCTL(KC_A), LGUI(KC_X), RGUI(KC_C), RGUI(KC_V), XXXXXXX, KC_WH_D, M_MDL, KC_MS_D, M_MDR, KC_UP, KC_ACL0,
_______, RGUI(KC_Z), _______, _______, _______, _______, KC_ENT, KC_BTN2, KC_BTN1, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT
),
/* FKEYS - Funtion keys & mac stuff
* ,-----------------------------------------. .-----------------------------------------.
* | FKEYS| F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | Ctrl |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | | | | | | | F11 | F12 | F13 | F14 | F15 | Alt |
* |------+------+------+------+------+------|------+------+------+------+------+------+------|
* |Qwerty| | | | | | /| | | | | | Del |
* |------+------+------+------+------+------+ // +------+------+------+------+------+------|
* | . |RGBTog| . | | LO | Bspc |/ | | HI | | | | |
* `------------------------------------------------------------------------------------------'
* ,-----------------------------------------. .-----------------------------------------.
* | FKEYS| F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | Ctrl |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | | | | | | | F11 | F12 | F13 | F14 | F15 | Alt |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* |Qwerty| | | | | | | | | | | | Del |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | . |RGBTog| . | | LO | Bspc | | | | HI | | | | |
* `-------------------------------------------------------------------------------------------------'
*/
[_FKEYS] = LAYOUT(
TG(_FKEYS), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_RCTL,
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_LALT,
TO(_QW), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_DEL,
_______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
TG(_FKEYS), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_RCTL,
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_LALT,
TO(_QW), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_DEL,
_______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* TRNS - skeleton for laters
* ,-----------------------------------------. .-----------------------------------------.
* | . | . | . | . | . | . | | ^ | & | * | ( | ) | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | . | . | . | . | . | . | | 6 | 7 | 8 | 9 | 0 | |
* |------+------+------+------+------+------|------+------+------+------+------+------+------|
* | . | . | . | . | . | . | /| | | | . | ; | " |
* |------+------+------+------+------+------+ // +------+------+------+------+------+------|
* | . | . | . | GUI | LO | . |/ | Spc | HI | GUI | M0 | / |LSFT |
* `------------------------------------------------------------------------------------------'
* ,-----------------------------------------. .-----------------------------------------.
* | . | . | . | . | . | . | | ^ | & | * | ( | ) | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | . | . | . | . | . | . | | 6 | 7 | 8 | 9 | 0 | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | . | . | . | . | . | . | | | | | . | ; | " |
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
* | . | . | . | GUI | LO | . | | | Spc | HI | GUI | M0 | / | LSFT |
* `-------------------------------------------------------------------------------------------------'
*/
[_TRNS] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};

View file

@ -5,10 +5,10 @@
#define XXX KC_NO
#define LAYOUT( \
k00, k01, k02, k03, k04, k05, k07, k08, k09, k0A, k0B, k0C, \
k10, k11, k12, k13, k14, k15, k17, k18, k19, k1A, k1B, k1C, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C \
k00, k01, k02, k03, k04, k05, k07, k08, k09, k0A, k0B, k0C, \
k10, k11, k12, k13, k14, k15, k17, k18, k19, k1A, k1B, k1C, \
k20, k21, k22, k23, k24, k25, k27, k28, k29, k2A, k2B, k2C, \
k30, k31, k32, k33, k34, k35, k26, k36, k37, k38, k39, k3A, k3B, k3C \
) { \
{ k00, k01, k02, k03, k04, k05, XXX, k07, k08, k09, k0A, k0B, k0C }, \
{ k10, k11, k12, k13, k14, k15, XXX, k17, k18, k19, k1A, k1B, k1C }, \