1
0
Fork 0

adding my stuff back after hard reset

This commit is contained in:
Oryhara 2018-02-12 14:47:32 -06:00 committed by Jack Humbert
parent 20b5dd80bd
commit b89e318d35
5 changed files with 592 additions and 41 deletions

View file

@ -0,0 +1,105 @@
/*
Copyright 2015 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/>.
*/
#ifndef INFINITY_ERGODOX_CONFIG_H
#define INFINITY_ERGODOX_CONFIG_H
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6464
#define DEVICE_VER 0x0001
/* in python2: list(u"whatever".encode('utf-16-le')) */
/* at most 32 characters or the ugly hack in usb_main.c borks */
#define MANUFACTURER "TMK"
#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00'
#define PRODUCT "Infinity keyboard/TMK"
#define USBSTR_PRODUCT 'I', '\x00', 'n', '\x00', 'f', '\x00', 'i', '\x00', 'n', '\x00', 'i', '\x00', 't', '\x00', 'y', '\x00', ' ', '\x00', 'k', '\x00', 'e', '\x00', 'y', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', '/', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00'
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
#define MOUSEKEY_MAX_SPEED 7
#define MOUSEKEY_WHEEL_DELAY 0
#define TAPPING_TOGGLE 1
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
#define TAPPING_TERM 200
#define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.)
/* 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
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || \
keyboard_report->mods == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) \
)
/* key matrix size */
#define MATRIX_ROWS 18
#define MATRIX_COLS 5
#define LOCAL_MATRIX_ROWS 9
/* number of backlight levels */
#define BACKLIGHT_LEVELS 3
#define LED_BRIGHTNESS_LO 100
#define LED_BRIGHTNESS_HI 255
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
#define SERIAL_LINK_BAUD 562500
#define SERIAL_LINK_THREAD_PRIORITY (NORMALPRIO - 1)
#define VISUALIZER_USER_DATA_SIZE 16
/*
* music mode options
* midi enabled
* keymask disabled
* so typing normally will result in music
*
*/
#define MUSIC_MASK keycode != KC_NO
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#endif

View file

