1
0
Fork 0

[Keymap] Jonavin murphpad keymap update (#14637)

Co-authored-by: Jonavin <=>
This commit is contained in:
jonavin 2021-09-29 12:42:53 -04:00 committed by GitHub
parent 0338481090
commit c89f74b929
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 216 additions and 34 deletions

View file

@ -21,3 +21,6 @@
// Increase layers to 6 for VIA
#define DYNAMIC_KEYMAP_LAYER_COUNT 6
// Remove line below for vertical layout
#define LANDSCAPE_MODE

View file

@ -18,7 +18,6 @@
#include "jonavin.h"
#include "layout_landscape.h"
#define LANDSCAPE_MODE
// Defines names for use in layer keycodes and the keymap
enum layer_names {
@ -28,6 +27,7 @@ enum layer_names {
_RGB
};
#ifdef LANDSCAPE_MODE
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_landscape(
@ -53,7 +53,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_FN2] = LAYOUT_landscape(
_______, _______, RESET,
_______, _______, _______, _______, _______, _______,
_______, _______, KC_MPLY, KC_MPRV, KC_MNXT, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
@ -91,6 +91,73 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______
),
};
#endif // LANDSCAPE_MODE
#ifndef LANDSCAPE_MODE
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Base */
[_BASE] = LAYOUT(
TT(_FN2),TT(_FN3),TT(_FN4),LT(_RGB,KC_PSCR),
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_MUTE, KC_P4, KC_P5, KC_P6, _______,
TT(_FN1), KC_P1, KC_P2, KC_P3, KC_PENT,
KC_RALT, KC_P0, _______, KC_PDOT, _______,
TT(_FN3), TT(_FN4), TT(_RGB)
),
[_FN1] = LAYOUT(
_______, _______, _______, RESET,
KC_CALC, _______, _______, _______,
_______, _______, _______, _______,
ENCFUNC, KC_TAB, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, KC_BSPC, _______, KC_DEL, _______,
_______, _______, _______
),
[_FN2] = LAYOUT(
_______, _______, _______, _______,
_______, _______, KC_MPLY, KC_MPRV,
_______, _______, _______, KC_MNXT,
RESET, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______
),
[_FN3] = LAYOUT(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______
),
[_FN4] = LAYOUT(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______, _______
),
[_RGB] = LAYOUT(
_______, _______, _______, _______,
_______, _______, _______, _______,
RGB_HUD, RGB_SPI, RGB_HUI, _______,
_______, RGB_RMOD, RGB_TOG, RGB_MOD, _______,
_______, RGB_VAD, RGB_SPD, RGB_VAI, _______,
_______, RGB_SAD, _______, RGB_SAI, _______,
_______, _______, _______
),
};
#endif // !LANDSCAPE_MODE
typedef struct {
char keydesc[6]; // this will be displayed on OLED
@ -99,15 +166,15 @@ typedef struct {
static const keycodedescType PROGMEM keyselection[] = {
// list of key codes that will be scrolled through by encoder and description
{"TASK", KC_TASK},
{"INS", KC_INS},
{"DEL", KC_DEL},
{"PrtSc", KC_PSCR},
{"TASK ", KC_TASK},
{"PREV ", KC_MEDIA_PREV_TRACK},
{"NEXT ", KC_MEDIA_NEXT_TRACK},
{"PLAY ", KC_MEDIA_PLAY_PAUSE},
{"PrtScm", KC_PSCR},
{"ScrLk", KC_SCLN},
{"Break", KC_PAUS},
{"C-A-D", KC_CAD}, // Ctrl-Alt-Del
{"AltF4", KC_AF4},
{"PLAY", KC_MEDIA_PLAY_PAUSE},
{"RESET", RESET}, // firmware flash mode
};
@ -168,7 +235,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
#endif
uint8_t mods_state = get_mods();
switch (index) {
case 0: // This is the only encoder right now, keeping for consistency
case 0: // main primary encoder
switch(get_highest_layer(layer_state)){ // special handling per layer
case _FN1: // on Fn layer select what the encoder does when pressed
if (!mods_state) {
@ -177,6 +244,11 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
} else {
// continue to default
}
case _RGB:
if (!mods_state) {
encoder_action_rgb_hue(clockwise);
break;
}
default: // all other layers
if (mods_state & MOD_BIT(KC_RSFT) ) { // If you are holding R shift, encoder changes layers
encoder_action_layerchange(clockwise);
@ -190,6 +262,17 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
break;
}
break;
case 1: // optional secondary encoder
switch(get_highest_layer(layer_state)){ // special handling per layer
case _RGB:
if (!mods_state) {
encoder_action_rgb_mode(clockwise);
break;
}
default: // all other layers
encoder_action_mediatrack(clockwise); // Otherwise prev/next track
break;
}
}
return true;
}
@ -287,16 +370,19 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
void oled_task_user(void) {
render_logo();
oled_set_cursor(0,6);
oled_set_cursor(0,5);
oled_write_ln_P(PSTR("Layer"), false);
oled_write_ln_P(PSTR("-JV-"), false);
oled_write_ln_P(PSTR(" "), false);
bool showSelectedKey = false;
switch (get_highest_layer(layer_state)) {
case _BASE:
oled_write_ln_P(PSTR("Base"), false);
oled_write_ln_P(PSTR("BASE"), false);
break;
case _FN1:
oled_write_ln_P(PSTR("FN 1"), false);
showSelectedKey = true;
break;
case _FN2:
oled_write_ln_P(PSTR("FN 2"), false);
@ -311,18 +397,26 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
oled_write_ln_P(PSTR("RGB "), false);
break;
default:
oled_write_ln_P(PSTR("Undef"), false);
oled_write_ln_P(PSTR(" ?? "), false);
}
oled_write_ln_P(PSTR(""), false);
if (showSelectedKey) oled_write_ln(selectedkey_rec.keydesc, false);
else oled_write_ln_P(PSTR(" "), false);
// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_ln_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_ln_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
oled_set_cursor(0,11);
oled_write_ln_P(led_state.num_lock ? PSTR(" NUM") : PSTR(" "), false);
oled_write_ln_P(led_state.caps_lock ? PSTR(" CAP") : PSTR(" "), false);
oled_write_ln_P(led_state.scroll_lock ? PSTR(" SCR") : PSTR(" "), false);
}
#endif // !LANDSCAPE_MODE
void suspend_power_down_user(void) { // shutdown oled when powered down to prevent OLED from showing Mercutio all the time
oled_off();
rgblight_disable_noeeprom();
}
void suspend_wakeup_init_user(void) {
rgblight_enable_noeeprom();
}
#endif

View file

@ -25,15 +25,15 @@ Special Features
static const keycodedescType PROGMEM keyselection[] = {
// list of key codes that will be scrollled through by encoder and description
{"TASK", KC_TASK},
{"INS", KC_INS},
{"DEL", KC_DEL},
{"PrtSc", KC_PSCR},
{"TASK ", KC_TASK},
{"PREV ", KC_MEDIA_PREV_TRACK},
{"NEXT ", KC_MEDIA_NEXT_TRACK},
{"PLAY ", KC_MEDIA_PLAY_PAUSE},
{"PrtScm", KC_PSCR},
{"ScrLk", KC_SCLN},
{"Break", KC_PAUS},
{"C-A-D", KC_CAD}, // Ctrl-Alt-Del
{"AltF4", KC_AF4},
{"PLAY", KC_MEDIA_PLAY_PAUSE},
{"RESET", RESET}, // firmware flash mode
};
@ -49,7 +49,7 @@ rules.mk OPTIONS - Active features from userspace
- STARTUP_NUMLOCK_ON = yes
- turns on NUMLOCK by default
DEFAULT MAPPING
DEFAULT LANDSCAPE MAPPING
![image](https://user-images.githubusercontent.com/71780717/131718965-b20afef6-3bc5-49e4-952f-5755a9d6d539.png)
@ -59,7 +59,18 @@ FN1 Layer 1
![image](https://user-images.githubusercontent.com/71780717/131719025-d41cbcd9-80b1-4a0a-abb5-55d878752dc6.png)
FN2 Layer 2
![image](https://user-images.githubusercontent.com/71780717/132967003-63268514-2ac3-4069-bca1-6d92992ca403.png)
RGB Layer 5 - Use Shift+Encoder to get to RGB layer 5
![image](https://user-images.githubusercontent.com/71780717/131719492-e2d05a75-3a7a-48ca-94a3-faa3ff891914.png)
--------------
NORMAL / TRADITIONAL NON-LANDSCAPE NUMPAD LAYOUT
![image](https://user-images.githubusercontent.com/71780717/132966975-3b463fb4-059f-42c5-b8b3-a3d35f4a0d6b.png)

View file

@ -160,6 +160,70 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
}
}
}
#ifdef RGB_MATRIX_ENABLE
void encoder_action_rgb_speed(bool clockwise) {
if (clockwise)
rgb_matrix_increase_speed_noeeprom();
else
rgb_matrix_decrease_speed_noeeprom();
}
void encoder_action_rgb_hue(bool clockwise) {
if (clockwise)
rgb_matrix_increase_hue_noeeprom();
else
rgb_matrix_decrease_hue_noeeprom();
}
void encoder_action_rgb_saturation(bool clockwise) {
if (clockwise)
rgb_matrix_increase_sat_noeeprom();
else
rgb_matrix_decrease_sat_noeeprom();
}
void encoder_action_rgb_brightness(bool clockwise) {
if (clockwise)
rgb_matrix_increase_val_noeeprom();
else
rgb_matrix_decrease_val_noeeprom();
}
void encoder_action_rgb_mode(bool clockwise) {
if (clockwise)
rgb_matrix_step_noeeprom();
else
rgb_matrix_step_reverse_noeeprom();
}
#elif defined(RGBLIGHT_ENABLE)
void encoder_action_rgb_speed(bool clockwise) {
if (clockwise)
rgblight_increase_speed_noeeprom();
else
rgblight_decrease_speed_noeeprom();
}
void encoder_action_rgb_hue(bool clockwise) {
if (clockwise)
rgblight_increase_hue_noeeprom();
else
rgblight_decrease_hue_noeeprom();
}
void encoder_action_rgb_saturation(bool clockwise) {
if (clockwise)
rgblight_increase_sat_noeeprom();
else
rgblight_decrease_sat_noeeprom();
}
void encoder_action_rgb_brightness(bool clockwise) {
if (clockwise)
rgblight_increase_val_noeeprom();
else
rgblight_decrease_val_noeeprom();
}
void encoder_action_rgb_mode(bool clockwise) {
if (clockwise)
rgblight_step_noeeprom();
else
rgblight_step_reverse_noeeprom();
}
#endif // RGB_MATRIX_ENABLE || RGBLIGHT_ENABLE
#endif // ENCODER_ENABLE
#if defined(ENCODER_ENABLE) && defined(ENCODER_DEFAULTACTIONS_ENABLE) // Encoder Functionality

View file

@ -36,7 +36,9 @@ enum custom_user_keycodes {
KC_WINLCK, //Toggles Win key on and off
RGB_TOI, // Timeout idle time up
RGB_TOD, // Timeout idle time down
RGB_NITE // Turns off all rgb but allow rgb indicators to work
RGB_NITE, // Turns off all rgb but allow rgb indicators to work
NEW_SAFE_RANGE // new safe range for keymap level custom keycodes
};
#define KC_CAD LALT(LCTL(KC_DEL))
@ -67,6 +69,14 @@ enum custom_user_keycodes {
uint8_t get_selected_layer(void);
void encoder_action_layerchange(bool clockwise);
#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE)
void encoder_action_rgb_speed(bool clockwise);
void encoder_action_rgb_hue(bool clockwise);
void encoder_action_rgb_saturation(bool clockwise);
void encoder_action_rgb_brightness(bool clockwise);
void encoder_action_rgb_mode(bool clockwise);
#endif // RGB_MATRIX_ENABLE / RGBLIGHT_ENABLE
#endif // ENCODER_ENABLE