Merge pull request #20 from qmk/master

Merge from QMK
pull/1231/head
Damien 8 years ago committed by GitHub
commit a43cb6c0af

@ -7,11 +7,11 @@ endif
include common.mk include common.mk
ifneq ($(SUBPROJECT),) ifneq ($(SUBPROJECT),)
TARGET ?= $(KEYBOARD)_$(SUBPROJECT)_$(KEYMAP) TARGET ?= $(KEYBOARD)_$(SUBPROJECT)_$(KEYMAP)
KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD)_$(SUBPROJECT) KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD)_$(SUBPROJECT)
else else
TARGET ?= $(KEYBOARD)_$(KEYMAP) TARGET ?= $(KEYBOARD)_$(KEYMAP)
KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD) KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD)
endif endif
# Force expansion # Force expansion
@ -20,15 +20,15 @@ TARGET := $(TARGET)
MASTER ?= left MASTER ?= left
ifdef master ifdef master
MASTER = $(master) MASTER = $(master)
endif endif
ifeq ($(MASTER),right) ifeq ($(MASTER),right)
OPT_DEFS += -DMASTER_IS_ON_RIGHT OPT_DEFS += -DMASTER_IS_ON_RIGHT
else else
ifneq ($(MASTER),left) ifneq ($(MASTER),left)
$(error MASTER does not have a valid value(left/right)) $(error MASTER does not have a valid value(left/right))
endif endif
endif endif
@ -56,31 +56,31 @@ endif
# We can assume a ChibiOS target When MCU_FAMILY is defined, since it's not used for LUFA # We can assume a ChibiOS target When MCU_FAMILY is defined, since it's not used for LUFA
ifdef MCU_FAMILY ifdef MCU_FAMILY
PLATFORM=CHIBIOS PLATFORM=CHIBIOS
else else
PLATFORM=AVR PLATFORM=AVR
endif endif
ifeq ($(PLATFORM),CHIBIOS) ifeq ($(PLATFORM),CHIBIOS)
include $(TMK_PATH)/protocol/chibios.mk include $(TMK_PATH)/protocol/chibios.mk
include $(TMK_PATH)/chibios.mk include $(TMK_PATH)/chibios.mk
OPT_OS = chibios OPT_OS = chibios
ifneq ("$(wildcard $(SUBPROJECT_PATH)/bootloader_defs.h)","") ifneq ("$(wildcard $(SUBPROJECT_PATH)/bootloader_defs.h)","")
OPT_DEFS += -include $(SUBPROJECT_PATH)/bootloader_defs.h OPT_DEFS += -include $(SUBPROJECT_PATH)/bootloader_defs.h
else ifneq ("$(wildcard $(SUBPROJECT_PATH)/boards/$(BOARD)/bootloader_defs.h)","") else ifneq ("$(wildcard $(SUBPROJECT_PATH)/boards/$(BOARD)/bootloader_defs.h)","")
OPT_DEFS += -include $(SUBPROJECT_PATH)/boards/$(BOARD)/bootloader_defs.h OPT_DEFS += -include $(SUBPROJECT_PATH)/boards/$(BOARD)/bootloader_defs.h
else ifneq ("$(wildcard $(KEYBOARD_PATH)/bootloader_defs.h)","") else ifneq ("$(wildcard $(KEYBOARD_PATH)/bootloader_defs.h)","")
OPT_DEFS += -include $(KEYBOARD_PATH)/bootloader_defs.h OPT_DEFS += -include $(KEYBOARD_PATH)/bootloader_defs.h
else ifneq ("$(wildcard $(KEYBOARD_PATH)/boards/$(BOARD)/bootloader_defs.h)","") else ifneq ("$(wildcard $(KEYBOARD_PATH)/boards/$(BOARD)/bootloader_defs.h)","")
OPT_DEFS += -include $(KEYBOARD_PATH)/boards/$(BOARD)/bootloader_defs.h OPT_DEFS += -include $(KEYBOARD_PATH)/boards/$(BOARD)/bootloader_defs.h
endif endif
endif endif
CONFIG_H = $(KEYBOARD_PATH)/config.h CONFIG_H = $(KEYBOARD_PATH)/config.h
ifneq ($(SUBPROJECT),) ifneq ($(SUBPROJECT),)
ifneq ("$(wildcard $(SUBPROJECT_C))","") ifneq ("$(wildcard $(SUBPROJECT_C))","")
CONFIG_H = $(SUBPROJECT_PATH)/config.h CONFIG_H = $(SUBPROJECT_PATH)/config.h
endif endif
endif endif
# Save the defines and includes here, so we don't include any keymap specific ones # Save the defines and includes here, so we don't include any keymap specific ones
@ -112,30 +112,30 @@ KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","") ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
CONFIG_H = $(KEYMAP_PATH)/config.h CONFIG_H = $(KEYMAP_PATH)/config.h
endif endif
# # project specific files # # project specific files
SRC += $(KEYBOARD_C) \ SRC += $(KEYBOARD_C) \
$(KEYMAP_C) \ $(KEYMAP_C) \
$(QUANTUM_DIR)/quantum.c \ $(QUANTUM_DIR)/quantum.c \
$(QUANTUM_DIR)/keymap_common.c \ $(QUANTUM_DIR)/keymap_common.c \
$(QUANTUM_DIR)/keycode_config.c \ $(QUANTUM_DIR)/keycode_config.c \
$(QUANTUM_DIR)/process_keycode/process_leader.c $(QUANTUM_DIR)/process_keycode/process_leader.c
ifneq ($(SUBPROJECT),) ifneq ($(SUBPROJECT),)
SRC += $(SUBPROJECT_C) SRC += $(SUBPROJECT_C)
endif endif
ifndef CUSTOM_MATRIX ifndef CUSTOM_MATRIX
SRC += $(QUANTUM_DIR)/matrix.c SRC += $(QUANTUM_DIR)/matrix.c
endif endif
ifeq ($(strip $(API_SYSEX_ENABLE)), yes) ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
OPT_DEFS += -DAPI_SYSEX_ENABLE OPT_DEFS += -DAPI_SYSEX_ENABLE
SRC += $(QUANTUM_DIR)/api/api_sysex.c SRC += $(QUANTUM_DIR)/api/api_sysex.c
OPT_DEFS += -DAPI_ENABLE OPT_DEFS += -DAPI_ENABLE
SRC += $(QUANTUM_DIR)/api.c SRC += $(QUANTUM_DIR)/api.c
MIDI_ENABLE=yes MIDI_ENABLE=yes
endif endif
@ -144,25 +144,25 @@ MUSIC_ENABLE := 0
ifeq ($(strip $(AUDIO_ENABLE)), yes) ifeq ($(strip $(AUDIO_ENABLE)), yes)
OPT_DEFS += -DAUDIO_ENABLE OPT_DEFS += -DAUDIO_ENABLE
MUSIC_ENABLE := 1 MUSIC_ENABLE := 1
SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
SRC += $(QUANTUM_DIR)/audio/audio.c SRC += $(QUANTUM_DIR)/audio/audio.c
SRC += $(QUANTUM_DIR)/audio/voices.c SRC += $(QUANTUM_DIR)/audio/voices.c
SRC += $(QUANTUM_DIR)/audio/luts.c SRC += $(QUANTUM_DIR)/audio/luts.c
endif endif
ifeq ($(strip $(MIDI_ENABLE)), yes) ifeq ($(strip $(MIDI_ENABLE)), yes)
OPT_DEFS += -DMIDI_ENABLE OPT_DEFS += -DMIDI_ENABLE
MUSIC_ENABLE := 1 MUSIC_ENABLE := 1
SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
endif endif
ifeq ($(MUSIC_ENABLE), 1) ifeq ($(MUSIC_ENABLE), 1)
SRC += $(QUANTUM_DIR)/process_keycode/process_music.c SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
endif endif
ifeq ($(strip $(COMBO_ENABLE)), yes) ifeq ($(strip $(COMBO_ENABLE)), yes)
OPT_DEFS += -DCOMBO_ENABLE OPT_DEFS += -DCOMBO_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
endif endif
ifeq ($(strip $(VIRTSER_ENABLE)), yes) ifeq ($(strip $(VIRTSER_ENABLE)), yes)
@ -171,56 +171,80 @@ endif
ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes) ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
OPT_DEFS += -DFAUXCLICKY_ENABLE OPT_DEFS += -DFAUXCLICKY_ENABLE
SRC += $(QUANTUM_DIR)/fauxclicky.c SRC += $(QUANTUM_DIR)/fauxclicky.c
endif endif
ifeq ($(strip $(UCIS_ENABLE)), yes) ifeq ($(strip $(UCIS_ENABLE)), yes)
OPT_DEFS += -DUCIS_ENABLE OPT_DEFS += -DUCIS_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
endif endif
ifeq ($(strip $(UNICODEMAP_ENABLE)), yes) ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
OPT_DEFS += -DUNICODEMAP_ENABLE OPT_DEFS += -DUNICODEMAP_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
endif endif
ifeq ($(strip $(UNICODE_ENABLE)), yes) ifeq ($(strip $(UNICODE_ENABLE)), yes)
OPT_DEFS += -DUNICODE_ENABLE OPT_DEFS += -DUNICODE_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
endif endif
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
OPT_DEFS += -DRGBLIGHT_ENABLE OPT_DEFS += -DRGBLIGHT_ENABLE
SRC += $(QUANTUM_DIR)/light_ws2812.c SRC += $(QUANTUM_DIR)/light_ws2812.c
SRC += $(QUANTUM_DIR)/rgblight.c SRC += $(QUANTUM_DIR)/rgblight.c
CIE1931_CURVE = yes
LED_BREATHING_TABLE = yes
endif endif
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
OPT_DEFS += -DTAP_DANCE_ENABLE OPT_DEFS += -DTAP_DANCE_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
endif endif
ifeq ($(strip $(PRINTING_ENABLE)), yes) ifeq ($(strip $(PRINTING_ENABLE)), yes)
OPT_DEFS += -DPRINTING_ENABLE OPT_DEFS += -DPRINTING_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
SRC += $(TMK_DIR)/protocol/serial_uart.c SRC += $(TMK_DIR)/protocol/serial_uart.c
endif endif
ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes) ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC)) SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
OPT_DEFS += $(SERIAL_DEFS) OPT_DEFS += $(SERIAL_DEFS)
VAPTH += $(SERIAL_PATH) VAPTH += $(SERIAL_PATH)
endif endif
ifneq ($(strip $(VARIABLE_TRACE)),) ifneq ($(strip $(VARIABLE_TRACE)),)
SRC += $(QUANTUM_DIR)/variable_trace.c SRC += $(QUANTUM_DIR)/variable_trace.c
OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE)) OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),) ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE)) OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
endif
endif
ifeq ($(strip $(LCD_ENABLE)), yes)
CIE1931_CURVE = yes
endif endif
ifeq ($(strip $(LED_ENABLE)), yes)
CIE1931_CURVE = yes
endif
ifeq ($(strip $(CIE1931_CURVE)), yes)
OPT_DEFS += -DUSE_CIE1931_CURVE
LED_TABLES = yes
endif
ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
OPT_DEFS += -DUSE_LED_BREATHING_TABLE
LED_TABLES = yes
endif
ifeq ($(strip $(LED_TABLES)), yes)
SRC += $(QUANTUM_DIR)/led_tables.c
endif endif
# Optimize size but this may cause error "relocation truncated to fit" # Optimize size but this may cause error "relocation truncated to fit"
@ -229,7 +253,7 @@ endif
# Search Path # Search Path
VPATH += $(KEYMAP_PATH) VPATH += $(KEYMAP_PATH)
ifneq ($(SUBPROJECT),) ifneq ($(SUBPROJECT),)
VPATH += $(SUBPROJECT_PATH) VPATH += $(SUBPROJECT_PATH)
endif endif
VPATH += $(KEYBOARD_PATH) VPATH += $(KEYBOARD_PATH)
VPATH += $(COMMON_VPATH) VPATH += $(COMMON_VPATH)
@ -243,27 +267,27 @@ EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
ifeq ($(PLATFORM),AVR) ifeq ($(PLATFORM),AVR)
ifeq ($(strip $(PROTOCOL)), VUSB) ifeq ($(strip $(PROTOCOL)), VUSB)
include $(TMK_PATH)/protocol/vusb.mk include $(TMK_PATH)/protocol/vusb.mk
else else
include $(TMK_PATH)/protocol/lufa.mk include $(TMK_PATH)/protocol/lufa.mk
endif endif
include $(TMK_PATH)/avr.mk include $(TMK_PATH)/avr.mk
endif endif
ifeq ($(strip $(VISUALIZER_ENABLE)), yes) ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer
VISUALIZER_PATH = $(QUANTUM_PATH)/visualizer VISUALIZER_PATH = $(QUANTUM_PATH)/visualizer
include $(VISUALIZER_PATH)/visualizer.mk include $(VISUALIZER_PATH)/visualizer.mk
endif endif
OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT) OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT)
$(KEYMAP_OUTPUT)_SRC := $(SRC) $(KEYMAP_OUTPUT)_SRC := $(SRC)
$(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\" $(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) $(GFXDEFS) -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\"
$(KEYMAP_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYMAP_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS)
$(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H) $(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H)
$(KEYBOARD_OUTPUT)_SRC := $(CHIBISRC) $(KEYBOARD_OUTPUT)_SRC := $(CHIBISRC) $(GFXSRC)
$(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS) $(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS) $(GFXDEFS)
$(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC) $(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC) $(GFXINC)
$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG) $(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
# Default target. # Default target.

@ -96,7 +96,7 @@ The keyboard `config.h` is included only if the keymap one doesn't exist. The fo
``` ```
#undef MY_SETTING #undef MY_SETTING
#define MY_SETTING 4 #define MY_SETTING 4
```c ```
For a value of `4` for this imaginary setting. So we `undef` it first, then `define` it. For a value of `4` for this imaginary setting. So we `undef` it first, then `define` it.

@ -0,0 +1,72 @@
#include "atomic.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* QWERTY - MIT ENHANCED / GRID COMPATIBLE
* .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
* | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
* | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | DEL |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
* | LCTRL1 | A | S | D | F | G | H | J | K | L | ; | ' | XXXXXX . ENTER | PG UP |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | LSHIFT | Z | X | C | V | B | N | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN |
* |--------+--------+--------+--------+--------+- 6.25u ---------+--------+--------+--------+--------+-----------------+--------+--------|
* | BRITE | LALT | FN | XXXXXX . SPACE | RCTRL | RALT | FN | LEFT | DOWN | RIGHT |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[0] = { /* QWERTY */
{ KC_ESC, 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_BSPC },
{ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL },
{ KC_LCTL, 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_ENT, KC_PGUP },
{ 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_RSFT, KC_UP, KC_PGDN },
{ M(0), KC_ALT, MO(1), KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT },
},
/* FUNCTION
* .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
* | GRV | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | XXXXXX . |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
* | SCR LK | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 | F21 | F22 | F23 | F24 | PAUSE | PR SCR |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
* | CAP LK | MS BT5 | MS BT4 | MS BT3 | MS BT2 | SLOW M | FAST M | NEXT | VOL+ | VOL- | PLAY | | XXXXXX . | WHEEL+ |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | NUM LK | | | | | | | | INSERT | END1 | HOME | XXXXXX . | MOUS U | WHEEL- |
* |--------+--------+--------+--------+--------+- 6.25 ------------+--------+--------+------+--------+-----------------+--------+--------|
* | | | FN | XXXXXX . MS BT1 | | | FN | MOUS L | MOUS D | MOUS R |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[1] = { /* FUNCTION LAYER*/
{ KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ },
{ KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR },
{ KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U },
{ KC_NLCK, _______, _______, _______, _______, _______, _______, _______, KC_INSERT, KC_END, KC_HOME, ___T___, ___T___, KC_MS_U, KC_WH_D },
{ _______, _______, MO(1), _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, MO(1), KC_MS_L, KC_MS_D, KC_MS_R },
},
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_MOMENTARY(1),
[2] = ACTION_LAYER_MOMENTARY(1),
};
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);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
break;
}
return MACRO_NONE;
};

@ -39,8 +39,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_LW] = { /* [> LOWER <] */ [_LW] = { /* [> LOWER <] */
{KC_INS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_TRNS, KC_UP, KC_F7, KC_F8, KC_F9, KC_F10}, {KC_INS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_TRNS, KC_UP, KC_F7, KC_F8, KC_F9, KC_F10},
{KC_DELT, KC_LEFT, KC_DOWN, KC_RGHT, KC_DOWN, KC_TRNS, KC_DOWN, KC_F4, KC_F5, KC_F6, KC_F11}, {KC_DELT, KC_LEFT, KC_DOWN, KC_RGHT, KC_DOWN, KC_TRNS, KC_DOWN, KC_F4, KC_F5, KC_F6, KC_F11},
{KC_TRNS, KC_VOLU, KC_TRNS, KC_TRNS, RESET, KC_LCTL, KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F12}, {KC_NO, KC_VOLU, KC_NO, KC_NO, RESET, KC_LCTL, KC_NO, KC_F1, KC_F2, KC_F3, KC_F12},
{KC_TRNS, KC_VOLD, KC_LGUI, KC_LSFT, KC_BSPC, KC_LALT, KC_SPC, DF(_QW), KC_PSCR, KC_SLCK, KC_PAUS} {KC_NO, KC_VOLD, KC_LGUI, KC_LSFT, KC_BSPC, KC_LALT, KC_SPC, TO(_QW), KC_PSCR, KC_SLCK, KC_PAUS}
}}; }};
const uint16_t PROGMEM fn_actions[] = { const uint16_t PROGMEM fn_actions[] = {

@ -12,49 +12,156 @@ extern keymap_config_t keymap_config;
// The underscores don't mean anything - you can have a layer called STUFF or any other name. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them // Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers. // entirely and just use numbers.
#define _DV 0 #define _DVORAK 0
#define _QW 1 #define _QWERTY 1
#define _CM 2 #define _COLEMAK 2
#define _L1 3 #define _DVORMAC 3
#define _L2 4 #define _LOWER 4
#define _RAISE 5
#define _ADJUST 16
// Macro name shortcuts enum planck_keycodes {
#define DVORAK M(_DV) DVORAK = SAFE_RANGE,
#define QWERTY M(_QW) QWERTY,
#define COLEMAK M(_CM) COLEMAK,
DVORMAC,
LOWER,
RAISE,
BACKLIT
};
// Adding macros to make the keymaps below much easier to read.
#define SFTSCLN SFT_T(KC_SCLN)
#define SFTSLSH SFT_T(KC_SLSH)
#define SFTZED SFT_T(KC_Z)
#define ALTENT ALT_T(KC_ENT)
#define ESCTRL CTL_T(KC_ESC)
#define TABALT ALT_T(KC_TAB)
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_DV] = { /* Dvorak */ /* Dvorak Layer
{KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_NO, KC_F, KC_G, KC_C, KC_R, KC_L }, ,----------------------------------. ,----------------------------------.
{KC_A, KC_O, KC_E, KC_U, KC_I, KC_NO, KC_D, KC_H, KC_T, KC_N, KC_S }, | ' | , | . | P | Y | | F | G | C | R | L |
{SFT_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, CTL_T(KC_DEL), KC_B, KC_M, KC_W, KC_V, SFT_T(KC_Z) }, |------+------+------+------+------| |------+------+------+------+------|
{KC_ESC, KC_TAB, KC_LGUI, MO(_L2), KC_BSPC, ALT_T(KC_ENT), KC_SPC, MO(_L1), KC_MINS, KC_SLSH, KC_EQL} | A | O | E | U | I | | D | H | T | N | S |
|------+------+------+------+------|------.,------|------+------+------+------+------|
|SFT/ ;| Q | J | K | X | CTRL ||Alt / | B | M | W | V |SFT/ Z|
|------+------+------+------+------| ||Enter |------+------+------+------+------|
| Esc | Tab | GUI | LOWER| BkSp |------'`------| Spc | RAISE| - | / | \ |
`----------------------------------' `----------------------------------' */
[_DVORAK] = {
{KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, XXXXXXX, KC_F, KC_G, KC_C, KC_R, KC_L },
{KC_A, KC_O, KC_E, KC_U, KC_I, XXXXXXX, KC_D, KC_H, KC_T, KC_N, KC_S },
{SFTSCLN, KC_Q, KC_J, KC_K, KC_X, KC_LCTL, KC_B, KC_M, KC_W, KC_V, SFTZED },
{ESCTRL, TABALT, KC_LGUI, LOWER, KC_BSPC, ALTENT, KC_SPC, RAISE, KC_MINS, KC_SLSH, KC_BSLS}
},
/* QWERTY Layer
,----------------------------------. ,----------------------------------.
| Q | W | E | R | T | | Y | U | I | O | P |
|------+------+------+------+------| |------+------+------+------+------|
| A | S | D | F | G | | H | J | K | L | ; |
|------+------+------+------+------|------.,------|------+------+------+------+------|
|SFT/ Z| X | C | V | B | CTRL ||Alt / | N | M | , | . |SFT/ /|
|------+------+------+------+------| ||Enter |------+------+------+------+------|
| Esc | Tab | GUI | LOWER| BkSp |------'`------| Spc | RAISE| - | ' | \ |
`----------------------------------' `----------------------------------' */
[_QWERTY] = {
{KC_Q, KC_W, KC_E, KC_R, KC_T, XXXXXXX, KC_Y, KC_U, KC_I, KC_O, KC_P },
{KC_A, KC_S, KC_D, KC_F, KC_G, XXXXXXX, KC_H, KC_J, KC_K, KC_L, KC_SCLN},
{SFTZED, KC_X, KC_C, KC_V, KC_B, KC_LCTL, KC_N, KC_M, KC_COMM, KC_DOT, SFTSLSH},
{ESCTRL, TABALT, KC_LGUI, LOWER, KC_BSPC, ALTENT, KC_SPC, RAISE, KC_MINS, KC_QUOT, KC_BSLS}
},
/* Colemak Layer
,----------------------------------. ,----------------------------------.
| Q | W | F | P | G | | J | L | U | Y | L |
|------+------+------+------+------| |------+------+------+------+------|
| A | R | S | T | D | | H | N | E | I | S |
|------+------+------+------+------|------.,------|------+------+------+------+------|
|SFT/ Z| X | C | V | B | CTRL ||Alt / | K | M | , | . |SFT/ /|
|------+------+------+------+------| ||Enter |------+------+------+------+------|
| Esc | Tab | GUI | LOWER| BkSp |------'`------| Spc | RAISE| - | ' | \ |
`----------------------------------' `----------------------------------'*/
[_COLEMAK] = {
{KC_Q, KC_W, KC_F, KC_P, KC_G, XXXXXXX, KC_J, KC_L, KC_U, KC_Y, KC_SCLN},
{KC_A, KC_R, KC_S, KC_T, KC_D, XXXXXXX, KC_H, KC_N, KC_E, KC_I, KC_O },
{SFTZED, KC_X, KC_C, KC_V, KC_B, KC_LCTL, KC_K, KC_M, KC_COMM, KC_DOT, SFTSLSH},
{ESCTRL, TABALT, KC_LGUI, LOWER, KC_BSPC, ALTENT, KC_SPC, RAISE, KC_MINS, KC_QUOT, KC_BSLS}
}, },
[_QW] = { /* Qwerty */
{KC_Q, KC_W, KC_E, KC_R, KC_T, KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_P }, /* Dvorak Layer with Command key on left thumb instead of Control
{KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO, KC_H, KC_J, KC_K, KC_L, KC_SCLN}, ,----------------------------------. ,----------------------------------.
{SFT_T(KC_Z), KC_X, KC_C, KC_V, KC_B, CTL_T(KC_DEL), KC_N, KC_M, KC_COMM, KC_DOT, SFT_T(KC_SLSH) }, | ' | , | . | P | Y | | F | G | C | R | L |
{KC_ESC, KC_TAB, KC_LGUI, MO(_L2), KC_BSPC, ALT_T(KC_ENT), KC_SPC, MO(_L1), KC_MINS, KC_QUOT, KC_ENT} |------+------+------+------+------| |------+------+------+------+------|
| A | O | E | U | I | | D | H | T | N | S |
|------+------+------+------+------|------.,------|------+------+------+------+------|
|SFT/ ;| Q | J | K | X | CMD ||Alt / | B | M | W | V |SFT/ Z|
|------+------+------+------+------| ||Enter |------+------+------+------+------|
| Esc | Tab | GUI | LOWER| BkSp |------'`------| Spc | RAISE| - | / | \ |
`----------------------------------' `----------------------------------' */
[_DVORMAC] = {
{KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, XXXXXXX, KC_F, KC_G, KC_C, KC_R, KC_L },
{KC_A, KC_O, KC_E, KC_U, KC_I, XXXXXXX, KC_D, KC_H, KC_T, KC_N, KC_S },
{SFTSCLN, KC_Q, KC_J, KC_K, KC_X, KC_LGUI, KC_B, KC_M, KC_W, KC_V, SFTZED },
{ESCTRL, TABALT, KC_LGUI, LOWER, KC_BSPC, ALTENT, KC_SPC, RAISE, KC_MINS, KC_SLSH, KC_BSLS}
}, },
[_CM] = { /* Colemak */
{KC_Q, KC_W, KC_F, KC_P, KC_G, KC_NO, KC_J, KC_L, KC_U, KC_Y, KC_SCLN}, /* LOWER Layer
{KC_A, KC_R, KC_S, KC_T, KC_D, KC_NO, KC_H, KC_N, KC_E, KC_I, KC_O }, ,----------------------------------. ,----------------------------------.
{SFT_T(KC_Z), KC_X, KC_C, KC_V, KC_B, CTL_T(KC_DEL), KC_K, KC_M, KC_COMM, KC_DOT, SFT_T(KC_SLSH) }, | ! | @ | # | $ | % | | ^ | & | * | ( | ) |
{KC_ESC, KC_TAB, KC_LGUI, MO(_L2), KC_BSPC, ALT_T(KC_ENT), KC_SPC, MO(_L1), KC_MINS, KC_QUOT, KC_ENT} |------+------+------+------+------| |------+------+------+------+------|
| CAPS | | UP | | Home | | PgDn | | + | { | } |
|------+------+------+------+------|------.,------|------+------+------+------+------|
| | Left | Down | Right| End | || | PgUp | Mute | Vol- | Vol+ | |
|------+------+------+------+------| || |------+------+------+------+------|
| ~ | | | | Del |------'`------| Ins | | | | |
`----------------------------------' `----------------------------------'*/
[_LOWER] = {
{KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, XXXXXXX, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN},
{KC_CAPS, _______, KC_UP, _______, KC_HOME, XXXXXXX, KC_PGUP, _______, KC_PLUS, KC_LCBR, KC_RCBR},
{_______, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, _______, KC_PGDN, KC_MUTE, KC_VOLD, KC_VOLU, _______},
{KC_TILD, _______, _______, _______, KC_DEL, _______, KC_INS, _______, _______, _______, _______}
}, },
[_L1] = { /* LAYER 1 */
{KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO, KC_6, KC_7, KC_8, KC_9, KC_0 }, /* RAISE Layer
{KC_TAB, KC_INS, KC_UP, KC_DEL, KC_HOME, KC_NO, KC_PGUP, KC_MUTE, KC_VOLD, KC_VOLU, KC_EQL }, ,----------------------------------. ,----------------------------------.
{KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, KC_LCTL, KC_PGDN, KC_MPRV, KC_MPLY, KC_MNXT, KC_BSLS}, | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |
{KC_TRNS, KC_GRV, KC_LGUI, KC_TRNS, KC_DEL, KC_LALT, KC_SPC, KC_TRNS, KC_LBRC, KC_RBRC, KC_ENT } |------+------+------+------+------| |------+------+------+------+------|
| CAPS | | UP | | Home | | PgDn | | = | [ | ] |
|------+------+------+------+------|------.,------|------+------+------+------+------|
| | Left | Down | Right| End | || | PgUp | Prev | Play | Next | |
|------+------+------+------+------| || |------+------+------+------+------|
| ` | | | | Del |------'`------| Ins | | | | |
`----------------------------------' `----------------------------------'*/
[_RAISE] = {
{KC_1, KC_2, KC_3, KC_4, KC_5, XXXXXXX, KC_6, KC_7, KC_8, KC_9, KC_0 },
{KC_CAPS, _______, KC_UP, _______, KC_HOME, XXXXXXX, KC_PGUP, _______, KC_EQL, KC_LBRC, KC_RBRC},
{_______, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, _______, KC_PGDN, KC_MPRV, KC_MPLY, KC_MNXT, _______},
{KC_GRV, _______, _______, _______, KC_DEL, _______, KC_INS, _______, _______, _______, _______}
}, },
[_L2] = { /* LAYER 2 */
{KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_NO, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN}, /* ADJUST Layer
{KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_NO, KC_TRNS, KC_F6, KC_F7, KC_F8, KC_PLUS}, ,----------------------------------. ,----------------------------------.
{KC_TRNS, KC_TRNS, DVORAK, QWERTY, COLEMAK, KC_LCTL, KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12 }, | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 |
{KC_TRNS, KC_TRNS, KC_LGUI, KC_TRNS, KC_BSPC, KC_LALT, KC_SPC, KC_TRNS, LSFT(KC_LBRC), LSFT(KC_RBRC), RESET} |------+------+------+------+------| |------+------+------+------+------|
| F11 | | | | | | | PrSc | ScLk | Paus | F12 |
|------+------+------+------+------|------.,------|------+------+------+------+------|
| |QWERTY|COLEMK|DVORAK|DVORMC| || | | | | | |
|------+------+------+------+------| || |------+------+------+------+------|
| | | | | |------'`------| | | | | RESET|
`----------------------------------' `----------------------------------'*/
[_ADJUST] = {
{KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, XXXXXXX, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 },
{KC_F11, _______, _______, _______, _______, XXXXXXX, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_F12 },
{_______, QWERTY, COLEMAK, DVORAK, DVORMAC, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET }
} }
}; };
const uint16_t PROGMEM fn_actions[] = { const uint16_t PROGMEM fn_actions[] = {
@ -66,24 +173,52 @@ void persistant_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer); default_layer_set(default_layer);
} }
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) bool process_record_user(uint16_t keycode, keyrecord_t *record) {
{ switch (keycode) {
switch(id) { case QWERTY:
case _DV: if (record->event.pressed) {
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_COLEMAK);
}
return false;
break;
case DVORAK:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_DVORAK);
}
return false;
break;
case DVORMAC:
if (record->event.pressed) { if (record->event.pressed) {
persistant_default_layer_set(1UL<<_DV); persistant_default_layer_set(1UL<<_DVORMAC);
} }
return false;
break; break;
case _QW: case LOWER:
if (record->event.pressed) { if (record->event.pressed) {
persistant_default_layer_set(1UL<<_QW); layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} }
return false;
break; break;
case _CM: case RAISE:
if (record->event.pressed) { if (record->event.pressed) {
persistant_default_layer_set(1UL<<_CM); layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} }
return false;
break; break;
} }
return MACRO_NONE; return true;
}; };

