Keymap: Update keymap to match latest changes to Wilba's firmware. (#4432)

* Fix firmware to work with latest Wilba changes (i.e. dynamic keymap) and M60a.

* Get back RGB Backlight codes.

* More tweaks.

* Update users/talljoe/rules.mk

Co-Authored-By: Talljoe <jwasson+github@gmail.com>
master
Joe Wasson 2018-11-21 13:18:18 -08:00 committed by Drashna Jaelre
parent 1485098443
commit 2f34252278
11 changed files with 52 additions and 194 deletions

View File

@ -76,3 +76,5 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
RAW_ENABLE = yes
DYNAMIC_KEYMAP_ENABLE = yes
CIE1931_CURVE = yes
LAYOUTS = 60_hhkb

View File

@ -11,7 +11,7 @@
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \
) KEYMAP_ARROW( \
) LAYOUT_arrow( \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1D, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K0D, \
@ -24,7 +24,7 @@
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \
) KEYMAP_ARROW( \
) LAYOUT_arrow( \
K00, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1D, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2C, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, \
@ -37,14 +37,14 @@
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \
) KEYMAP_ARROW( \
) LAYOUT_arrow( \
K00, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K2D, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2C, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, \
K40, K49, K42, K44, K45, K48, K0B, K0C, K4C \
K40, K41, K42, K44, K45, K48, K0B, K0C, K4C \
)
#define TEMPLATE_RESET KEYMAP_ARROW( \
#define TEMPLATE_RESET LAYOUT_arrow( \
RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RESET, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \

View File

@ -34,7 +34,7 @@
{ K40, K41, K42, {}, {}, {}, {}, K47, {}, {}, K4A, K4B, K4C, K4D } \
}
#ifdef KEYBOARD_zeal60
#if defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A)
#define ZEAL_RGB

View File

@ -1,94 +1 @@
#ifdef KEYBOARD_zeal60
#include "config.h"
#include "zeal60.h"
#include "rgb_backlight.h"
#include "action_layer.h"
#include "solarized.h"
#include "talljoe.h"
// from zeal_backlight.c
// we want to be able to set indicators for the spacebar stabs
// but they are not represented by a row/index.
extern backlight_config g_config;
void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led );
void set_backlight_defaults(void) {
uint8_t space;
uint8_t caps_lock;
map_row_column_to_led(3, 12, &caps_lock);
map_row_column_to_led(4, 7, &space);
backlight_config default_values = {
.use_split_backspace = USE_SPLIT_BACKSPACE,
.use_split_left_shift = USE_SPLIT_LEFT_SHIFT,
.use_split_right_shift = USE_SPLIT_RIGHT_SHIFT,
.use_7u_spacebar = USE_7U_SPACEBAR,
.use_iso_enter = USE_ISO_ENTER,
.disable_when_usb_suspended = 1,
.disable_after_timeout = 0,
.brightness = 255,
.effect = 10,
.color_1 = solarized.base2,
.color_2 = solarized.base02,
.caps_lock_indicator = { .index = caps_lock, .color = solarized.red },
.layer_1_indicator = { .index = space, .color = solarized.blue },
.layer_2_indicator = { .index = space, .color = solarized.yellow },
.layer_3_indicator = { .index = 254, .color = solarized.red },
.alphas_mods = {
RGB_BACKLIGHT_ALPHAS_MODS_ROW_0,
RGB_BACKLIGHT_ALPHAS_MODS_ROW_1,
RGB_BACKLIGHT_ALPHAS_MODS_ROW_2,
RGB_BACKLIGHT_ALPHAS_MODS_ROW_3,
RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 }
};
memcpy(&g_config, &default_values, sizeof(backlight_config));
backlight_config_save();
#undef CUSTOM_RGB_LAYOUTS
#ifdef CUSTOM_RGB_LAYOUTS
solarized_t* S = &solarized;
HSV alphas = S->base2;
HSV custom_color_map[MATRIX_ROWS][MATRIX_COLS] = CM(
S->red, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->red,
S->orange, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->orange,
S->green, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->green,
S->blue, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->blue, S->blue,
S->violet, S->magenta, S->yellow, alphas, S->yellow, S->magenta, S->violet, S->green
);
for (uint8_t row = 0; row < MATRIX_ROWS; ++row) {
for (uint8_t col = 0; col < MATRIX_COLS; ++col) {
uint8_t index;
map_row_column_to_led( row, col, &index );
set_key_color(index, custom_color_map[row][col]);
}
}
#endif // CUSTOM_RGB_LAYOUTS
}
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
static uint8_t last_effect;
switch (keycode) {
case DFAULTS:
if (IS_PRESSED(record->event)) set_backlight_defaults();
return false;
case BL_TOGG:
if (IS_PRESSED(record->event)) {
if (g_config.effect) {
last_effect = g_config.effect;
g_config.effect = 0;
} else {
g_config.effect = last_effect;
}
}
return false;
case EFFECT...EFFECT_END:
if (IS_PRESSED(record->event)) {
uint8_t effect = keycode - EFFECT;
g_config.effect = effect;
backlight_config_save();
}
return false;
}
return true;
}
#endif
// This space intentionally left blank