@ -2,15 +2,19 @@
#include "debug.h"
#include "action_layer.h"
#include "version.h"
#define QWERTY 0 // qwerty layer
#define HALFQWERTY 1 // mirrored qwerty layer
#define DVORAK 2 // dvorak layer
#define HALFDVORAK 3 // mirrored dvorak layer
#include "keymap_steno.h"
#ifndef MIDI_ENABLE
#error "Midi is not enabled"
#endif
#define QWERTY 0 // qwerty layer
#define HALFQWERTY 1 // mirrored qwerty layer
#define DVORAK 2 // dvorak layer
#define HALFDVORAK 3 // mirrored dvorak layer
#define SYMB 5 // symbols
#define HALFSYMB 6 // media keys
#define PLVR 7 // steno plover layout
#define SHORTCUTS 8 //layer with shortcut keys
#define MDIA 9
enum custom_keycodes {
@ -37,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,-------------. ,-------------.
* |Symbol|Dvorak| |Plover|HalfSymb|
* ,------|------|------| |------+--------+------.
* | | | Home | | PgUp | | |
* | | |MU_TOG| | PgUp | | |
* | Space|DELETE|------| |------| Tab |Enter |
* |mirror| | End | | PgDn | |mirror|
* `--------------------' `----------------------'
@ -52,16 +56,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MINUS,
KC_LCTRL, KC_LALT, LCTL(LSFT(KC_TAB)),LCTL(KC_TAB), MO(SHORTCUTS),
TG(SYMB), TG(DVORAK),
KC_HOME,
MU_ON,
LT(HALFQWERTY, KC_SPACE),KC_DEL,KC_END,
// right hand
KC_BSLS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_SLASH,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
KC_EQL,KC_N, KC_M, KC_COMM,KC_DOT, KC_SLASH, KC_RSFT,
KC_RGUI, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL,
TG(PLVR), TG(HALFSYMB),
KC_PGUP,
MO(MDIA), KC_UP,KC_DOWN,KC_RALT, KC_RCTRL,
TG(PLVR), TG(MDIA),
MU_OFF,
KC_PGDN,KC_TAB, LT(HALFQWERTY, KC_ENT)
),
/* Keymap 1: mirrored qwerty
@ -95,16 +99,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LSFT, KC_SLASH, KC_DOT, KC_COMM,KC_M, KC_N, KC_EQL,
KC_LCTRL, KC_LALT, LCTL(LSFT(KC_TAB)),LCTL(KC_TAB), KC_TRNS,
KC_TRNS, KC_TRANSPARENT,
KC_HOME,
KC_TRNS,
KC_TRANSPARENT,KC_DEL,KC_END,
// right hand
KC_GRAVE, KC_5, KC_4, KC_3, KC_2, KC_1, KC_BSPC,
KC_LBRC, KC_T, KC_R, KC_E, KC_W, KC_Q, KC_BSLS,
KC_G, KC_F, KC_D, KC_S, KC_A, KC_ENT,
KC_MINUS,KC_B, KC_V, KC_C, KC_X, KC_Z, KC_RSFT,
KC_RGUI, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL,
KC_TRNS, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL,
KC_TRANSPARENT, KC_TRNS,
KC_PGUP,
KC_TRNS,
KC_PGDN,KC_TAB, KC_TRANSPARENT
),
/* Keymap 3: dvorak
@ -118,7 +122,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+------| - | | = |------+------+------+------+------+--------|
* | LShift | ; | Q | J | K | X | | | | B | M | W | V | Z | RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |LCTRL|ALT |CTLShTab|CTL-TAB| LGui| | RGui| UP | DOWN | ALT | RCTRL |
* |LCTRL|ALT |CTLShTab|CTL-TAB| LGui| | Mouse| UP | DOWN | ALT | RCTRL |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Alt | | | |Alt |
@ -138,16 +142,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_MINUS,
KC_LCTRL, KC_LALT, LCTL(LSFT(KC_TAB)),LCTL(KC_TAB), KC_TRNS,
TG(SYMB), KC_TRANSPARENT,
KC_HOME,
KC_TRNS,
LT(HALFDVORAK, KC_SPACE),KC_DEL,KC_END,
// right hand
KC_BSLS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_RBRC, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLASH,
KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT,
KC_EQL,KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT,
KC_RGUI, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL,
KC_TRANSPARENT, TG(HALFSYMB),
KC_PGUP,
KC_TRNS, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL,
KC_TRANSPARENT, TG(MDIA),
KC_TRNS,
KC_PGDN,KC_TAB, LT(HALFDVORAK, KC_ENT)
),
/* Keymap 3: mirrored dvorak
@ -161,7 +165,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+------| = | | - |------+------+------+------+------+--------|
* | LShift | Z | V | W | M | B | | | | X | K | J | Q | ; | RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |LCTRL|ALT |CTLShTab|CTL-TAB| LGui| | RGui| UP | DOWN | ALT | RCTRL |
* |LCTRL|ALT |CTLShTab|CTL-TAB| LGui| | MOUSE| UP | DOWN | ALT | RCTRL |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Alt | | | |Alt |
@ -181,16 +185,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LSFT, KC_Z, KC_V, KC_W, KC_M, KC_B, KC_EQL,
KC_LCTRL, KC_LALT, LCTL(LSFT(KC_TAB)),LCTL(KC_TAB), KC_TRNS,
KC_TRANSPARENT, KC_TRANSPARENT,
KC_HOME,
KC_TRNS,
KC_TRANSPARENT,KC_DEL,KC_END,
// right hand
KC_GRAVE, KC_5, KC_4, KC_3, KC_2, KC_5, KC_ESC,
KC_LBRC, KC_Y, KC_P, KC_DOT, KC_COMM,KC_P, KC_TAB,
KC_I, KC_U, KC_E, KC_O, KC_A, KC_BSPC,
KC_MINUS,KC_X, KC_K, KC_J, KC_Q, KC_SCLN, KC_RSFT,
KC_RGUI, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL,
KC_TRNS, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL,
KC_TRANSPARENT, KC_TRNS,
KC_PGUP,
KC_TRNS,
KC_PGDN,KC_TAB, KC_TRANSPARENT
),
/* Keymap 5: Symbol Layer
@ -230,7 +234,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_NO, KC_UP, KC_KP_7, KC_KP_8, KC_KP_9,KC_KP_ASTERISK, KC_KP_SLASH,
KC_DOWN, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_MINUS, KC_KP_ENTER,
KC_NO,KC_AMPR,KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_PLUS, KC_NO,
KC_NO,KC_DOT, KC_0, KC_KP_EQUAL, KC_NO,
KC_TRNS,KC_DOT, KC_0, KC_KP_EQUAL, KC_NO,
KC_NO, KC_TRNS,
KC_NO,
KC_NO, KC_NO, LT(HALFSYMB, KC_ENT)
@ -265,16 +269,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_NO,KC_NO,KC_KP_1, KC_KP_2, KC_KP_3,KC_KP_PLUS,KC_KP_ENTER,
EPRM,KC_NO,KC_KP_0,KC_KP_DOT,KC_KP_EQUAL,
KC_TRNS,KC_NO,
KC_NO,
KC_TRNS,
KC_TRANSPARENT,KC_NO,KC_NO,
// right hand
KC_F6, KC_F5, KC_F4, KC_F3, KC_F2, KC_F1, KC_BSPC,
KC_NO,KC_PIPE,KC_LCBR,KC_RCBR, KC_SLASH, KC_BSLS, KC_NO,
KC_GRV,KC_LPRN,KC_RPRN, KC_SCLN, KC_QUOT, KC_NO,
KC_NO, KC_TILD,KC_LBRC,KC_RBRC, KC_EQL, KC_MINUS, KC_NO,
KC_NO,KC_NO, KC_NO, KC_NO, KC_NO,
KC_TRNS,KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_TRNS,
KC_NO,
KC_TRNS,
KC_NO, KC_NO, KC_TRANSPARENT
),
@ -303,22 +307,107 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[PLVR] = LAYOUT_ergodox( // layout: layer 4: Steno for Plover
// left hand
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS,
KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T,
KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO,
STN_N1, STN_N2, STN_N3, STN_N4, STN_N5, STN_N6, KC_NO,
STN_FN, STN_S1, STN_TL, STN_PL, STN_HL, STN_ST1,
KC_NO, STN_S2, STN_KL, STN_WL, STN_RL, STN_ST2, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_FN4, KC_NO,
KC_NO,
KC_C, KC_V, KC_NO,
KC_TRNS, KC_TRNS,
KC_TRNS,
STN_A, STN_O, KC_NO,
// right hand
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS,
KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,
KC_NO, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS,
KC_TRNS, STN_N7, STN_N8, STN_N9, STN_NA, STN_NB, STN_NC,
STN_ST3, STN_FR, STN_PR, STN_LR, STN_TR, STN_DR,
KC_NO,STN_ST4, STN_RR, STN_BR, STN_GR, STN_SR, STN_ZR,
KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_NO, KC_N, KC_M
KC_NO, STN_E, STN_U
),
/* Keymap 8: shortcuts
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | ESC | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | BSPC |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | TAB | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | BkSp | A | S | D | F | G |------| |------| H | J | K | L | ; |ENTER |
* |--------+------+------+------+------+------| - | | = |------+------+------+------+------+--------|
* | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |LCTRL|ALT |CTLShTab|CTL-TAB| | | RGui| UP | DOWN | ALT | RCTRL |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Alt |Dvorak| |Plover|Alt |
* ,------|------|------| |------+--------+------.
* | | | Home | | PgUp | | |
* | Space|DELETE|------| |------| Tab |Enter |
* |mirror| | End | | PgDn | |mirror|
* `--------------------' `----------------------'
*/
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
// Otherwise, it needs KC_*
[SHORTCUTS] = LAYOUT_ergodox( // layer 0 : default
// left hand
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO,
KC_TAB, LCTL(KC_Q), LCTL(KC_W),LCTL(KC_E),LCTL(KC_R),LCTL(KC_T), KC_NO,
KC_BSPC, LCTL(KC_A), LCTL(KC_S),LCTL(KC_D),LCTL(KC_F),LCTL(KC_G),
KC_LSFT, LCTL(KC_Z), LCTL(KC_X),LCTL(KC_C),LCTL(KC_V),LCTL(KC_B), KC_MINUS,
KC_LCTRL, KC_LALT, LCTL(LSFT(KC_TAB)),LCTL(KC_TAB), KC_TRANSPARENT,
KC_NO, KC_NO,
KC_NO,
KC_NO,KC_NO,KC_NO,
// right hand
KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
KC_EQL,KC_N, KC_M, KC_COMM,KC_DOT, KC_SLASH, KC_RSFT,
KC_TRNS, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL,
KC_NO, KC_TRNS,
KC_NO,
KC_NO,KC_NO, KC_NO
),
/* Keymap 2: Media and mouse keys
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | |LClick| MsUp |RClick| | | | | |LClick| MsUp |RClick| | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | |MsLeft|MsDown|MsRght| |------| |------| |MsLeft|MsDown|MsRght| | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// MEDIA AND MOUSE
[MDIA] = LAYOUT_ergodox(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_WH_U,
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WH_D,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_WH_L, KC_WH_R, KC_TRNS,
// right hand
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_WH_U, KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_TRNS,
KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS,
KC_WH_D, 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_WH_L, KC_WH_R
),
/* Keymap 8: shortcuts
*
@ -418,7 +507,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
steno_set_mode(STENO_MODE_GEMINI); // or STENO_MODE_BOLT
};

View file

@ -0,0 +1,91 @@
# project specific files
SRC = matrix.c \
led.c
## chip/board settings
# - the next two should match the directories in
# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
# - For Teensies, FAMILY = KINETIS and SERIES is either
# KL2x (LC) or K20x (3.0,3.1,3.2).
# - For Infinity KB, SERIES = K20x
MCU_FAMILY = KINETIS
MCU_SERIES = K20x
# Linker script to use
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
# or <this_dir>/ld/
# - NOTE: a custom ld script is needed for EEPROM on Teensy LC
# - LDSCRIPT =
# - MKL26Z64 for Teensy LC
# - MK20DX128 for Teensy 3.0
# - MK20DX256 for Teensy 3.1 and 3.2
# - MK20DX128BLDR4 for Infinity 60% with Kiibohd bootloader
# - MK20DX256BLDR8 for Infinity ErgoDox with Kiibohd bootloader
MCU_LDSCRIPT = MK20DX256BLDR8
# Startup code to use
# - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
# - STARTUP =
# - kl2x for Teensy LC
# - k20x5 for Teensy 3.0 and Infinity 60%
# - k20x7 for Teensy 3.1, 3.2 and Infinity ErgoDox
MCU_STARTUP = k20x7
# Board: it should exist either in <chibios>/os/hal/boards/
# or <this_dir>/boards
# - BOARD =
# - PJRC_TEENSY_LC for Teensy LC
# - PJRC_TEENSY_3 for Teensy 3.0
# - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2
# - MCHCK_K20 for Infinity KB
#BOARD = MCHCK_K20
BOARD = PJRC_TEENSY_3_1
# Cortex version
# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4
MCU = cortex-m4
# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
# I.e. 6 for Teensy LC; 7 for Teensy 3.x
ARMV = 7
# Vector table for application
# 0x00000000-0x00001000 area is occupied by bootlaoder.*/
# The CORTEX_VTOR... is needed only for MCHCK/Infinity KB
OPT_DEFS += -DCORTEX_VTOR_INIT=0x00002000
# Build Options
# comment out to disable the options.
#
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
CUSTOM_MATRIX = yes # Custom matrix file for the ErgoDox EZ
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
UNICODE_ENABLE = yes # Unicode
ONEHAND_ENABLE = yes # Allow swapping hands of keyboard
STENO_ENABLE = yes #enable plover steno mode
CUSTOM_MATRIX = yes # Custom matrix file
SERIAL_LINK_ENABLE = yes
VISUALIZER_ENABLE = yes
LCD_ENABLE = yes
BACKLIGHT_ENABLE = yes
LCD_BACKLIGHT_ENABLE = yes
MIDI_ENABLE = yes
MIDI_ADVANCED = yes
MUSIC_MODE = yes
RGBLIGHT_ENABLE = no
LCD_DRIVER = st7565
LCD_WIDTH = 128
LCD_HEIGHT = 32
LED_DRIVER = is31fl3731c
LED_WIDTH = 7
LED_HEIGHT = 7
LAYOUTS = ergodox