@ -0,0 +1,107 @@
# Xyverz's Atreus Keymap
## About this keymap:
This is the second iteration of my Atreus keymap. The first one was as close to the planck as I could get at the
time, but still very much like the original Atreus keymap. I've managed to get things working better now and have
implemented (more like copied) the RAISE/LOWER/ADJUST layers. This is a work in progress, but I think I'm closer
to a final go with this.
I'm using MOD_TAP quite a bit in this keymap. On all layers, R4 pinky keys use mod-tap and are SHIFT when held
and their normal keys when tapped. In addition, ESC and TAB are also set as Ctrl and ALT respectively when held,
and Enter/ALT on the right thumb key for all layers.
I've enabled persistent keymaps for Qwerty, Dvorak and Colemak layers, similar to the default Planck layouts.
Recently added: Documentation, Formatting, and another Dvorak layer that has Command on the left thumb, instead of
Control.
## Still to do:
* Enjoy this revision; figure out new things later.
### Layer 0: Dvorak layer
,----------------------------------. ,----------------------------------.
| ' | , | . | P | Y | | F | G | C | R | L |
|------+------+------+------+------| |------+------+------+------+------|
| A | O | E | U | I | | D | H | T | N | S |
|------+------+------+------+------|------.,------|------+------+------+------+------|
|Shft ;| Q | J | K | X | CTRL ||Alt / | B | M | W | V |Shft Z|
|------+------+------+------+------| ||Enter |------+------+------+------+------|
| Esc | Tab | GUI | LOWER| BkSp |------'`------| Spc | RAISE| - | / | \ |
`----------------------------------' `----------------------------------'
### Layer 1: QWERTY layer
,----------------------------------. ,----------------------------------.
| Q | W | E | R | T | | Y | U | I | O | P |
|------+------+------+------+------| |------+------+------+------+------|
| A | S | D | F | G | | H | J | K | L | ; |
|------+------+------+------+------|------.,------|------+------+------+------+------|
|Shft Z| X | C | V | B | CTRL ||Alt / | N | M | , | . |Shft /|
|------+------+------+------+------| ||Enter |------+------+------+------+------|
| Esc | Tab | GUI | LOWER| BkSp |------'`------| Spc | RAISE| - | ' | \ |
`----------------------------------' `----------------------------------'
### Keymap 2: Colemak layer
,----------------------------------. ,----------------------------------.
| Q | W | F | P | G | | J | L | U | Y | L |
|------+------+------+------+------| |------+------+------+------+------|
| A | R | S | T | D | | H | N | E | I | S |
|------+------+------+------+------|------.,------|------+------+------+------+------|
|Shft Z| X | C | V | B | CTRL ||Alt / | K | M | , | . |Shft /|
|------+------+------+------+------| ||Enter |------+------+------+------+------|
| Esc | Tab | GUI | LOWER| BkSp |------'`------| Spc | RAISE| - | ' | \ |
`----------------------------------' `----------------------------------'
### Keymap 3: Dvorak for Mac layout
,----------------------------------. ,----------------------------------.
| ' | , | . | P | Y | | F | G | C | R | L |
|------+------+------+------+------| |------+------+------+------+------|
| A | O | E | U | I | | D | H | T | N | S |
|------+------+------+------+------|------.,------|------+------+------+------+------|
|SFT/ ;| Q | J | K | X | CMD ||Alt / | B | M | W | V |SFT/ Z|
|------+------+------+------+------| ||Enter |------+------+------+------+------|
| Esc | Tab | GUI | LOWER| BkSp |------'`------| Spc | RAISE| - | / | \ |
`----------------------------------' `----------------------------------'
### Keymap 4: LOWER layer
,----------------------------------. ,----------------------------------.
| ! | @ | # | $ | % | | ^ | & | * | ( | ) |
|------+------+------+------+------| |------+------+------+------+------|
| CAPS | | UP | | Home | | PgDn | | + | { | } |
|------+------+------+------+------|------.,------|------+------+------+------+------|
| | Left | Down | Right| End | || | PgUp | Mute | Vol- | Vol+ | |
|------+------+------+------+------| || |------+------+------+------+------|
| ~ | | | | Del |------'`------| Ins | | | | |
`----------------------------------' `----------------------------------'
### Keymap 5: RAISE layer
,----------------------------------. ,----------------------------------.
| 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |
|------+------+------+------+------| |------+------+------+------+------|
| CAPS | | UP | | Home | | PgDn | | = | [ | ] |
|------+------+------+------+------|------.,------|------+------+------+------+------|
| | Left | Down | Right| End | || | PgUp | Prev | Play | Next | |
|------+------+------+------+------| || |------+------+------+------+------|
| ` | | | | Del |------'`------| Ins | | | | |
`----------------------------------' `----------------------------------'
### Keymap 6: ADJUST layer
,----------------------------------. ,----------------------------------.
| F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 |
|------+------+------+------+------| |------+------+------+------+------|
| F11 | | | | | | | PScr | SLck | Paus | F12 |
|------+------+------+------+------|------.,------|------+------+------+------+------|
| |QWERTY|COLEMK|DVORAK|DVORMC| || | | | | | |
|------+------+------+------+------| || |------+------+------+------+------|
| | | | | |------'`------| | | | | RESET|
`----------------------------------' `----------------------------------'

@ -0,0 +1,175 @@
/* This is the Atreus62 keyboard layout by Xyverz aka u/Zrevyx on r/mk
I've blatantly stolen what works for me from the Planck and Preonic
layouts and modified this file to fit me. Initial credet goes to
u/profet23 for the doing all the work and adding this keyboard to
QMK in the first place.
I've got Dvorak, Qwerty, and Colemak layouts at this time, with the
possibility of adding more in the future.
The bottom row is fairly Kinesis-ish since the Contour and Advantage
keyboards have been my daily drivers for the last 17 years. I hope
You can get some enjoyment out of this layout should you chose it!
CHANGELOG:
0.1 - Initial commit. Based off of Profet's default keymap.
0.2 - Converted to a more Planck/Preonic keymap style file with
persistent layers enabled. Renamed layers to reflect OLKB maps.
Added a TODO list.
TODO:
* Make the layout more efficient, even if it means changing the RAISE
and LOWER functionality.
* Add legends in comments for each layer. Maybe.
* Add a gaming layer.
*/
// this is the style you want to emulate.
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
#include "atreus62.h"
#include "action_layer.h"
#include "eeconfig.h"
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _DVORAK 0
#define _QWERTY 1
#define _COLEMAK 2
#define _WOW 3
#define _LOWER 4
#define _RAISE 5
#define _ADJUST 16
enum atreus52_keycodes {
DVORAK = SAFE_RANGE,
QWERTY,
COLEMAK,
WOW,
LOWER,
RAISE
};
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_DVORAK] = { /* dvorak */
{ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS },
{ KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, _______, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH },
{ KC_CAPS, KC_A, KC_O, KC_E, KC_U, KC_I, _______, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS },
{ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_LGUI, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT },
{ KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, KC_BSPC, KC_ENT, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_RCTL }
},
[_QWERTY] = { /* qwerty */
{ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS },
{ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, _______, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL },
{ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, _______, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT },
{ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LGUI, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT },
{ KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, KC_BSPC, KC_ENT, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_RCTL }
},
[_COLEMAK] = { /* colemak */
{ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS },
{ KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, _______, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL },
{ KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, _______, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT },
{ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LGUI, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT },
{ KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, KC_BSPC, KC_ENT, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_RCTL}
},
[_WOW] = { /* Dvorak with minor modifications for playing World of Warcraft */
{ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS },
{ KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, _______, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH },
{ KC_CAPS, KC_A, KC_O, KC_E, KC_U, KC_I, _______, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS },
{ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_LALT, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT },
{ KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, KC_BSPC, CTL_T(KC_ENT), KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT }
},
[_LOWER] = {
{ KC_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12 },
{ KC_TILD, KC_GRV, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PIPE },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PLUS, KC_LCBR, KC_RCBR, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______ },
{ _______, _______, KC_HOME, KC_END, _______, KC_DEL, _______, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ }
},
[_RAISE] = {
{ KC_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12 },
{ KC_TILD, KC_GRV, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BSLS },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_EQL, KC_LBRC, KC_RBRC, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______ },
{ _______, _______, KC_HOME, KC_END, _______, KC_DEL, _______, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ }
},
[_ADJUST] = {
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{ _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, QWERTY, COLEMAK, DVORAK, _______, WOW },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }
},
};
const uint16_t PROGMEM fn_actions[] = {
};
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_COLEMAK);
}
return false;
break;
case DVORAK:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_DVORAK);
}
return false;
break;
case WOW:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_WOW);
}
return false;
break;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
}
return true;
};

@ -0,0 +1,49 @@
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device.
# Please customize your programmer settings(PROGRAM_CMD)
#
# make teensy = Download the hex file to the device, using teensy_loader_cli.
# (must have teensy_loader_cli installed).
#
# make dfu = Download the hex file to the device, using dfu-programmer (must
# have dfu-programmer installed).
#
# make flip = Download the hex file to the device, using Atmel FLIP (must
# have Atmel FLIP installed).
#
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
# (must have dfu-programmer installed).
#
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
# (must have Atmel FLIP installed).
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# Build Options
# change to "no" to disable the options, or define them in the makefile.mk in
# the appropriate keymap folder that will get included automatically
#
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

@ -0,0 +1,111 @@
// Xyverz' keymap.
// It's based on the default keymap, but Dvorak!
#include "clueboard.h"
// Used for SHIFT_ESC
#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _BL 0
#define _FL 1
#define _RS 2
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: (Base Layer) Default Layer
* ,--------------------------------------------------------------------------. ,----.
* |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]| \| BS| |PGUP|
* |--------------------------------------------------------------------------| |----|
* | Tab| '| ,| .| P| Y| F| G| C| R| L| /| =| \| |PGDN|
* |--------------------------------------------------------------------------| `----'
* |_FL/Caps| A| O| E| U| I| H| D| H| T| N| S| - | Ent|
* |-----------------------------------------------------------------------------.
* |Shift| BS| ;| Q| J| K| X| B| M| W| V| Z| BS|Shift| UP|
* |------------------------------------------------------------------------|----|----.
* | Ctrl| Gui| Alt| MHen| Space| Space| Hen| Alt| Ctrl| _FL|LEFT|DOWN|RGHT|
* `----------------------------------------------------------------------------------'
*/
[_BL] = KEYMAP(
F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_GRV, KC_BSPC, KC_PGUP, \
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, KC_PGDN, \
LT(_FL, KC_CAPS), KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_NUHS, KC_ENT, \
KC_LSFT, KC_RO, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_SLSH, KC_RSFT, KC_UP, \
KC_LCTL, KC_LALT, KC_LGUI, KC_MHEN, KC_SPC, KC_SPC, KC_HENK, KC_RGUI, KC_RCTL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT),
/* Keymap _FL: Function Layer
* ,--------------------------------------------------------------------------. ,----.
* | `| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12| | Del| |BLIN|
* |--------------------------------------------------------------------------| |----|
* | | | | | | | | |PScr|SLck|Paus| | | | |BLDE|
* |--------------------------------------------------------------------------| `----'
* | | | _RS| | | | | | | | | | | |
* |-----------------------------------------------------------------------------.
* | | | | | | | | | | | | | | |PGUP|
* |------------------------------------------------------------------------|----|----.
* | | | | | | | | | | _FL|HOME|PGDN| END|
* `----------------------------------------------------------------------------------'
*/
[_FL] = KEYMAP(
KC_GRV, 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_TRNS, KC_DEL, BL_STEP, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, MO(_RS), 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_PGUP, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), KC_HOME, KC_PGDN, KC_END),
/* Keymap _RS: Reset layer
* ,--------------------------------------------------------------------------. ,----.
* | | | | | | | | | | | | | | | RGB| |VAL+|
* |--------------------------------------------------------------------------| |----|
* | | | | |RESET| | | | | | | | | | |VAL-|
* |--------------------------------------------------------------------------| `----'
* | | | _RS| | | | | | | | | | | |
* |-----------------------------------------------------------------------------.
* | | | | | | | | | | | | | | |SAT+|
* |------------------------------------------------------------------------|----|----.
* | | | | | | | | | | _FL|HUE-|SAT-|HUE+|
* `----------------------------------------------------------------------------------'
*/
[_RS] = KEYMAP(
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, RGB_TOG, RGB_VAI, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_VAD, \
KC_TRNS, KC_TRNS, MO(_RS), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
MO(_FL), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), RGB_SAI, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_MOD, RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_HUD, RGB_SAD, RGB_HUI),
};
enum function_id {
SHIFT_ESC,
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_FUNCTION(SHIFT_ESC),
};
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
static uint8_t shift_esc_shift_mask;
switch (id) {
case SHIFT_ESC:
shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
if (record->event.pressed) {
if (shift_esc_shift_mask) {
add_key(KC_GRV);
send_keyboard_report();
} else {
add_key(KC_ESC);
send_keyboard_report();
}
} else {
if (shift_esc_shift_mask) {
del_key(KC_GRV);
send_keyboard_report();
} else {
del_key(KC_ESC);
send_keyboard_report();
}
}
break;
}
}

@ -49,6 +49,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_SAT_STEP 255 #define RGBLIGHT_SAT_STEP 255
#define RGBLIGHT_VAL_STEP 12 #define RGBLIGHT_VAL_STEP 12
/* fix space cadet rollover issue */
#define DISABLE_SPACE_CADET_ROLLOVER
// #define RGB_MIDI // #define RGB_MIDI
#define RGBW_BB_TWI #define RGBW_BB_TWI

@ -74,7 +74,3 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512
SLEEP_LED_ENABLE = no SLEEP_LED_ENABLE = no
API_SYSEX_ENABLE ?= no API_SYSEX_ENABLE ?= no
RGBLIGHT_ENABLE ?= yes RGBLIGHT_ENABLE ?= yes
ifndef QUANTUM_DIR
include ../../../Makefile
endif

@ -0,0 +1,107 @@
/* 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/>.
*/
#if defined(VISUALIZER_ENABLE)
#include "animations.h"
#include "visualizer.h"
#ifdef LCD_ENABLE
#include "lcd_keyframes.h"
#endif
#ifdef LCD_BACKLIGHT_ENABLE
#include "lcd_backlight_keyframes.h"
#endif
#ifdef LED_ENABLE
#include "led_keyframes.h"
#endif
#include "visualizer_keyframes.h"
#if defined(LCD_ENABLE) && defined(LCD_BACKLIGHT_ENABLE)
// Don't worry, if the startup animation is long, you can use the keyboard like normal
// during that time
keyframe_animation_t default_startup_animation = {
.num_frames = 4,
.loop = false,
.frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(5000), 0},
.frame_functions = {
lcd_keyframe_enable,
backlight_keyframe_enable,
lcd_keyframe_draw_logo,
backlight_keyframe_animate_color,
},
};
keyframe_animation_t default_suspend_animation = {
.num_frames = 4,
.loop = false,
.frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0},
.frame_functions = {
lcd_keyframe_display_layer_text,
backlight_keyframe_animate_color,
lcd_keyframe_disable,
backlight_keyframe_disable,
},
};
#endif
#if defined(LED_ENABLE)
#define CROSSFADE_TIME 1000
#define GRADIENT_TIME 3000
keyframe_animation_t led_test_animation = {
.num_frames = 14,
.loop = true,
.frame_lengths = {
gfxMillisecondsToTicks(1000), // fade in
gfxMillisecondsToTicks(1000), // no op (leds on)
gfxMillisecondsToTicks(1000), // fade out
gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in)
gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
0, // mirror leds
gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out)
gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
0, // normal leds
gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
},
.frame_functions = {
led_keyframe_fade_in_all,
keyframe_no_operation,
led_keyframe_fade_out_all,
led_keyframe_crossfade,
led_keyframe_left_to_right_gradient,
led_keyframe_crossfade,
led_keyframe_top_to_bottom_gradient,
led_keyframe_mirror_orientation,
led_keyframe_crossfade,
led_keyframe_left_to_right_gradient,
led_keyframe_crossfade,
led_keyframe_top_to_bottom_gradient,
led_keyframe_normal_orientation,
led_keyframe_crossfade,
},
};
#endif
#endif

@ -0,0 +1,30 @@
/* 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 KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_
#define KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_
#include "visualizer.h"
// You can use these default animations, but of course you can also write your own custom ones instead
extern keyframe_animation_t default_startup_animation;
extern keyframe_animation_t default_suspend_animation;
// An animation for testing and demonstrating the led support, should probably not be used for real world
// cases
extern keyframe_animation_t led_test_animation;
#endif /* KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ */

@ -40,7 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* number of backlight levels */ /* number of backlight levels */
#define BACKLIGHT_LEVELS 3 #define BACKLIGHT_LEVELS 3
#define LED_BRIGHTNESS_LO 15 #define LED_BRIGHTNESS_LO 100
#define LED_BRIGHTNESS_HI 255 #define LED_BRIGHTNESS_HI 255
/* define if matrix has ghost */ /* define if matrix has ghost */
@ -54,6 +54,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// The visualizer needs gfx thread priorities // The visualizer needs gfx thread priorities
#define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2) #define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2)
#define VISUALIZER_USER_DATA_SIZE 16
/* /*
* Feature disable options * Feature disable options
* These options are also useful to firmware size reduction. * These options are also useful to firmware size reduction.

@ -25,6 +25,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "board_IS31FL3731C.h" #include "board_IS31FL3731C.h"
// Can't include led_tables from here
extern const uint8_t CIE1931_CURVE[];
/*===========================================================================*/ /*===========================================================================*/
/* Driver local definitions. */ /* Driver local definitions. */
/*===========================================================================*/ /*===========================================================================*/
@ -100,37 +104,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS31 #define IS31
//Generated by http://jared.geek.nz/2013/feb/linear-led-pwm
const unsigned char cie[256] = {
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 4, 5, 5, 5,
5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
7, 8, 8, 8, 8, 9, 9, 9, 10, 10,
10, 10, 11, 11, 11, 12, 12, 12, 13, 13,
13, 14, 14, 15, 15, 15, 16, 16, 17, 17,
17, 18, 18, 19, 19, 20, 20, 21, 21, 22,
22, 23, 23, 24, 24, 25, 25, 26, 26, 27,
28, 28, 29, 29, 30, 31, 31, 32, 32, 33,
34, 34, 35, 36, 37, 37, 38, 39, 39, 40,
41, 42, 43, 43, 44, 45, 46, 47, 47, 48,
49, 50, 51, 52, 53, 54, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, 70, 71, 72, 73, 74, 75, 76, 77, 79,
80, 81, 82, 83, 85, 86, 87, 88, 90, 91,
92, 94, 95, 96, 98, 99, 100, 102, 103, 105,
106, 108, 109, 110, 112, 113, 115, 116, 118, 120,
121, 123, 124, 126, 128, 129, 131, 132, 134, 136,
138, 139, 141, 143, 145, 146, 148, 150, 152, 154,
155, 157, 159, 161, 163, 165, 167, 169, 171, 173,
175, 177, 179, 181, 183, 185, 187, 189, 191, 193,
196, 198, 200, 202, 204, 207, 209, 211, 214, 216,
218, 220, 223, 225, 228, 230, 232, 235, 237, 240,
242, 245, 247, 250, 252, 255,
};
/*===========================================================================*/ /*===========================================================================*/
/* Driver local functions. */ /* Driver local functions. */
/*===========================================================================*/ /*===========================================================================*/
@ -231,7 +204,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
uint8_t* src = PRIV(g)->frame_buffer; uint8_t* src = PRIV(g)->frame_buffer;
for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) { for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
for (int x=0;x<GDISP_SCREEN_WIDTH;x++) { for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
PRIV(g)->write_buffer[get_led_address(g, x, y)]=cie[*src]; PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[*src];
++src; ++src;
} }
} }

@ -8,8 +8,6 @@
#ifndef _GDISP_LLD_BOARD_H #ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H #define _GDISP_LLD_BOARD_H
#include "print.h"
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6 #define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6
#define ST7565_ADC ST7565_ADC_NORMAL #define ST7565_ADC ST7565_ADC_NORMAL
#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC #define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
@ -39,35 +37,49 @@
// MSB First // MSB First
// CLK Low by default // CLK Low by default
static const SPIConfig spi1config = { static const SPIConfig spi1config = {
NULL, // Operation complete callback or @p NULL.
/* HW dependent part.*/ .end_cb = NULL,
ST7565_GPIOPORT, //The chip select line port - when not using pcs.
ST7565_SS_PIN, .ssport = ST7565_GPIOPORT,
SPIx_CTARn_FMSZ(7) // brief The chip select line pad number - when not using pcs.
| SPIx_CTARn_ASC(7) .sspad=ST7565_SS_PIN,
| SPIx_CTARn_DT(7) // SPI initialization data.
| SPIx_CTARn_CSSCK(7) .tar0 =
| SPIx_CTARn_PBR(0) SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
| SPIx_CTARn_BR(7) | SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns
//SPI_CR1_BR_0 | SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns
| SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns
| SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2
| SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns
}; };
static bool_t st7565_is_data_mode = 1; static GFXINLINE void acquire_bus(GDisplay *g) {
(void) g;
// Only the LCD is using the SPI bus, so no need to acquire
// spiAcquireBus(&SPID1);
spiSelect(&SPID1);
}
static GFXINLINE void release_bus(GDisplay *g) {
(void) g;
// Only the LCD is using the SPI bus, so no need to release
//spiReleaseBus(&SPID1);
spiUnselect(&SPID1);
}
static GFXINLINE void init_board(GDisplay *g) { static GFXINLINE void init_board(GDisplay *g) {
(void) g; (void) g;
palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL); palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN); palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
st7565_is_data_mode = 1;
palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL); palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN); palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
palSetPadModeRaw(MOSI, ST7565_SPI_MODE); palSetPadModeRaw(MOSI, ST7565_SPI_MODE);
palSetPadModeRaw(SLCK, ST7565_SPI_MODE); palSetPadModeRaw(SLCK, ST7565_SPI_MODE);
palSetPadModeRaw(SS, ST7565_SPI_MODE); palSetPadModeRaw(SS, PAL_MODE_OUTPUT_PUSHPULL);
spiInit(); spiInit();
spiStart(&SPID1, &spi1config); spiStart(&SPID1, &spi1config);
spiSelect(&SPID1); release_bus(g);
} }
static GFXINLINE void post_init_board(GDisplay *g) { static GFXINLINE void post_init_board(GDisplay *g) {
@ -84,43 +96,17 @@ static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
} }
} }
static GFXINLINE void acquire_bus(GDisplay *g) { static GFXINLINE void enter_data_mode(GDisplay *g) {
(void) g; palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
// Only the LCD is using the SPI bus, so no need to acquire
// spiAcquireBus(&SPID1);
} }
static GFXINLINE void release_bus(GDisplay *g) { static GFXINLINE void enter_cmd_mode(GDisplay *g) {
(void) g; palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN);
// Only the LCD is using the SPI bus, so no need to release
//spiReleaseBus(&SPID1);
} }
static GFXINLINE void write_cmd(GDisplay *g, uint8_t cmd) {
(void) g;
if (st7565_is_data_mode) {
// The sleeps need to be at lest 10 vs 25 ns respectively
// So let's sleep two ticks, one tick might not be enough
// if we are at the end of the tick
chThdSleep(2);
palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN);
chThdSleep(2);
st7565_is_data_mode = 0;
}
spiSend(&SPID1, 1, &cmd);
}
static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) { static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
(void) g; (void) g;
if (!st7565_is_data_mode) {
// The sleeps need to be at lest 10 vs 25 ns respectively
// So let's sleep two ticks, one tick might not be enough
// if we are at the end of the tick
chThdSleep(2);
palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
chThdSleep(2);
st7565_is_data_mode = 1;
}
spiSend(&SPID1, length, data); spiSend(&SPID1, length, data);
} }