View File

@ -19,4 +19,7 @@
K41, K42, K45, K48, K4C \
)
#ifdef RGB_BACKLIGHT_M60_A
#define ZEAL_RGB
#endif
#endif //CONFIG_USER_H

View File

@ -1,89 +1 @@
#ifdef KEYBOARD_zeal60
#include "config.h"
#include "zeal60.h"
#include "zeal_backlight.h"
#include "action_layer.h"
#include "solarized.h"
#include "talljoe.h"
// from zeal_backlight.c
// we want to be able to set indicators for the spacebar stabs
// but they are not represented by a row/index.
extern zeal_backlight_config g_config;
void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led );
void set_backlight_defaults(void) {
uint8_t space;
uint8_t caps_lock;
map_row_column_to_led(3, 12, &caps_lock);
map_row_column_to_led(4, 7, &space);
zeal_backlight_config default_values = {
.use_split_backspace = USE_SPLIT_BACKSPACE,
.use_split_left_shift = USE_SPLIT_LEFT_SHIFT,
.use_split_right_shift = USE_SPLIT_RIGHT_SHIFT,
.use_7u_spacebar = USE_7U_SPACEBAR,
.use_iso_enter = USE_ISO_ENTER,
.disable_when_usb_suspended = 1,
.disable_after_timeout = 0,
.brightness = 255,
.effect = 10,
.color_1 = solarized.base2,
.color_2 = solarized.base02,
.caps_lock_indicator = { .index = caps_lock, .color = solarized.red },
.layer_1_indicator = { .index = space, .color = solarized.blue },
.layer_2_indicator = { .index = space, .color = solarized.yellow },
.layer_3_indicator = { .index = 254, .color = solarized.red },
.alphas_mods = {
BACKLIGHT_ALPHAS_MODS_ROW_0,
BACKLIGHT_ALPHAS_MODS_ROW_1,
BACKLIGHT_ALPHAS_MODS_ROW_2,
BACKLIGHT_ALPHAS_MODS_ROW_3,
BACKLIGHT_ALPHAS_MODS_ROW_4 }
};
memcpy(&g_config, &default_values, sizeof(zeal_backlight_config));
backlight_config_save();
solarized_t* S = &solarized;
HSV alphas = S->base2;
HSV custom_color_map[MATRIX_ROWS][MATRIX_COLS] = CM(
S->red, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->red,
S->orange, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->orange,
S->green, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->green,
S->blue, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->blue, S->blue,
S->violet, S->magenta, S->yellow, alphas, S->yellow, S->magenta, S->violet, S->green
);
for (uint8_t row = 0; row < MATRIX_ROWS; ++row) {
for (uint8_t col = 0; col < MATRIX_COLS; ++col) {
backlight_set_key_color(row, col, custom_color_map[row][col]);
}
}
}
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
static uint8_t last_effect;
switch (keycode) {
case DFAULTS:
if (IS_PRESSED(record->event)) set_backlight_defaults();
return false;
case BL_TOGG:
if (IS_PRESSED(record->event)) {
if (g_config.effect) {
last_effect = g_config.effect;
g_config.effect = 0;
} else {
g_config.effect = last_effect;
}
}
return false;
case EFFECT...EFFECT_END:
if (IS_PRESSED(record->event)) {
uint8_t effect = keycode - EFFECT;
g_config.effect = effect;
backlight_config_save();
}
return false;
}
return true;
}
#endif
// This space intentionally left blank

View File

@ -5,4 +5,8 @@
#define RESET_LAYER 15
#define BOOTMAGIC_KEY_SALT KC_ESC
#define BOOTMAGIC_KEY_SKIP KC_I
#define BOOTMAGIC_KEY_EEPROM_CLEAR KC_E
#endif // !USERSPACE_CONFIG_H

View File

@ -5,3 +5,5 @@ EXTRAFLAGS+=-flto
TAP_DANCE_ENABLE=yes
CONSOLE_ENABLE=no
COMMAND_ENABLE=no
DYNAMIC_KEYMAP_ENABLE=no
BOOTMAGIC_ENABLE=full

