diff options
Diffstat (limited to 'keyboards/mechwild/murphpad/keymaps/jonavin/keymap.c')
-rw-r--r-- | keyboards/mechwild/murphpad/keymaps/jonavin/keymap.c | 128 |
1 files changed, 111 insertions, 17 deletions
diff --git a/keyboards/mechwild/murphpad/keymaps/jonavin/keymap.c b/keyboards/mechwild/murphpad/keymaps/jonavin/keymap.c index 39e6ac87e4..dc03e334bf 100644 --- a/keyboards/mechwild/murphpad/keymaps/jonavin/keymap.c +++ b/keyboards/mechwild/murphpad/keymaps/jonavin/keymap.c @@ -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(); + oled_off(); + rgblight_disable_noeeprom(); + } + + void suspend_wakeup_init_user(void) { + rgblight_enable_noeeprom(); } #endif |