@ -20,16 +20,16 @@
/*===========================================================================*/ /*===========================================================================*/
#ifndef GDISP_SCREEN_HEIGHT #ifndef GDISP_SCREEN_HEIGHT
#define GDISP_SCREEN_HEIGHT 32 #define GDISP_SCREEN_HEIGHT 32
#endif #endif
#ifndef GDISP_SCREEN_WIDTH #ifndef GDISP_SCREEN_WIDTH
#define GDISP_SCREEN_WIDTH 128 #define GDISP_SCREEN_WIDTH 128
#endif #endif
#ifndef GDISP_INITIAL_CONTRAST #ifndef GDISP_INITIAL_CONTRAST
#define GDISP_INITIAL_CONTRAST 0 #define GDISP_INITIAL_CONTRAST 35
#endif #endif
#ifndef GDISP_INITIAL_BACKLIGHT #ifndef GDISP_INITIAL_BACKLIGHT
#define GDISP_INITIAL_BACKLIGHT 100 #define GDISP_INITIAL_BACKLIGHT 100
#endif #endif
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) #define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
@ -40,16 +40,16 @@
/* Driver config defaults for backward compatibility. */ /* Driver config defaults for backward compatibility. */
/*===========================================================================*/ /*===========================================================================*/
#ifndef ST7565_LCD_BIAS #ifndef ST7565_LCD_BIAS
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7 #define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
#endif #endif
#ifndef ST7565_ADC #ifndef ST7565_ADC
#define ST7565_ADC ST7565_ADC_NORMAL #define ST7565_ADC ST7565_ADC_NORMAL
#endif #endif
#ifndef ST7565_COM_SCAN #ifndef ST7565_COM_SCAN
#define ST7565_COM_SCAN ST7565_COM_SCAN_INC #define ST7565_COM_SCAN ST7565_COM_SCAN_INC
#endif #endif
#ifndef ST7565_PAGE_ORDER #ifndef ST7565_PAGE_ORDER
#define ST7565_PAGE_ORDER 0,1,2,3 #define ST7565_PAGE_ORDER 0,1,2,3
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
@ -58,12 +58,24 @@
typedef struct{ typedef struct{
bool_t buffer2; bool_t buffer2;
uint8_t data_pos;
uint8_t data[16];
uint8_t ram[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8]; uint8_t ram[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8];
}PrivData; }PrivData;
// Some common routines and macros // Some common routines and macros
#define PRIV(g) ((PrivData*)g->priv) #define PRIV(g) ((PrivData*)g->priv)
#define RAM(g) (PRIV(g)->ram) #define RAM(g) (PRIV(g)->ram)
static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) {
PRIV(g)->data[PRIV(g)->data_pos++] = cmd;
}
static GFXINLINE void flush_cmd(GDisplay* g) {
write_data(g, PRIV(g)->data, PRIV(g)->data_pos);
PRIV(g)->data_pos = 0;
}
#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); } #define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); }
#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); } #define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); }
@ -86,207 +98,232 @@ typedef struct{
*/ */
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// The private area is the display surface. // The private area is the display surface.
g->priv = gfxAlloc(sizeof(PrivData)); g->priv = gfxAlloc(sizeof(PrivData));
PRIV(g)->buffer2 = false; PRIV(g)->buffer2 = false;
PRIV(g)->data_pos = 0;
// Initialise the board interface
init_board(g); // Initialise the board interface
init_board(g);
// Hardware reset
setpin_reset(g, TRUE); // Hardware reset
gfxSleepMilliseconds(20); setpin_reset(g, TRUE);
setpin_reset(g, FALSE); gfxSleepMilliseconds(20);
gfxSleepMilliseconds(20); setpin_reset(g, FALSE);
gfxSleepMilliseconds(20);
acquire_bus(g); acquire_bus(g);
write_cmd(g, ST7565_DISPLAY_OFF); enter_cmd_mode(g);
write_cmd(g, ST7565_LCD_BIAS);
write_cmd(g, ST7565_RESET);
write_cmd(g, ST7565_LCD_BIAS);
write_cmd(g, ST7565_ADC); write_cmd(g, ST7565_ADC);
write_cmd(g, ST7565_COM_SCAN); write_cmd(g, ST7565_COM_SCAN);
write_cmd(g, ST7565_START_LINE | 0); write_cmd(g, ST7565_RESISTOR_RATIO | 0x1);
write_cmd2(g, ST7565_CONTRAST, GDISP_INITIAL_CONTRAST);
write_cmd(g, ST7565_RESISTOR_RATIO | 0x6);
// turn on voltage converter (VC=1, VR=0, VF=0) // turn on internal power supply (VC=1, VR=1, VF=1)
write_cmd(g, ST7565_POWER_CONTROL | 0x04); write_cmd(g, ST7565_POWER_CONTROL | 0x07);
delay_ms(50);
// turn on voltage regulator (VC=1, VR=1, VF=0) write_cmd(g, ST7565_INVERT_DISPLAY);
write_cmd(g, ST7565_POWER_CONTROL | 0x06); write_cmd(g, ST7565_ALLON_NORMAL);
delay_ms(50);
// turn on voltage follower (VC=1, VR=1, VF=1) write_cmd(g, ST7565_START_LINE | 0);
write_cmd(g, ST7565_POWER_CONTROL | 0x07); write_cmd(g, ST7565_RMW);
delay_ms(50); flush_cmd(g);
write_cmd(g, 0xE2);
write_cmd(g, ST7565_COM_SCAN);
write_cmd2(g, ST7565_CONTRAST, GDISP_INITIAL_CONTRAST*64/101);
//write_cmd2(g, ST7565_CONTRAST, 0);
write_cmd(g, ST7565_DISPLAY_ON);
write_cmd(g, ST7565_ALLON_NORMAL);
write_cmd(g, ST7565_INVERT_DISPLAY);
write_cmd(g, ST7565_RMW);
// Finish Init // Finish Init
post_init_board(g); post_init_board(g);
// Release the bus // Release the bus
release_bus(g); release_bus(g);
/* Initialise the GDISP structure */ /* Initialise the GDISP structure */
g->g.Width = GDISP_SCREEN_WIDTH; g->g.Width = GDISP_SCREEN_WIDTH;
g->g.Height = GDISP_SCREEN_HEIGHT; g->g.Height = GDISP_SCREEN_HEIGHT;
g->g.Orientation = GDISP_ROTATE_0; g->g.Orientation = GDISP_ROTATE_0;
g->g.Powermode = powerOn; g->g.Powermode = powerOff;
g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
g->g.Contrast = GDISP_INITIAL_CONTRAST; g->g.Contrast = GDISP_INITIAL_CONTRAST;
return TRUE; return TRUE;
} }
#if GDISP_HARDWARE_FLUSH #if GDISP_HARDWARE_FLUSH
LLDSPEC void gdisp_lld_flush(GDisplay *g) { LLDSPEC void gdisp_lld_flush(GDisplay *g) {
unsigned p; unsigned p;
// Don't flush if we don't need it. // Don't flush if we don't need it.
if (!(g->flags & GDISP_FLG_NEEDFLUSH)) if (!(g->flags & GDISP_FLG_NEEDFLUSH))
return; return;
acquire_bus(g); acquire_bus(g);
unsigned dstOffset = (PRIV(g)->buffer2 ? 4 : 0); enter_cmd_mode(g);
for (p = 0; p < 4; p++) { unsigned dstOffset = (PRIV(g)->buffer2 ? 4 : 0);
write_cmd(g, ST7565_PAGE | (p + dstOffset)); for (p = 0; p < 4; p++) {
write_cmd(g, ST7565_COLUMN_MSB | 0); write_cmd(g, ST7565_PAGE | (p + dstOffset));
write_cmd(g, ST7565_COLUMN_LSB | 0); write_cmd(g, ST7565_COLUMN_MSB | 0);
write_cmd(g, ST7565_RMW); write_cmd(g, ST7565_COLUMN_LSB | 0);
write_data(g, RAM(g) + (p*GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH); write_cmd(g, ST7565_RMW);
} flush_cmd(g);
unsigned line = (PRIV(g)->buffer2 ? 32 : 0); enter_data_mode(g);
write_cmd(g, ST7565_START_LINE | line); write_data(g, RAM(g) + (p*GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH);
PRIV(g)->buffer2 = !PRIV(g)->buffer2; enter_cmd_mode(g);
release_bus(g); }
unsigned line = (PRIV(g)->buffer2 ? 32 : 0);
g->flags &= ~GDISP_FLG_NEEDFLUSH; write_cmd(g, ST7565_START_LINE | line);
} flush_cmd(g);
PRIV(g)->buffer2 = !PRIV(g)->buffer2;
release_bus(g);
g->flags &= ~GDISP_FLG_NEEDFLUSH;
}
#endif #endif
#if GDISP_HARDWARE_DRAWPIXEL #if GDISP_HARDWARE_DRAWPIXEL
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
coord_t x, y; coord_t x, y;
switch(g->g.Orientation) { switch(g->g.Orientation) {
default: default:
case GDISP_ROTATE_0: case GDISP_ROTATE_0:
x = g->p.x; x = g->p.x;
y = g->p.y; y = g->p.y;
break; break;
case GDISP_ROTATE_90: case GDISP_ROTATE_90:
x = g->p.y; x = g->p.y;
y = GDISP_SCREEN_HEIGHT-1 - g->p.x; y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
break; break;
case GDISP_ROTATE_180: case GDISP_ROTATE_180:
x = GDISP_SCREEN_WIDTH-1 - g->p.x; x = GDISP_SCREEN_WIDTH-1 - g->p.x;
y = GDISP_SCREEN_HEIGHT-1 - g->p.y; y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
break; break;
case GDISP_ROTATE_270: case GDISP_ROTATE_270:
x = GDISP_SCREEN_HEIGHT-1 - g->p.y; x = GDISP_SCREEN_HEIGHT-1 - g->p.y;
y = g->p.x; y = g->p.x;
break; break;
} }
if (gdispColor2Native(g->p.color) != Black) if (gdispColor2Native(g->p.color) != Black)
RAM(g)[xyaddr(x, y)] |= xybit(y); RAM(g)[xyaddr(x, y)] |= xybit(y);
else else
RAM(g)[xyaddr(x, y)] &= ~xybit(y); RAM(g)[xyaddr(x, y)] &= ~xybit(y);
g->flags |= GDISP_FLG_NEEDFLUSH; g->flags |= GDISP_FLG_NEEDFLUSH;
} }
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
coord_t x, y; coord_t x, y;
switch(g->g.Orientation) { switch(g->g.Orientation) {
default: default:
case GDISP_ROTATE_0: case GDISP_ROTATE_0:
x = g->p.x; x = g->p.x;
y = g->p.y; y = g->p.y;
break; break;
case GDISP_ROTATE_90: case GDISP_ROTATE_90:
x = g->p.y; x = g->p.y;
y = GDISP_SCREEN_HEIGHT-1 - g->p.x; y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
break; break;
case GDISP_ROTATE_180: case GDISP_ROTATE_180:
x = GDISP_SCREEN_WIDTH-1 - g->p.x; x = GDISP_SCREEN_WIDTH-1 - g->p.x;
y = GDISP_SCREEN_HEIGHT-1 - g->p.y; y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
break; break;
case GDISP_ROTATE_270: case GDISP_ROTATE_270:
x = GDISP_SCREEN_HEIGHT-1 - g->p.y; x = GDISP_SCREEN_HEIGHT-1 - g->p.y;
y = g->p.x; y = g->p.x;
break; break;
} }
return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black; return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black;
} }
#endif #endif
LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
uint8_t* buffer = (uint8_t*)g->p.ptr;
int linelength = g->p.cx;
for (int i = 0; i < g->p.cy; i++) {
unsigned dstx = g->p.x;
unsigned dsty = g->p.y + i;
unsigned srcx = g->p.x1;
unsigned srcy = g->p.y1 + i;
unsigned srcbit = srcy * g->p.x2 + srcx;
for(int j=0; j < linelength; j++) {
uint8_t src = buffer[srcbit / 8];
uint8_t bit = 7-(srcbit % 8);
uint8_t bitset = (src >> bit) & 1;
uint8_t* dst = &(RAM(g)[xyaddr(dstx, dsty)]);
if (bitset) {
*dst |= xybit(dsty);
}
else {
*dst &= ~xybit(dsty);
}
dstx++;
srcbit++;
}
}
g->flags |= GDISP_FLG_NEEDFLUSH;
}
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL #if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
LLDSPEC void gdisp_lld_control(GDisplay *g) { LLDSPEC void gdisp_lld_control(GDisplay *g) {
switch(g->p.x) { switch(g->p.x) {
case GDISP_CONTROL_POWER: case GDISP_CONTROL_POWER:
if (g->g.Powermode == (powermode_t)g->p.ptr) if (g->g.Powermode == (powermode_t)g->p.ptr)
return; return;
switch((powermode_t)g->p.ptr) { switch((powermode_t)g->p.ptr) {
case powerOff: case powerOff:
case powerSleep: case powerSleep:
case powerDeepSleep: case powerDeepSleep:
acquire_bus(g); acquire_bus(g);
write_cmd(g, ST7565_DISPLAY_OFF); enter_cmd_mode(g);
release_bus(g); write_cmd(g, ST7565_DISPLAY_OFF);
break; flush_cmd(g);
case powerOn: release_bus(g);
acquire_bus(g); break;
write_cmd(g, ST7565_DISPLAY_ON); case powerOn:
release_bus(g); acquire_bus(g);
break; enter_cmd_mode(g);
default: write_cmd(g, ST7565_DISPLAY_ON);
return; flush_cmd(g);
} release_bus(g);
g->g.Powermode = (powermode_t)g->p.ptr; break;
return; default:
return;
case GDISP_CONTROL_ORIENTATION: }
if (g->g.Orientation == (orientation_t)g->p.ptr) g->g.Powermode = (powermode_t)g->p.ptr;
return; return;
switch((orientation_t)g->p.ptr) {
/* Rotation is handled by the drawing routines */ case GDISP_CONTROL_ORIENTATION:
case GDISP_ROTATE_0: if (g->g.Orientation == (orientation_t)g->p.ptr)
case GDISP_ROTATE_180: return;
g->g.Height = GDISP_SCREEN_HEIGHT; switch((orientation_t)g->p.ptr) {
g->g.Width = GDISP_SCREEN_WIDTH; /* Rotation is handled by the drawing routines */
break; case GDISP_ROTATE_0:
case GDISP_ROTATE_90: case GDISP_ROTATE_180:
case GDISP_ROTATE_270: g->g.Height = GDISP_SCREEN_HEIGHT;
g->g.Height = GDISP_SCREEN_WIDTH; g->g.Width = GDISP_SCREEN_WIDTH;
g->g.Width = GDISP_SCREEN_HEIGHT; break;
break; case GDISP_ROTATE_90:
default: case GDISP_ROTATE_270:
return; g->g.Height = GDISP_SCREEN_WIDTH;
} g->g.Width = GDISP_SCREEN_HEIGHT;
g->g.Orientation = (orientation_t)g->p.ptr; break;
return; default:
return;
case GDISP_CONTROL_CONTRAST: }
if ((unsigned)g->p.ptr > 100) g->g.Orientation = (orientation_t)g->p.ptr;
g->p.ptr = (void *)100; return;
acquire_bus(g);
write_cmd2(g, ST7565_CONTRAST, ((((unsigned)g->p.ptr)<<6)/101) & 0x3F); case GDISP_CONTROL_CONTRAST:
release_bus(g); g->g.Contrast = (unsigned)g->p.ptr & 63;
g->g.Contrast = (unsigned)g->p.ptr; acquire_bus(g);
return; enter_cmd_mode(g);
} write_cmd2(g, ST7565_CONTRAST, g->g.Contrast);
} flush_cmd(g);
release_bus(g);
return;
}
}
#endif // GDISP_NEED_CONTROL #endif // GDISP_NEED_CONTROL
#endif // GFX_USE_GDISP #endif // GFX_USE_GDISP

@ -14,12 +14,13 @@
/* Driver hardware support. */ /* Driver hardware support. */
/*===========================================================================*/ /*===========================================================================*/
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing #define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
#define GDISP_HARDWARE_DRAWPIXEL TRUE #define GDISP_HARDWARE_DRAWPIXEL TRUE
#define GDISP_HARDWARE_PIXELREAD TRUE #define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL TRUE #define GDISP_HARDWARE_CONTROL TRUE
#define GDISP_HARDWARE_BITFILLS TRUE
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
#endif /* GFX_USE_GDISP */ #endif /* GFX_USE_GDISP */

@ -34,4 +34,6 @@
#define ST7565_RESISTOR_RATIO 0x20 #define ST7565_RESISTOR_RATIO 0x20
#define ST7565_POWER_CONTROL 0x28 #define ST7565_POWER_CONTROL 0x28
#define ST7565_RESET 0xE2
#endif /* _ST7565_H */ #endif /* _ST7565_H */

@ -143,7 +143,7 @@
#define GDISP_HARDWARE_DRAWPIXEL TRUE #define GDISP_HARDWARE_DRAWPIXEL TRUE
#define GDISP_HARDWARE_CLEARS FALSE #define GDISP_HARDWARE_CLEARS FALSE
#define GDISP_HARDWARE_FILLS FALSE #define GDISP_HARDWARE_FILLS FALSE
#define GDISP_HARDWARE_BITFILLS FALSE //#define GDISP_HARDWARE_BITFILLS FALSE
#define GDISP_HARDWARE_SCROLL FALSE #define GDISP_HARDWARE_SCROLL FALSE
#define GDISP_HARDWARE_PIXELREAD TRUE #define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL TRUE #define GDISP_HARDWARE_CONTROL TRUE

@ -70,10 +70,33 @@ void lcd_backlight_hal_init(void) {
RGB_PORT->PCR[BLUE_PIN] = RGB_MODE; RGB_PORT->PCR[BLUE_PIN] = RGB_MODE;
} }
static uint16_t cie_lightness(uint16_t v) {
// The CIE 1931 formula for lightness
// Y = luminance (output) 0-1
// L = lightness input 0 - 100
// Y = (L* / 902.3) if L* <= 8
// Y = ((L* + 16) / 116)^3 if L* > 8
float l = 100.0f * (v / 65535.0f);
float y = 0.0f;
if (l <= 8.0f) {
y = l / 902.3;
}
else {
y = ((l + 16.0f) / 116.0f);
y = y * y * y;
if (y > 1.0f) {
y = 1.0f;
}
}
return y * 65535.0f;
}
void lcd_backlight_hal_color(uint16_t r, uint16_t g, uint16_t b) { void lcd_backlight_hal_color(uint16_t r, uint16_t g, uint16_t b) {
CHANNEL_RED.CnV = r; CHANNEL_RED.CnV = cie_lightness(r);
CHANNEL_GREEN.CnV = g; CHANNEL_GREEN.CnV = cie_lightness(g);
CHANNEL_BLUE.CnV = b; CHANNEL_BLUE.CnV = cie_lightness(b);
} }
__attribute__ ((weak)) __attribute__ ((weak))
@ -103,34 +126,48 @@ void matrix_scan_kb(void) {
matrix_scan_user(); matrix_scan_user();
} }
__attribute__ ((weak))
void ergodox_board_led_on(void){ void ergodox_board_led_on(void){
} }
__attribute__ ((weak))
void ergodox_right_led_1_on(void){ void ergodox_right_led_1_on(void){
} }
__attribute__ ((weak))
void ergodox_right_led_2_on(void){ void ergodox_right_led_2_on(void){
} }
__attribute__ ((weak))
void ergodox_right_led_3_on(void){ void ergodox_right_led_3_on(void){
} }
void ergodox_right_led_on(uint8_t led){ __attribute__ ((weak))
}
void ergodox_board_led_off(void){ void ergodox_board_led_off(void){
} }
__attribute__ ((weak))
void ergodox_right_led_1_off(void){ void ergodox_right_led_1_off(void){
} }
__attribute__ ((weak))
void ergodox_right_led_2_off(void){ void ergodox_right_led_2_off(void){
} }
__attribute__ ((weak))
void ergodox_right_led_3_off(void){ void ergodox_right_led_3_off(void){
} }
void ergodox_right_led_off(uint8_t led){ __attribute__ ((weak))
void ergodox_right_led_1_set(uint8_t n) {
}
__attribute__ ((weak))
void ergodox_right_led_2_set(uint8_t n) {
}
__attribute__ ((weak))
void ergodox_right_led_3_set(uint8_t n) {
} }
#ifdef ONEHAND_ENABLE #ifdef ONEHAND_ENABLE

@ -7,13 +7,38 @@ void ergodox_board_led_on(void);
void ergodox_right_led_1_on(void); void ergodox_right_led_1_on(void);
void ergodox_right_led_2_on(void); void ergodox_right_led_2_on(void);
void ergodox_right_led_3_on(void); void ergodox_right_led_3_on(void);
void ergodox_right_led_on(uint8_t led);
inline void ergodox_right_led_on(uint8_t led) {
switch (led) {
case 0:
ergodox_right_led_1_on();
break;
case 1:
ergodox_right_led_2_on();
break;
case 2:
ergodox_right_led_3_on();
break;
}
}
void ergodox_board_led_off(void); void ergodox_board_led_off(void);
void ergodox_right_led_1_off(void); void ergodox_right_led_1_off(void);
void ergodox_right_led_2_off(void); void ergodox_right_led_2_off(void);
void ergodox_right_led_3_off(void); void ergodox_right_led_3_off(void);
void ergodox_right_led_off(uint8_t led); inline void ergodox_right_led_off(uint8_t led) {
switch (led) {
case 0:
ergodox_right_led_1_off();
break;
case 1:
ergodox_right_led_2_off();
break;
case 2:
ergodox_right_led_3_off();
break;
}
}
inline void ergodox_led_all_on(void) inline void ergodox_led_all_on(void)
{ {
@ -31,36 +56,22 @@ inline void ergodox_led_all_off(void)
ergodox_right_led_3_off(); ergodox_right_led_3_off();
} }
inline void ergodox_right_led_1_set(uint8_t n){ void ergodox_right_led_1_set(uint8_t n);
if (n) { void ergodox_right_led_2_set(uint8_t n);
ergodox_right_led_1_on(); void ergodox_right_led_3_set(uint8_t n);
} else {
ergodox_right_led_1_off();
}
}
inline void ergodox_right_led_2_set(uint8_t n){
if (n) {
ergodox_right_led_2_on();
} else {
ergodox_right_led_2_off();
}
}
inline void ergodox_right_led_3_set(uint8_t n){
if (n) {
ergodox_right_led_3_on();
} else {
ergodox_right_led_3_off();
}
}
inline void ergodox_right_led_set(uint8_t led, uint8_t n){ inline void ergodox_right_led_set(uint8_t led, uint8_t n){
if (n) { switch (led) {
ergodox_right_led_on(led); case 0:
} else { ergodox_right_led_1_set(n);
ergodox_right_led_off(led); break;
} case 1:
ergodox_right_led_2_set(n);
break;
case 2:
ergodox_right_led_3_set(n);
break;
}
} }
inline void ergodox_led_all_set(uint8_t n) { inline void ergodox_led_all_set(uint8_t n) {

@ -1,6 +1,7 @@
# project specific files # project specific files
SRC = matrix.c \ SRC = matrix.c \
led.c led.c \
animations.c
## chip/board settings ## chip/board settings
# - the next two should match the directories in # - the next two should match the directories in
@ -59,17 +60,13 @@ OPT_DEFS += -DCORTEX_VTOR_INIT=0x00002000
# #
CUSTOM_MATRIX ?= yes # Custom matrix file CUSTOM_MATRIX ?= yes # Custom matrix file
SERIAL_LINK_ENABLE = yes SERIAL_LINK_ENABLE = yes
VISUALIZER_ENABLE ?= no #temporarily disabled to make everything compile VISUALIZER_ENABLE ?= yes
LCD_ENABLE ?= yes LCD_ENABLE ?= yes
LED_ENABLE ?= yes LED_ENABLE ?= no
LCD_BACKLIGHT_ENABLE ?= yes LCD_BACKLIGHT_ENABLE ?= yes
MIDI_ENABLE = no MIDI_ENABLE = no
RGBLIGHT_ENABLE = no RGBLIGHT_ENABLE = no
ifndef QUANTUM_DIR
include ../../../Makefile
endif
ifdef LCD_ENABLE ifdef LCD_ENABLE
include $(SUBPROJECT_PATH)/drivers/gdisp/st7565ergodox/driver.mk include $(SUBPROJECT_PATH)/drivers/gdisp/st7565ergodox/driver.mk
endif endif

@ -0,0 +1,123 @@
/* 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 KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_
#define KEYBOARDS_ERGODOX_INFINITY_SIMPLE_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 "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
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, 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 /* KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ */

@ -0,0 +1,329 @@
/*
Copyright 2016 Fred Sundvik <fsundvik@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/>.
*/
// 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 "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 const uint32_t led_emulation_colors[4] = {
LCD_COLOR(0, 0, 0),
LCD_COLOR(255, 255, 255),
LCD_COLOR(84, 255, 255),
LCD_COLOR(168, 255, 255),
};
static uint32_t next_led_target_color = 0;
typedef enum {
LCD_STATE_INITIAL,
LCD_STATE_LAYER_BITMAP,
LCD_STATE_BITMAP_AND_LEDS,
} lcd_state_t;
static lcd_state_t lcd_state = LCD_STATE_INITIAL;
typedef struct {
uint8_t led_on;
uint8_t led1;
uint8_t led2;
uint8_t led3;
} visualizer_user_data_t;
// Don't access from visualization function, use the visualizer state instead
static visualizer_user_data_t user_data_keyboard = {
.led_on = 0,
.led1 = LED_BRIGHTNESS_HI,
.led2 = LED_BRIGHTNESS_HI,
.led3 = LED_BRIGHTNESS_HI,
};
_Static_assert(sizeof(visualizer_user_data_t) <= VISUALIZER_USER_DATA_SIZE,
"Please increase the VISUALIZER_USER_DATA_SIZE");
// Feel free to modify the animations below, or even add new ones if needed
// The color animation animates the LCD color when you change layers
static keyframe_animation_t one_led_color = {
.num_frames = 1,
.loop = false,
.frame_lengths = {gfxMillisecondsToTicks(0)},
.frame_functions = {backlight_keyframe_set_color},
};
bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) {
uint32_t temp = next_led_target_color;
next_led_target_color = state->target_lcd_color;
state->target_lcd_color = temp;
return false;
}
// The color animation animates the LCD color when you change layers
static keyframe_animation_t two_led_colors = {
.num_frames = 2,
.loop = true,
.frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)},
.frame_functions = {backlight_keyframe_set_color, swap_led_target_color},
};
// The LCD animation alternates between the layer name display and a
// bitmap that displays all active layers
static keyframe_animation_t lcd_bitmap_animation = {
.num_frames = 1,
.loop = false,
.frame_lengths = {gfxMillisecondsToTicks(0)},
.frame_functions = {lcd_keyframe_display_layer_bitmap},
};
static keyframe_animation_t lcd_bitmap_leds_animation = {
.num_frames = 2,
.loop = true,
.frame_lengths = {gfxMillisecondsToTicks(2000), gfxMillisecondsToTicks(2000)},
.frame_functions = {lcd_keyframe_display_layer_bitmap, lcd_keyframe_display_led_states},
};
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;
lcd_state = LCD_STATE_INITIAL;
start_keyframe_animation(&default_startup_animation);
}
inline bool is_led_on(visualizer_user_data_t* user_data, uint8_t num) {
return user_data->led_on & (1u << num);
}
static uint8_t get_led_index_master(visualizer_user_data_t* user_data) {
for (int i=0; i < 3; i++) {
if (is_led_on(user_data, i)) {
return i + 1;
}
}
return 0;
}
static uint8_t get_led_index_slave(visualizer_user_data_t* user_data) {
uint8_t master_index = get_led_index_master(user_data);
if (master_index!=0) {
for (int i=master_index; i < 3; i++) {
if (is_led_on(user_data, i)) {
return i + 1;
}
}
}
return 0;
}
static uint8_t get_secondary_led_index(visualizer_user_data_t* user_data) {
if (is_led_on(user_data, 0) &&
is_led_on(user_data, 1) &&
is_led_on(user_data, 2)) {
return 3;
}
return 0;
}
static uint8_t get_brightness(visualizer_user_data_t* user_data, uint8_t index) {
switch (index) {
case 1:
return user_data->led1;
case 2:
return user_data->led2;
case 3:
return user_data->led3;
}
return 0;
}
static void update_emulated_leds(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
visualizer_user_data_t* user_data_new = (visualizer_user_data_t*)state->status.user_data;
visualizer_user_data_t* user_data_old = (visualizer_user_data_t*)prev_status->user_data;
uint8_t new_index;
uint8_t old_index;
if (is_serial_link_master()) {
new_index = get_led_index_master(user_data_new);
old_index = get_led_index_master(user_data_old);
}
else {
new_index = get_led_index_slave(user_data_new);
old_index = get_led_index_slave(user_data_old);
}
uint8_t new_secondary_index = get_secondary_led_index(user_data_new);
uint8_t old_secondary_index = get_secondary_led_index(user_data_old);
uint8_t old_brightness = get_brightness(user_data_old, old_index);
uint8_t new_brightness = get_brightness(user_data_new, new_index);
uint8_t old_secondary_brightness = get_brightness(user_data_old, old_secondary_index);
uint8_t new_secondary_brightness = get_brightness(user_data_new, new_secondary_index);
if (lcd_state == LCD_STATE_INITIAL ||
new_index != old_index ||
new_secondary_index != old_secondary_index ||
new_brightness != old_brightness ||
new_secondary_brightness != old_secondary_brightness) {
if (new_secondary_index != 0) {
state->target_lcd_color = change_lcd_color_intensity(
led_emulation_colors[new_index], new_brightness);
next_led_target_color = change_lcd_color_intensity(
led_emulation_colors[new_secondary_index], new_secondary_brightness);
stop_keyframe_animation(&one_led_color);
start_keyframe_animation(&two_led_colors);
} else {
state->target_lcd_color = change_lcd_color_intensity(
led_emulation_colors[new_index], new_brightness);
stop_keyframe_animation(&two_led_colors);
start_keyframe_animation(&one_led_color);
}
}
}
static void update_lcd_text(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
if (state->status.leds) {
if (lcd_state != LCD_STATE_BITMAP_AND_LEDS ||
state->status.leds != prev_status->leds ||
state->status.layer != prev_status->layer ||
state->status.default_layer != prev_status->default_layer) {
// NOTE: that it doesn't matter if the animation isn't playing, stop will do nothing in that case
stop_keyframe_animation(&lcd_bitmap_animation);
lcd_state = LCD_STATE_BITMAP_AND_LEDS;
// For information:
// The logic in this function makes sure that this doesn't happen, but if you call start on an
// animation that is already playing it will be restarted.
start_keyframe_animation(&lcd_bitmap_leds_animation);
}
} else {
if (lcd_state != LCD_STATE_LAYER_BITMAP ||
state->status.layer != prev_status->layer ||
state->status.default_layer != prev_status->default_layer) {
stop_keyframe_animation(&lcd_bitmap_leds_animation);
lcd_state = LCD_STATE_LAYER_BITMAP;
start_keyframe_animation(&lcd_bitmap_animation);
}
}
}
void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
// Check the status here to start and stop animations
// You might have to save some state, like the current animation here so that you can start the right
// This function is called every time the status changes
// NOTE that this is called from the visualizer thread, so don't access anything else outside the status
// This is also important because the slave won't have access to the active layer for example outside the
// status.
update_emulated_leds(state, prev_status);
update_lcd_text(state, prev_status);
}
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;
lcd_state = LCD_STATE_INITIAL;
start_keyframe_animation(&default_startup_animation);
}
void ergodox_board_led_on(void){
// No board led support
}
void ergodox_right_led_1_on(void){
user_data_keyboard.led_on |= (1u << 0);
visualizer_set_user_data(&user_data_keyboard);
}
void ergodox_right_led_2_on(void){
user_data_keyboard.led_on |= (1u << 1);
visualizer_set_user_data(&user_data_keyboard);
}
void ergodox_right_led_3_on(void){
user_data_keyboard.led_on |= (1u << 2);
visualizer_set_user_data(&user_data_keyboard);
}
void ergodox_board_led_off(void){
// No board led support
}
void ergodox_right_led_1_off(void){
user_data_keyboard.led_on &= ~(1u << 0);
visualizer_set_user_data(&user_data_keyboard);
}
void ergodox_right_led_2_off(void){
user_data_keyboard.led_on &= ~(1u << 1);
visualizer_set_user_data(&user_data_keyboard);
}
void ergodox_right_led_3_off(void){
user_data_keyboard.led_on &= ~(1u << 2);
visualizer_set_user_data(&user_data_keyboard);
}
void ergodox_right_led_1_set(uint8_t n) {
user_data_keyboard.led1 = n;
visualizer_set_user_data(&user_data_keyboard);
}
void ergodox_right_led_2_set(uint8_t n) {
user_data_keyboard.led2 = n;
visualizer_set_user_data(&user_data_keyboard);
}
void ergodox_right_led_3_set(uint8_t n) {
user_data_keyboard.led3 = n;
visualizer_set_user_data(&user_data_keyboard);
}

@ -0,0 +1,42 @@
/*
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/>.
*/
#include "simple_visualizer.h"
// 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) {
uint8_t saturation = 60;
if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {
saturation = 255;
}
if (state->status.layer & 0x4) {
state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF);
state->layer_text = "Media & Mouse";
}
else if (state->status.layer & 0x2) {
state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF);
state->layer_text = "Symbol";
}
else {
state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF);
state->layer_text = "Default";
}
}