View file

@ -12,7 +12,140 @@ 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 "simple_visualizer.h"
#include "visualizer.h"
#include "gfx.h"
#include "math.h"
#include "default_animations.h"
#include "led_backlight_keyframes.h"
#define ONESIDESCAN 9
#define BOTHSIDESCAN 16
#define FULL_ON LUMA2COLOR(255)
#define THREE_QUARTER LUMA2COLOR(200)
#define HALF_ON LUMA2COLOR(150)
#define ONE_QUARTER LUMA2COLOR(50)
#define CROSSFADE_TIME 8000
bool KITT_scan_one_side_left_to_right(keyframe_animation_t* animation, visualizer_state_t* state);
bool KITT_scan_one_side_right_to_left(keyframe_animation_t* animation, visualizer_state_t* state);
keyframe_animation_t Fade_in_all_leds = {
.num_frames = 1,
.loop = false,
.frame_lengths = {
CROSSFADE_TIME,
},
.frame_functions = {
led_backlight_keyframe_fade_in_all,
},
};
/*
* one set left to right. then reverse to go back.
* | left side | right side | |
|---|---|---|---|---|---|---|:-:|---|---|---|---|---|---|-------|
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | phase |
_________________________________________________________________
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| 2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
| 1 | 2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
| 0 | 1 | 2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
| 0 | 0 | 1 | 2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
| 0 | 0 | 0 | 1 | 2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
| 0 | 0 | 0 | 0 | 1 | 2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
| 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 0 | 0 | 0 | 0 | 0 | 9 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 0 | 0 | 0 | 0 | 10 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 0 | 0 | 0 | 11 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 0 | 0 | 12 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 0 | 13 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 14 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 15 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 16 |
*/
#ifdef MASTER_IS_ON_RIGHT /*right side*/
keyframe_animation_t KITT_Scanner_animation = {
.num_frames = 2,
.loop = true,
.frame_lengths = {
CROSSFADE_TIME * BOTHSIDESCAN,
CROSSFADE_TIME * BOTHSIDESCAN,
},
.frame_functions = {
KITT_scan_one_side_left_to_right,
KITT_scan_one_side_right_to_left,
},
};
bool KITT_scan_one_side_left_to_right(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
float frame_length = animation->frame_lengths[animation->current_frame];
float current_pos = frame_length - animation->time_left_in_frame;
int phase = current_pos/(frame_length/BOTHSIDESCAN);
int row = 0;
gdispGClear(LED_DISPLAY, ONE_QUARTER);
gdispGDrawPixel(LED_DISPLAY, 14-phase, row, FULL_ON);
gdispGDrawPixel(LED_DISPLAY, 15-phase, row, THREE_QUARTER);
gdispGDrawPixel(LED_DISPLAY, 16-phase, row, HALF_ON);
gdispGDrawPixel(LED_DISPLAY, 6, row, ONE_QUARTER);
return true;
}
bool KITT_scan_one_side_right_to_left(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
float frame_length = animation->frame_lengths[animation->current_frame];
float current_pos = frame_length - animation->time_left_in_frame;
int phase = current_pos/(frame_length/BOTHSIDESCAN);
int row = 0;
gdispGClear(LED_DISPLAY, ONE_QUARTER);
gdispGDrawPixel(LED_DISPLAY, phase, row, FULL_ON);
gdispGDrawPixel(LED_DISPLAY, phase-1, row, THREE_QUARTER);
gdispGDrawPixel(LED_DISPLAY, phase-2, row, HALF_ON);
gdispGDrawPixel(LED_DISPLAY, 6, row, ONE_QUARTER);
return true;
}
#else /*left side*/
keyframe_animation_t KITT_Scanner_animation = {
.num_frames = 2,
.loop = true,
.frame_lengths = {
CROSSFADE_TIME * BOTHSIDESCAN,
CROSSFADE_TIME * BOTHSIDESCAN,
},
.frame_functions = {
KITT_scan_one_side_left_to_right,
KITT_scan_one_side_right_to_left,
},
};
bool KITT_scan_one_side_left_to_right(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
float frame_length = animation->frame_lengths[animation->current_frame];
float current_pos = frame_length - animation->time_left_in_frame;
int phase = current_pos/(frame_length/BOTHSIDESCAN);
int row = 0;
gdispGClear(LED_DISPLAY, ONE_QUARTER);
gdispGDrawPixel(LED_DISPLAY, phase, row, FULL_ON);
gdispGDrawPixel(LED_DISPLAY, phase-1, row, THREE_QUARTER);
gdispGDrawPixel(LED_DISPLAY, phase-2, row, HALF_ON);
gdispGDrawPixel(LED_DISPLAY, 6, row, ONE_QUARTER);
return true;
}
bool KITT_scan_one_side_right_to_left(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
float frame_length = animation->frame_lengths[animation->current_frame];
float current_pos = frame_length - animation->time_left_in_frame;
int phase = current_pos/(frame_length/BOTHSIDESCAN);
int row = 0;
gdispGClear(LED_DISPLAY, ONE_QUARTER);
gdispGDrawPixel(LED_DISPLAY, (14 - phase), row, FULL_ON);
gdispGDrawPixel(LED_DISPLAY, 14 - (phase-1), row, THREE_QUARTER);
gdispGDrawPixel(LED_DISPLAY, 14 - (phase-2), row, HALF_ON);
gdispGDrawPixel(LED_DISPLAY, 6, row, ONE_QUARTER);
return true;
}
#endif
#define RED 0
#define ORANGE 21
@ -37,13 +170,19 @@ static void get_visualizer_layer_and_color(visualizer_state_t* state) {
/* if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {
saturation = 255;
} */
if (state->status.layer & 0x100) {
if (state->status.layer & 0x200) {
state->target_lcd_color = LCD_COLOR(GREEN, saturation, 0xFF);
state->layer_text = "MOUSE";
}
else if (state->status.layer & 0x100) {
state->target_lcd_color = LCD_COLOR(MAGENTA, saturation, 0xFF);
state->layer_text = "Shortcuts Layer";
}
else if (state->status.layer & 0x80) {
state->target_lcd_color = LCD_COLOR(VIOLET, saturation, 0xFF);
state->layer_text = "Plover";
start_keyframe_animation(&KITT_Scanner_animation);
}
else if (state->status.layer & 0x40) {
state->target_lcd_color = LCD_COLOR(RASPBERRY, saturation, 0xFF);
@ -68,5 +207,7 @@ static void get_visualizer_layer_and_color(visualizer_state_t* state) {
else {
state->target_lcd_color = LCD_COLOR(YELLOW, saturation, 0xFF);
state->layer_text = "Qwerty";
stop_keyframe_animation(&KITT_Scanner_animation);
start_keyframe_animation(&Fade_in_all_leds);
}
}
}

View file

@ -0,0 +1,125 @@
/* 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/>.
*/
#ifndef VISUALIZER_H_
#define VISUALIZER_H_
// 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 "system/serial_link.h"
#include "led.h"
#include "default_animations.h"
static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
static const uint32_t initial_color = LCD_COLOR(0, 0, 0);
static bool initial_update = true;
// Feel free to modify the animations below, or even add new ones if needed
extern keyframe_animation_t KITT_Scanner_animation;
static keyframe_animation_t lcd_layer_display = {
.num_frames = 1,
.loop = false,
.frame_lengths = {gfxMillisecondsToTicks(0)},
.frame_functions = {lcd_keyframe_display_layer_and_led_states}
};
// 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, lcd_backlight_keyframe_animate_color},
};
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(130);
state->current_lcd_color = initial_color;
state->target_lcd_color = logo_background_color;
initial_update = true;
start_keyframe_animation(&default_startup_animation);
}
// This function should be implemented by the keymap visualizer
// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing
// that the simple_visualizer assumes that you are updating
// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is
// stopped. This can be done by either double buffering it or by using constant strings
static void get_visualizer_layer_and_color(visualizer_state_t* state);
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)
uint32_t prev_color = state->target_lcd_color;
const char* prev_layer_text = state->layer_text;
get_visualizer_layer_and_color(state);
if (initial_update || prev_color != state->target_lcd_color) {
start_keyframe_animation(&color_animation);
}
if (initial_update || prev_layer_text != state->layer_text) {
start_keyframe_animation(&lcd_layer_display);
}
// You can also stop existing animations, and start your custom ones here
// remember that you should normally have only one animation for the LCD
// and one for the background. But you can also combine them if you want.
}
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(&default_suspend_animation);
}
void user_visualizer_resume(visualizer_state_t* state) {
state->current_lcd_color = initial_color;
state->target_lcd_color = logo_background_color;
initial_update = true;
start_keyframe_animation(&default_startup_animation);
}
#endif /* VISUALIZER_H_ */