+++ /dev/null
-/*
-Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
-Jun Wako <wakojun@gmail.com>
-
-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
-#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_TRN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,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<<LEFT_LED_3_SHIFT)
- );
- if (mcp23018_status) goto out;
- mcp23018_status = i2c_write(0b11111111
- & ~(ergodox_left_led_2<<LEFT_LED_2_SHIFT)
- & ~(ergodox_left_led_1<<LEFT_LED_1_SHIFT)
- );
- if (mcp23018_status) goto out;
-
- out:
- i2c_stop();
- return mcp23018_status;
-}
-#endif
+++ /dev/null
-# 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
-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 ($(strip $(KEYBOARD)),ergodox_infinity)
-VISUALIZER_ENABLE = yes
-LCD_BACKLIGHT_ENABLE = yes
-BACKLIGHT_ENABLE = yes
-LCD_ENABLE = yes
-# ifndef QUANTUM_DIR
-# include ../../../../Makefile
-# endif
-else
-OPT_DEFS+= -DLEFT_LEDS
-BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
-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
-
-
+++ /dev/null
-/*
-Copyright 2017 Fred Sundvik
-
-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/>.
-*/
-
-// 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 "visualizer_keyframes.h"
-#include "lcd_keyframes.h"
-#include "lcd_backlight_keyframes.h"
-#include "led_backlight_keyframes.h"
-#include "system/serial_link.h"
-// #include "default_animations.h"
-// #include "led_test.h"
-
-static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
-static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state);
-
-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, 0xFF, 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
-
-static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
-#ifdef LCD_ENABLE
- lcd_keyframe_enable(animation, state);
-#endif
-#ifdef LCD_BACKLIGHT_ENABLE
- lcd_backlight_keyframe_enable(animation, state);
-#endif
-#ifdef BACKLIGHT_ENABLE
- led_backlight_keyframe_enable(animation, state);
-#endif
- return false;
-}
-
-static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
-#ifdef LCD_ENABLE
- lcd_keyframe_disable(animation, state);
-#endif
-#ifdef LCD_BACKLIGHT_ENABLE
- lcd_backlight_keyframe_disable(animation, state);
-#endif
-#ifdef BACKLIGHT_ENABLE
- led_backlight_keyframe_disable(animation, state);
-#endif
- return false;
-}
-
-static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
- bool ret = false;
-#ifdef LCD_BACKLIGHT_ENABLE
- ret |= lcd_backlight_keyframe_animate_color(animation, state);
-#endif
-#ifdef BACKLIGHT_ENABLE
- ret |= led_backlight_keyframe_fade_in_all(animation, state);
-#endif
- return ret;
-}
-
-static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
- bool ret = false;
-#ifdef LCD_BACKLIGHT_ENABLE
- ret |= lcd_backlight_keyframe_animate_color(animation, state);
-#endif
-#ifdef BACKLIGHT_ENABLE
- ret |= led_backlight_keyframe_fade_out_all(animation, state);
-#endif
- return ret;
-}
-
-// 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 = {
-#if LCD_ENABLE
- .num_frames = 3,
-#else
- .num_frames = 2,
-#endif
- .loop = false,
- .frame_lengths = {
- 0,
-#if LCD_ENABLE
- 0,
-#endif
- gfxMillisecondsToTicks(5000)},
- .frame_functions = {
- keyframe_enable,
-#if LCD_ENABLE
- display_welcome,
-#endif
- keyframe_fade_in,
- },
-};
-
-keyframe_animation_t suspend_animation = {
-#if LCD_ENABLE
- .num_frames = 3,
-#else
- .num_frames = 2,
-#endif
- .loop = false,
- .frame_lengths = {
-#if LCD_ENABLE
- 0,
-#endif
- gfxMillisecondsToTicks(1000),
- 0},
- .frame_functions = {
-#if LCD_ENABLE
- lcd_keyframe_display_layer_text,
-#endif
- keyframe_fade_out,
- keyframe_disable,
- },
-};
-
-void user_visualizer_suspend(visualizer_state_t* state) {
- state->layer_text = "Suspending...";
- uint8_t hue = LCD_HUE(state->current_lcd_color);
- uint8_t sat = LCD_SAT(state->current_lcd_color);
- state->target_lcd_color = LCD_COLOR(hue, sat, 0);
- start_keyframe_animation(&suspend_animation);
-}
-
-void user_visualizer_resume(visualizer_state_t* state) {
- state->current_lcd_color = LCD_COLOR(0,0,0);
- state->target_lcd_color = LCD_COLOR(0,0,0xFF);
- // initial_update = true;
- start_keyframe_animation(&startup_animation);
-}
-
-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, visualizer_keyboard_status_t* prev_status) {
- // 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, 0xFF, 0xFF);
- state->layer_text = "Plover";
- }
- else if (state->status.layer & 0x10) {
- state->target_lcd_color = LCD_COLOR(0x90, 0xFF, 0xFF);
- state->layer_text = "Numpad";
- }
- else if (state->status.layer & 0x8) {
- state->target_lcd_color = LCD_COLOR(0x60, 0xFF, 0xFF);
- state->layer_text = "KBD FXNs";
- }
- else if (state->status.layer & 0x4) {
- state->target_lcd_color = LCD_COLOR(0x30, 0xFF, 0xFF);
- state->layer_text = "Mouse";
- }
- else if (state->status.layer & 0x2) {
- state->target_lcd_color = LCD_COLOR(0x00, 0xFF, 0xFF);
- state->layer_text = "FXN/Symbols";
- }
- else {
- state->target_lcd_color = LCD_COLOR(0x00, 0xFF, 0x80);
- state->layer_text = "Default";
- }
-}
+++ /dev/null
-../../ergodox_ez/keymaps/don
\ No newline at end of file
--- /dev/null
+/*
+Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
+Jun Wako <wakojun@gmail.com>
+
+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
+#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,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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<<LEFT_LED_3_SHIFT)
+ );
+ if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(0b11111111
+ & ~(ergodox_left_led_2<<LEFT_LED_2_SHIFT)
+ & ~(ergodox_left_led_1<<LEFT_LED_1_SHIFT)
+ );
+ if (mcp23018_status) goto out;
+
+ out:
+ i2c_stop();
+ return mcp23018_status;
+}
+#endif
--- /dev/null
+# 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
+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 ($(strip $(KEYBOARD)),ergodox_infinity)
+VISUALIZER_ENABLE = yes
+LCD_BACKLIGHT_ENABLE = yes
+BACKLIGHT_ENABLE = yes
+LCD_ENABLE = yes
+# ifndef QUANTUM_DIR
+# include ../../../../Makefile
+# endif
+else
+OPT_DEFS+= -DLEFT_LEDS
+BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+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
+
+
--- /dev/null
+/*
+Copyright 2017 Fred Sundvik
+
+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/>.
+*/
+
+// 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 "visualizer_keyframes.h"
+#include "lcd_keyframes.h"
+#include "lcd_backlight_keyframes.h"
+#include "led_backlight_keyframes.h"
+#include "system/serial_link.h"
+// #include "default_animations.h"
+// #include "led_test.h"
+
+static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
+static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state);
+
+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, 0xFF, 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
+
+static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
+#ifdef LCD_ENABLE
+ lcd_keyframe_enable(animation, state);
+#endif
+#ifdef LCD_BACKLIGHT_ENABLE
+ lcd_backlight_keyframe_enable(animation, state);
+#endif
+#ifdef BACKLIGHT_ENABLE
+ led_backlight_keyframe_enable(animation, state);
+#endif
+ return false;
+}
+
+static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
+#ifdef LCD_ENABLE
+ lcd_keyframe_disable(animation, state);
+#endif
+#ifdef LCD_BACKLIGHT_ENABLE
+ lcd_backlight_keyframe_disable(animation, state);
+#endif
+#ifdef BACKLIGHT_ENABLE
+ led_backlight_keyframe_disable(animation, state);
+#endif
+ return false;
+}
+
+static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
+ bool ret = false;
+#ifdef LCD_BACKLIGHT_ENABLE
+ ret |= lcd_backlight_keyframe_animate_color(animation, state);
+#endif
+#ifdef BACKLIGHT_ENABLE
+ ret |= led_backlight_keyframe_fade_in_all(animation, state);
+#endif
+ return ret;
+}
+
+static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
+ bool ret = false;
+#ifdef LCD_BACKLIGHT_ENABLE
+ ret |= lcd_backlight_keyframe_animate_color(animation, state);
+#endif
+#ifdef BACKLIGHT_ENABLE
+ ret |= led_backlight_keyframe_fade_out_all(animation, state);
+#endif
+ return ret;
+}
+
+// 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 = {
+#if LCD_ENABLE
+ .num_frames = 3,
+#else
+ .num_frames = 2,
+#endif
+ .loop = false,
+ .frame_lengths = {
+ 0,
+#if LCD_ENABLE
+ 0,
+#endif
+ gfxMillisecondsToTicks(5000)},
+ .frame_functions = {
+ keyframe_enable,
+#if LCD_ENABLE
+ display_welcome,
+#endif
+ keyframe_fade_in,
+ },
+};
+
+keyframe_animation_t suspend_animation = {
+#if LCD_ENABLE
+ .num_frames = 3,
+#else
+ .num_frames = 2,
+#endif
+ .loop = false,
+ .frame_lengths = {
+#if LCD_ENABLE
+ 0,
+#endif
+ gfxMillisecondsToTicks(1000),
+ 0},
+ .frame_functions = {
+#if LCD_ENABLE
+ lcd_keyframe_display_layer_text,
+#endif
+ keyframe_fade_out,
+ keyframe_disable,
+ },
+};
+
+void user_visualizer_suspend(visualizer_state_t* state) {
+ state->layer_text = "Suspending...";
+ uint8_t hue = LCD_HUE(state->current_lcd_color);
+ uint8_t sat = LCD_SAT(state->current_lcd_color);
+ state->target_lcd_color = LCD_COLOR(hue, sat, 0);
+ start_keyframe_animation(&suspend_animation);
+}
+
+void user_visualizer_resume(visualizer_state_t* state) {
+ state->current_lcd_color = LCD_COLOR(0,0,0);
+ state->target_lcd_color = LCD_COLOR(0,0,0xFF);
+ // initial_update = true;
+ start_keyframe_animation(&startup_animation);
+}
+
+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, visualizer_keyboard_status_t* prev_status) {
+ // 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, 0xFF, 0xFF);
+ state->layer_text = "Plover";
+ }
+ else if (state->status.layer & 0x10) {
+ state->target_lcd_color = LCD_COLOR(0x90, 0xFF, 0xFF);
+ state->layer_text = "Numpad";
+ }
+ else if (state->status.layer & 0x8) {
+ state->target_lcd_color = LCD_COLOR(0x60, 0xFF, 0xFF);
+ state->layer_text = "KBD FXNs";
+ }
+ else if (state->status.layer & 0x4) {
+ state->target_lcd_color = LCD_COLOR(0x30, 0xFF, 0xFF);
+ state->layer_text = "Mouse";
+ }
+ else if (state->status.layer & 0x2) {
+ state->target_lcd_color = LCD_COLOR(0x00, 0xFF, 0xFF);
+ state->layer_text = "FXN/Symbols";
+ }
+ else {
+ state->target_lcd_color = LCD_COLOR(0x00, 0xFF, 0x80);
+ state->layer_text = "Default";
+ }
+}