@ -0,0 +1,69 @@
# ErgoDox Familiar Layout
Familiar layout for those who regularly switch back and forth from ErgoDox to regular QWERTY.
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](../../../../license_GPLv3.md../../../../license_GPLv3.md) [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg)](https://github.com/RichardLitt/standard-readme)
## Table of Contents
- [Background](#background)
- [Install](#install)
- [Usage](#usage)
- [Layers](#layers)
- [Contribute](#contribute)
- [Issues](#issues)
- [License](#license)
## Background
This layout is built to be as familiar as possible for users coming directly from a default (QWERTY US) keyboard, while gaining as much advantage as possible from the ErgoDox and QMK featureset. I use an ErgoDoxEZ at home, but I don't have a regular office (CS grad student) so I regularly use either my laptop or a default-setup lab computer; I context switch daily so this layout is meant to reduce the mental overhead as much as possible.
The default ErgoDoxEZ layout is probably more optimized as a solo daily driver - as are a lot of the others available keymaps. The focus of this layout is to get as much from the 'Dox as possible without overly disrupting long-established muscle memory.
Key features of the familiar layout:
1. QWERTY default layout.
1. International symbols layer, mapped in the US-International layout default positions, through [UCIS](https://github.com/qmk/qmk_firmware/wiki/Unicode-and-additional-language-support#ucis_enable).
1. Numpad layer on right hand.
1. Thumb cluster holds spacebar, ALT, and access to secondary layers.
1. Function-layer arrow keys in both the first-person-shooter (actually ESDF instead of WASD) and vim (HJKL) locations.
## Install
If you are on Windows or Mac, choose the proper line in [`keymap.c`](keymap.c) for [unicode/international character support](https://github.com/qmk/qmk_firmware/wiki/Unicode-and-additional-language-support#ucis_enable) (starts at line 235).
```c
void matrix_init_user(void) {
set_unicode_input_mode(UC_LNX); // Linux
//set_unicode_input_mode(UC_OSX); // Mac OSX
//set_unicode_input_mode(UC_WIN); // Windows (with registry key, see wiki)
//set_unicode_input_mode(UC_WINC); // Windows (with WinCompose, see wiki)
};
```
For instructions on building and installing this keymap, [go to the wiki](https://github.com/qmk/qmk_firmware/tree/master/keyboards/ergodox#build-dependencies). Below is the command for me; it may be different for you.
```sh
$ make ergodox-ez-familiar-teensy
```
## Usage
[![Familiar Layout](familiar.png)](http://www.keyboard-layout-editor.com/#/gists/13508a9f99cff381d58b7be6f7dcc644)
### Layers
1. Base Layer: QWERTY, with arrow keys at bottom right.
1. UCIS Layer: US-International symbols layer, plus —. Accessed by toggling the `INTL` layer using the UCIS key (bottom of left thumb cluster).
1. UCIS-Shifted Layer: Making shift work for UCIS characters. An ugly workaround. Any ideas? Accessed through holding shift while the UCIS layer is active (toggles the `INSF` layer).
1. Numpad Layer: Right hand number pad. Accessed by toggling the `NUMP` layer using the NPAD key (bottom of right thumb cluster).
1. Function Layer: F1-F12, arrows on ESDF and HJKL, media player controls. Accessed by holding either FN key (center key of each thumb cluster), which toggles the `ARRW` layer. I know, I need to work on my naming conventions.
## Contribute
[Contributor Covenant](http://contributor-covenant.org/)
I'm terrible at this; I have no background in human-computer interaction, kinesiology, or keyboard-ology. Please send comments/issues/pull requests/angry tweets/etc. If you think there is a better way to take advantage of the ErgoDox/QMK comination without straying far from 84/101-key QWERTY, I want to know it.
### Issues
1. The top two keys of the right thumb cluster are currently unused. I wanted them for screen brightness, but I haven't found a solution I like.
1. The `'`, `"`, `[`, and `]` keys are terrible to access; I want to put them somewhere else but I haven't figured out where.
1. The `INSF` layer is an ugly workaround. I should write a function for doing different things in the `INTL` layer depending on whether SHIFT is being held. Or something. Ideas?
## License
QMK is licensed ([mostly](https://github.com/qmk/qmk_firmware/issues/1038)) under the [GPLv2](blob/master/license_GPLv2.md). Accordingly, to whatever extent applicable, this keymap is licensed under the [GPLv3](../../../../license_GPLv3.md).

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

@ -0,0 +1,267 @@
#include "ergodox.h"
#include "debug.h"
#include "action_layer.h"
#include "version.h"
// Layers
#define BASE 0 // default layer
#define INTL 1 // international symbols
#define INSF 2 // international symbols shifted
#define NUMP 3 // numpad
#define ARRW 4 // function, media, arrow keys
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
// Otherwise, it needs KC_*
/* layer 0 : default
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | ESC | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | - | = | BCKSPC |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | TAB | Q | W | E | R | T | HOME | | PGUP | Y | U | I | O | P | DELETE |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | ` | A | S | D | F | G |------| |------| H | J | K | L | ; | ENTER |
* |--------+------+------+------+------+------| END | | PGDN |------+------+------+------+------+--------|
* | (/LSFT | Z | X | C | V | B | | | | N | M | , | . | UP | )/RSFT |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | LCTRL | LGUI | MENU | ' | " | | [ | ] | LEFT | DOWN | RIGHT |
* `------------------------------------' `------------------------------------'
* ,-------------. ,-------------.
* | VOL- | VOL+ | | | |
* ,------|------|------| |------+------+------.
* | SPC/ |SLASH/| MUTE | |NUMLCK|WHACK/| SPC/ |
* | ALT | MO(1)|------| |------|MO(1) | ALT |
* | | | LAY3 | | LAY2 | | |
* `--------------------' `--------------------'
*/
[BASE] = KEYMAP(
// left hand
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_HOME,
KC_GRV, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_END,
KC_LCTL, KC_LGUI, KC_MENU, KC_QUOT, S(KC_QUOT),
KC_VOLD, KC_VOLU,
KC_MUTE,
ALT_T(KC_SPC), LT(ARRW,KC_SLSH), TG(INTL),
// right hand
KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_PGUP, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENTER,
KC_PGDN, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_RSPC,
KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_RGHT,
_______, _______,
KC_NLCK,
TG(NUMP), LT(ARRW,KC_BSLS), ALT_T(KC_SPC)
),
/* layer 1: International symbols, etc
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | ´ | ¡ | ² | ³ | ¤ | | ¼ | | ½ | ¾ | | | ¥ | × | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | ä | å | é | ® | þ | | | | ü | ú | í | ó | ö | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | á | ß | ð | | |------| |------| | | | ø | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* |MO(INSF)| æ | | © | | | | | | ñ | µ | ç | | |MO(INSF)|
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | ¬ | ¿ | | « | » | | | |
* `------------------------------------' `------------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[INTL] = KEYMAP(
// left hand
UC(0x00B4), UC(0x00A1), UC(0x00B2), UC(0x00B3), UC(0x00A4), UC(0x20AC), UC(0x00BC),
_______, UC(0x00E4), UC(0x00E5), UC(0x00E9), UC(0x00AE), UC(0x00FE), _______,
_______, UC(0x00E1), UC(0x00DF), UC(0x00F0), _______, _______,
MO(INSF), UC(0x00E6), _______, UC(0x00A9), _______, _______, _______,
_______, _______, _______, UC(0x00AC), UC(0x00BF),
_______, _______,
_______,
_______, _______, _______,
// right hand
UC(0x00BD), UC(0x00BE), UC(0x2018), UC(0x2019), UC(0x00A5), UC(0x00D7), _______,
_______, UC(0x00FC), UC(0x00FA), UC(0x00ED), UC(0x00F3), UC(0x00F6), _______,
_______, _______, _______, UC(0x00F8), UC(0x00B6), _______,
_______, UC(0x00F1), UC(0x00B5), UC(0x00E7), _______, _______, MO(INSF),
UC(0x00AB), UC(0x00BB), _______, _______, _______,
_______, _______,
_______,
_______, _______, _______
),
/* layer 2 : international symbols, shifted
* This layer is an ugly workaround; it pretends that SHIFT still works normally on keys
* which don't produce an "upper case" or "shifted" international symobol.
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | ¨ | ¹ | | | £ | | | | | | | | | ÷ | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | Ä | Å | É | | Þ | | | | Ü | Ú | Í | Ó | Ö | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | Á | § | Ð | | |------| |------| | | | Ø | ° | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | Æ | | ¢ | | | | | | Ñ | | Ç | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | ¦ | | | | | | | |
* `------------------------------------' `------------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[INSF] = KEYMAP(
// left hand
UC(0x00A8), UC(0x00B9), _______, _______, UC(0x00A3), _______, _______,
_______, UC(0x00C4), UC(0x00C5), UC(0x00C9), _______, UC(0x00DE), _______,
_______, UC(0x00C1), UC(0x00A7), UC(0x00D0), S(KC_F), S(KC_G),
_______, UC(0x00C6), S(KC_X), UC(0x00A2), S(KC_V), S(KC_B), _______,
_______, _______, _______, UC(0x00A6), _______,
_______, _______,
_______,
_______, _______, _______,
// right hand
_______, _______, _______, _______, UC(0x2014), UC(0x00F7), _______,
_______, UC(0x00DC), UC(0x00DA), UC(0x00CD), UC(0x00D3), UC(0x00D6), _______,
S(KC_H), S(KC_J), S(KC_K), UC(0x00D8), UC(0x00B0), _______,
_______, UC(0x00D1), _______, UC(0x00C7), S(KC_DOT), _______, _______,
_______, _______, _______, _______, _______,
_______, _______,
_______,
_______, _______, _______
),
/* layer 3: numberpad
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | ( | ) | / | * | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | | | | | | | | 7 | 8 | 9 | - | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | |------| |------| | 4 | 5 | 6 | + | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | 1 | 2 | 3 | = | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | 0 | . | , | ENTER| |
* `------------------------------------' `------------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[NUMP] = KEYMAP(
// left hand
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______,
_______,
_______, _______, _______,
// right hand
_______, _______, S(KC_9), S(KC_0), KC_PSLS, KC_PAST, _______,
_______, _______, KC_KP_7, KC_KP_8, KC_KP_9, KC_PMNS, _______,
_______, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, _______,
_______, _______, KC_KP_1, KC_KP_2, KC_KP_3, KC_PEQL, _______,
KC_KP_0, KC_KP_DOT, KC_PCMM, KC_PENT, _______,
_______, _______,
_______,
_______, _______, _______
),
/* layer 4 : functions and arrows
* This layer is at the top so that the functions still work no matter what layers are active.
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | ESCAPE | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | SYSREQ |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | UP | | | | | | | | | | | INSERT |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* |CAPSLOCK| | LEFT | DOWN |RIGHT | |------| |------| LEFT | DOWN | UP | RIGHT| | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | |M_PREV|M_STOP|M_PLPS|M_NEXT| | | | | | | | | PGUP | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | HOME | PGDN | END |
* `------------------------------------' `------------------------------------'
* ,-------------. ,-------------.
* | | PAUSE| | | |
* ,------|------|------| |------+------+------.
* | | | | |SCRLK | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[ARRW] = KEYMAP(
// left hand
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,
_______, _______, _______, KC_UP, _______, _______, _______,
KC_CAPS, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, KC_PAUSE,
_______,
_______, _______, _______,
// right hand
KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_SYSREQ,
_______, _______, _______, _______, _______, _______, KC_INS,
KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______,
_______, _______, _______, _______, _______, KC_PGUP, _______,
_______, _______, KC_HOME, KC_PGDN, KC_END,
_______, _______,
KC_SLCK,
_______, _______, _______
),
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
set_unicode_input_mode(UC_LNX); // Linux
//set_unicode_input_mode(UC_OSX); // Mac OSX
//set_unicode_input_mode(UC_WIN); // Windows (with registry key, see wiki)
//set_unicode_input_mode(UC_WINC); // Windows (with WinCompose, see wiki)
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
case INTL:
case INSF:
ergodox_right_led_1_on();
break;
case NUMP:
ergodox_right_led_2_on();
break;
case ARRW:
ergodox_right_led_3_on();
break;
default:
// none
break;
}
};

@ -40,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0 : Dvorak /* Layer 0 : Dvorak
* ,--------------------------------------------------. ,--------------------------------------------------. * ,--------------------------------------------------. ,--------------------------------------------------.
* | ] | 1 | 2 | 3 | 4 | 5 | ESC | | ESC | 6 | 7 | 8 | 9 | 0 | [ | * | = | 1 | 2 | 3 | 4 | 5 | ESC | | ESC | 6 | 7 | 8 | 9 | 0 | / |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | ' | , | . | P | Y | | | | F | G | C | R | L | \ | * | Tab | ' | , | . | P | Y | | | | F | G | C | R | L | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+------| _MD | | _KP |------+------+------+------+------+--------| * |--------+------+------+------+------+------| _MD | | _KP |------+------+------+------+------+--------|
* | LShift | ; | Q | J | K | X | | | | B | M | W | V | Z | RShift | * | LShift | ; | Q | J | K | X | | | | B | M | W | V | Z | RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | LGUI | ` | INS | Left | Rght | | Up | Dn | / | = | RGUI | * | LGUI | ` | INS | Left | Rght | | Up | Dn | [ | ] | RGUI |
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | LCTL | LALT | | RALT | RCTL | * | LCTL | LALT | | RALT | RCTL |
@ -61,7 +61,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/ */
[_DV] = KEYMAP( [_DV] = KEYMAP(
// left hand // left hand
KC_RBRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC,
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, XXXXXXX, KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, XXXXXXX,
KC_CAPS, KC_A, KC_O, KC_E, KC_U, KC_I, KC_CAPS, KC_A, KC_O, KC_E, KC_U, KC_I,
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, MO(_MD), KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, MO(_MD),
@ -70,11 +70,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_HOME, KC_HOME,
KC_BSPC, KC_DEL, KC_END, KC_BSPC, KC_DEL, KC_END,
// right hand // right hand
KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SLSH,
XXXXXXX, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSLS, XXXXXXX, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSLS,
KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS,
MO(_KP), KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, MO(_KP), KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT,
KC_UP, KC_DOWN, KC_SLSH, KC_EQL, KC_RGUI, KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, KC_RGUI,
KC_RALT, KC_RCTL, KC_RALT, KC_RCTL,
KC_PGUP, KC_PGUP,
KC_PGDN, KC_ENT, KC_SPC KC_PGDN, KC_ENT, KC_SPC
@ -91,7 +91,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+------| _MD | | _KP |------+------+------+------+------+--------| * |--------+------+------+------+------+------| _MD | | _KP |------+------+------+------+------+--------|
* | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift | * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | LGUI | ` | INS | Left | Rght | | Up | Dn | / | = | RGUI | * | LGUI | ` | INS | Left | Rght | | Up | Dn | [ | ] | RGUI |
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | LCTL | LALT | | RALT | RCTL | * | LCTL | LALT | | RALT | RCTL |
@ -133,7 +133,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+------| _MD | | _KP |------+------+------+------+------+--------| * |--------+------+------+------+------+------| _MD | | _KP |------+------+------+------+------+--------|
* | LShift | Z | X | C | V | B | | | | K | M | , | . | / | RShift | * | LShift | Z | X | C | V | B | | | | K | M | , | . | / | RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | LGUI | ` | INS | Left | Rght | | Up | Dn | / | = | RGUI | * | LGUI | ` | INS | Left | Rght | | Up | Dn | [ | ] | RGUI |
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | LCTL | LALT | | RALT | RCTL | * | LCTL | LALT | | RALT | RCTL |

@ -2,7 +2,7 @@
## About this keymap: ## About this keymap:
The Dvorak layout shown herestems from my early Kinesis years, using the Contour PS/2 with a Dvorak software layout. Because of this, the RBRC and LBRC were on opposite sides of the board in the corner keys. I've decided to continue using this layout with my ErgoDox. The Dvorak layout shown here stems from my early Kinesis years, using the Contour PS/2 with a Dvorak software layout. ~~Because of this, the RBRC and LBRC were on opposite sides of the board in the corner keys. I've decided to continue using this layout with my ErgoDox.~~ I've decided do give the normal placing of the SLSH, EQL, and xBRC keys a try, after using a different keyboard for a while...
The QWERTY layout shown here is based entirely on the Kinesis Advantage layout, with the additional keys as shown in the diagrams. The Colemak layout is merely an adaptation of that. The QWERTY layout shown here is based entirely on the Kinesis Advantage layout, with the additional keys as shown in the diagrams. The Colemak layout is merely an adaptation of that.
@ -17,15 +17,15 @@ I've enabled persistent keymaps for Qwerty, Dvorak and Colemak layers, similar t
### Layer 0: Dvorak layer ### Layer 0: Dvorak layer
,--------------------------------------------------.,--------------------------------------------------. ,--------------------------------------------------.,--------------------------------------------------.
| ] | 1 | 2 | 3 | 4 | 5 | ESC || ESC | 6 | 7 | 8 | 9 | 0 | [ | | = | 1 | 2 | 3 | 4 | 5 | ESC || ESC | 6 | 7 | 8 | 9 | 0 | / |
|--------+------+------+------+------+-------------||------+------+------+------+------+------+--------| |--------+------+------+------+------+-------------||------+------+------+------+------+------+--------|
| Tab | ' | , | . | Y | Y | || | F | G | C | R | L | \ | | Tab | ' | , | . | P | Y | || | F | G | C | R | L | \ |
|--------+------+------+------+------+------| || |------+------+------+------+------+--------| |--------+------+------+------+------+------| || |------+------+------+------+------+--------|
| CapsLk | A | O | E | U | I |------||------| D | H | T | N | S | - | | CapsLk | A | O | E | U | I |------||------| D | H | T | N | S | - |
|--------+------+------+------+------+------| _MD || _KP |------+------+------+------+------+--------| |--------+------+------+------+------+------| _MD || _KP |------+------+------+------+------+--------|
| LShift | Z | X | C | V | X | || | B | M | W | V | Z | RShift | | LShift | Z | X | C | V | X | || | B | M | W | V | Z | RShift |
`--------+------+------+------+------+-------------'`-------------+------+------+------+------+--------' `--------+------+------+------+------+-------------'`-------------+------+------+------+------+--------'
| LGUI | ` | INS | Left | Rght | | Up | Dn | / | = | RGUI | | LGUI | ` | INS | Left | Rght | | Up | Dn | [ | ] | RGUI |
`----------------------------------' `----------------------------------' `----------------------------------' `----------------------------------'
,-------------.,-------------. ,-------------.,-------------.
| LCtr | LAlt || Ralt | RCtr | | LCtr | LAlt || Ralt | RCtr |

@ -0,0 +1,149 @@
#include "gh60.h"
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _QW 0
#define _DV 1
#define _CM 2
#define _FL 3
// Macro name shortcuts
#define QWERTY M(_QW)
#define DVORAK M(_DV)
#define COLEMAK M(_CM)
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* _QW: Qwerty Layer
* ,-----------------------------------------------------------.
* |ESC | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Backsp|
* |-----------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
* |-----------------------------------------------------------|
* |Fn | A| S| D| F| G| H| J| K| L| ;| '| Return|
* |-----------------------------------------------------------|
* |Shift | Z| X| C| V| B| N| M| ,| .| /| Shift|
* |-----------------------------------------------------------|
* |Ctrl|Alt |Gui | Space |Gui |Alt |Ctrl| Fn|
* `-----------------------------------------------------------'
*/
[_QW] = { /* Layer 0: Qwerty */
{KC_ESC, 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_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},
{MO(_FL), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXXX, KC_ENT },
{KC_LSFT, XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, XXXXXXX, KC_RSFT},
{KC_LCTL, KC_LALT, KC_LGUI, XXXXXXX, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_RGUI, KC_RALT, KC_RCTL, MO(_FL)}
},
/*
* _DV: Dvorak Layer
* ,-----------------------------------------------------------.
* |ESC | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]| Backsp|
* |-----------------------------------------------------------|
* |Tab | '| ,| .| P| Y| F| G| C| R| L| /| =| \|
* |-----------------------------------------------------------|
* |Fn | A| O| E| U| I| D| H| T| N| S| -| Return|
* |-----------------------------------------------------------|
* |Shift | ;| Q| J| K| X| B| M| W| V| Z| Shift|
* |-----------------------------------------------------------|
* |Ctrl|Alt |Gui | Space |Gui |Alt |Ctrl| Fn|
* `-----------------------------------------------------------'
*/
[_DV] = { /* Layer 1: Dvorak */
{KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC},
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS},
{MO(_FL), KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, XXXXXXX, KC_ENT },
{KC_LSFT, XXXXXXX, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, XXXXXXX, KC_RSFT},
{KC_LCTL, KC_LALT, KC_LGUI, XXXXXXX, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_RGUI, KC_RALT, KC_RCTL, MO(_FL)}
},
/*
* _CM: Colemak Layer
* ,-----------------------------------------------------------.
* |ESC | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Backsp|
* |-----------------------------------------------------------|
* |Tab | Q| W| F| P| G| J| L| U| Y| ;| [| ]| \|
* |-----------------------------------------------------------|
* |Fn | A| R| S| T| D| H| N| E| I| O| '| Return|
* |-----------------------------------------------------------|
* |Shift | Z| X| C| V| B| K| M| ,| .| /| Shift|
* |-----------------------------------------------------------|
* |Ctrl|Alt |Gui | Space |Gui |Alt |Ctrl| Fn|
* `-----------------------------------------------------------'
*/
[_CM] = { /* Layer 2: Colemak */
{KC_ESC, 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_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSLS},
{MO(_FL), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, XXXXXXX, KC_ENT },
{KC_LSFT, XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, XXXXXXX, KC_RSFT},
{KC_LCTL, KC_LALT, KC_LGUI, XXXXXXX, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_RGUI, KC_RALT, KC_RCTL, MO(_FL)}
},
/*
* _FL: Function Layer
* ,-----------------------------------------------------------.
* | |F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| Del|
* |-----------------------------------------------------------|
* | | | | | | | |PgU| Up|PgD|PSc|SLk|Pau| |
* |-----------------------------------------------------------|
* | | |MPr|MPl|MNx| |Hom| Lt| Dn| Rt| | | |
* |-----------------------------------------------------------|
* |CAPS | |Mut|VlD|VlU| |End| | | | | |
* |-----------------------------------------------------------|
* |_QW |_DV |_CM | | | | | |
* `-----------------------------------------------------------'
*/
[_FL] = { /* Layer 3: Functions */
{_______, 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_DEL },
{_______, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, _______},
{_______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, XXXXXXX, _______},
{KC_CAPS, XXXXXXX, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, KC_END, _______, _______, _______, _______, XXXXXXX, _______},
{QWERTY, DVORAK, COLEMAK, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______}
},
};
const uint16_t PROGMEM fn_actions[] = {
};
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
case _DV:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_DV);
}
break;
case _QW:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_QW);
}
break;
case _CM:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_CM);
}
break;
}
return MACRO_NONE;
};

@ -0,0 +1,3 @@
ifndef MAKEFILE_INCLUDED
include ../../Makefile
endif

@ -0,0 +1,167 @@
/*
Copyright 2012 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 CONFIG_H
#define CONFIG_H
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER fudanchii
#define PRODUCT kbod
#define DESCRIPTION Keyboard of Disapproval
/* key matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 8
/*
* 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 { C6, D7, E6, B4, B5, B6, B7, D6 }
#define MATRIX_COL_PINS { D0, D1, F0, F1, F4, F5, F6, F7 }
#define UNUSED_PINS
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
#define DIODE_DIRECTION COL2ROW
// #define BACKLIGHT_PIN B7
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
/* 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
/*
* 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
/*
* Magic Key Options
*
* Magic keys are hotkey commands that allow control over firmware functions of
* the keyboard. They are best used in combination with the HID Listen program,
* found here: https://www.pjrc.com/teensy/hid_listen.html
*
* The options below allow the magic key functionality to be changed. This is
* useful if your keyboard/keypad is missing keys and you want magic key support.
*
*/
/* key combination for magic key command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
/* override magic key keymap */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
//#define MAGIC_KEY_HELP1 H
//#define MAGIC_KEY_HELP2 SLASH
//#define MAGIC_KEY_DEBUG D
//#define MAGIC_KEY_DEBUG_MATRIX X
//#define MAGIC_KEY_DEBUG_KBD K
//#define MAGIC_KEY_DEBUG_MOUSE M
//#define MAGIC_KEY_VERSION V
//#define MAGIC_KEY_STATUS S
//#define MAGIC_KEY_CONSOLE C
//#define MAGIC_KEY_LAYER0_ALT1 ESC
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
//#define MAGIC_KEY_LAYER0 0
//#define MAGIC_KEY_LAYER1 1
//#define MAGIC_KEY_LAYER2 2
//#define MAGIC_KEY_LAYER3 3
//#define MAGIC_KEY_LAYER4 4
//#define MAGIC_KEY_LAYER5 5
//#define MAGIC_KEY_LAYER6 6
//#define MAGIC_KEY_LAYER7 7
//#define MAGIC_KEY_LAYER8 8
//#define MAGIC_KEY_LAYER9 9
//#define MAGIC_KEY_BOOTLOADER PAUSE
//#define MAGIC_KEY_LOCK CAPS
//#define MAGIC_KEY_EEPROM E
//#define MAGIC_KEY_NKRO N
//#define MAGIC_KEY_SLEEP_LED Z
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#define PREVENT_STUCK_MODIFIERS
#undef TAPPING_TOGGLE
#define TAPPING_TOGGLE 2
#endif

@ -0,0 +1,28 @@
#include "kbod.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
}
void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
led_set_user(usb_led);
}

@ -0,0 +1,21 @@
#ifndef KBOD_H
#define KBOD_H
#include "quantum.h"
#define KEYMAP( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, \
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, \
k40, k41, k42, k43, k44, k45, k46, k47 \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07 }, { k08, k09, k0A, k0B, k0C, k0D, KC_NO, KC_NO }, \
{ k10, k11, k12, k13, k14, k15, k16, k17 }, { k18, k19, k1A, k1B, k1C, k1D, KC_NO, k3B }, \
{ k20, k21, k22, k23, k24, k25, k26, k27 }, { k28, k29, k2A, k2B, k2C, k38, k39, k3A }, \
{ k30, k31, k32, k33, k34, k35, k36, k37 }, \
{ k40, k41, k42, k43, k44, k45, k46, k47 }, \
}
#endif

@ -0,0 +1,21 @@
# 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 = no # 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 = no # 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
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

@ -0,0 +1,8 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
// place overrides here
#endif

@ -0,0 +1,104 @@
#include "kbod.h"
#define _____ KC_TRNS
#define MODS_PRESSED(btn) (get_mods() & (MOD_BIT(KC_L##btn)|MOD_BIT(KC_R##btn)))
#define SET_WHETHER(mask, btn1, btn2) \
if (record->event.pressed) { \
if (mask) { \
add_key(btn2); \
send_keyboard_report(); \
} else { \
add_key(btn1); \
send_keyboard_report(); \
} \
} else { \
if (mask) { \
del_key(btn2); \
send_keyboard_report(); \
} else { \
del_key(btn1); \
send_keyboard_report(); \
} \
} \
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP( /* Base */
F(0), KC_1, KC_2, KC_3, F(1), KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQUAL, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLASH,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_QUOT, KC_ENTER,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_RSFT,
TT(1), KC_LCTL, KC_LALT, KC_SPACE, KC_RALT, KC_RGUI, KC_APP, KC_RCTL
),
KEYMAP( /* Cursor layer */
KC_GRAVE, 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_DEL,
TT(3), _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_INSERT,
TT(2), _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_HOME, _____,
_____, _____, _____, _____, _____, _____, _____, _____, KC_PGUP, KC_PGDN, KC_END, KC_UP,
_____, _____, _____, _____, _____, KC_LEFT, KC_DOWN, KC_RIGHT
),
KEYMAP( /* Keypad layer */
TO(0), KC_1, KC_2, KC_3, F(1), KC_5, KC_6, KC_P7, KC_P8, KC_P9, KC_P0, KC_PMNS, KC_PPLS, KC_BSPC,
_____, _____, _____, _____, _____, _____, _____, KC_P4, KC_P5, KC_P6, _____, _____, _____, _____,
_____, _____, _____, _____, _____, _____, _____, KC_P1, KC_P2, KC_P3, _____, _____, _____,
_____, _____, _____, _____, _____, _____, _____, KC_P0, KC_PDOT, KC_MS_BTN1, KC_MS_UP, KC_MS_BTN2,
_____, _____, _____, _____, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_MS_BTN3
),
KEYMAP( /* Multimedia layer */
TO(0), _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_AUDIO_MUTE, KC_AUDIO_VOL_DOWN, KC_AUDIO_VOL_UP, _____,
_____, _____, KC_WAKE, _____, _____, _____, _____, _____, _____, _____, KC_MSTP, KC_MPRV, KC_MNXT, _____,
_____, _____, KC_SLEP, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____,
_____, _____, KC_PWR, _____, _____, _____, _____, _____, _____, KC_MS_BTN1, KC_MS_WH_UP, KC_MS_BTN2,
_____, _____, _____, KC_MPLY, KC_MS_WH_LEFT, KC_MS_WH_DOWN, KC_MS_WH_RIGHT, KC_MS_BTN3
),
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_FUNCTION(0),
[1] = ACTION_FUNCTION(1),
};
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
static uint8_t shift_esc_mask;
static uint8_t alt_mask;
switch (id) {
case 0:
shift_esc_mask = MODS_PRESSED(SHIFT);
SET_WHETHER(shift_esc_mask, KC_ESC, KC_GRAVE);
break;
case 1:
alt_mask = MODS_PRESSED(ALT);
SET_WHETHER(alt_mask, KC_4, KC_F4);
break;
}
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
return MACRO_NONE;
};
void led_set_user(uint8_t usb_led) {
if (usb_led & _BV(USB_LED_CAPS_LOCK)) {
PORTB |= _BV(PB0);
} else {
PORTB &= ~_BV(PB0);
}
}
void matrix_init_user(void) {
DDRB |= _BV(PB0);
DDRC |= _BV(PC7);
}
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
if (layer) {
PORTC |= _BV(PC7);
} else {
PORTC &= ~_BV(PC7);
}
}

@ -0,0 +1,5 @@
# The default keymap for kbod
This is the default keymap for kbod,
it consists of a base layer with QWERTY layout, a momentary cursor-layer, and mouse-keys and multimedia layers.

