From: Don Armstrong Date: Sun, 22 Oct 2017 23:42:04 +0000 (-0700) Subject: move my keymap to new location and include QMK_KEYBOARD_H X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=35abd0dbe8675e14cf7b1c2aa019fd86263eea65;p=qmk_firmware.git move my keymap to new location and include QMK_KEYBOARD_H --- diff --git a/keyboards/ergodox/keymaps/don/Makefile b/keyboards/ergodox/keymaps/don/Makefile deleted file mode 100644 index bb0dd5d8f..000000000 --- a/keyboards/ergodox/keymaps/don/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# Build Options -# change to "no" to disable the options, or define them in the Makefile in -# the appropriate keymap folder that will get included automatically -# -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration -NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = no # Audio output on port C6 -UNICODE_ENABLE = yes # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -ifeq ($(SUBPROJECT_DIR),'infinity') -VISUALIZER_ENABLE = yes -LCD_BACKLIGHT_ENABLE = yes -LCD_ENABLE = yes -else -OPT_DEFS+= -DLEFT_LEDS -RGBLIGHT_ENABLE = no -endif - -dfu-util: $(BUILD_DIR)/$(TARGET).bin sizeafter - while true; do \ - sudo dfu-util -l | grep -q "DFU"; \ - if [ $$? -eq 0 ]; then \ - break; \ - fi; \ - sleep 0.1; \ - done; - sudo dfu-util --device DFU -D $(BUILD_DIR)/$(TARGET).bin - - -ifndef QUANTUM_DIR - include ../../../../Makefile -endif diff --git a/keyboards/ergodox/keymaps/don/keymap.c b/keyboards/ergodox/keymaps/don/keymap.c deleted file mode 100644 index 640b24f84..000000000 --- a/keyboards/ergodox/keymaps/don/keymap.c +++ /dev/null @@ -1,272 +0,0 @@ -/* -Copyright 2016 Fred Sundvik -Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "ergodox.h" -#include "debug.h" -#include "action_layer.h" -#include "version.h" -#include "keymap_plover.h" - -#define BASE 0 -#define SYMB 1 -#define MOUS 2 -#define FNXN 3 -#define NUMP 4 -#define PLVR 5 - - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [BASE] = KEYMAP( // layer 0 : default - // left hand - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_EQL, - KC_BSLS,KC_Q, KC_W, KC_E, KC_R, KC_T, TG(MOUS), - KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, - KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, MO(SYMB), - KC_EQL,KC_GRV, KC_BSLS,KC_LEFT,KC_RGHT, - KC_LALT,KC_LGUI, - KC_HOME, - KC_BSPC,KC_LCTL, KC_END, - // right hand - TG(NUMP), KC_6,KC_7, KC_8, KC_9, KC_0, KC_MINS, - KC_LBRC,KC_Y,KC_U, KC_I, KC_O, KC_P, KC_RBRC, - KC_H,KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, - TG(SYMB), KC_N,KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, - KC_UP, KC_DOWN,KC_LEFT,KC_RGHT,KC_RGUI, - KC_DEL,KC_RGUI, - KC_PGUP, - KC_PGDN,KC_ENT, KC_SPC - ), - - [SYMB] = KEYMAP( // layer 1 : function and symbol keys - // left hand - TG(PLVR),KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, - KC_TRNS,KC_LBRC,KC_RBRC,KC_LBRC,KC_RBRC,KC_SCLN,KC_TRNS, - KC_TRNS,KC_BSLS,KC_SLSH,KC_9 ,KC_0 ,KC_SCLN, - KC_TRNS,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_TRNS, - TG(FNXN),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS, - KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS, - // right hand - KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_PWR , - KC_TRNS,KC_TRNS,KC_EQL ,KC_EQL ,KC_MINS,KC_MINS,KC_VOLU, - KC_LEFT,KC_DOWN,KC_UP ,KC_RGHT,KC_TRNS,KC_VOLD, - KC_TRNS,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MUTE, - KC_MRWD,KC_MSTP,KC_MPLY,KC_MPRV,KC_MNXT, - KC_TRNS,KC_TRNS, - KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS - ), - [MOUS] = KEYMAP( // layer 2 : Mouse - // left hand - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS , - KC_TRNS,KC_BTN4,KC_BTN2,KC_BTN3,KC_BTN1,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS, - KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS, - // right hand - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_ACL0,KC_TRNS,KC_WH_D,KC_WH_U,KC_TRNS,KC_TRNS, - KC_ACL1,KC_MS_L,KC_MS_D,KC_MS_U,KC_MS_R,KC_TRNS, - KC_TRNS,KC_ACL2,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS, - KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS - ), - - [FNXN] = KEYMAP( // layer 3 : keyboard functions - // left hand - RESET,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_FN0, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_FN0, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,BL_TOGG,BL_STEP,BL_OFF,BL_ON,KC_TRNS,KC_FN0, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS, - KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS, - // right hand - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS, - KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS - ), - - [NUMP] = KEYMAP( // layer 4: numpad - // left hand - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS,KC_TRNS, - KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS, - // right hand - KC_TRNS,KC_NLCK, KC_PSLS,KC_PAST,KC_PAST,KC_PMNS,KC_BSPC, - KC_TRNS,KC_NO, KC_P7, KC_P8, KC_P9, KC_PMNS,KC_BSPC, - KC_NO, KC_P4, KC_P5, KC_P6, KC_PPLS,KC_PENT, - KC_TRNS,KC_NO, KC_P1, KC_P2, KC_P3, KC_PPLS,KC_PENT, - KC_P0, KC_PDOT,KC_SLSH,KC_PENT,KC_PENT, - KC_TRNS,KC_TRNS, - KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS - ), -/* Keymap 8: Steno for Plover - * - * ,--------------------------------------------------. ,---------------------------------------- - * | | | | | | | BASE | | | | | | | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+----- - * | | # | # | # | # | # | # | | # | # | # | # | # | # - * |--------+------+------+------+------+------| | | |------+------+------+------+----- - * | | | T | P | H | |------| |------| | F | P | L | T - * |--------+ S +------+------+------+ * | * | | * | * +------+------+------+----- - * | | | K | W | R | | | | | | R | B | G | S - * `--------+------+------+------+------+-------------' `-------------+------+------+------+----- - * | | | | | | | | | | - * `----------------------------------' `-------------------------- - * ,-------------. ,-------------. - * | | | | | | - * ,------|------|------| |------+------+------. - * | | | | | | | | - * | A | O |------| |------| E | U | - * | | | | | | | | - * `--------------------' `--------------------' - */ - -[PLVR] = KEYMAP( -// left hand -KC_TRNS,KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_FN0, -KC_NO, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, -KC_NO, PV_LS, PV_LT, PV_LP, PV_LH, PV_STAR, -KC_NO, PV_LS, PV_LK, PV_LW, PV_LR, PV_STAR, PV_STAR, -KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, - KC_NO, KC_NO, - KC_NO, - PV_A, PV_O, KC_NO, - - // right hand -KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, -PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, -PV_STAR, PV_RF, PV_RP, PV_RL, PV_RT, PV_RD, -PV_STAR, PV_STAR, PV_RR, PV_RB, PV_RG, PV_RS, PV_RZ, -KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, - KC_NO, KC_NO, - KC_NO, - KC_NO,PV_E, PV_U - ), -}; -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_LAYER_SET(BASE, ON_PRESS), // FN0 - push Layer0 -}; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - // MACRODOWN only works in this function - switch(id) { - case 0: - if (record->event.pressed) { - register_code(KC_RSFT); - } else { - unregister_code(KC_RSFT); - } - break; - } - return MACRO_NONE; -}; - -// Runs just one time when the keyboard initializes. -void matrix_init_user(void) { - -}; - -// Runs constantly in the background, in a loop. -void matrix_scan_user(void) { -#ifdef LEFT_LEDS - uint8_t layer = biton32(layer_state); - ergodox_left_led_1_off(); - ergodox_left_led_2_off(); - ergodox_left_led_3_off(); - ergodox_right_led_1_off(); - ergodox_right_led_2_off(); - ergodox_right_led_3_off(); - switch (layer) { - // TODO: Make this relevant to the ErgoDox EZ. - case SYMB: - ergodox_left_led_1_on(); - ergodox_right_led_1_on(); - break; - case MOUS: - ergodox_left_led_2_on(); - ergodox_right_led_2_on(); - break; - case NUMP: - ergodox_left_led_3_on(); - ergodox_right_led_3_on(); - break; - } -#endif - -}; - -// if this is my ergodox ez, I have left LEDs. -#ifdef LEFT_LEDS - -extern bool ergodox_left_led_1; -extern bool ergodox_left_led_2; -extern bool ergodox_left_led_3; - - -uint8_t ergodox_left_leds_update(void) { - if (mcp23018_status) { // if there was an error - return mcp23018_status; - } -#define LEFT_LED_1_SHIFT 7 // in MCP23018 port B -#define LEFT_LED_2_SHIFT 6 // in MCP23018 port B -#define LEFT_LED_3_SHIFT 7 // in MCP23018 port A - - // set logical value (doesn't matter on inputs) - // - unused : hi-Z : 1 - // - input : hi-Z : 1 - // - driving : hi-Z : 1 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); - if (mcp23018_status) goto out; - mcp23018_status = i2c_write(OLATA); - if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111 - & ~(ergodox_left_led_3<. -*/ - -// Currently we are assuming that both the backlight and LCD are enabled -// But it's entirely possible to write a custom visualizer that use only -// one of them -#ifndef LCD_BACKLIGHT_ENABLE -#error This visualizer needs that LCD backlight is enabled -#endif - -#ifndef LCD_ENABLE -#error This visualizer needs that LCD is enabled -#endif - -#include "visualizer.h" -// #include "led_test.h" - -static const char* welcome_text[] = {"QMK: Don Keymap", "Infinity Ergodox"}; - -// Just an example how to write custom keyframe functions, we could have moved -// all this into the init function -bool display_welcome(keyframe_animation_t* animation, visualizer_state_t* state) { - (void)animation; - // Read the uGFX documentation for information how to use the displays - // http://wiki.ugfx.org/index.php/Main_Page - gdispClear(White); - // You can use static variables for things that can't be found in the animation - // or state structs - gdispDrawString(0, 3, welcome_text[0], state->font_dejavusansbold12, Black); - gdispDrawString(0, 15, welcome_text[1], state->font_dejavusansbold12, Black); - // Always remember to flush the display - gdispFlush(); - // you could set the backlight color as well, but we won't do it here, since - // it's part of the following animation - // lcd_backlight_color(hue, saturation, intensity); - // We don't need constant updates, just drawing the screen once is enough - return false; -} - -// Feel free to modify the animations below, or even add new ones if needed - -// Don't worry, if the startup animation is long, you can use the keyboard like normal -// during that time -static keyframe_animation_t startup_animation = { - .num_frames = 4, - .loop = false, - .frame_lengths = {0, gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(5000), 0}, - .frame_functions = { - display_welcome, - keyframe_animate_backlight_color, - keyframe_no_operation, - enable_visualization - }, -}; - -// The color animation animates the LCD color when you change layers -static keyframe_animation_t color_animation = { - .num_frames = 2, - .loop = false, - // Note that there's a 200 ms no-operation frame, - // this prevents the color from changing when activating the layer - // momentarily - .frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)}, - .frame_functions = {keyframe_no_operation, keyframe_animate_backlight_color}, -}; - -// The LCD animation alternates between the layer name display and a -// bitmap that displays all active layers -static keyframe_animation_t lcd_animation = { - .num_frames = 2, - .loop = true, - .frame_lengths = {gfxMillisecondsToTicks(2000), gfxMillisecondsToTicks(2000)}, - .frame_functions = {keyframe_display_layer_text, keyframe_display_layer_bitmap}, -}; - -static keyframe_animation_t suspend_animation = { - .num_frames = 3, - .loop = false, - .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, - .frame_functions = { - keyframe_display_layer_text, - keyframe_animate_backlight_color, - keyframe_disable_lcd_and_backlight, - }, -}; - -static keyframe_animation_t resume_animation = { - .num_frames = 5, - .loop = false, - .frame_lengths = {0, 0, gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(5000), 0}, - .frame_functions = { - keyframe_enable_lcd_and_backlight, - display_welcome, - keyframe_animate_backlight_color, - keyframe_no_operation, - enable_visualization, - }, -}; - -void initialize_user_visualizer(visualizer_state_t* state) { - // The brightness will be dynamically adjustable in the future - // But for now, change it here. - lcd_backlight_brightness(0x50); - state->current_lcd_color = LCD_COLOR(0x00, 0x00, 0xFF); - state->target_lcd_color = LCD_COLOR(0x10, 0xFF, 0xFF); - start_keyframe_animation(&startup_animation); - // start_keyframe_animation(&led_test_animation); -} - -void update_user_visualizer_state(visualizer_state_t* state) { - // Add more tests, change the colors and layer texts here - // Usually you want to check the high bits (higher layers first) - // because that's the order layers are processed for keypresses - // You can for check for example: - // state->status.layer - // state->status.default_layer - // state->status.leds (see led.h for available statuses) - if (state->status.layer & 0x20) { - state->target_lcd_color = LCD_COLOR(0xB0, saturation, 0xFF); - state->layer_text = "Plover"; - } - else if (state->status.layer & 0x10) { - state->target_lcd_color = LCD_COLOR(0x90, saturation, 0xFF); - state->layer_text = "Numpad"; - } - else if (state->status.layer & 0x8) { - state->target_lcd_color = LCD_COLOR(0x60, saturation, 0xFF); - state->layer_text = "KBD FXNs"; - } - else if (state->status.layer & 0x4) { - state->target_lcd_color = LCD_COLOR(0x30, saturation, 0xFF); - state->layer_text = "Mouse"; - } - else if (state->status.layer & 0x2) { - state->target_lcd_color = LCD_COLOR(0x00, saturation, 0xFF); - state->layer_text = "FXN/Symbols"; - } - else { - state->target_lcd_color = LCD_COLOR(0x00, saturation, 0x80); - state->layer_text = "Default"; - } -} diff --git a/keyboards/ergodox_ez/keymaps/don/Makefile b/keyboards/ergodox_ez/keymaps/don/Makefile new file mode 100644 index 000000000..bb0dd5d8f --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/don/Makefile @@ -0,0 +1,40 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = yes # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +ifeq ($(SUBPROJECT_DIR),'infinity') +VISUALIZER_ENABLE = yes +LCD_BACKLIGHT_ENABLE = yes +LCD_ENABLE = yes +else +OPT_DEFS+= -DLEFT_LEDS +RGBLIGHT_ENABLE = no +endif + +dfu-util: $(BUILD_DIR)/$(TARGET).bin sizeafter + while true; do \ + sudo dfu-util -l | grep -q "DFU"; \ + if [ $$? -eq 0 ]; then \ + break; \ + fi; \ + sleep 0.1; \ + done; + sudo dfu-util --device DFU -D $(BUILD_DIR)/$(TARGET).bin + + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/ergodox_ez/keymaps/don/keymap.c b/keyboards/ergodox_ez/keymaps/don/keymap.c new file mode 100644 index 000000000..8d336d8e4 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/don/keymap.c @@ -0,0 +1,272 @@ +/* +Copyright 2016 Fred Sundvik +Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include QMK_KEYBOARD_H +#include "debug.h" +#include "action_layer.h" +#include "version.h" +#include "keymap_plover.h" + +#define BASE 0 +#define SYMB 1 +#define MOUS 2 +#define FNXN 3 +#define NUMP 4 +#define PLVR 5 + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [BASE] = KEYMAP( // layer 0 : default + // left hand + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_EQL, + KC_BSLS,KC_Q, KC_W, KC_E, KC_R, KC_T, TG(MOUS), + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, MO(SYMB), + KC_EQL,KC_GRV, KC_BSLS,KC_LEFT,KC_RGHT, + KC_LALT,KC_LGUI, + KC_HOME, + KC_BSPC,KC_LCTL, KC_END, + // right hand + TG(NUMP), KC_6,KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_LBRC,KC_Y,KC_U, KC_I, KC_O, KC_P, KC_RBRC, + KC_H,KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, + TG(SYMB), KC_N,KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, + KC_UP, KC_DOWN,KC_LEFT,KC_RGHT,KC_RGUI, + KC_DEL,KC_RGUI, + KC_PGUP, + KC_PGDN,KC_ENT, KC_SPC + ), + + [SYMB] = KEYMAP( // layer 1 : function and symbol keys + // left hand + TG(PLVR),KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, + KC_TRNS,KC_LBRC,KC_RBRC,KC_LBRC,KC_RBRC,KC_SCLN,KC_TRNS, + KC_TRNS,KC_BSLS,KC_SLSH,KC_9 ,KC_0 ,KC_SCLN, + KC_TRNS,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_TRNS, + TG(FNXN),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_PWR , + KC_TRNS,KC_TRNS,KC_EQL ,KC_EQL ,KC_MINS,KC_MINS,KC_VOLU, + KC_LEFT,KC_DOWN,KC_UP ,KC_RGHT,KC_TRNS,KC_VOLD, + KC_TRNS,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MUTE, + KC_MRWD,KC_MSTP,KC_MPLY,KC_MPRV,KC_MNXT, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS + ), + [MOUS] = KEYMAP( // layer 2 : Mouse + // left hand + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS , + KC_TRNS,KC_BTN4,KC_BTN2,KC_BTN3,KC_BTN1,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_ACL0,KC_TRNS,KC_WH_D,KC_WH_U,KC_TRNS,KC_TRNS, + KC_ACL1,KC_MS_L,KC_MS_D,KC_MS_U,KC_MS_R,KC_TRNS, + KC_TRNS,KC_ACL2,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS + ), + + [FNXN] = KEYMAP( // layer 3 : keyboard functions + // left hand + RESET,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_FN0, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_FN0, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,BL_TOGG,BL_STEP,BL_OFF,BL_ON,KC_TRNS,KC_FN0, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS + ), + + [NUMP] = KEYMAP( // layer 4: numpad + // left hand + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_TRNS,KC_NLCK, KC_PSLS,KC_PAST,KC_PAST,KC_PMNS,KC_BSPC, + KC_TRNS,KC_NO, KC_P7, KC_P8, KC_P9, KC_PMNS,KC_BSPC, + KC_NO, KC_P4, KC_P5, KC_P6, KC_PPLS,KC_PENT, + KC_TRNS,KC_NO, KC_P1, KC_P2, KC_P3, KC_PPLS,KC_PENT, + KC_P0, KC_PDOT,KC_SLSH,KC_PENT,KC_PENT, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS + ), +/* Keymap 8: Steno for Plover + * + * ,--------------------------------------------------. ,---------------------------------------- + * | | | | | | | BASE | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+----- + * | | # | # | # | # | # | # | | # | # | # | # | # | # + * |--------+------+------+------+------+------| | | |------+------+------+------+----- + * | | | T | P | H | |------| |------| | F | P | L | T + * |--------+ S +------+------+------+ * | * | | * | * +------+------+------+----- + * | | | K | W | R | | | | | | R | B | G | S + * `--------+------+------+------+------+-------------' `-------------+------+------+------+----- + * | | | | | | | | | | + * `----------------------------------' `-------------------------- + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | A | O |------| |------| E | U | + * | | | | | | | | + * `--------------------' `--------------------' + */ + +[PLVR] = KEYMAP( +// left hand +KC_TRNS,KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_FN0, +KC_NO, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, +KC_NO, PV_LS, PV_LT, PV_LP, PV_LH, PV_STAR, +KC_NO, PV_LS, PV_LK, PV_LW, PV_LR, PV_STAR, PV_STAR, +KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, + KC_NO, + PV_A, PV_O, KC_NO, + + // right hand +KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, +PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, +PV_STAR, PV_RF, PV_RP, PV_RL, PV_RT, PV_RD, +PV_STAR, PV_STAR, PV_RR, PV_RB, PV_RG, PV_RS, PV_RZ, +KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, + KC_NO, + KC_NO,PV_E, PV_U + ), +}; +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_SET(BASE, ON_PRESS), // FN0 - push Layer0 +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { +#ifdef LEFT_LEDS + uint8_t layer = biton32(layer_state); + ergodox_left_led_1_off(); + ergodox_left_led_2_off(); + ergodox_left_led_3_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case SYMB: + ergodox_left_led_1_on(); + ergodox_right_led_1_on(); + break; + case MOUS: + ergodox_left_led_2_on(); + ergodox_right_led_2_on(); + break; + case NUMP: + ergodox_left_led_3_on(); + ergodox_right_led_3_on(); + break; + } +#endif + +}; + +// if this is my ergodox ez, I have left LEDs. +#ifdef LEFT_LEDS + +extern bool ergodox_left_led_1; +extern bool ergodox_left_led_2; +extern bool ergodox_left_led_3; + + +uint8_t ergodox_left_leds_update(void) { + if (mcp23018_status) { // if there was an error + return mcp23018_status; + } +#define LEFT_LED_1_SHIFT 7 // in MCP23018 port B +#define LEFT_LED_2_SHIFT 6 // in MCP23018 port B +#define LEFT_LED_3_SHIFT 7 // in MCP23018 port A + + // set logical value (doesn't matter on inputs) + // - unused : hi-Z : 1 + // - input : hi-Z : 1 + // - driving : hi-Z : 1 + mcp23018_status = i2c_start(I2C_ADDR_WRITE); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(OLATA); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b11111111 + & ~(ergodox_left_led_3<. +*/ + +// Currently we are assuming that both the backlight and LCD are enabled +// But it's entirely possible to write a custom visualizer that use only +// one of them +#ifndef LCD_BACKLIGHT_ENABLE +#error This visualizer needs that LCD backlight is enabled +#endif + +#ifndef LCD_ENABLE +#error This visualizer needs that LCD is enabled +#endif + +#include "visualizer.h" +// #include "led_test.h" + +static const char* welcome_text[] = {"QMK: Don Keymap", "Infinity Ergodox"}; + +// Just an example how to write custom keyframe functions, we could have moved +// all this into the init function +bool display_welcome(keyframe_animation_t* animation, visualizer_state_t* state) { + (void)animation; + // Read the uGFX documentation for information how to use the displays + // http://wiki.ugfx.org/index.php/Main_Page + gdispClear(White); + // You can use static variables for things that can't be found in the animation + // or state structs + gdispDrawString(0, 3, welcome_text[0], state->font_dejavusansbold12, Black); + gdispDrawString(0, 15, welcome_text[1], state->font_dejavusansbold12, Black); + // Always remember to flush the display + gdispFlush(); + // you could set the backlight color as well, but we won't do it here, since + // it's part of the following animation + // lcd_backlight_color(hue, saturation, intensity); + // We don't need constant updates, just drawing the screen once is enough + return false; +} + +// Feel free to modify the animations below, or even add new ones if needed + +// Don't worry, if the startup animation is long, you can use the keyboard like normal +// during that time +static keyframe_animation_t startup_animation = { + .num_frames = 4, + .loop = false, + .frame_lengths = {0, gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(5000), 0}, + .frame_functions = { + display_welcome, + keyframe_animate_backlight_color, + keyframe_no_operation, + enable_visualization + }, +}; + +// The color animation animates the LCD color when you change layers +static keyframe_animation_t color_animation = { + .num_frames = 2, + .loop = false, + // Note that there's a 200 ms no-operation frame, + // this prevents the color from changing when activating the layer + // momentarily + .frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)}, + .frame_functions = {keyframe_no_operation, keyframe_animate_backlight_color}, +}; + +// The LCD animation alternates between the layer name display and a +// bitmap that displays all active layers +static keyframe_animation_t lcd_animation = { + .num_frames = 2, + .loop = true, + .frame_lengths = {gfxMillisecondsToTicks(2000), gfxMillisecondsToTicks(2000)}, + .frame_functions = {keyframe_display_layer_text, keyframe_display_layer_bitmap}, +}; + +static keyframe_animation_t suspend_animation = { + .num_frames = 3, + .loop = false, + .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, + .frame_functions = { + keyframe_display_layer_text, + keyframe_animate_backlight_color, + keyframe_disable_lcd_and_backlight, + }, +}; + +static keyframe_animation_t resume_animation = { + .num_frames = 5, + .loop = false, + .frame_lengths = {0, 0, gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(5000), 0}, + .frame_functions = { + keyframe_enable_lcd_and_backlight, + display_welcome, + keyframe_animate_backlight_color, + keyframe_no_operation, + enable_visualization, + }, +}; + +void initialize_user_visualizer(visualizer_state_t* state) { + // The brightness will be dynamically adjustable in the future + // But for now, change it here. + lcd_backlight_brightness(0x50); + state->current_lcd_color = LCD_COLOR(0x00, 0x00, 0xFF); + state->target_lcd_color = LCD_COLOR(0x10, 0xFF, 0xFF); + start_keyframe_animation(&startup_animation); + // start_keyframe_animation(&led_test_animation); +} + +void update_user_visualizer_state(visualizer_state_t* state) { + // Add more tests, change the colors and layer texts here + // Usually you want to check the high bits (higher layers first) + // because that's the order layers are processed for keypresses + // You can for check for example: + // state->status.layer + // state->status.default_layer + // state->status.leds (see led.h for available statuses) + if (state->status.layer & 0x20) { + state->target_lcd_color = LCD_COLOR(0xB0, saturation, 0xFF); + state->layer_text = "Plover"; + } + else if (state->status.layer & 0x10) { + state->target_lcd_color = LCD_COLOR(0x90, saturation, 0xFF); + state->layer_text = "Numpad"; + } + else if (state->status.layer & 0x8) { + state->target_lcd_color = LCD_COLOR(0x60, saturation, 0xFF); + state->layer_text = "KBD FXNs"; + } + else if (state->status.layer & 0x4) { + state->target_lcd_color = LCD_COLOR(0x30, saturation, 0xFF); + state->layer_text = "Mouse"; + } + else if (state->status.layer & 0x2) { + state->target_lcd_color = LCD_COLOR(0x00, saturation, 0xFF); + state->layer_text = "FXN/Symbols"; + } + else { + state->target_lcd_color = LCD_COLOR(0x00, saturation, 0x80); + state->layer_text = "Default"; + } +}