View File

@ -1,13 +1,16 @@
#include QMK_KEYBOARD_H
#include "talljoe.h"
#ifdef ZEAL_RGB
#include "../../../keyboards/zeal60/rgb_backlight.h"
#endif
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = TEMPLATE_TKL(
KC_ESC, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_PSCR, KC_SLCK, MO_ADJ ,
US_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL , US_BSLS, KC_INS , KC_HOME, KC_PGUP,
US_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_DEL , KC_END , KC_PGDN,
CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G , KC_H, KC_J, KC_K, KC_L, US_SCLN, US_QUOT, US_ENT ,
CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G , KC_H, KC_J, KC_K, KC_L, US_SCLN, KC_QUOT, US_ENT ,
SH_LBRC, KC_Z, KC_X, KC_C, KC_V, KC_B , KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SH_RBRC, KC_UP ,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC2, KC_SPC1, KC_SPC3, KC_RALT, KC_RGUI, KC_RCTL, KC_PTT , KC_LEFT, KC_DOWN, KC_RGHT),
[_WORKMAN] = TEMPLATE(
@ -52,7 +55,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LCTL, KC_PTT , KC_PGDN, KC_SPC , KC_SPC , KC_SPC , KC_RALT, KC_APP , KC_RCTL, KC_PTT ),
#endif
[_NAV] = TEMPLATE_NAV(
KC_GRV , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
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 , XXXXXXX, XXXXXXX,
US_TAB , KC_EXLM, KC_AT , KC_HASH, KC_DLR , KC_PERC, KC_INS , KC_PGUP, KC_UP , KC_PGDN, KC_BTN1, KC_BTN3, KC_BTN2, KC_DEL ,
CTL_ESC, KC_LCBR, KC_RCBR, KC_LPRN, KC_RPRN, KC_AMPR, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END , US_QUOT, TG_ADJ ,
KC_LSFT, KC_EQL, KC_PLUS, KC_MINS, KC_UNDS, KC_ASTR, KC_CALC, US_GRV , KC_WBAK, KC_WFWD, KC_WREF, KC_RSFT, KC_APP ,
@ -65,7 +68,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LCTL, KC_LGUI, KC_LALT, NM_SPC2, NM_SPC1, NM_SPC3, KC_PDOT, KC_PCMM, KC_RCTL, KC_PTT ),
// Adjust layer is on the split-shift key; or NAV+Enter (for non-split keyboards)
[_ADJUST] = TEMPLATE_ADJUST(
MO_RST , FX(1) , FX(2) , FX(3) , FX(4) , FX(5) , FX(8) , FX(9) , FX(10) , FX(20) , FX(0) , BR_DEC , BR_INC , XXXXXXX, MO_RST ,
MO_RST , FX(1) , FX(2) , FX(3) , FX(4) , FX(5) , FX(6) , FX(7) , FX(8) , FX(9) , FX(10) , BR_DEC , BR_INC , XXXXXXX, MO_RST ,
MO_RST , H1_INC , S1_INC , H2_INC , S2_INC , EF_INC , RGB_HUI, RGB_SAI, RGB_MOD, RGB_M_P, DFAULTS, RGB_VAD, RGB_VAI, MO_RST ,
XXXXXXX, H1_DEC , S1_DEC , H2_DEC , S2_DEC , EF_DEC , RGB_HUD, RGB_SAD, RGB_RMOD,RGB_M_K, RGB_M_B, RGB_M_G, TG_ADJ ,
TG_NKRO, LY_QWER, LY_WORK, LY_NRMN, LY_DVRK, LY_CLMK, XXXXXXX, LY_MALT, XXXXXXX, XXXXXXX, KC_MAKE, KC_CAPS, XXXXXXX,
@ -101,7 +104,11 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
#ifdef ZEAL_RGB
extern backlight_config g_config;
#endif
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint8_t last_effect;
#ifdef RGBLIGHT_ENABLE
static uint32_t savedRgbMode;
@ -144,6 +151,27 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
#ifdef ZEAL_RGB
case BL_TOGG:
if (IS_PRESSED(record->event)) {
if (g_config.effect) {
last_effect = g_config.effect;
g_config.effect = 0;
} else {
g_config.effect = last_effect;
}
}
return false;
case EFFECT...EFFECT_END:
if (IS_PRESSED(record->event)) {
uint8_t effect = keycode - EFFECT;
if(effect == g_config.effect)
effect = 0; // Toggle effect on second press
g_config.effect = effect;
backlight_config_save();
}
return false;
#endif
}
return process_record_keymap(keycode, record);
}