@ -0,0 +1,21 @@
KBOD keyboard firmware
======================
KBOD is a 60% Keyboard kit, hand-wired, with Arduino Micro as its controller. It's utilize 8x8 matrix and has layout similar to GH-60
## Quantum MK Firmware
For the full Quantum feature list, see [the parent readme](/).
## Building
Download or clone the whole firmware and use ```make handwired-kbod-default``` to generate the .hex file. You may flash it with avrdude
## Flashing
Something along this line:
```
avrdude -p m32u4 -c avr109 -P <COM PORT> -C <avrdude conf file> -e -u flash:w:handwired_kbod_default.hex
```
[More info](https://github.com/fudanchii/keyboard_of_disapproval)

@ -0,0 +1,68 @@
# MCU name
#MCU = at90usb1287
MCU = atmega32u4
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Boot Section Size in *bytes*
# Teensy halfKay 512
# Teensy++ halfKay 1024
# Atmel DFU loader 4096
# LUFA bootloader 4096
# USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options
# change yes to no to disable
#
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 ?= no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE ?= no # USB Nkey Rollover
BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default
MIDI_ENABLE ?= no # MIDI controls
UNICODE_ENABLE ?= no # Unicode
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE ?= no # Audio output on port C6
FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches

@ -0,0 +1,21 @@
# 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 = yes # 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 = no # 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
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

@ -0,0 +1,8 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
// place overrides here
#endif

@ -0,0 +1,302 @@
#include "kinesis.h"
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
#define _DV 0 // Dvorak layer
#define _QW 1 // Qwerty layer
#define _CM 2 // Colemak layer
#define _MD 3 // Media Layer
#define _KP 4 // Keypad Layer
// Macro name shortcuts
#define DVORAK M(_DV)
#define QWERTY M(_QW)
#define COLEMAK M(_CM)
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
/*
Function Keys on All Layers (Keypad toggles):
,-----------------------------------------------------------------.
| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 |
`-----------------------------------------------------------------'
,-----------------------------------------------------------------.
| F9 | F10 | F11 | F12 | PScr | SLck | Paus | Keypad | RESET |
`-----------------------------------------------------------------'
Dvorak layer:
,-------------------------------------------.,-------------------------------------------.
| ] | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | [ |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| Tab | ' | , | . | P | Y || F | G | C | R | L | \ |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| CapsLk | A | O | E | U | I || D | H | T | N | S | - |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| LShift | Z | X | C | V | X || B | M | W | V | Z | RShift |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| ` | INS | Left | Rght | | Up | Dn | / | = |
`---------------------------' `---------------------------'
,--------------.,--------------.
| LCtl | LAlt || RGUI | RCtl |
,------|-------|------||------+-------+-------.
| | Del | Home || PgUp | Enter | |
| BkSp | / |------||------| / | Space |
| | Media | End || PgDn | KeyPd | |
`---------------------'`----------------------'
QWERTY layer:
,-------------------------------------------.,-------------------------------------------.
| = | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | - |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| Tab | Q | W | E | R | T || Y | U | I | O | P | \ |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| CapsLk | A | S | D | F | G || H | J | K | L | ; | ' |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| LShift | Z | X | C | V | B || N | M | , | . | / | RShift |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| ` | INS | Left | Rght | | Up | Dn | [ | ] |
`---------------------------' `---------------------------'
,--------------.,--------------.
| LCtl | LAlt || RGUI | RCtl |
,------|-------|------||------+-------+-------.
| | Del | Home || PgUp | Enter | |
| BkSp | / |------||------| / | Space |
| | Media | End || PgDn | KeyPd | |
`---------------------'`----------------------'
Colemak layer:
,-------------------------------------------.,-------------------------------------------.
| = | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | - |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| Tab | Q | W | F | P | G || J | L | U | Y | ; | \ |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| BkSpc | A | R | S | T | D || H | N | E | I | O | ' |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| LShift | Z | X | C | V | B || K | M | , | . | / | RShift |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| ` | INS | Left | Rght | | Up | Dn | [ | ] |
`---------------------------' `---------------------------'
,--------------.,--------------.
| LCtl | LAlt || RGUI | RCtl |
,------|-------|------||------+-------+-------.
| | Del | Home || PgUp | Enter | |
| BkSp | / |------||------| / | Space |
| | Media | End || PgDn | KeyPd | |
`---------------------'`----------------------'
Media layer:
,-------------------------------------------.,-------------------------------------------.
| F11 | F1 | F2 | F3 | F4 | F5 || F6 | F7 | F8 | F9 | F10 | F12 |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || | | | | | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || | Mute | Vol- | Vol+ | | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || Stop | Prev | Play | Next | Sel | |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| | | | | | | | | |
`---------------------------' `---------------------------'
,-------------.,-------------.
| | || | |
,------|------|------||------+------+------.
| | | || | | |
| | |------||------| | |
| | | || | | |
`--------------------'`--------------------'
Keypad layer:
,-------------------------------------------.,-------------------------------------------.
| Power | | | | | || | NmLk | KP = | KP / | KP * | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| Sleep | | | | | || | KP 7 | KP 8 | KP 9 | KP - | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| Wake | |QWERTY|Colemk|Dvorak| || | KP 4 | KP 5 | KP 6 | KP + | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || | KP 1 | KP 2 | KP 3 |KP Ent| |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| | | | | | | | KP . |KP Ent| |
`---------------------------' `----------------------------------'
,-------------.,-------------.
| | || | |
,------|------|------||------+------+------.
| | | || | | |
| | |------||------| | KP 0 |
| | | || | | |
`--------------------'`--------------------'
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_DV] = KEYMAP(
// Left Hand
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8,
KC_RBRC, KC_1, KC_2, KC_3, KC_4, KC_5,
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y,
KC_CAPS, KC_A, KC_O, KC_E, KC_U, KC_I,
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X,
KC_GRV, KC_INS, KC_LEFT, KC_RGHT,
// Left Thumb
KC_LCTL, KC_LALT,
KC_HOME,
KC_BSPC, LT(_MD, KC_DEL), KC_END,
// Right Hand
KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, TG(_KP), RESET,
KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC,
KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSLS,
KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS,
KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT,
KC_UP, KC_DOWN, KC_SLSH, KC_EQL,
// Right Thumb
KC_RGUI, KC_RCTL,
KC_PGUP,
KC_PGDN, LT(_KP, KC_ENT), KC_SPC
),
[_QW] = KEYMAP(
// Left Hand
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B,
KC_GRV, KC_INS, KC_LEFT, KC_RGHT,
// Left Thumb
KC_LCTL, KC_LALT,
KC_HOME,
KC_BSPC, LT(_MD, KC_DEL), KC_END,
// Right Hand
KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, TG(_KP), RESET,
KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL ,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_UP, KC_DOWN, KC_LBRC, KC_RBRC,
// Right Thumb
KC_RGUI, KC_RCTL,
KC_PGUP,
KC_PGDN, LT(_KP, KC_ENT), KC_SPC
),
[_CM] = KEYMAP(
// Left Hand
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5,
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G,
KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B,
KC_GRV, KC_INS, KC_LEFT, KC_RGHT,
// Left Thumb
KC_LCTL, KC_LALT,
KC_HOME,
KC_BSPC, LT(_MD, KC_DEL), KC_END,
// Right Hand
KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, TG(_KP), RESET,
KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL,
KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_UP, KC_DOWN, KC_LBRC, KC_RBRC,
// Right Thumb
KC_RGUI, KC_RCTL,
KC_PGUP,
KC_PGDN, LT(_KP, KC_ENT), KC_SPC
),
[_MD] = KEYMAP(
// Left Hand
_______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______,
// Left Thumb
_______, _______,
_______,
_______, _______, _______,
// Right Hand
_______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12,
_______, _______, _______, _______, _______, _______,
_______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
KC_MSTP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSEL, _______,
_______, _______, _______, _______,
// Right Thumb
_______, _______,
_______,
_______, _______, _______
),
[_KP] = KEYMAP(
// Left Hand
_______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_PWR, _______, _______, _______, _______, _______,
KC_SLEP, _______, _______, _______, _______, _______,
KC_WAKE, _______, QWERTY, COLEMAK, DVORAK, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______,
// Left Thumb
_______, _______,
_______,
_______, _______, _______,
// Right Hand */
_______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_NLCK, KC_PEQL, KC_PSLS, KC_PAST, _______,
_______, KC_P7, KC_P8, KC_P9, KC_PMNS, _______,
_______, KC_P4, KC_P5, KC_P6, KC_PPLS, _______,
_______, KC_P1, KC_P2, KC_P3, KC_PENT, _______,
_______, _______, KC_PDOT, KC_PENT,
// Right Thumb
_______, _______,
_______,
_______, _______, KC_P0
)
};
const uint16_t PROGMEM fn_actions[] = {
};
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
case _DV:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_DV);
}
break;
case _QW:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_QW);
}
break;
case _CM:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_CM);
}
break;
}
return MACRO_NONE;
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};

@ -0,0 +1,128 @@
# Xyverz's Kinesis Keymap
## About this keymap:
The Dvorak layout shown here stems from my early Kinesis years, using the Contour PS/2 with a Dvorak software layout. Because of this, the RBRC and LBRC were on opposite sides of the board in the corner keys. I've decided to continue using this layout with my QMK Kinesis.
The QWERTY layout shown here is based entirely on the Kinesis Advantage layout. The Colemak layout is merely an adaptation of that.
I've enabled persistent keymaps for Qwerty, Dvorak and Colemak layers, similar to the default Planck layouts.
## Still to do:
* Implement the CapsLock, NumLock, and ScrLck LEDs on the off-chance that I decide to actually solder some to the keyboard.
### Function Keys on All Layers (keypad toggles):
,-----------------------------------------------------------------.
| Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 |
`-----------------------------------------------------------------'
,-----------------------------------------------------------------.
| F9 | F10 | F11 | F12 | PScr | SLck | Paus | Keypad | Reset |
`-----------------------------------------------------------------'
### Layer 0: Dvorak layer
,-------------------------------------------.,-------------------------------------------.
| ] | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | [ |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| Tab | ' | , | . | P | Y || F | G | C | R | L | \ |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| CapsLk | A | O | E | U | I || D | H | T | N | S | - |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| LShift | Z | X | C | V | X || B | M | W | V | Z | RShift |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| ` | Ins | Left | Rght | | Up | Dn | / | = |
`---------------------------' `---------------------------'
,--------------.,--------------.
| LCtl | LAlt || RGUI | RCtl |
,------|-------|------||------+-------+-------.
| | Del | Home || PgUp | Enter | |
| BkSp | / |------||------| / | Space |
| | Media | End || PgDn | KeyPd | |
`---------------------'`----------------------'
### Layer 1: QWERTY layer
,-------------------------------------------.,-------------------------------------------.
| = | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | - |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| Tab | Q | W | E | R | T || Y | U | I | O | P | \ |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| CapsLk | A | S | D | F | G || H | J | K | L | ; | ' |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| LShift | Z | X | C | V | B || N | M | , | . | / | RShift |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| ` | Ins | Left | Rght | | Up | Dn | [ | ] |
`---------------------------' `---------------------------'
,--------------.,--------------.
| LCtl | LAlt || RGUI | RCtl |
,------|-------|------||------+-------+-------.
| | Del | Home || PgUp | Enter | |
| BkSp | / |------||------| / | Space |
| | Media | End || PgDn | KeyPd | |
`---------------------'`----------------------'
### Keymap 2: Colemak layer
,-------------------------------------------.,-------------------------------------------.
| = | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | - |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| Tab | Q | W | F | P | G || J | L | U | Y | ; | \ |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| BkSpc | A | R | S | T | D || H | N | E | I | O | ' |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| LShift | Z | X | C | V | B || K | M | , | . | / | RShift |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| ` | Ins | Left | Rght | | Up | Dn | [ | ] |
`---------------------------' `---------------------------'
,--------------.,--------------.
| LCtl | LAlt || RGUI | RCtl |
,------|-------|------||------+-------+-------.
| | Del | Home || PgUp | Enter | |
| BkSp | / |------||------| / | Space |
| | Media | End || PgDn | KeyPd | |
`---------------------'`----------------------'
### layer 3 : Media layer
,-------------------------------------------.,-------------------------------------------.
| F11 | F1 | F2 | F3 | F4 | F5 || F6 | F7 | F8 | F9 | F10 | F12 |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || | | | | | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || | Mute | Vol- | Vol+ | | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || Stop | Prev | Play | Next | Sel | |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| | | | | | | | | |
`---------------------------' `---------------------------'
,-------------.,-------------.
| | || | |
,------|------|------||------+------+------.
| | | || | | |
| | |------||------| | |
| | | || | | |
`--------------------'`--------------------'
### Keymap 4: Keypad layer
,-------------------------------------------.,-------------------------------------------.
| Power | | | | | || | NmLk | KP = | KP / | KP * | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| Sleep | | | | | || | KP 7 | KP 8 | KP 9 | KP - | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| Wake | |QWERTY|Colemk|Dvorak| || | KP 4 | KP 5 | KP 6 | KP + | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || | KP 1 | KP 2 | KP 3 |KP Ent| |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| | | | | | | | KP . |KP Ent| |
`---------------------------' `----------------------------------'
,-------------.,-------------.
| | || | |
,------|------|------||------+------+------.
| | | || | | |
| | |------||------| | KP 0 |
| | | || | | |
`--------------------'`--------------------'

@ -27,19 +27,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define TAPPING_FORCE_HOLD #define TAPPING_FORCE_HOLD
#define TAPPING_TERM 100 #define TAPPING_TERM 100
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 6
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
#ifdef SUBPROJECT_rev1 #ifdef SUBPROJECT_rev1
#include "../../rev1/config.h" #include "../../rev1/config.h"
#endif #endif
#ifdef SUBPROJECT_rev2 #ifdef SUBPROJECT_rev2
#include "../../rev2/config.h" #include "../../rev2/config.h"
#endif #endif
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 6
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17

@ -6,6 +6,9 @@
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
#include "audio.h" #include "audio.h"
#endif #endif
#ifdef SSD1306OLED
#include "ssd1306.h"
#endif
extern keymap_config_t keymap_config; extern keymap_config_t keymap_config;

@ -20,51 +20,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define TAPPING_TERM 150 #define TAPPING_TERM 150
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 8
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#ifdef SUBPROJECT_rev1 #ifdef SUBPROJECT_rev1
#include "../../rev1/config.h" #include "../../rev1/config.h"
#define COMPACT_KEYMAP( \
k00, k01, k02, k03, k04, k05, k40, k41, k42, k43, k44, k45, \
k10, k11, k12, k13, k14, k15, k50, k51, k52, k53, k54, k55, \
k20, k21, k22, k23, k24, k25, k60, k61, k62, k63, k64, k65, \
k30, k31, k32, k33, k34, k35, k70, k71, k72, k73, k74, k75 \
) \
{ \
{ KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05 }, \
{ KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15 }, \
{ KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25 }, \
{ KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35 }, \
{ KC_##k40, KC_##k41, KC_##k42, KC_##k43, KC_##k44, KC_##k45 }, \
{ KC_##k50, KC_##k51, KC_##k52, KC_##k53, KC_##k54, KC_##k55 }, \
{ KC_##k60, KC_##k61, KC_##k62, KC_##k63, KC_##k64, KC_##k65 }, \
{ KC_##k70, KC_##k71, KC_##k72, KC_##k73, KC_##k74, KC_##k75 } \
}
#endif #endif
#ifdef SUBPROJECT_rev2 #ifdef SUBPROJECT_rev2
#include "../../rev2/config.h" #include "../../rev2/config.h"
#define COMPACT_KEYMAP( \
k00, k01, k02, k03, k04, k05, k45, k44, k43, k42, k41, k40, \
k10, k11, k12, k13, k14, k15, k55, k54, k53, k52, k51, k50, \
k20, k21, k22, k23, k24, k25, k65, k64, k63, k62, k61, k60, \
k30, k31, k32, k33, k34, k35, k75, k74, k73, k72, k71, k70 \
) \
{ \
{ KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05 }, \
{ KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15 }, \
{ KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25 }, \
{ KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35 }, \
{ KC_##k40, KC_##k41, KC_##k42, KC_##k43, KC_##k44, KC_##k45 }, \
{ KC_##k50, KC_##k51, KC_##k52, KC_##k53, KC_##k54, KC_##k55 }, \
{ KC_##k60, KC_##k61, KC_##k62, KC_##k63, KC_##k64, KC_##k65 }, \
{ KC_##k70, KC_##k71, KC_##k72, KC_##k73, KC_##k74, KC_##k75 } \
}
#endif
#ifdef SUBPROJECT_rev2fliphalf
#include "../../rev2fliphalf/config.h"
#endif #endif
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 8
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8

@ -39,7 +39,7 @@ enum custom_keycodes {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = COMPACT_KEYMAP( [_QWERTY] = KC_KEYMAP(
//,----+----+----+----+----+----. ,----+----+----+----+----+----. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS, TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS,
//|----+----+----+----+----+----| |----+----+----+----+----+----| //|----+----+----+----+----+----| |----+----+----+----+----+----|
@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//`----+----+----+----+----+----' `----+----+----+----+----+----' //`----+----+----+----+----+----' `----+----+----+----+----+----'
), ),
[_COLEMAK] = COMPACT_KEYMAP( [_COLEMAK] = KC_KEYMAP(
//,----+----+----+----+----+----. ,----+----+----+----+----+----. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
TAB , Q , W , F , P , G , J , L , U , Y ,SCLN,MINS, TAB , Q , W , F , P , G , J , L , U , Y ,SCLN,MINS,
//|----+----+----+----+----+----| |----+----+----+----+----+----| //|----+----+----+----+----+----| |----+----+----+----+----+----|
@ -63,7 +63,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//`----+----+----+----+----+----' `----+----+----+----+----+----' //`----+----+----+----+----+----' `----+----+----+----+----+----'
), ),
[_DVORAK] = COMPACT_KEYMAP( [_DVORAK] = KC_KEYMAP(
//,----+----+----+----+----+----. ,----+----+----+----+----+----. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
TAB ,QUOT,COMM,DOT , P , Y , F , G , C , R , L ,MINS, TAB ,QUOT,COMM,DOT , P , Y , F , G , C , R , L ,MINS,
//|----+----+----+----+----+----| |----+----+----+----+----+----| //|----+----+----+----+----+----| |----+----+----+----+----+----|
@ -75,7 +75,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//`----+----+----+----+----+----' `----+----+----+----+----+----' //`----+----+----+----+----+----' `----+----+----+----+----+----'
), ),
[_LOWER] = COMPACT_KEYMAP( [_LOWER] = KC_KEYMAP(
//,----+----+----+----+----+----. ,----+----+----+----+----+----. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , , , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , ,
//|----+----+----+----+----+----| |----+----+----+----+----+----| //|----+----+----+----+----+----| |----+----+----+----+----+----|
@ -87,7 +87,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//`----+----+----+----+----+----' `----+----+----+----+----+----' //`----+----+----+----+----+----' `----+----+----+----+----+----'
), ),
[_RAISE] = COMPACT_KEYMAP( [_RAISE] = KC_KEYMAP(
//,----+----+----+----+----+----. ,----+----+----+----+----+----. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN, , ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN, ,
//|----+----+----+----+----+----| |----+----+----+----+----+----| //|----+----+----+----+----+----| |----+----+----+----+----+----|
@ -99,7 +99,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//`----+----+----+----+----+----' `----+----+----+----+----+----' //`----+----+----+----+----+----' `----+----+----+----+----+----'
), ),
[_FN3] = COMPACT_KEYMAP( [_FN3] = KC_KEYMAP(
//,----+----+----+----+----+----. ,----+----+----+----+----+----. //,----+----+----+----+----+----. ,----+----+----+----+----+----.
F12 , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 , F12 , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,
//|----+----+----+----+----+----| |----+----+----+----+----+----| //|----+----+----+----+----+----| |----+----+----+----+----+----|

@ -0,0 +1,37 @@
/*
Copyright 2012 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/>.
*/
#define USE_SERIAL
#define MASTER_LEFT
// #define MASTER_RIGHT
// #define EE_HANDS
#ifdef SUBPROJECT_rev1
#include "../../rev1/config.h"
#endif
#ifdef SUBPROJECT_rev2
#include "../../rev2/config.h"
/* RGB Underglow */
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 8
#endif
#ifdef SUBPROJECT_rev2fliphalf
#include "../../rev2fliphalf/config.h"
#endif

@ -0,0 +1,191 @@
#include "lets_split.h"
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _QWERTY 0
#define _COLEMAK 1
#define _DVORAK 2
#define _LOWER 3
#define _RAISE 4
#define _ADJUST 16
enum planck_keycodes {
QWERTY = SAFE_RANGE,
COLEMAK,
DVORAK,
LOWER,
RAISE,
ADJUST
};
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Bksp |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = KEYMAP ( \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,\
KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUI_T(KC_BSPC), KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \
),
/* Colemak
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Bksp |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = KEYMAP ( \
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \
KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUI_T(KC_BSPC), KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \
),
/* Dvorak
* ,-----------------------------------------------------------------------------------.
* | Tab | " | , | . | P | Y | F | G | C | R | L | / |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | O | E | U | I | D | H | T | N | S | - |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| ; | Q | J | K | X | B | M | W | V | Z | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | Alt | Left |Right |Lower | Bksp |Space |Raise | Up | Down | GUI |Enter |
* `-----------------------------------------------------------------------------------'
*/
[_DVORAK] = KEYMAP ( \
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, \
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, \
KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUI_T(KC_BSPC), KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \
),
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Caps | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | Mute | Vol- | Vol+ | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| | Home | End | | Del | Ins | | PgUp | PgDN | |Enter |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = KEYMAP ( \
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, \
_______, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ \
),
/* Raise
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Caps | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | Prev | Play | Next | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| | Home | End | | Del | Ins | | PgUp | PgDN | |Enter |
* `-----------------------------------------------------------------------------------'
*/
[_RAISE] = KEYMAP ( \
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \
KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, \
_______, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ \
),
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | F11 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F12 |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | Reset| |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | |RGB ON| MODE | HUE+ | HUE- | SAT+ | SAT- | VAL+ | VAL- | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = KEYMAP ( \
KC_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12 , \
_______, RESET, _______, _______, _______, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
_______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
)
};
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_COLEMAK);
}
return false;
break;
case DVORAK:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_DVORAK);
}
return false;
break;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
}
return true;
}

@ -11,6 +11,20 @@
#include "rev2fliphalf.h" #include "rev2fliphalf.h"
#endif #endif
// Used to create a keymap using only KC_ prefixed keys
#define KC_KEYMAP( \
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
) \
KEYMAP( \
KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \
KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \
KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \
KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35 \
)
#include "quantum.h" #include "quantum.h"
#endif #endif

@ -7,6 +7,12 @@ Split keyboard firmware for Arduino Pro Micro or other ATmega32u4
based boards. based boards.
## Build Guide
A build guide for putting together the Let's Split v2 can be found here: [An Overly Verbose Guide to Building a Let's Split Keyboard](https://github.com/nicinabox/lets-split-guide)
There is additional information there about flashing and adding RGB underglow.
## First Time Setup ## First Time Setup
Download or clone the whole firmware and navigate to the keyboards/lets_split directory. Once your dev env is setup, you'll be able to generate the default .hex using: Download or clone the whole firmware and navigate to the keyboards/lets_split directory. Once your dev env is setup, you'll be able to generate the default .hex using:
@ -62,8 +68,7 @@ Apart from diodes and key switches for the keyboard matrix in each half, you
will need: will need:
* 2 Arduino Pro Micro's. You can find theses on aliexpress for ≈3.50USD each. * 2 Arduino Pro Micro's. You can find theses on aliexpress for ≈3.50USD each.
* 2 TRS sockets * 2 TRRS sockets and 1 TRRS cable, or 2 TRS sockets and 1 TRS cable
* 1 TRS cable.
Alternatively, you can use any sort of cable and socket that has at least 3 Alternatively, you can use any sort of cable and socket that has at least 3
wires. If you want to use I2C to communicate between halves, you will need a wires. If you want to use I2C to communicate between halves, you will need a
@ -77,7 +82,7 @@ A speaker can be hooked-up to either side to the `5` (`C6`) pin and `GND`, and t
Wiring Wiring
------ ------
The 3 wires of the TRS cable need to connect GND, VCC, and digital pin 3 (i.e. The 3 wires of the TRS/TRRS cable need to connect GND, VCC, and digital pin 3 (i.e.
PD0 on the ATmega32u4) between the two Pro Micros. PD0 on the ATmega32u4) between the two Pro Micros.
Then wire your key matrix to any of the remaining 17 IO pins of the pro micro Then wire your key matrix to any of the remaining 17 IO pins of the pro micro

@ -9,20 +9,20 @@
//void promicro_bootloader_jmp(bool program); //void promicro_bootloader_jmp(bool program);
#define KEYMAP( \ #define KEYMAP( \
k00, k01, k02, k03, k04, k05, k40, k41, k42, k43, k44, k45, \ L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
k10, k11, k12, k13, k14, k15, k50, k51, k52, k53, k54, k55, \ L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
k20, k21, k22, k23, k24, k25, k60, k61, k62, k63, k64, k65, \ L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
k30, k31, k32, k33, k34, k35, k70, k71, k72, k73, k74, k75 \ L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
) \ ) \
{ \ { \
{ k00, k01, k02, k03, k04, k05 }, \ { L00, L01, L02, L03, L04, L05 }, \
{ k10, k11, k12, k13, k14, k15 }, \ { L10, L11, L12, L13, L14, L15 }, \
{ k20, k21, k22, k23, k24, k25 }, \ { L20, L21, L22, L23, L24, L25 }, \
{ k30, k31, k32, k33, k34, k35 }, \ { L30, L31, L32, L33, L34, L35 }, \
{ k40, k41, k42, k43, k44, k45 }, \ { R00, R01, R02, R03, R04, R05 }, \
{ k50, k51, k52, k53, k54, k55 }, \ { R10, R11, R12, R13, R14, R15 }, \
{ k60, k61, k62, k63, k64, k65 }, \ { R20, R21, R22, R23, R24, R25 }, \
{ k70, k71, k72, k73, k74, k75 } \ { R30, R31, R32, R33, R34, R35 } \
} }
#endif #endif

@ -37,4 +37,3 @@ void shutdown_user(void) {
stop_all_notes(); stop_all_notes();
#endif #endif
} }

@ -10,62 +10,51 @@
#ifdef USE_I2C #ifdef USE_I2C
#include <stddef.h> #include <stddef.h>
#ifdef __AVR__ #ifdef __AVR__
#include <avr/io.h> #include <avr/io.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#endif
#ifdef SSD1306OLED
extern bool iota_gfx_init(void);
extern void iota_gfx_task(void);
extern bool iota_gfx_off(void);
extern bool iota_gfx_on(void);
extern void iota_gfx_flush(void);
extern void iota_gfx_write_char(uint8_t c);
extern void iota_gfx_write(const char *data);
extern void iota_gfx_write_P(const char *data);
extern void iota_gfx_clear_screen(void);
#endif #endif
#endif #endif
//void promicro_bootloader_jmp(bool program); //void promicro_bootloader_jmp(bool program);
#ifndef FLIP_HALF #ifndef FLIP_HALF
//Standard Keymap // Standard Keymap
// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left)
#define KEYMAP( \ #define KEYMAP( \
k40, k41, k42, k43, k44, k45, k05, k04, k03, k02, k01, k00, \ L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
k50, k51, k52, k53, k54, k55, k15, k14, k13, k12, k11, k10, \ L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
k60, k61, k62, k63, k64, k65, k25, k24, k23, k22, k21, k20, \ L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
k70, k71, k72, k73, k74, k75, k35, k34, k33, k32, k31, k30 \ L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
) \ ) \
{ \ { \
{ k45, k44, k43, k42, k41, k40 }, \ { L00, L01, L02, L03, L04, L05 }, \
{ k55, k54, k53, k52, k51, k50 }, \ { L10, L11, L12, L13, L14, L15 }, \
{ k65, k64, k63, k62, k61, k60 }, \ { L20, L21, L22, L23, L24, L25 }, \
{ k75, k74, k73, k72, k71, k70 }, \ { L30, L31, L32, L33, L34, L35 }, \
{ k00, k01, k02, k03, k04, k05 }, \ { R05, R04, R03, R02, R01, R00 }, \
{ k10, k11, k12, k13, k14, k15 }, \ { R15, R14, R13, R12, R11, R10 }, \
{ k20, k21, k22, k23, k24, k25 }, \ { R25, R24, R23, R22, R21, R20 }, \
{ k30, k31, k32, k33, k34, k35 } \ { R35, R34, R33, R32, R31, R30 } \
} }
#else #else
// Keymap with one side flipped // Keymap with right side flipped
// (TRRS jack on both halves are to the right)
#define KEYMAP( \ #define KEYMAP( \
k00, k01, k02, k03, k04, k05, k40, k41, k42, k43, k44, k45, \ L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
k10, k11, k12, k13, k14, k15, k50, k51, k52, k53, k54, k55, \ L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
k20, k21, k22, k23, k24, k25, k60, k61, k62, k63, k64, k65, \ L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
k30, k31, k32, k33, k34, k35, k70, k71, k72, k73, k74, k75 \ L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
) \ ) \
{ \ { \
{ k00, k01, k02, k03, k04, k05 }, \ { L00, L01, L02, L03, L04, L05 }, \
{ k10, k11, k12, k13, k14, k15 }, \ { L10, L11, L12, L13, L14, L15 }, \
{ k20, k21, k22, k23, k24, k25 }, \ { L20, L21, L22, L23, L24, L25 }, \
{ k30, k31, k32, k33, k34, k35 }, \ { L30, L31, L32, L33, L34, L35 }, \
{ k45, k44, k43, k42, k41, k40 }, \ { R00, R01, R02, R03, R04, R05 }, \
{ k55, k54, k53, k52, k51, k50 }, \ { R10, R11, R12, R13, R14, R15 }, \
{ k65, k64, k63, k62, k61, k60 }, \ { R20, R21, R22, R23, R24, R25 }, \
{ k75, k74, k73, k72, k71, k70 } \ { R30, R31, R32, R33, R34, R35 } \
} }
#endif #endif
#endif #endif

@ -1,7 +1,7 @@
SRC += matrix.c \ SRC += matrix.c \
i2c.c \ i2c.c \
split_util.c \ split_util.c \
serial.c\ serial.c \
ssd1306.c ssd1306.c
# MCU name # MCU name
@ -74,3 +74,15 @@ USE_I2C ?= yes
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
CUSTOM_MATRIX = yes CUSTOM_MATRIX = yes
avrdude: build
ls /dev/tty* > /tmp/1; \
echo "Reset your Pro Micro now"; \
while [[ -z $$USB ]]; do \
sleep 1; \
ls /dev/tty* > /tmp/2; \
USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \
done; \
avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex
.PHONY: avrdude

@ -21,7 +21,7 @@ static void setup_handedness(void) {
#ifdef EE_HANDS #ifdef EE_HANDS
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
#else #else
// I2c_MASTER_RIGHT ish deprecate use MASTER_RIGHT instead since this works for both serial and i2c: // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
#if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
isLeftHand = !has_usb(); isLeftHand = !has_usb();
#else #else

@ -1,8 +1,9 @@
#ifdef SSD1306OLED
#include "ssd1306.h"
#include "config.h" #include "config.h"
#include "i2c.h" #include "i2c.h"
#include <stdbool.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include "print.h" #include "print.h"
#include "lets_split.h" #include "lets_split.h"
#include "common/glcdfont.c" #include "common/glcdfont.c"
@ -466,3 +467,4 @@ void iota_gfx_task(void) {
iota_gfx_off(); iota_gfx_off();
} }
} }
#endif

@ -0,0 +1,17 @@
#ifndef SSD1306_H
#define SSD1306_H
#include <stdbool.h>
#include <stdio.h>
bool iota_gfx_init(void);
void iota_gfx_task(void);
bool iota_gfx_off(void);
bool iota_gfx_on(void);
void iota_gfx_flush(void);
void iota_gfx_write_char(uint8_t c);
void iota_gfx_write(const char *data);
void iota_gfx_write_P(const char *data);
void iota_gfx_clear_screen(void);
#endif

@ -0,0 +1,3 @@
ifndef MAKEFILE_INCLUDED
include ../../Makefile
endif

@ -0,0 +1,170 @@
/*
Copyright 2012 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 CONFIG_H
#define CONFIG_H
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER Bigtuna.io
#define PRODUCT Miuni32
#define DESCRIPTION A custom keyboard for writers
/* key matrix size */
#define MATRIX_ROWS 3
#define MATRIX_COLS 11
/*
* 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 { F0, F4, D7}
#define MATRIX_COL_PINS { C6, C7, F7, F6, F1, E6, B7, B3, B2, B1, B0}
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL
// #define BACKLIGHT_PIN B7
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
/* 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
/*
* 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
/*
* Magic Key Options
*
* Magic keys are hotkey commands that allow control over firmware functions of
* the keyboard. They are best used in combination with the HID Listen program,
* found here: https://www.pjrc.com/teensy/hid_listen.html
*
* The options below allow the magic key functionality to be changed. This is
* useful if your keyboard/keypad is missing keys and you want magic key support.
*
*/
/* key combination for magic key command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
/* override magic key keymap */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
//#define MAGIC_KEY_HELP1 H
//#define MAGIC_KEY_HELP2 SLASH
//#define MAGIC_KEY_DEBUG D
//#define MAGIC_KEY_DEBUG_MATRIX X
//#define MAGIC_KEY_DEBUG_KBD K
//#define MAGIC_KEY_DEBUG_MOUSE M
//#define MAGIC_KEY_VERSION V
//#define MAGIC_KEY_STATUS S
//#define MAGIC_KEY_CONSOLE C
//#define MAGIC_KEY_LAYER0_ALT1 ESC
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
//#define MAGIC_KEY_LAYER0 0
//#define MAGIC_KEY_LAYER1 1
//#define MAGIC_KEY_LAYER2 2
//#define MAGIC_KEY_LAYER3 3
//#define MAGIC_KEY_LAYER4 4
//#define MAGIC_KEY_LAYER5 5
//#define MAGIC_KEY_LAYER6 6
//#define MAGIC_KEY_LAYER7 7
//#define MAGIC_KEY_LAYER8 8
//#define MAGIC_KEY_LAYER9 9
//#define MAGIC_KEY_BOOTLOADER PAUSE
//#define MAGIC_KEY_LOCK CAPS
//#define MAGIC_KEY_EEPROM E
//#define MAGIC_KEY_NKRO N
//#define MAGIC_KEY_SLEEP_LED Z
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#define RGBLIGHT_TIMER
#define RGB_DI_PIN D0 // The pin your RGB strip is wired to
#define RGBLIGHT_TIMER // Require for fancier stuff (not compatible with audio)
#define RGBLED_NUM 7 // Number of LEDs
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
#endif

@ -0,0 +1,21 @@
# 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 = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

@ -0,0 +1,8 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
// place overrides here
#endif

@ -0,0 +1,49 @@
#include "miuni32.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] ={
{KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_RSFT, KC_ENT},
{KC_Z, KC_X, KC_C, KC_V, KC_V, KC_SPC, KC_B, KC_N, KC_M , MO(1), KC_RCTL}
},
[1] ={
{KC_PGUP, KC_UP, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL},
{KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_HOME, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_END, KC_TRNS},
{RGB_TOG, RGB_HUI, RGB_HUD, RGB_SAI, KC_TRNS, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, RGB_MOD},
}
};
const uint16_t PROGMEM fn_actions[] = {
};
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;
};
void matrix_init_user(void) {
}
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void led_set_user(uint8_t usb_led) {
}

@ -0,0 +1 @@
# The default keymap for miuni32

@ -0,0 +1,28 @@
#include "miuni32.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
}
void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
led_set_user(usb_led);
}

@ -0,0 +1,15 @@
#ifndef MIUNI32_H
#define MIUNI32_H
#include "quantum.h"
#define KEYMAP( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A ) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A } \
}
#endif

@ -0,0 +1,28 @@
miuni32 keyboard firmware
======================
## Quantum MK Firmware
For the full Quantum feature list, see [the parent readme](/).
## Building
Download or clone the whole firmware and navigate to the keyboards/miuni32 folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file.
Depending on which keymap you would like to use, you will have to compile slightly differently.
### Default
To build with the default keymap, simply run `make default`.
### Other Keymaps
Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a folder with the name of your keymap in the keymaps folder, and see keymap documentation (you can find in top readme.md) and existant keymap files.
To build the firmware binary hex file with a keymap just do `make` with a keymap like this:
```
$ make [default|jack|<name>]
```
Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder.

@ -0,0 +1,67 @@
# MCU name
#MCU = at90usb1287
MCU = atmega32u4
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Boot Section Size in *bytes*
# Teensy halfKay 512
# Teensy++ halfKay 1024
# Atmel DFU loader 4096
# LUFA bootloader 4096
# USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options
# change yes to no to disable
#
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 ?= yes # Console for debug(+400)
COMMAND_ENABLE ?= yes # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE ?= no # USB Nkey Rollover
BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default
MIDI_ENABLE ?= no # MIDI controls
UNICODE_ENABLE ?= no # Unicode
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE ?= no # Audio output on port C6

@ -48,6 +48,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* number of backlight levels */ /* number of backlight levels */
#define BACKLIGHT_LEVELS 3 #define BACKLIGHT_LEVELS 3
#define BACKLIGHT_BREATHING
/* Set 0 if debouncing isn't needed */ /* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5 #define DEBOUNCING_DELAY 5

@ -37,6 +37,14 @@ enum planck_keycodes {
#define _______ KC_TRNS #define _______ KC_TRNS
#define XXXXXXX KC_NO #define XXXXXXX KC_NO
#define MACRO_BREATH_TOGGLE 21
#define MACRO_BREATH_SPEED_INC 23
#define MACRO_BREATH_SPEED_DEC 24
#define MACRO_BREATH_DEFAULT 25
#define M_BRTOG M(MACRO_BREATH_TOGGLE)
#define M_BRINC M(MACRO_BREATH_SPEED_INC)
#define M_BRDEC M(MACRO_BREATH_SPEED_DEC)
#define M_BRDFT M(MACRO_BREATH_DEFAULT)
// Tap Dance Declarations // Tap Dance Declarations
enum { enum {
ESC_CAP = 0, ESC_CAP = 0,
@ -173,10 +181,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_ADJUST] = { [_ADJUST] = {
{_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, M_BRDFT, KC_DEL },
{_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______}, {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, M_BRINC, _______},
{_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, M_BRDEC, C_A_INS},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, C_A_INS, C_A_DEL} {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, M_BRTOG, C_A_DEL}
} }
@ -210,6 +218,32 @@ void persistant_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer); default_layer_set(default_layer);
} }
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
switch(id) {
case MACRO_BREATH_TOGGLE:
if (record->event.pressed) {
breathing_toggle();
}
break;
case MACRO_BREATH_SPEED_INC:
if (record->event.pressed) {
breathing_speed_inc(1);
}
break;
case MACRO_BREATH_SPEED_DEC:
if (record->event.pressed) {
breathing_speed_dec(1);
}
break;
case MACRO_BREATH_DEFAULT:
if (record->event.pressed) {
breathing_defaults();
}
break;
}
return MACRO_NONE;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case QWERTY: case QWERTY:

@ -0,0 +1,6 @@
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
AUDIO_ENABLE = no # Audio output on port C6
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

@ -44,14 +44,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * | Ctrl | Alt | Left |Right |Lower | Bksp |Space |Raise | Up | Down | GUI |Enter |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_QWERTY] = { [_QWERTY] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
{BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUI_T(KC_BSPC), KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT }
}, },
/* Colemak /* Colemak
@ -62,14 +62,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * | Ctrl | Alt | Left |Right |Lower | Bksp |Space |Raise | Up | Down | GUI |Enter |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_COLEMAK] = { [_COLEMAK] = {
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
{KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
{BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUI_T(KC_BSPC), KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT }
}, },
/* Dvorak /* Dvorak
@ -86,8 +86,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_DVORAK] = { [_DVORAK] = {
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH}, {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH},
{KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS}, {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_T(KC_ENT)}, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT},
{KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, KC_BSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT } {KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUI_T(KC_BSPC), KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT }
}, },
/* Lower /* Lower
@ -128,9 +128,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Adjust (Lower + Raise) /* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | | Reset| | | | | | | | | | Del | * | F11 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F12 |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | * | | Reset| |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
@ -138,8 +138,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_ADJUST] = { [_ADJUST] = {
{_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, {KC_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12 },
{_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______}, {_______, RESET, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______},
{_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
} }

@ -1,21 +1,19 @@
# Build Options # Build Options
# change to "no" to disable the options, or define them in the Makefile in # change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically # the appropriate keymap folder that will get included automatically
# #
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400) CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration COMMAND_ENABLE = no # 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 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 = yes # Enable keyboard backlight functionality BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6 AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 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. RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

@ -0,0 +1,21 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
// Number of backlight levels
#undef BACKLIGHT_LEVELS
#define BACKLIGHT_LEVELS 3
/* ws2812 RGB LED */
#undef RGB_DI_PIN
#define RGB_DI_PIN B3
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 11 // Number of LEDs
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
#endif

@ -14,22 +14,16 @@
#define _DVORAK 2 #define _DVORAK 2
#define _LOWER 3 #define _LOWER 3
#define _RAISE 4 #define _RAISE 4
#define _MUSIC 5
#define _ADJUST 16 #define _ADJUST 16
// Macro name shortcuts enum preonic_keycodes {
#define QWERTY M(_QWERTY) QWERTY = SAFE_RANGE,
#define COLEMAK M(_COLEMAK) COLEMAK,
#define DVORAK M(_DVORAK) DVORAK,
#define LOWER M(_LOWER) LOWER,
#define RAISE M(_RAISE) RAISE,
#define M_BL 5 BACKLIT
#define AUD_OFF M(6) };
#define AUD_ON M(7)
#define MUS_OFF M(8)
#define MUS_ON M(9)
#define VC_IN M(10)
#define VC_DE M(11)
// Fillers to make layering more clear // Fillers to make layering more clear
#define _______ KC_TRNS #define _______ KC_TRNS
@ -47,41 +41,41 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / | Shift| * | Shift| Z | X | C | V | B | N | M | , | . | / | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | Alt | Left |Right |Lower | Space |Raise | Up | Down | GUI |Enter | * | Ctrl | Alt | Left |Right |Lower | Bksp |Space |Raise | Up | Down | GUI |Enter |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_QWERTY] = { [_QWERTY] = {
{KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL}, {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL },
{KC_MINS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_MINS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT}, {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_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, KC_SPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT } {KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUI_T(KC_BSPC), KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT }
}, },
/* Colemak /* Colemak
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del | * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | R | S | T | D | H | N | E | I | O | " | * | Bksp | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | * | Shift| Z | X | C | V | B | K | M | , | . | / | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * | Ctrl | Alt | Left |Right |Lower | Bksp |Space |Raise | Up | Down | GUI |Enter |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_COLEMAK] = { [_COLEMAK] = {
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL}, {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL },
{KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
{M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUI_T(KC_BSPC), KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT }
}, },
/* Dvorak /* Dvorak
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | \ |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Tab | " | , | . | P | Y | F | G | C | R | L | / | * | Tab | " | , | . | P | Y | F | G | C | R | L | / |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
@ -89,112 +83,98 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| ; | Q | J | K | X | B | M | W | V | Z | Shift| * | Shift| ; | Q | J | K | X | B | M | W | V | Z | Shift|
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | Alt | Left |Right |Lower | Space |Raise | Up | Down | GUI |Enter | * | Ctrl | Alt | Left |Right |Lower | Bksp |Space |Raise | Up | Down | GUI |Enter |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_DVORAK] = { [_DVORAK] = {
{KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS},
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH}, {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH},
{KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS}, {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT}, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT},
{KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, KC_SPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT } {KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUI_T(KC_BSPC), KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT }
}, },
/* Lower /* Lower
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | | |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | Caps | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | * | Caps | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | Mute | Vol- | Vol+ | | * | | F7 | F8 | F9 | F10 | F11 | F12 | | Mute | Vol- | Vol+ | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| | Home | End | | Ins | | PgUp | PgDN | |Enter | * | Brite| | Home | End | | Del | Ins | | PgUp | PgDN | |Enter |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_LOWER] = { [_LOWER] = {
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______},
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL}, {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PIPE},
{KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, {KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, _______},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______},
{M(M_BL), _______, KC_HOME, KC_END, _______, KC_INS, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______} {BACKLIT, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______}
}, },
/* Raise /* Raise
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | \ |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | Caps | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | * | Caps | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | Prev | Play | Next | | * | | F7 | F8 | F9 | F10 | F11 | F12 | | Prev | Play | Next | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| | Home | End | | Ins | | PgUp | PgDN | |Enter | * | Brite| | Home | End | | Del | Ins | | PgUp | PgDN | |Enter |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_RAISE] = { [_RAISE] = {
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______},
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL}, {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSLS},
{KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, {KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, _______},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______},
{M(M_BL), _______, KC_HOME, KC_END, _______, KC_INS, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______} {BACKLIT, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______}
},
/* Music (reserved for process_action_user)
*
*/
[_MUSIC] = {
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LOWER, XXXXXXX, XXXXXXX, RAISE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}
}, },
/* Adjust (Lower + Raise) /* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | Reset| | | | | | | | | | Del | * | | Reset| | | | | | | | | | |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | |Audoff|Aud on|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | * | | | | | |AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | |Voice-|Voice+|Musoff|Mus on| | | | | | | | * | |RGB ON| MODE | HUE+ | HUE- | SAT+ | SAT- | VAL+ | VAL- | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | * | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_ADJUST] = { [_ADJUST] = {
{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_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12 },
{_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______}, {_______, _______, _______, _______, _______, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______},
{_______, VC_DE, VC_IN, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______}, {_______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
} }
};
const uint16_t PROGMEM fn_actions[] = {
}; };
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
float start_up[][2] = { float tone_startup[][2] = {
{440.0*pow(2.0,(14)/12.0), 20}, {NOTE_B5, 20},
{440.0*pow(2.0,(26)/12.0), 8}, {NOTE_B6, 8},
{440.0*pow(2.0,(18)/12.0), 20}, {NOTE_DS6, 20},
{440.0*pow(2.0,(26)/12.0), 8} {NOTE_B6, 8}
}; };
float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
float goodbye[][2] = SONG(GOODBYE_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
#endif #endif
void persistant_default_layer_set(uint16_t default_layer) { void persistant_default_layer_set(uint16_t default_layer) {
@ -202,34 +182,36 @@ void persistant_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer); default_layer_set(default_layer);
} }
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) bool process_record_user(uint16_t keycode, keyrecord_t *record) {
{ switch (keycode) {
switch(id) { case QWERTY:
case _QWERTY:
if (record->event.pressed) { if (record->event.pressed) {
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0); PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
#endif #endif
persistant_default_layer_set(1UL<<_QWERTY); persistant_default_layer_set(1UL<<_QWERTY);
} }
return false;
break; break;
case _COLEMAK: case COLEMAK:
if (record->event.pressed) { if (record->event.pressed) {
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0); PLAY_NOTE_ARRAY(tone_colemak, false, 0);
#endif #endif
persistant_default_layer_set(1UL<<_COLEMAK); persistant_default_layer_set(1UL<<_COLEMAK);
} }
return false;
break; break;
case _DVORAK: case DVORAK:
if (record->event.pressed) { if (record->event.pressed) {
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0); PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
#endif #endif
persistant_default_layer_set(1UL<<_DVORAK); persistant_default_layer_set(1UL<<_DVORAK);
} }
return false;
break; break;
case _LOWER: case LOWER:
if (record->event.pressed) { if (record->event.pressed) {
layer_on(_LOWER); layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST); update_tri_layer(_LOWER, _RAISE, _ADJUST);
@ -237,8 +219,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
layer_off(_LOWER); layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST); update_tri_layer(_LOWER, _RAISE, _ADJUST);
} }
return false;
break; break;
case _RAISE: case RAISE:
if (record->event.pressed) { if (record->event.pressed) {
layer_on(_RAISE); layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST); update_tri_layer(_LOWER, _RAISE, _ADJUST);
@ -246,8 +229,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
layer_off(_RAISE); layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST); update_tri_layer(_LOWER, _RAISE, _ADJUST);
} }
return false;
break; break;
case M_BL: case BACKLIT:
if (record->event.pressed) { if (record->event.pressed) {
register_code(KC_RSFT); register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE #ifdef BACKLIGHT_ENABLE
@ -256,87 +240,41 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
} else { } else {
unregister_code(KC_RSFT); unregister_code(KC_RSFT);
} }
break; return false;
case 6: break;
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
audio_off();
#endif
}
break;
case 7:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
audio_on();
PLAY_NOTE_ARRAY(start_up, false, 0);
#endif
}
break;
case 8:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
layer_off(_MUSIC);
stop_all_notes();
#endif
}
break;
case 9:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(music_scale, false, 0);
layer_on(_MUSIC);
#endif
}
break;
case 10:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
voice_iterate();
PLAY_NOTE_ARRAY(music_scale, false, 0);
#endif
}
break;
case 11:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
voice_deiterate();
PLAY_NOTE_ARRAY(music_scale, false, 0);
#endif
}
break;
} }
return MACRO_NONE; return true;
}; };
void matrix_init_user(void) { void matrix_init_user(void) {
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
_delay_ms(20); // gets rid of tick startup_user();
PLAY_NOTE_ARRAY(start_up, false, 0); #endif
#endif
} }
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
uint8_t starting_note = 0x0C; void startup_user()
int offset = 7; {
_delay_ms(20); // gets rid of tick
void process_action_user(keyrecord_t *record) { PLAY_NOTE_ARRAY(tone_startup, false, 0);
}
if (IS_LAYER_ON(_MUSIC)) { void shutdown_user()
if (record->event.pressed) { {
play_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF); PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
} else { _delay_ms(150);
stop_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); stop_all_notes();
} }
}
void music_on_user(void)
{
music_scale_user();
} }
void play_goodbye_tone() void music_scale_user(void)
{ {
PLAY_NOTE_ARRAY(goodbye, false, 0); PLAY_NOTE_ARRAY(music_scale, false, 0);
_delay_ms(150);
} }
#endif #endif

@ -0,0 +1,21 @@
# 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 = no # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = 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
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

@ -0,0 +1,12 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
// place overrides here
#ifdef BACKLIGHT_ENABLE
#define BACKLIGHT_PIN B2
#define BACKLIGHT_LEVELS 7
#endif
#endif

@ -0,0 +1,138 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
//Author: tong92 <tong92power@gmail.com>
#include "tv44.h"
#include "action_layer.h"
#include "eeconfig.h"
#ifdef BACKLIGHT_ENABLE
#include "backlight.h"
#endif
// Fillers to make layering more clear
#define _______ KC_TRNS
#define LOWER F(1)
#define RAISE F(2)
#define FTN MO(4)
#define MOUSE M(10)
#define GO_DEFT M(99)
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,--------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* | Ctrl | A | S | D | F | G | H | J | K | L | ; | Enter|
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* | Shift | Z | X | C | V | B | N | M | , | . | / |Shift|
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* | Ftn1 | GUI | Alt | Space/LOWER | Space/RAISE | ' | [ | ] | Alt |
* `--------------------------------------------------------------------------'
*/
[0] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_LCTL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_ENT},
{KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT,KC_SLSH,KC_RSFT },
{FTN ,KC_LGUI,KC_LALT,LOWER,XXXXXXX,XXXXXXX,XXXXXXX,RAISE,KC_QUOT,KC_LBRC,KC_RBRC,KC_RALT}
},
/* LOWER
* ,--------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* | | F1 | F2 | F3 | F4 | F5 | F6 | - | + | [ | ] | \ |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | HOME| PgUp| UP | PgDo|
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* | | | | | | END | LEFT| Down|RIGHT|
* `--------------------------------------------------------------------------'
*/
[1] = {
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______},
{_______,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS,KC_PLUS,KC_LBRC,KC_RBRC,KC_BSLS },
{_______,KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX,KC_HOME,KC_PGUP,KC_UP ,KC_PGDN },
{XXXXXXX,_______,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,KC_END, KC_LEFT,KC_DOWN,KC_RIGHT}
},
/* RAISE
* ,--------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* | | F1 | F2 | F3 | F4 | F5 | F6 | _ | = | { | } | | |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | HOME| PgUp| UP | PgDo|
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* | | | | | | END | LEFT| Down|RIGHT|
* `--------------------------------------------------------------------------'
*/
[2] ={
{KC_TILD,KC_EXLM,KC_AT, KC_HASH,KC_DLR, KC_PERC,KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,_______ },
{_______,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS,KC_EQL, KC_LCBR,KC_RCBR,KC_PIPE },
{_______,KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______,KC_HOME,KC_PGUP,KC_UP ,KC_PGDN },
{XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,_______,KC_END, KC_LEFT,KC_DOWN,KC_RIGHT}
},
/* FTN
* ,--------------------------------------------------------------------------.
* | ESC |WinOf|WinUp| | |Sh+Ca| | PgUp| UP | PgDo|PrtSc| DELET |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* | |WinLe|WinDo|WinRi| |Al+Ca|CapsL| LEFT| DOWN|RIGHT| | |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* | |WinLW|WinRW| | |Ct+Ca|ScroL| HOME| | END | | Ctrl|
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* | | DeskL | DeskR| Task Manager| DeskX | MOUSE| | | LED |
* `--------------------------------------------------------------------------'
*/
[4] = {
{KC_ESC ,LALT(KC_F4) ,LGUI(KC_UP) ,XXXXXXX ,XXXXXXX ,S(KC_CAPS) ,XXXXXXX,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR,KC_DELT},
{_______,LGUI(KC_LEFT) ,LGUI(KC_DOWN) ,LGUI(KC_RIGHT) ,XXXXXXX ,LALT(KC_CAPS),KC_CAPS,KC_LEFT,KC_DOWN,KC_RIGHT,XXXXXXX,XXXXXXX},
{_______,LGUI(LSFT(KC_LEFT)),LGUI(LSFT(KC_RIGHT)),XXXXXXX ,XXXXXXX ,LCTL(KC_CAPS),KC_SLCK,KC_HOME,XXXXXXX,KC_END,XXXXXXX,KC_RCTL},
{_______,LGUI(LCTL(KC_LEFT)),LGUI(LCTL(KC_RIGHT)),LCTL(LALT(KC_DELT)),XXXXXXX,XXXXXXX,XXXXXXX,LGUI(LCTL(KC_F4)),MOUSE,XXXXXXX,XXXXXXX,M(0)}
},
/* MOUSE
* ,--------------------------------------------------------------------------.
* | | | |Mo_Up| | | |M_WhL|M_WhU|M_WhR| | RESET |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* | | |Mo_Le|Mo_Do|Mo_Ri| | |M_Bt1|M_WhD|M_Bt2| | |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* | | | | | | | |M_AC0|M_AC1|M_AC2| | |
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* | | | | GO_DEFAULT | GO_DEFAULT | | | | |
* `--------------------------------------------------------------------------'
*/
[10] ={
{XXXXXXX,XXXXXXX,XXXXXXX,KC_MS_U,XXXXXXX,XXXXXXX,XXXXXXX,KC_WH_L,KC_WH_U,KC_WH_R,XXXXXXX,RESET},
{XXXXXXX,XXXXXXX,KC_MS_L,KC_MS_D,KC_MS_R,XXXXXXX,XXXXXXX,KC_BTN1,KC_WH_D,KC_BTN2,XXXXXXX,XXXXXXX},
{XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,KC_ACL0,KC_ACL1,KC_ACL2,XXXXXXX,XXXXXXX},
{XXXXXXX,XXXXXXX,XXXXXXX,GO_DEFT,XXXXXXX,XXXXXXX,XXXXXXX,GO_DEFT,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX}
}
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TAP_KEY(1, KC_SPC),
[2] = ACTION_LAYER_TAP_KEY(2, KC_SPC)
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
case 0:
if (record->event.pressed) {
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
}
break;
case 10:
if (record->event.pressed) {
layer_on(10);
}
break;
case 99:
if (record->event.pressed) {
layer_off(10);
layer_off(4);
}
break;
}
return MACRO_NONE;
};

@ -0,0 +1,52 @@
# The tong92's keymap for tv44
- Arrow Layout (45key)
- my keymap for Window User
- Mouse Layer : space -> Default Layer
## Qwerty
,--------------------------------------------------------------------------.
| Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
|------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
| Ctrl | A | S | D | F | G | H | J | K | L | ; | Enter|
|-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
| Shift | Z | X | C | V | B | N | M | , | . | / |Shift|
|--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
| Ftn1 | GUI | Alt | Space/LOWER | Space/RAISE | ' | [ | ] | Alt |
`--------------------------------------------------------------------------'
## RAISE
,--------------------------------------------------------------------------.
| ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | |
|------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
| | F1 | F2 | F3 | F4 | F5 | F6 | _ | = | { | } | | |
|-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
| | F7 | F8 | F9 | F10 | F11 | F12 | | HOME| PgUp| UP | PgDo|
|--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
| | | | | | END | LEFT| Down|RIGHT|
`--------------------------------------------------------------------------'
## FTN
,--------------------------------------------------------------------------.
| ESC |WinOf|WinUp| | |Sh+Ca| | PgUp| UP | PgDo|PrtSc| DELET |
|------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
| |WinLe|WinDo|WinRi| |Al+Ca|CapsL| LEFT| DOWN|RIGHT| | |
|-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
| |WinLW|WinRW| | |Ct+Ca|ScroL| HOME| | END | | Ctrl|
|--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
| | DeskL | DeskR| Task Manager| DeskX | MOUSE| | | LED |
`--------------------------------------------------------------------------'
## MOUSE
,--------------------------------------------------------------------------.
| | | |Mo_Up| | | |M_WhL|M_WhU|M_WhR| | RESET |
|------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
| | |Mo_Le|Mo_Do|Mo_Ri| | |M_Bt1|M_WhD|M_Bt2| | |
|-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
| | | | | | | |M_AC0|M_AC1|M_AC2| | |
|--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
| | | | GO_DEFAULT | GO_DEFAULT | | | | |
`--------------------------------------------------------------------------'

@ -22,38 +22,38 @@ extern keymap_config_t keymap_config;
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_DV] = { /* 0: Dvorak */ [_DV] = { /* 0: Dvorak */
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC }, {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH },
{MO(_L1), KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT }, {MO(_L1), KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, LT(_L2, KC_MINS)},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT }, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT },
{KC_LCTL, KC_LALT, KC_LGUI, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, KC_SLSH, KC_MINS, XXXXXXX, MO(_L2) } {KC_LCTL, KC_LALT, KC_LGUI, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, KC_BSLS, KC_EQL, XXXXXXX, KC_ENT }
}, },
[_QW] = { /* 1: Qwerty */ [_QW] = { /* 1: Qwerty */
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC }, {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC },
{MO(_L1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT }, {MO(_L1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, LT(_L2, KC_QUOT)},
{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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT },
{KC_LCTL, KC_LALT, KC_LGUI, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, KC_SLSH, KC_MINS, XXXXXXX, MO(_L2) } {KC_LCTL, KC_LALT, KC_LGUI, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, KC_SLSH, KC_MINS, XXXXXXX, KC_ENT }
}, },
[_CM] = { /* 2: Colemak */ [_CM] = { /* 2: Colemak */
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC }, {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC },
{MO(_L1), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT }, {MO(_L1), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, LT(_L2, KC_QUOT)},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT }, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT },
{KC_LCTL, KC_LALT, KC_LGUI, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, KC_SLSH, KC_MINS, XXXXXXX, MO(_L2) } {KC_LCTL, KC_LALT, KC_LGUI, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, KC_SLSH, KC_MINS, XXXXXXX, KC_ENT }
}, },
[_L1] = {/* 1: FN 1 */ [_L1] = {/* 1: FN 1 */
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL }, {KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL },
{_______, KC_BSLS, KC_QUOT, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_DOWN, KC_UP, KC_LEFT, KC_RGHT, _______ }, {_______, KC_BSLS, KC_QUOT, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_DOWN, KC_UP, KC_LEFT, KC_RGHT, _______ },
{_______, _______, _______, KC_PSCR, _______, _______, _______, KC_MSTP, KC_MPLY, KC_MPRV, KC_MNXT, KC_RSFT }, {_______, _______, _______, KC_PSCR, _______, _______, _______, KC_MSTP, KC_MPLY, KC_MPRV, KC_MNXT, KC_RSFT },
{KC_ESC, KC_LGUI, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, KC_SLSH, _______, _______ } {KC_ESC, KC_LGUI, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, KC_EQL, _______, _______ }
}, },
[_L2] = { /* 2: FN 2 */ [_L2] = { /* 2: FN 2 */
{KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_ESC }, {KC_TILD, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_ESC },
{_______, KC_F11, KC_F12, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_VOLU, KC_ENT }, {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_HOME, KC_PGUP, KC_VOLU, _______ },
{_______, _______, _______, _______, _______, _______, _______, _______, KC_END, KC_PGDN, KC_VOLD, _______ }, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_END, KC_PGDN, KC_VOLD, _______ },
{QWERTY, DVORAK, COLEMAK, _______, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, _______ } {QWERTY, DVORAK, COLEMAK, _______, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, KC_PLUS, _______, _______ }
} }
}; };

@ -5,8 +5,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// 0: Base Layer // 0: Base Layer
KEYMAP( KEYMAP(
KC_ESC, 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_BSLS, KC_GRV, \ KC_ESC, 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_GRV, \
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_BSPC, \ 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_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \ 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_NO, KC_ENT, \
KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL, \ KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL, \
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RGUI, F(0), KC_LEFT, KC_DOWN, KC_RIGHT), KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RGUI, F(0), KC_LEFT, KC_DOWN, KC_RIGHT),

@ -0,0 +1,71 @@
/*
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/>.
*/
#include "led_tables.h"
#ifdef USE_CIE1931_CURVE
// Lightness curve using the CIE 1931 lightness formula
//Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm
const uint8_t CIE1931_CURVE[] PROGMEM = {
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 4, 5, 5, 5,
5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
7, 8, 8, 8, 8, 9, 9, 9, 10, 10,
10, 10, 11, 11, 11, 12, 12, 12, 13, 13,
13, 14, 14, 15, 15, 15, 16, 16, 17, 17,
17, 18, 18, 19, 19, 20, 20, 21, 21, 22,
22, 23, 23, 24, 24, 25, 25, 26, 26, 27,
28, 28, 29, 29, 30, 31, 31, 32, 32, 33,
34, 34, 35, 36, 37, 37, 38, 39, 39, 40,
41, 42, 43, 43, 44, 45, 46, 47, 47, 48,
49, 50, 51, 52, 53, 54, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, 70, 71, 72, 73, 74, 75, 76, 77, 79,
80, 81, 82, 83, 85, 86, 87, 88, 90, 91,
92, 94, 95, 96, 98, 99, 100, 102, 103, 105,
106, 108, 109, 110, 112, 113, 115, 116, 118, 120,
121, 123, 124, 126, 128, 129, 131, 132, 134, 136,
138, 139, 141, 143, 145, 146, 148, 150, 152, 154,
155, 157, 159, 161, 163, 165, 167, 169, 171, 173,
175, 177, 179, 181, 183, 185, 187, 189, 191, 193,
196, 198, 200, 202, 204, 207, 209, 211, 214, 216,
218, 220, 223, 225, 228, 230, 232, 235, 237, 240,
242, 245, 247, 250, 252, 255,
};
#endif
#ifdef USE_LED_BREATHING_TABLE
const uint8_t LED_BREATHING_TABLE[] PROGMEM = {
0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9,
10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35,
37, 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76,
79, 82, 85, 88, 90, 93, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124,
127, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 162, 165, 167, 170, 173,
176, 179, 182, 185, 188, 190, 193, 196, 198, 201, 203, 206, 208, 211, 213, 215,
218, 220, 222, 224, 226, 228, 230, 232, 234, 235, 237, 238, 240, 241, 243, 244,
245, 246, 248, 249, 250, 250, 251, 252, 253, 253, 254, 254, 254, 255, 255, 255,
255, 255, 255, 255, 254, 254, 254, 253, 253, 252, 251, 250, 250, 249, 248, 246,
245, 244, 243, 241, 240, 238, 237, 235, 234, 232, 230, 228, 226, 224, 222, 220,
218, 215, 213, 211, 208, 206, 203, 201, 198, 196, 193, 190, 188, 185, 182, 179,
176, 173, 170, 167, 165, 162, 158, 155, 152, 149, 146, 143, 140, 137, 134, 131,
128, 124, 121, 118, 115, 112, 109, 106, 103, 100, 97, 93, 90, 88, 85, 82,
79, 76, 73, 70, 67, 65, 62, 59, 57, 54, 52, 49, 47, 44, 42, 40,
37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11,
10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0
};
#endif

@ -0,0 +1,30 @@
/*
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 LED_TABLES_H
#define LED_TABLES_H
#include "progmem.h"
#include <stdint.h>
#ifdef USE_CIE1931_CURVE
extern const uint8_t CIE1931_CURVE[] PROGMEM;
#endif
#ifdef USE_LED_BREATHING_TABLE
extern const uint8_t LED_BREATHING_TABLE[] PROGMEM;
#endif
#endif

@ -135,7 +135,7 @@ void reset_keyboard(void) {
#endif #endif
static bool shift_interrupted[2] = {0, 0}; static bool shift_interrupted[2] = {0, 0};
static uint16_t scs_timer = 0; static uint16_t scs_timer[2] = {0, 0};
bool process_record_quantum(keyrecord_t *record) { bool process_record_quantum(keyrecord_t *record) {
@ -395,7 +395,7 @@ bool process_record_quantum(keyrecord_t *record) {
case KC_LSPO: { case KC_LSPO: {
if (record->event.pressed) { if (record->event.pressed) {
shift_interrupted[0] = false; shift_interrupted[0] = false;
scs_timer = timer_read (); scs_timer[0] = timer_read ();
register_mods(MOD_BIT(KC_LSFT)); register_mods(MOD_BIT(KC_LSFT));
} }
else { else {
@ -405,7 +405,7 @@ bool process_record_quantum(keyrecord_t *record) {
shift_interrupted[1] = true; shift_interrupted[1] = true;
} }
#endif #endif
if (!shift_interrupted[0] && timer_elapsed(scs_timer) < TAPPING_TERM) { if (!shift_interrupted[0] && timer_elapsed(scs_timer[0]) < TAPPING_TERM) {
register_code(LSPO_KEY); register_code(LSPO_KEY);
unregister_code(LSPO_KEY); unregister_code(LSPO_KEY);
} }
@ -418,7 +418,7 @@ bool process_record_quantum(keyrecord_t *record) {
case KC_RSPC: { case KC_RSPC: {
if (record->event.pressed) { if (record->event.pressed) {
shift_interrupted[1] = false; shift_interrupted[1] = false;
scs_timer = timer_read (); scs_timer[1] = timer_read ();
register_mods(MOD_BIT(KC_RSFT)); register_mods(MOD_BIT(KC_RSFT));
} }
else { else {
@ -428,7 +428,7 @@ bool process_record_quantum(keyrecord_t *record) {
shift_interrupted[1] = true; shift_interrupted[1] = true;
} }
#endif #endif
if (!shift_interrupted[1] && timer_elapsed(scs_timer) < TAPPING_TERM) { if (!shift_interrupted[1] && timer_elapsed(scs_timer[1]) < TAPPING_TERM) {
register_code(RSPC_KEY); register_code(RSPC_KEY);
unregister_code(RSPC_KEY); unregister_code(RSPC_KEY);
} }

@ -20,56 +20,8 @@
#include "timer.h" #include "timer.h"
#include "rgblight.h" #include "rgblight.h"
#include "debug.h" #include "debug.h"
#include "led_tables.h"
// Lightness curve using the CIE 1931 lightness formula
//Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm
const uint8_t DIM_CURVE[] PROGMEM = {
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 4, 5, 5, 5,
5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
7, 8, 8, 8, 8, 9, 9, 9, 10, 10,
10, 10, 11, 11, 11, 12, 12, 12, 13, 13,
13, 14, 14, 15, 15, 15, 16, 16, 17, 17,
17, 18, 18, 19, 19, 20, 20, 21, 21, 22,
22, 23, 23, 24, 24, 25, 25, 26, 26, 27,
28, 28, 29, 29, 30, 31, 31, 32, 32, 33,
34, 34, 35, 36, 37, 37, 38, 39, 39, 40,
41, 42, 43, 43, 44, 45, 46, 47, 47, 48,
49, 50, 51, 52, 53, 54, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, 70, 71, 72, 73, 74, 75, 76, 77, 79,
80, 81, 82, 83, 85, 86, 87, 88, 90, 91,
92, 94, 95, 96, 98, 99, 100, 102, 103, 105,
106, 108, 109, 110, 112, 113, 115, 116, 118, 120,
121, 123, 124, 126, 128, 129, 131, 132, 134, 136,
138, 139, 141, 143, 145, 146, 148, 150, 152, 154,
155, 157, 159, 161, 163, 165, 167, 169, 171, 173,
175, 177, 179, 181, 183, 185, 187, 189, 191, 193,
196, 198, 200, 202, 204, 207, 209, 211, 214, 216,
218, 220, 223, 225, 228, 230, 232, 235, 237, 240,
242, 245, 247, 250, 252, 255,
};
const uint8_t RGBLED_BREATHING_TABLE[] PROGMEM = {
0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9,
10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35,
37, 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76,
79, 82, 85, 88, 90, 93, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124,
127, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 162, 165, 167, 170, 173,
176, 179, 182, 185, 188, 190, 193, 196, 198, 201, 203, 206, 208, 211, 213, 215,
218, 220, 222, 224, 226, 228, 230, 232, 234, 235, 237, 238, 240, 241, 243, 244,
245, 246, 248, 249, 250, 250, 251, 252, 253, 253, 254, 254, 254, 255, 255, 255,
255, 255, 255, 255, 254, 254, 254, 253, 253, 252, 251, 250, 250, 249, 248, 246,
245, 244, 243, 241, 240, 238, 237, 235, 234, 232, 230, 228, 226, 224, 222, 220,
218, 215, 213, 211, 208, 206, 203, 201, 198, 196, 193, 190, 188, 185, 182, 179,
176, 173, 170, 167, 165, 162, 158, 155, 152, 149, 146, 143, 140, 137, 134, 131,
128, 124, 121, 118, 115, 112, 109, 106, 103, 100, 97, 93, 90, 88, 85, 82,
79, 76, 73, 70, 67, 65, 62, 59, 57, 54, 52, 49, 47, 44, 42, 40,
37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11,
10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0
};
__attribute__ ((weak)) __attribute__ ((weak))
const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
@ -135,9 +87,9 @@ void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
break; break;
} }
} }
r = pgm_read_byte(&DIM_CURVE[r]); r = pgm_read_byte(&CIE1931_CURVE[r]);
g = pgm_read_byte(&DIM_CURVE[g]); g = pgm_read_byte(&CIE1931_CURVE[g]);
b = pgm_read_byte(&DIM_CURVE[b]); b = pgm_read_byte(&CIE1931_CURVE[b]);
setrgb(r, g, b, led1); setrgb(r, g, b, led1);
} }
@ -509,7 +461,7 @@ void rgblight_effect_breathing(uint8_t interval) {
} }
last_timer = timer_read(); last_timer = timer_read();
rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, pgm_read_byte(&RGBLED_BREATHING_TABLE[pos])); rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, pgm_read_byte(&LED_BREATHING_TABLE[pos]));
pos = (pos + 1) % 256; pos = (pos + 1) % 256;
} }
void rgblight_effect_rainbow_mood(uint8_t interval) { void rgblight_effect_rainbow_mood(uint8_t interval) {

@ -212,7 +212,7 @@ void serial_link_update(void) {
systime_t current_time = chVTGetSystemTimeX(); systime_t current_time = chVTGetSystemTimeX();
systime_t delta = current_time - last_update; systime_t delta = current_time - last_update;
if (changed || delta > US2ST(1000)) { if (changed || delta > US2ST(5000)) {
last_update = current_time; last_update = current_time;
last_matrix = matrix; last_matrix = matrix;
matrix_object_t* m = begin_write_keyboard_matrix(); matrix_object_t* m = begin_write_keyboard_matrix();

@ -1,36 +0,0 @@
/*
The MIT License (MIT)
Copyright (c) 2016 Fred Sundvik
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "keyboard.h"
#include "action_layer.h"
#include "visualizer.h"
#include "host.h"
void post_keyboard_init(void) {
visualizer_init();
}
void post_keyboard_task() {
visualizer_set_state(default_layer_state, layer_state, host_keyboard_leds());
}

@ -1,325 +0,0 @@
/**
* This file has a different license to the rest of the uGFX system.
* You can copy, modify and distribute this file as you see fit.
* You do not need to publish your source modifications to this file.
* The only thing you are not permitted to do is to relicense it
* under a different license.
*/
/**
* Copy this file into your project directory and rename it as gfxconf.h
* Edit your copy to turn on the uGFX features you want to use.
* The values below are the defaults.
*
* Only remove the comments from lines where you want to change the
* default value. This allows definitions to be included from
* driver makefiles when required and provides the best future
* compatibility for your project.
*
* Please use spaces instead of tabs in this file.
*/
#ifndef _GFXCONF_H
#define _GFXCONF_H
///////////////////////////////////////////////////////////////////////////
// GOS - One of these must be defined, preferably in your Makefile //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_OS_CHIBIOS TRUE
//#define GFX_USE_OS_FREERTOS FALSE
// #define GFX_FREERTOS_USE_TRACE FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
//#define GFX_USE_OS_OSX FALSE
//#define GFX_USE_OS_ECOS FALSE
//#define GFX_USE_OS_RAWRTOS FALSE
//#define GFX_USE_OS_ARDUINO FALSE
//#define GFX_USE_OS_KEIL FALSE
//#define GFX_USE_OS_CMSIS FALSE
//#define GFX_USE_OS_RAW32 FALSE
// #define INTERRUPTS_OFF() optional_code
// #define INTERRUPTS_ON() optional_code
// These are not defined by default for some reason
#define GOS_NEED_X_THREADS FALSE
#define GOS_NEED_X_HEAP FALSE
// Options that (should where relevant) apply to all operating systems
#define GFX_NO_INLINE FALSE
// #define GFX_COMPILER GFX_COMPILER_UNKNOWN
// #define GFX_CPU GFX_CPU_UNKNOWN
// #define GFX_OS_HEAP_SIZE 0
// #define GFX_OS_NO_INIT FALSE
// #define GFX_OS_INIT_NO_WARNING FALSE
// #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine
// #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine
// #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine
///////////////////////////////////////////////////////////////////////////
// GDISP //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GDISP TRUE
//#define GDISP_NEED_AUTOFLUSH FALSE
//#define GDISP_NEED_TIMERFLUSH FALSE
//#define GDISP_NEED_VALIDATION TRUE
//#define GDISP_NEED_CLIP TRUE
//#define GDISP_NEED_CIRCLE FALSE
//#define GDISP_NEED_ELLIPSE FALSE
//#define GDISP_NEED_ARC FALSE
//#define GDISP_NEED_ARCSECTORS FALSE
//#define GDISP_NEED_CONVEX_POLYGON FALSE
//#define GDISP_NEED_SCROLL FALSE
//#define GDISP_NEED_PIXELREAD FALSE
//#define GDISP_NEED_CONTROL FALSE
//#define GDISP_NEED_QUERY FALSE
//#define GDISP_NEED_MULTITHREAD FALSE
//#define GDISP_NEED_STREAMING FALSE
#define GDISP_NEED_TEXT TRUE
// #define GDISP_NEED_TEXT_WORDWRAP FALSE
// #define GDISP_NEED_ANTIALIAS FALSE
// #define GDISP_NEED_UTF8 FALSE
#define GDISP_NEED_TEXT_KERNING TRUE
// #define GDISP_INCLUDE_FONT_UI1 FALSE
// #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font.
// #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE
// #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE
// #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE
#define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
// #define GDISP_INCLUDE_USER_FONTS FALSE
//#define GDISP_NEED_IMAGE FALSE
// #define GDISP_NEED_IMAGE_NATIVE FALSE
// #define GDISP_NEED_IMAGE_GIF FALSE
// #define GDISP_NEED_IMAGE_BMP FALSE
// #define GDISP_NEED_IMAGE_BMP_1 FALSE
// #define GDISP_NEED_IMAGE_BMP_4 FALSE
// #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE
// #define GDISP_NEED_IMAGE_BMP_8 FALSE
// #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE
// #define GDISP_NEED_IMAGE_BMP_16 FALSE
// #define GDISP_NEED_IMAGE_BMP_24 FALSE
// #define GDISP_NEED_IMAGE_BMP_32 FALSE
// #define GDISP_NEED_IMAGE_JPG FALSE
// #define GDISP_NEED_IMAGE_PNG FALSE
// #define GDISP_NEED_IMAGE_ACCOUNTING FALSE
//#define GDISP_NEED_PIXMAP FALSE
// #define GDISP_NEED_PIXMAP_IMAGE FALSE
//#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE // If not defined the native hardware orientation is used.
//#define GDISP_LINEBUF_SIZE 128
//#define GDISP_STARTUP_COLOR Black
#define GDISP_NEED_STARTUP_LOGO FALSE
//#define GDISP_TOTAL_DISPLAYS 1
//#define GDISP_DRIVER_LIST GDISPVMT_Win32, GDISPVMT_Win32
// #ifdef GDISP_DRIVER_LIST
// // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability
// #define GDISP_HARDWARE_STREAM_WRITE FALSE
// #define GDISP_HARDWARE_STREAM_READ FALSE
// #define GDISP_HARDWARE_STREAM_POS FALSE
// #define GDISP_HARDWARE_DRAWPIXEL FALSE
// #define GDISP_HARDWARE_CLEARS FALSE
// #define GDISP_HARDWARE_FILLS FALSE
// #define GDISP_HARDWARE_BITFILLS FALSE
// #define GDISP_HARDWARE_SCROLL FALSE
// #define GDISP_HARDWARE_PIXELREAD FALSE
// #define GDISP_HARDWARE_CONTROL FALSE
// #define GDISP_HARDWARE_QUERY FALSE
// #define GDISP_HARDWARE_CLIP FALSE
#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
// #endif
// The custom format is not defined for some reason, so define it as error
// so we don't get compiler warnings
#define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR
#define GDISP_USE_GFXNET FALSE
// #define GDISP_GFXNET_PORT 13001
// #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE
// #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE
// #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE
///////////////////////////////////////////////////////////////////////////
// GWIN //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GWIN FALSE
//#define GWIN_NEED_WINDOWMANAGER FALSE
// #define GWIN_REDRAW_IMMEDIATE FALSE
// #define GWIN_REDRAW_SINGLEOP FALSE
// #define GWIN_NEED_FLASHING FALSE
// #define GWIN_FLASHING_PERIOD 250
//#define GWIN_NEED_CONSOLE FALSE
// #define GWIN_CONSOLE_USE_HISTORY FALSE
// #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE
// #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE
// #define GWIN_CONSOLE_ESCSEQ FALSE
// #define GWIN_CONSOLE_USE_BASESTREAM FALSE
// #define GWIN_CONSOLE_USE_FLOAT FALSE
//#define GWIN_NEED_GRAPH FALSE
//#define GWIN_NEED_GL3D FALSE
//#define GWIN_NEED_WIDGET FALSE
//#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1
// #define GWIN_NEED_LABEL FALSE
// #define GWIN_LABEL_ATTRIBUTE FALSE
// #define GWIN_NEED_BUTTON FALSE
// #define GWIN_BUTTON_LAZY_RELEASE FALSE
// #define GWIN_NEED_SLIDER FALSE
// #define GWIN_SLIDER_NOSNAP FALSE
// #define GWIN_SLIDER_DEAD_BAND 5
// #define GWIN_SLIDER_TOGGLE_INC 20
// #define GWIN_NEED_CHECKBOX FALSE
// #define GWIN_NEED_IMAGE FALSE
// #define GWIN_NEED_IMAGE_ANIMATION FALSE
// #define GWIN_NEED_RADIO FALSE
// #define GWIN_NEED_LIST FALSE
// #define GWIN_NEED_LIST_IMAGES FALSE
// #define GWIN_NEED_PROGRESSBAR FALSE
// #define GWIN_PROGRESSBAR_AUTO FALSE
// #define GWIN_NEED_KEYBOARD FALSE
// #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1
// #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE
// #define GWIN_NEED_TEXTEDIT FALSE
// #define GWIN_FLAT_STYLING FALSE
// #define GWIN_WIDGET_TAGS FALSE
//#define GWIN_NEED_CONTAINERS FALSE
// #define GWIN_NEED_CONTAINER FALSE
// #define GWIN_NEED_FRAME FALSE
// #define GWIN_NEED_TABSET FALSE
// #define GWIN_TABSET_TABHEIGHT 18
///////////////////////////////////////////////////////////////////////////
// GEVENT //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GEVENT FALSE
//#define GEVENT_ASSERT_NO_RESOURCE FALSE
//#define GEVENT_MAXIMUM_SIZE 32
//#define GEVENT_MAX_SOURCE_LISTENERS 32
///////////////////////////////////////////////////////////////////////////
// GTIMER //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GTIMER FALSE
//#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
//#define GTIMER_THREAD_WORKAREA_SIZE 2048
///////////////////////////////////////////////////////////////////////////
// GQUEUE //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GQUEUE FALSE
//#define GQUEUE_NEED_ASYNC FALSE
//#define GQUEUE_NEED_GSYNC FALSE
//#define GQUEUE_NEED_FSYNC FALSE
//#define GQUEUE_NEED_BUFFERS FALSE
///////////////////////////////////////////////////////////////////////////
// GINPUT //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GINPUT FALSE
//#define GINPUT_NEED_MOUSE FALSE
// #define GINPUT_TOUCH_STARTRAW FALSE
// #define GINPUT_TOUCH_NOTOUCH FALSE
// #define GINPUT_TOUCH_NOCALIBRATE FALSE
// #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE
// #define GINPUT_MOUSE_POLL_PERIOD 25
// #define GINPUT_MOUSE_CLICK_TIME 300
// #define GINPUT_TOUCH_CXTCLICK_TIME 700
// #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE
// #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE
// #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32
//#define GINPUT_NEED_KEYBOARD FALSE
// #define GINPUT_KEYBOARD_POLL_PERIOD 200
// #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32
// #define GKEYBOARD_LAYOUT_OFF FALSE
// #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE
//#define GINPUT_NEED_TOGGLE FALSE
//#define GINPUT_NEED_DIAL FALSE
///////////////////////////////////////////////////////////////////////////
// GFILE //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GFILE FALSE
//#define GFILE_NEED_PRINTG FALSE
//#define GFILE_NEED_SCANG FALSE
//#define GFILE_NEED_STRINGS FALSE
//#define GFILE_NEED_FILELISTS FALSE
//#define GFILE_NEED_STDIO FALSE
//#define GFILE_NEED_NOAUTOMOUNT FALSE
//#define GFILE_NEED_NOAUTOSYNC FALSE
//#define GFILE_NEED_MEMFS FALSE
//#define GFILE_NEED_ROMFS FALSE
//#define GFILE_NEED_RAMFS FALSE
//#define GFILE_NEED_FATFS FALSE
//#define GFILE_NEED_NATIVEFS FALSE
//#define GFILE_NEED_CHBIOSFS FALSE
//#define GFILE_ALLOW_FLOATS FALSE
//#define GFILE_ALLOW_DEVICESPECIFIC FALSE
//#define GFILE_MAX_GFILES 3
///////////////////////////////////////////////////////////////////////////
// GADC //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GADC FALSE
//#define GADC_MAX_LOWSPEED_DEVICES 4
///////////////////////////////////////////////////////////////////////////
// GAUDIO //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GAUDIO FALSE
// There seems to be a bug in the ugfx code, the wrong define is used
// So define it in order to avoid warnings
#define GFX_USE_GAUDIN GFX_USE_GAUDIO
// #define GAUDIO_NEED_PLAY FALSE
// #define GAUDIO_NEED_RECORD FALSE
///////////////////////////////////////////////////////////////////////////
// GMISC //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GMISC FALSE
//#define GMISC_NEED_ARRAYOPS FALSE
//#define GMISC_NEED_FASTTRIG FALSE
//#define GMISC_NEED_FIXEDTRIG FALSE
//#define GMISC_NEED_INVSQRT FALSE
// #define GMISC_INVSQRT_MIXED_ENDIAN FALSE
// #define GMISC_INVSQRT_REAL_SLOW FALSE
//#define GMISC_NEED_MATRIXFLOAT2D FALSE
//#define GMISC_NEED_MATRIXFIXED2D FALSE
#endif /* _GFXCONF_H */

@ -1,91 +0,0 @@
/*
The MIT License (MIT)
Copyright (c) 2016 Fred Sundvik
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "lcd_backlight.h"
#include "hal.h"
#define RED_PIN 1
#define GREEN_PIN 2
#define BLUE_PIN 3
#define CHANNEL_RED FTM0->CHANNEL[0]
#define CHANNEL_GREEN FTM0->CHANNEL[1]
#define CHANNEL_BLUE FTM0->CHANNEL[2]
#define RGB_PORT PORTC
#define RGB_PORT_GPIO GPIOC
// Base FTM clock selection (72 MHz system clock)
// @ 0xFFFF period, 72 MHz / (0xFFFF * 2) = Actual period
// Higher pre-scalar will use the most power (also look the best)
// Pre-scalar calculations
// 0 - 72 MHz -> 549 Hz
// 1 - 36 MHz -> 275 Hz
// 2 - 18 MHz -> 137 Hz
// 3 - 9 MHz -> 69 Hz (Slightly visible flicker)
// 4 - 4 500 kHz -> 34 Hz (Visible flickering)
// 5 - 2 250 kHz -> 17 Hz
// 6 - 1 125 kHz -> 9 Hz
// 7 - 562 500 Hz -> 4 Hz
// Using a higher pre-scalar without flicker is possible but FTM0_MOD will need to be reduced
// Which will reduce the brightness range
#define PRESCALAR_DEFINE 0
void lcd_backlight_hal_init(void) {
// Setup Backlight
SIM->SCGC6 |= SIM_SCGC6_FTM0;
FTM0->CNT = 0; // Reset counter
// PWM Period
// 16-bit maximum
FTM0->MOD = 0xFFFF;
// Set FTM to PWM output - Edge Aligned, Low-true pulses
#define CNSC_MODE FTM_SC_CPWMS | FTM_SC_PS(4) | FTM_SC_CLKS(0)
CHANNEL_RED.CnSC = CNSC_MODE;
CHANNEL_GREEN.CnSC = CNSC_MODE;
CHANNEL_BLUE.CnSC = CNSC_MODE;
// System clock, /w prescalar setting
FTM0->SC = FTM_SC_CLKS(1) | FTM_SC_PS(PRESCALAR_DEFINE);
CHANNEL_RED.CnV = 0;
CHANNEL_GREEN.CnV = 0;
CHANNEL_BLUE.CnV = 0;
RGB_PORT_GPIO->PDDR |= (1 << RED_PIN);
RGB_PORT_GPIO->PDDR |= (1 << GREEN_PIN);
RGB_PORT_GPIO->PDDR |= (1 << BLUE_PIN);
#define RGB_MODE PORTx_PCRn_SRE | PORTx_PCRn_DSE | PORTx_PCRn_MUX(4)
RGB_PORT->PCR[RED_PIN] = RGB_MODE;
RGB_PORT->PCR[GREEN_PIN] = RGB_MODE;
RGB_PORT->PCR[BLUE_PIN] = RGB_MODE;
}
void lcd_backlight_hal_color(uint16_t r, uint16_t g, uint16_t b) {
CHANNEL_RED.CnV = r;
CHANNEL_GREEN.CnV = g;
CHANNEL_BLUE.CnV = b;
}

@ -1,121 +0,0 @@
/*
The MIT License (MIT)
Copyright (c) 2016 Fred Sundvik
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// 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"
static const char* welcome_text[] = {"TMK", "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, MS2ST(1000), MS2ST(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 = {MS2ST(200), MS2ST(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 = {MS2ST(2000), MS2ST(2000)},
.frame_functions = {keyframe_display_layer_text, keyframe_display_layer_bitmap},
};
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);
}
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 & 0x2) {
state->target_lcd_color = LCD_COLOR(0xA0, 0xB0, 0xFF);
state->layer_text = "Layer 2";
}
else {
state->target_lcd_color = LCD_COLOR(0x50, 0xB0, 0xFF);
state->layer_text = "Layer 1";
}
// 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.
start_keyframe_animation(&lcd_animation);
start_keyframe_animation(&color_animation);
}

@ -25,10 +25,10 @@ SOFTWARE.
#include "lcd_backlight.h" #include "lcd_backlight.h"
#include <math.h> #include <math.h>
static uint8_t current_hue = 0x00; static uint8_t current_hue = 0;
static uint8_t current_saturation = 0x00; static uint8_t current_saturation = 0;
static uint8_t current_intensity = 0xFF; static uint8_t current_intensity = 0;
static uint8_t current_brightness = 0x7F; static uint8_t current_brightness = 0;
void lcd_backlight_init(void) { void lcd_backlight_init(void) {
lcd_backlight_hal_init(); lcd_backlight_hal_init();

@ -32,6 +32,10 @@ SOFTWARE.
#define LCD_SAT(color) ((color >> 8) & 0xFF) #define LCD_SAT(color) ((color >> 8) & 0xFF)
#define LCD_INT(color) (color & 0xFF) #define LCD_INT(color) (color & 0xFF)
inline uint32_t change_lcd_color_intensity(uint32_t color, uint8_t new_intensity) {
return (color & 0xFFFFFF00) | new_intensity;
}
void lcd_backlight_init(void); void lcd_backlight_init(void);
void lcd_backlight_color(uint8_t hue, uint8_t saturation, uint8_t intensity); void lcd_backlight_color(uint8_t hue, uint8_t saturation, uint8_t intensity);
void lcd_backlight_brightness(uint8_t b); void lcd_backlight_brightness(uint8_t b);

@ -0,0 +1,77 @@
/* 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/>.
*/
#include "lcd_backlight_keyframes.h"
bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) {
int frame_length = animation->frame_lengths[animation->current_frame];
int current_pos = frame_length - animation->time_left_in_frame;
uint8_t t_h = LCD_HUE(state->target_lcd_color);
uint8_t t_s = LCD_SAT(state->target_lcd_color);
uint8_t t_i = LCD_INT(state->target_lcd_color);
uint8_t p_h = LCD_HUE(state->prev_lcd_color);
uint8_t p_s = LCD_SAT(state->prev_lcd_color);
uint8_t p_i = LCD_INT(state->prev_lcd_color);
uint8_t d_h1 = t_h - p_h; //Modulo arithmetic since we want to wrap around
int d_h2 = t_h - p_h;
// Chose the shortest way around
int d_h = abs(d_h2) < d_h1 ? d_h2 : d_h1;
int d_s = t_s - p_s;
int d_i = t_i - p_i;
int hue = (d_h * current_pos) / frame_length;
int sat = (d_s * current_pos) / frame_length;
int intensity = (d_i * current_pos) / frame_length;
//dprintf("%X -> %X = %X\n", p_h, t_h, hue);
hue += p_h;
sat += p_s;
intensity += p_i;
state->current_lcd_color = LCD_COLOR(hue, sat, intensity);
lcd_backlight_color(
LCD_HUE(state->current_lcd_color),
LCD_SAT(state->current_lcd_color),
LCD_INT(state->current_lcd_color));
return true;
}
bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
state->prev_lcd_color = state->target_lcd_color;
state->current_lcd_color = state->target_lcd_color;
lcd_backlight_color(
LCD_HUE(state->current_lcd_color),
LCD_SAT(state->current_lcd_color),
LCD_INT(state->current_lcd_color));
return false;
}
bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
lcd_backlight_hal_color(0, 0, 0);
return false;
}
bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
lcd_backlight_color(LCD_HUE(state->current_lcd_color),
LCD_SAT(state->current_lcd_color),
LCD_INT(state->current_lcd_color));
return false;
}

@ -0,0 +1,30 @@
/* 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 QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_
#define QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_
#include "visualizer.h"
// Animates the LCD backlight color between the current color and the target color (of the state)
bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state);
// Sets the backlight color to the target color
bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state);
bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
#endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */

@ -0,0 +1,188 @@
/* 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/>.
*/
#include "lcd_keyframes.h"
#include <string.h>
#include "action_util.h"
#include "led.h"
#include "resources/resources.h"
bool lcd_keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
gdispClear(White);
gdispDrawString(0, 10, state->layer_text, state->font_dejavusansbold12, Black);
return false;
}
static void format_layer_bitmap_string(uint16_t default_layer, uint16_t layer, char* buffer) {
for (int i=0; i<16;i++)
{
uint32_t mask = (1u << i);
if (default_layer & mask) {
if (layer & mask) {
*buffer = 'B';
} else {
*buffer = 'D';
}
} else if (layer & mask) {
*buffer = '1';
} else {
*buffer = '0';
}
++buffer;
if (i==3 || i==7 || i==11) {
*buffer = ' ';
++buffer;
}
}
*buffer = 0;
}
bool lcd_keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
const char* layer_help = "1=On D=Default B=Both";
char layer_buffer[16 + 4]; // 3 spaces and one null terminator
gdispClear(White);
gdispDrawString(0, 0, layer_help, state->font_fixed5x8, Black);
format_layer_bitmap_string(state->status.default_layer, state->status.layer, layer_buffer);
gdispDrawString(0, 10, layer_buffer, state->font_fixed5x8, Black);
format_layer_bitmap_string(state->status.default_layer >> 16, state->status.layer >> 16, layer_buffer);
gdispDrawString(0, 20, layer_buffer, state->font_fixed5x8, Black);
return false;
}
static void format_mods_bitmap_string(uint8_t mods, char* buffer) {
*buffer = ' ';
++buffer;
for (int i = 0; i<8; i++)
{
uint32_t mask = (1u << i);
if (mods & mask) {
*buffer = '1';
} else {
*buffer = '0';
}
++buffer;
if (i==3) {
*buffer = ' ';
++buffer;
}
}
*buffer = 0;
}
bool lcd_keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
const char* title = "Modifier states";
const char* mods_header = " CSAG CSAG ";
char status_buffer[12];
gdispClear(White);
gdispDrawString(0, 0, title, state->font_fixed5x8, Black);
gdispDrawString(0, 10, mods_header, state->font_fixed5x8, Black);
format_mods_bitmap_string(state->status.mods, status_buffer);
gdispDrawString(0, 20, status_buffer, state->font_fixed5x8, Black);
return false;
}
#define LED_STATE_STRING_SIZE sizeof("NUM CAPS SCRL COMP KANA")
static void get_led_state_string(char* output, visualizer_state_t* state) {
uint8_t pos = 0;
if (state->status.leds & (1u << USB_LED_NUM_LOCK)) {
memcpy(output + pos, "NUM ", 4);
pos += 4;
}
if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {
memcpy(output + pos, "CAPS ", 5);
pos += 5;
}
if (state->status.leds & (1u << USB_LED_SCROLL_LOCK)) {
memcpy(output + pos, "SCRL ", 5);
pos += 5;
}
if (state->status.leds & (1u << USB_LED_COMPOSE)) {
memcpy(output + pos, "COMP ", 5);
pos += 5;
}
if (state->status.leds & (1u << USB_LED_KANA)) {
memcpy(output + pos, "KANA ", 5);
pos += 5;
}
output[pos] = 0;
}
bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer_state_t* state)
{
(void)animation;
char output[LED_STATE_STRING_SIZE];
get_led_state_string(output, state);
gdispClear(White);
gdispDrawString(0, 10, output, state->font_dejavusansbold12, Black);
return false;
}
bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
gdispClear(White);
uint8_t y = 10;
if (state->status.leds) {
char output[LED_STATE_STRING_SIZE];
get_led_state_string(output, state);
gdispDrawString(0, 1, output, state->font_dejavusansbold12, Black);
y = 17;
}
gdispDrawString(0, y, state->layer_text, state->font_dejavusansbold12, Black);
return false;
}
bool lcd_keyframe_draw_logo(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)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, here we use the image
//gdispGBlitArea is a tricky function to use since it supports blitting part of the image
// if you have full screen image, then just use 128 and 32 for both source and target dimensions
gdispGBlitArea(GDISP, 0, 0, 128, 32, 0, 0, 128, (pixel_t*)resource_lcd_logo);
return false;
}
bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
gdispSetPowerMode(powerOff);
return false;
}
bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
gdispSetPowerMode(powerOn);
return false;
}

@ -0,0 +1,39 @@
/* 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 QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_
#define QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_
#include "visualizer.h"
// Displays the layer text centered vertically on the screen
bool lcd_keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays a bitmap (0/1) of all the currently active layers
bool lcd_keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays a bitmap (0/1) of all the currently active mods
bool lcd_keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays the keyboard led states (CAPS (Caps lock), NUM (Num lock), SCRL (Scroll lock), COMP (Compose), KANA)
bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays both the layer text and the led states
bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays the QMK logo on the LCD screen
bool lcd_keyframe_draw_logo(keyframe_animation_t* animation, visualizer_state_t* state);
bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
#endif /* QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_ */

@ -21,50 +21,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include "led_test.h"
#include "gfx.h" #include "gfx.h"
#include "math.h" #include "math.h"
#include "led_keyframes.h"
#define CROSSFADE_TIME 1000
#define GRADIENT_TIME 3000
keyframe_animation_t led_test_animation = {
.num_frames = 14,
.loop = true,
.frame_lengths = {
gfxMillisecondsToTicks(1000), // fade in
gfxMillisecondsToTicks(1000), // no op (leds on)
gfxMillisecondsToTicks(1000), // fade out
gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in)
gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
0, // mirror leds
gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out)
gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
0, // normal leds
gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
},
.frame_functions = {
keyframe_fade_in_all_leds,
keyframe_no_operation,
keyframe_fade_out_all_leds,
keyframe_led_crossfade,
keyframe_led_left_to_right_gradient,
keyframe_led_crossfade,
keyframe_led_top_to_bottom_gradient,
keyframe_mirror_led_orientation,
keyframe_led_crossfade,
keyframe_led_left_to_right_gradient,
keyframe_led_crossfade,
keyframe_led_top_to_bottom_gradient,
keyframe_normal_led_orientation,
keyframe_led_crossfade,
},
};
static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) { static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) {
int frame_length = animation->frame_lengths[animation->current_frame]; int frame_length = animation->frame_lengths[animation->current_frame];
@ -96,19 +55,19 @@ static uint8_t compute_gradient_color(float t, float index, float num) {
return (uint8_t)(255.0f * v); return (uint8_t)(255.0f * v);
} }
bool keyframe_fade_in_all_leds(keyframe_animation_t* animation, visualizer_state_t* state) { bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state; (void)state;
keyframe_fade_all_leds_from_to(animation, 0, 255); keyframe_fade_all_leds_from_to(animation, 0, 255);
return true; return true;
} }
bool keyframe_fade_out_all_leds(keyframe_animation_t* animation, visualizer_state_t* state) { bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state; (void)state;
keyframe_fade_all_leds_from_to(animation, 255, 0); keyframe_fade_all_leds_from_to(animation, 255, 0);
return true; return true;
} }
bool keyframe_led_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state; (void)state;
float frame_length = animation->frame_lengths[animation->current_frame]; float frame_length = animation->frame_lengths[animation->current_frame];
float current_pos = frame_length - animation->time_left_in_frame; float current_pos = frame_length - animation->time_left_in_frame;
@ -120,7 +79,7 @@ bool keyframe_led_left_to_right_gradient(keyframe_animation_t* animation, visual
return true; return true;
} }
bool keyframe_led_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state; (void)state;
float frame_length = animation->frame_lengths[animation->current_frame]; float frame_length = animation->frame_lengths[animation->current_frame];
float current_pos = frame_length - animation->time_left_in_frame; float current_pos = frame_length - animation->time_left_in_frame;
@ -139,7 +98,7 @@ static void copy_current_led_state(uint8_t* dest) {
} }
} }
} }
bool keyframe_led_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) { bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state; (void)state;
if (animation->first_update_of_frame) { if (animation->first_update_of_frame) {
copy_current_led_state(&crossfade_start_frame[0][0]); copy_current_led_state(&crossfade_start_frame[0][0]);
@ -155,14 +114,14 @@ bool keyframe_led_crossfade(keyframe_animation_t* animation, visualizer_state_t*
return true; return true;
} }
bool keyframe_mirror_led_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state; (void)state;
(void)animation; (void)animation;
gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180); gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180);
return false; return false;
} }
bool keyframe_normal_led_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state; (void)state;
(void)animation; (void)animation;
gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0); gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0);

@ -22,20 +22,20 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef TMK_VISUALIZER_LED_TEST_H_ #ifndef LED_KEYFRAMES_H
#define TMK_VISUALIZER_LED_TEST_H_ #define LED_KEYFRAMES_H
#include "visualizer.h" #include "visualizer.h"
bool keyframe_fade_in_all_leds(keyframe_animation_t* animation, visualizer_state_t* state); bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_fade_out_all_leds(keyframe_animation_t* animation, visualizer_state_t* state); bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_led_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state); bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_led_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state); bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_led_crossfade(keyframe_animation_t* animation, visualizer_state_t* state); bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_mirror_led_orientation(keyframe_animation_t* animation, visualizer_state_t* state); bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_normal_led_orientation(keyframe_animation_t* animation, visualizer_state_t* state); bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
extern keyframe_animation_t led_test_animation; extern keyframe_animation_t led_test_animation;
#endif /* TMK_VISUALIZER_LED_TEST_H_ */ #endif /* LED_KEYFRAMES_H */

@ -0,0 +1,61 @@
/* 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/>.
*/
#include "resources.h"
// To generate an image array like this
// Ensure the image is 128 x 32 or smaller
// Convert the bitmap to a C array using a program like http://www.riuson.com/lcd-image-converter/
// Ensure the the conversion process produces a monochrome format array - 1 bit/pixel, left to right, top to bottom
// Update array in the source code with the C array produced by the conversion program
// The image below is generated from lcd_logo.png
const uint8_t resource_lcd_logo[512] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xf8, 0xfe, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x38, 0x38, 0x06, 0x29, 0x41, 0x24, 0x52, 0x24, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x38, 0x38, 0x09, 0x55, 0x42, 0xaa, 0xaa, 0xaa, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x38, 0x38, 0x09, 0x55, 0x82, 0x28, 0xaa, 0xae, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x38, 0x38, 0x09, 0x55, 0x43, 0x28, 0xaa, 0xaa, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x38, 0x38, 0x0a, 0x55, 0x42, 0x28, 0xaa, 0xaa, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x38, 0x38, 0x05, 0x45, 0x42, 0x28, 0x89, 0x4a, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x38, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x38, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0e, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x03, 0xff, 0x80, 0x04, 0x45, 0x14, 0xa4, 0x92, 0x83, 0x52, 0x22, 0x22, 0x36, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x0a, 0xaa, 0xaa, 0xaa, 0xba, 0x84, 0x55, 0x55, 0x57, 0x45, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x08, 0xaa, 0xaa, 0xaa, 0x92, 0xb2, 0x55, 0x55, 0x42, 0x65, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x08, 0xaa, 0xaa, 0xaa, 0x92, 0x81, 0x56, 0x65, 0x42, 0x45, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x0a, 0xaa, 0xaa, 0xaa, 0x92, 0x81, 0x54, 0x45, 0x42, 0x45, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x04, 0x48, 0xa2, 0x4a, 0x89, 0x06, 0x24, 0x42, 0x41, 0x36, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

@ -0,0 +1,27 @@
/* 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 QUANTUM_VISUALIZER_RESOURCES_RESOURCES_H_
#define QUANTUM_VISUALIZER_RESOURCES_RESOURCES_H_
#include <stdint.h>
#ifdef LCD_ENABLE
extern const uint8_t resource_lcd_logo[];
#endif
#endif /* QUANTUM_VISUALIZER_RESOURCES_RESOURCES_H_ */

@ -48,20 +48,22 @@ SOFTWARE.
#include "serial_link/system/serial_link.h" #include "serial_link/system/serial_link.h"
#endif #endif
#include "action_util.h"
// Define this in config.h // Define this in config.h
#ifndef VISUALIZER_THREAD_PRIORITY #ifndef VISUALIZER_THREAD_PRIORITY
#define "Visualizer thread priority not defined" #define "Visualizer thread priority not defined"
#endif #endif
// mods status
#include "action_util.h"
static visualizer_keyboard_status_t current_status = { static visualizer_keyboard_status_t current_status = {
.layer = 0xFFFFFFFF, .layer = 0xFFFFFFFF,
.default_layer = 0xFFFFFFFF, .default_layer = 0xFFFFFFFF,
.mods = 0xFF, .mods = 0xFF,
.leds = 0xFFFFFFFF, .leds = 0xFFFFFFFF,
.suspended = false, .suspended = false,
#ifdef VISUALIZER_USER_DATA_SIZE
.user_data = {0}
#endif
}; };
static bool same_status(visualizer_keyboard_status_t* status1, visualizer_keyboard_status_t* status2) { static bool same_status(visualizer_keyboard_status_t* status1, visualizer_keyboard_status_t* status2) {
@ -69,11 +71,19 @@ static bool same_status(visualizer_keyboard_status_t* status1, visualizer_keyboa
status1->default_layer == status2->default_layer && status1->default_layer == status2->default_layer &&
status1->mods == status2->mods && status1->mods == status2->mods &&
status1->leds == status2->leds && status1->leds == status2->leds &&
status1->suspended == status2->suspended; status1->suspended == status2->suspended
#ifdef VISUALIZER_USER_DATA_SIZE
&& memcmp(status1->user_data, status2->user_data, VISUALIZER_USER_DATA_SIZE) == 0
#endif
;
} }
static bool visualizer_enabled = false; static bool visualizer_enabled = false;
#ifdef VISUALIZER_USER_DATA_SIZE
static uint8_t user_data[VISUALIZER_USER_DATA_SIZE];
#endif
#define MAX_SIMULTANEOUS_ANIMATIONS 4 #define MAX_SIMULTANEOUS_ANIMATIONS 4
static keyframe_animation_t* animations[MAX_SIMULTANEOUS_ANIMATIONS] = {}; static keyframe_animation_t* animations[MAX_SIMULTANEOUS_ANIMATIONS] = {};
@ -144,6 +154,14 @@ void stop_all_keyframe_animations(void) {
} }
} }
static uint8_t get_num_running_animations(void) {
uint8_t count = 0;
for (int i=0;i<MAX_SIMULTANEOUS_ANIMATIONS;i++) {
count += animations[i] ? 1 : 0;
}
return count;
}
static bool update_keyframe_animation(keyframe_animation_t* animation, visualizer_state_t* state, systemticks_t delta, systemticks_t* sleep_time) { static bool update_keyframe_animation(keyframe_animation_t* animation, visualizer_state_t* state, systemticks_t delta, systemticks_t* sleep_time) {
// TODO: Clean up this messy code // TODO: Clean up this messy code
dprintf("Animation frame%d, left %d, delta %d\n", animation->current_frame, dprintf("Animation frame%d, left %d, delta %d\n", animation->current_frame,
@ -212,175 +230,6 @@ void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* stat
(*temp_animation.frame_functions[next_frame])(&temp_animation, &temp_state); (*temp_animation.frame_functions[next_frame])(&temp_animation, &temp_state);
} }
bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
return false;
}
#ifdef LCD_BACKLIGHT_ENABLE
bool keyframe_animate_backlight_color(keyframe_animation_t* animation, visualizer_state_t* state) {
int frame_length = animation->frame_lengths[animation->current_frame];
int current_pos = frame_length - animation->time_left_in_frame;
uint8_t t_h = LCD_HUE(state->target_lcd_color);
uint8_t t_s = LCD_SAT(state->target_lcd_color);
uint8_t t_i = LCD_INT(state->target_lcd_color);
uint8_t p_h = LCD_HUE(state->prev_lcd_color);
uint8_t p_s = LCD_SAT(state->prev_lcd_color);
uint8_t p_i = LCD_INT(state->prev_lcd_color);
uint8_t d_h1 = t_h - p_h; //Modulo arithmetic since we want to wrap around
int d_h2 = t_h - p_h;
// Chose the shortest way around
int d_h = abs(d_h2) < d_h1 ? d_h2 : d_h1;
int d_s = t_s - p_s;
int d_i = t_i - p_i;
int hue = (d_h * current_pos) / frame_length;
int sat = (d_s * current_pos) / frame_length;
int intensity = (d_i * current_pos) / frame_length;
//dprintf("%X -> %X = %X\n", p_h, t_h, hue);
hue += p_h;
sat += p_s;
intensity += p_i;
state->current_lcd_color = LCD_COLOR(hue, sat, intensity);
lcd_backlight_color(
LCD_HUE(state->current_lcd_color),
LCD_SAT(state->current_lcd_color),
LCD_INT(state->current_lcd_color));
return true;
}
bool keyframe_set_backlight_color(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
state->prev_lcd_color = state->target_lcd_color;
state->current_lcd_color = state->target_lcd_color;
lcd_backlight_color(
LCD_HUE(state->current_lcd_color),
LCD_SAT(state->current_lcd_color),
LCD_INT(state->current_lcd_color));
return false;
}
#endif // LCD_BACKLIGHT_ENABLE
#ifdef LCD_ENABLE
bool keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
gdispClear(White);
gdispDrawString(0, 10, state->layer_text, state->font_dejavusansbold12, Black);
gdispFlush();
return false;
}
static void format_layer_bitmap_string(uint16_t default_layer, uint16_t layer, char* buffer) {
for (int i=0; i<16;i++)
{
uint32_t mask = (1u << i);
if (default_layer & mask) {
if (layer & mask) {
*buffer = 'B';
} else {
*buffer = 'D';
}
} else if (layer & mask) {
*buffer = '1';
} else {
*buffer = '0';
}
++buffer;
if (i==3 || i==7 || i==11) {
*buffer = ' ';
++buffer;
}
}
*buffer = 0;
}
bool keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
const char* layer_help = "1=On D=Default B=Both";
char layer_buffer[16 + 4]; // 3 spaces and one null terminator
gdispClear(White);
gdispDrawString(0, 0, layer_help, state->font_fixed5x8, Black);
format_layer_bitmap_string(state->status.default_layer, state->status.layer, layer_buffer);
gdispDrawString(0, 10, layer_buffer, state->font_fixed5x8, Black);
format_layer_bitmap_string(state->status.default_layer >> 16, state->status.layer >> 16, layer_buffer);
gdispDrawString(0, 20, layer_buffer, state->font_fixed5x8, Black);
gdispFlush();
return false;
}
static void format_mods_bitmap_string(uint8_t mods, char* buffer) {
*buffer = ' ';
++buffer;
for (int i = 0; i<8; i++)
{
uint32_t mask = (1u << i);
if (mods & mask) {
*buffer = '1';
} else {
*buffer = '0';
}
++buffer;
if (i==3) {
*buffer = ' ';
++buffer;
}
}
*buffer = 0;
}
bool keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
const char* title = "Modifier states";
const char* mods_header = " CSAG CSAG ";
char status_buffer[12];
gdispClear(White);
gdispDrawString(0, 0, title, state->font_fixed5x8, Black);
gdispDrawString(0, 10, mods_header, state->font_fixed5x8, Black);
format_mods_bitmap_string(state->status.mods, status_buffer);
gdispDrawString(0, 20, status_buffer, state->font_fixed5x8, Black);
gdispFlush();
return false;
}
#endif // LCD_ENABLE
bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
#ifdef LCD_ENABLE
gdispSetPowerMode(powerOff);
#endif
#ifdef LCD_BACKLIGHT_ENABLE
lcd_backlight_hal_color(0, 0, 0);
#endif
return false;
}
bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
#ifdef LCD_ENABLE
gdispSetPowerMode(powerOn);
#endif
return false;
}
bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
dprint("User visualizer inited\n");
visualizer_enabled = true;
return false;
}
// TODO: Optimize the stack size, this is probably way too big // TODO: Optimize the stack size, this is probably way too big
static DECLARE_THREAD_STACK(visualizerThreadStack, 1024); static DECLARE_THREAD_STACK(visualizerThreadStack, 1024);
static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
@ -396,6 +245,9 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
.mods = 0xFF, .mods = 0xFF,
.leds = 0xFFFFFFFF, .leds = 0xFFFFFFFF,
.suspended = false, .suspended = false,
#ifdef VISUALIZER_USER_DATA_SIZE
.user_data = {0},
#endif
}; };
visualizer_state_t state = { visualizer_state_t state = {
@ -418,13 +270,15 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
systemticks_t sleep_time = TIME_INFINITE; systemticks_t sleep_time = TIME_INFINITE;
systemticks_t current_time = gfxSystemTicks(); systemticks_t current_time = gfxSystemTicks();
bool force_update = true;
while(true) { while(true) {
systemticks_t new_time = gfxSystemTicks(); systemticks_t new_time = gfxSystemTicks();
systemticks_t delta = new_time - current_time; systemticks_t delta = new_time - current_time;
current_time = new_time; current_time = new_time;
bool enabled = visualizer_enabled; bool enabled = visualizer_enabled;
if (!same_status(&state.status, &current_status)) { if (force_update || !same_status(&state.status, &current_status)) {
force_update = false;
if (visualizer_enabled) { if (visualizer_enabled) {
if (current_status.suspended) { if (current_status.suspended) {
stop_all_keyframe_animations(); stop_all_keyframe_animations();
@ -433,8 +287,9 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
user_visualizer_suspend(&state); user_visualizer_suspend(&state);
} }
else { else {
visualizer_keyboard_status_t prev_status = state.status;
state.status = current_status; state.status = current_status;
update_user_visualizer_state(&state); update_user_visualizer_state(&state, &prev_status);
} }
state.prev_lcd_color = state.current_lcd_color; state.prev_lcd_color = state.current_lcd_color;
} }
@ -458,13 +313,17 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
gdispGFlush(LED_DISPLAY); gdispGFlush(LED_DISPLAY);
#endif #endif
#ifdef LCD_ENABLE
gdispGFlush(LCD_DISPLAY);
#endif
#ifdef EMULATOR #ifdef EMULATOR
draw_emulator(); draw_emulator();
#endif #endif
// The animation can enable the visualizer // Enable the visualizer when the startup or the suspend animation has finished
// And we might need to update the state when that happens if (!visualizer_enabled && state.status.suspended == false && get_num_running_animations() == 0) {
// so don't sleep visualizer_enabled = true;
if (enabled != visualizer_enabled) { force_update = true;
sleep_time = 0; sleep_time = 0;
} }
@ -554,6 +413,12 @@ uint8_t visualizer_get_mods() {
return mods; return mods;
} }
#ifdef VISUALIZER_USER_DATA_SIZE
void visualizer_set_user_data(void* u) {
memcpy(user_data, u, VISUALIZER_USER_DATA_SIZE);
}
#endif
void visualizer_update(uint32_t default_state, uint32_t state, uint8_t mods, uint32_t leds) { void visualizer_update(uint32_t default_state, uint32_t state, uint8_t mods, uint32_t leds) {
// Note that there's a small race condition here, the thread could read // Note that there's a small race condition here, the thread could read
// a state where one of these are set but not the other. But this should // a state where one of these are set but not the other. But this should
@ -582,6 +447,9 @@ void visualizer_update(uint32_t default_state, uint32_t state, uint8_t mods, uin
.leds = leds, .leds = leds,
.suspended = current_status.suspended, .suspended = current_status.suspended,
}; };
#ifdef VISUALIZER_USER_DATA_SIZE
memcpy(new_status.user_data, user_data, VISUALIZER_USER_DATA_SIZE);
#endif
if (!same_status(&current_status, &new_status)) { if (!same_status(&current_status, &new_status)) {
changed = true; changed = true;
current_status = new_status; current_status = new_status;

@ -34,7 +34,7 @@ SOFTWARE.
#include "lcd_backlight.h" #include "lcd_backlight.h"
#endif #endif
// use this function to merget both real_mods and oneshot_mods in a uint16_t // use this function to merge both real_mods and oneshot_mods in a uint16_t
uint8_t visualizer_get_mods(void); uint8_t visualizer_get_mods(void);
// This need to be called once at the start // This need to be called once at the start
@ -68,6 +68,9 @@ typedef struct {
uint8_t mods; uint8_t mods;
uint32_t leds; // See led.h for available statuses uint32_t leds; // See led.h for available statuses
bool suspended; bool suspended;
#ifdef VISUALIZER_USER_DATA_SIZE
uint8_t user_data[VISUALIZER_USER_DATA_SIZE];
#endif
} visualizer_keyboard_status_t; } visualizer_keyboard_status_t;
// The state struct is used by the various keyframe functions // The state struct is used by the various keyframe functions
@ -123,32 +126,22 @@ void stop_keyframe_animation(keyframe_animation_t* animation);
// Useful for crossfades for example // Useful for crossfades for example
void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* state); void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* state);
// Some predefined keyframe functions that can be used by the user code // The master can set userdata which will be transferred to the slave
// Does nothing, useful for adding delays #ifdef VISUALIZER_USER_DATA_SIZE
bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state); void visualizer_set_user_data(void* user_data);
// Animates the LCD backlight color between the current color and the target color (of the state) #endif
bool keyframe_animate_backlight_color(keyframe_animation_t* animation, visualizer_state_t* state);
// Sets the backlight color to the target color
bool keyframe_set_backlight_color(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays the layer text centered vertically on the screen
bool keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays a bitmap (0/1) of all the currently active layers
bool keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
// Displays a bitmap (0/1) of all the currently active mods
bool keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state);
// Call this once, when the initial animation has finished, alternatively you can call it
// directly from the initalize_user_visualizer function (the animation can be null)
bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state);
// These functions have to be implemented by the user // These functions have to be implemented by the user
void initialize_user_visualizer(visualizer_state_t* state); // Called regularly each time the state has changed (but not every scan loop)
void update_user_visualizer_state(visualizer_state_t* state); void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status);
// Called when the computer goes to suspend, will also stop calling update_user_visualizer_state
void user_visualizer_suspend(visualizer_state_t* state); void user_visualizer_suspend(visualizer_state_t* state);
// You have to start at least one animation as a response to the following two functions
// When the animation has finished the visualizer will resume normal operation and start calling the
// update_user_visualizer_state again
// Called when the keyboard boots up
void initialize_user_visualizer(visualizer_state_t* state);
// Called when the computer resumes from a suspend
void user_visualizer_resume(visualizer_state_t* state); void user_visualizer_resume(visualizer_state_t* state);
#endif /* VISUALIZER_H */ #endif /* VISUALIZER_H */

@ -20,7 +20,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
SRC += $(VISUALIZER_DIR)/visualizer.c SRC += $(VISUALIZER_DIR)/visualizer.c \
$(VISUALIZER_DIR)/visualizer_keyframes.c
EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR) EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR)
GFXLIB = $(LIB_PATH)/ugfx GFXLIB = $(LIB_PATH)/ugfx
VPATH += $(VISUALIZER_PATH) VPATH += $(VISUALIZER_PATH)
@ -32,25 +33,33 @@ OPT_DEFS += -DLCD_ENABLE
ULIBS += -lm ULIBS += -lm
endif endif
ifdef LCD_BACKLIGHT_ENABLE ifeq ($(strip $(LCD_ENABLE)), yes)
SRC += $(VISUALIZER_DIR)/lcd_backlight.c SRC += $(VISUALIZER_DIR)/lcd_backlight.c
SRC += $(VISUALIZER_DIR)/lcd_keyframes.c
SRC += $(VISUALIZER_DIR)/lcd_backlight_keyframes.c
# Note, that the linker will strip out any resources that are not actually in use
SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c
OPT_DEFS += -DLCD_BACKLIGHT_ENABLE OPT_DEFS += -DLCD_BACKLIGHT_ENABLE
endif endif
ifdef LED_ENABLE ifeq ($(strip $(LED_ENABLE)), yes)
SRC += $(VISUALIZER_DIR)/led_test.c SRC += $(VISUALIZER_DIR)/led_keyframes.c
OPT_DEFS += -DLED_ENABLE OPT_DEFS += -DLED_ENABLE
endif endif
include $(GFXLIB)/gfx.mk include $(GFXLIB)/gfx.mk
SRC += $(patsubst $(TOP_DIR)/%,%,$(GFXSRC)) GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC))
OPT_DEFS += $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS)))
ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","")
SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c
else else
ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","") ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","")
ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","")
$(error "$(KEYMAP_PATH)/visualizer.c" does not exist) $(error "$(KEYMAP_PATH)/visualizer.c" does not exist)
else
SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c
endif
else else
SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c
endif endif

@ -0,0 +1,23 @@
/* 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/>.
*/
#include "visualizer_keyframes.h"
bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
return false;
}

@ -0,0 +1,26 @@
/* 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 QUANTUM_VISUALIZER_VISUALIZER_KEYFRAMES_H_
#define QUANTUM_VISUALIZER_VISUALIZER_KEYFRAMES_H_
#include "visualizer.h"
// Some predefined keyframe functions that can be used by the user code
// Does nothing, useful for adding delays
bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state);
#endif /* QUANTUM_VISUALIZER_VISUALIZER_KEYFRAMES_H_ */

@ -32,7 +32,7 @@ The OLKB product firmwares are maintained by [Jack Humbert](https://github.com/j
This is not a tiny project. While this is the main readme, there are many other files you might want to consult. Here are some points of interest: This is not a tiny project. While this is the main readme, there are many other files you might want to consult. Here are some points of interest:
* [**The Wiki**](https://github.com/qmk/qmk_firmware/wiki) - the entirety of the readme has been moved here * [**The Wiki**](https://github.com/qmk/qmk_firmware/wiki) - the entirety of the readme has been moved here
* The readme for your own keyboard: This is found under `keyboards/<your keyboards's name>/`. So for the ErgoDox EZ, it's [here](keyboards/ergodox/ez/); for the Planck, it's [here](keyboards/planck/) and so on. * The readme for your own keyboard: This is found under `keyboards/<your keyboards's name>/`. So for the ErgoDox, it's [here](keyboards/ergodox/); for the Planck, it's [here](keyboards/planck/) and so on.
* The list of possible keycodes you can use in your keymap is actually spread out in a few different places: * The list of possible keycodes you can use in your keymap is actually spread out in a few different places:
* [doc/keycode.txt](doc/keycode.txt) - an explanation of those same keycodes. * [doc/keycode.txt](doc/keycode.txt) - an explanation of those same keycodes.
* [quantum/quantum_keycodes.h](quantum/quantum_keycodes.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `quantum_keycodes.h` is where they're actually defined. * [quantum/quantum_keycodes.h](quantum/quantum_keycodes.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `quantum_keycodes.h` is where they're actually defined.

@ -58,9 +58,13 @@ void set_oneshot_locked_mods(int8_t mods) { oneshot_locked_mods = mods; }
void clear_oneshot_locked_mods(void) { oneshot_locked_mods = 0; } void clear_oneshot_locked_mods(void) { oneshot_locked_mods = 0; }
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) #if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
static int16_t oneshot_time = 0; static int16_t oneshot_time = 0;
inline bool has_oneshot_mods_timed_out() { bool has_oneshot_mods_timed_out(void) {
return TIMER_DIFF_16(timer_read(), oneshot_time) >= ONESHOT_TIMEOUT; return TIMER_DIFF_16(timer_read(), oneshot_time) >= ONESHOT_TIMEOUT;
} }
#else
bool has_oneshot_mods_timed_out(void) {
return false;
}
#endif #endif
#endif #endif

Loading…
Cancel
Save