mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +00:00
Added custom switch matrix and Changed the encoder built-in push button functionality logic as suggested by QMK maintainer in Pull Request.
This commit is contained in:
parent
c6d1aa0ec9
commit
09ba0009e0
@ -28,15 +28,15 @@ enum protokeeb_keymap_layers {
|
||||
#define LOWER LT(LAYER_LOWER, KC_KP_0)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[LAYER_BASE] = LAYOUT_ortho_4x4( /* Base */
|
||||
KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_SLASH,
|
||||
[LAYER_BASE] = LAYOUT_custom_matrix( /* Base */
|
||||
KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_SLASH, KC_MUTE,
|
||||
KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_ASTERISK,
|
||||
KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_MINUS,
|
||||
LOWER, KC_KP_DOT, KC_KP_ENTER, KC_KP_PLUS
|
||||
),
|
||||
|
||||
[LAYER_LOWER] = LAYOUT_ortho_4x4( /* RGB Control */
|
||||
RGB_MODE_PLAIN, RGB_MODE_FORWARD, RGB_MODE_REVERSE, RGB_TOG,
|
||||
[LAYER_LOWER] = LAYOUT_custom_matrix( /* RGB Control */
|
||||
RGB_MODE_PLAIN, RGB_MODE_FORWARD, RGB_MODE_REVERSE, RGB_TOG, KC_MUTE,
|
||||
RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD,
|
||||
RGB_VAI, RGB_VAD, RGB_SPI, RGB_SPD,
|
||||
KC_TRNS, RGB_MODE_SWIRL, QK_DEBUG_TOGGLE, QK_BOOT
|
||||
|
@ -33,29 +33,29 @@ enum protokeeb_keymap_layers {
|
||||
#define RGB_CTRL MO(LAYER_RGB_CONTROL)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[LAYER_NOTES_SET_1] = LAYOUT_ortho_4x4( /* Notes Set-1 */
|
||||
MI_C, MI_Cs, MI_D, MI_Ds,
|
||||
[LAYER_NOTES_SET_1] = LAYOUT_custom_matrix( /* Notes Set-1 */
|
||||
MI_C, MI_Cs, MI_D, MI_Ds, KC_MUTE,
|
||||
MI_E, MI_F, MI_Fs, MI_G,
|
||||
MI_Gs, MI_A, MI_As, MI_B,
|
||||
RGB_CTRL, NOTES_SET_2, NOTES_SET_3, MI_TOGG
|
||||
),
|
||||
|
||||
[LAYER_NOTES_SET_2] = LAYOUT_ortho_4x4( /* Notes Set-2 */
|
||||
MI_C1, MI_Cs1, MI_D1, MI_Ds1,
|
||||
[LAYER_NOTES_SET_2] = LAYOUT_custom_matrix( /* Notes Set-2 */
|
||||
MI_C1, MI_Cs1, MI_D1, MI_Ds1, KC_MUTE,
|
||||
MI_E1, MI_F1, MI_Fs1, MI_G1,
|
||||
MI_Gs1, MI_A1, MI_As1, MI_B1,
|
||||
NOTES_SET_1, KC_TRNS, NOTES_SET_3, KC_TRNS
|
||||
),
|
||||
|
||||
[LAYER_NOTES_SET_3] = LAYOUT_ortho_4x4( /* Notes Set-3 */
|
||||
MI_C2, MI_Cs2, MI_D2, MI_Ds2,
|
||||
[LAYER_NOTES_SET_3] = LAYOUT_custom_matrix( /* Notes Set-3 */
|
||||
MI_C2, MI_Cs2, MI_D2, MI_Ds2, KC_MUTE,
|
||||
MI_E2, MI_F2, MI_Fs2, MI_G2,
|
||||
MI_Gs2, MI_A2, MI_As2, MI_B2,
|
||||
NOTES_SET_1, NOTES_SET_2, KC_TRNS, KC_TRNS
|
||||
),
|
||||
|
||||
[LAYER_RGB_CONTROL] = LAYOUT_ortho_4x4( /* RGB Control */
|
||||
RGB_MODE_PLAIN, RGB_MODE_FORWARD, RGB_MODE_REVERSE, RGB_TOG,
|
||||
[LAYER_RGB_CONTROL] = LAYOUT_custom_matrix( /* RGB Control */
|
||||
RGB_MODE_PLAIN, RGB_MODE_FORWARD, RGB_MODE_REVERSE, RGB_TOG, KC_MUTE,
|
||||
RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD,
|
||||
RGB_VAI, RGB_VAD, RGB_SPI, RGB_SPD,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, QK_BOOT
|
||||
@ -69,4 +69,4 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[LAYER_NOTES_SET_3] = { ENCODER_CCW_CW(MI_TRSD, MI_TRSU) },
|
||||
[LAYER_RGB_CONTROL] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI) },
|
||||
};
|
||||
#endif
|
||||
#endif
|
@ -28,19 +28,19 @@ enum protokeeb_keymap_layers {
|
||||
#define LOWER LT(LAYER_LOWER, KC_KP_0)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[LAYER_BASE] = LAYOUT_ortho_4x4( /* Base */
|
||||
KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_SLASH,
|
||||
[LAYER_BASE] = LAYOUT_custom_matrix( /* Base */
|
||||
KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_SLASH, KC_MUTE,
|
||||
KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_ASTERISK,
|
||||
KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_MINUS,
|
||||
LOWER, KC_KP_DOT, KC_KP_ENTER, KC_KP_PLUS
|
||||
),
|
||||
|
||||
[LAYER_LOWER] = LAYOUT_ortho_4x4( /* RGB Control */
|
||||
RGB_MODE_PLAIN, RGB_MODE_FORWARD, RGB_MODE_REVERSE, RGB_TOG,
|
||||
[LAYER_LOWER] = LAYOUT_custom_matrix( /* RGB Control */
|
||||
RGB_MODE_PLAIN, RGB_MODE_FORWARD, RGB_MODE_REVERSE, RGB_TOG, KC_MUTE,
|
||||
RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD,
|
||||
RGB_VAI, RGB_VAD, RGB_SPI, RGB_SPD,
|
||||
KC_TRNS, RGB_MODE_SWIRL, QK_DEBUG_TOGGLE, QK_BOOT
|
||||
)
|
||||
),
|
||||
};
|
||||
|
||||
#if defined(ENCODER_MAP_ENABLE)
|
||||
|
@ -16,6 +16,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// Define the pin connected to the encoder push button
|
||||
#define ENCODER_BUTTON_PIN GP14
|
||||
|
||||
// Define the row and column for the encoder button
|
||||
#define ENCODER_BUTTON_ROW 0
|
||||
#define ENCODER_BUTTON_COL 4
|
||||
|
||||
/* ARGB LED Byte order */
|
||||
#define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_RGB
|
||||
|
||||
@ -45,4 +52,4 @@
|
||||
|
||||
#if defined (ENCODER_ENABLE)
|
||||
#define ENCODER_MAP_KEY_DELAY 10
|
||||
#endif
|
||||
#endif
|
@ -9,10 +9,6 @@
|
||||
"bootloader": "rp2040",
|
||||
"debounce": 20,
|
||||
"diode_direction": "COL2ROW",
|
||||
"dip_switch": {
|
||||
"enabled": true,
|
||||
"pins": ["GP14"]
|
||||
},
|
||||
"encoder": {
|
||||
"rotary": [{ "pin_a": "GP12", "pin_b": "GP13", "resolution": 2 }]
|
||||
},
|
||||
@ -24,7 +20,7 @@
|
||||
"rgblight": true
|
||||
},
|
||||
"matrix_pins": {
|
||||
"cols": ["GP6", "GP7", "GP8", "GP9"],
|
||||
"cols": ["GP6", "GP7", "GP8", "GP9", "GP14"],
|
||||
"rows": ["GP2", "GP3", "GP4", "GP5"]
|
||||
},
|
||||
"processor": "RP2040",
|
||||
@ -67,12 +63,13 @@
|
||||
"pin": "GP10"
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT_ortho_4x4": {
|
||||
"LAYOUT_custom_matrix": {
|
||||
"layout": [
|
||||
{ "label": "7", "matrix": [0, 0], "x": 0, "y": 0 },
|
||||
{ "label": "8", "matrix": [0, 1], "x": 1, "y": 0 },
|
||||
{ "label": "9", "matrix": [0, 2], "x": 2, "y": 0 },
|
||||
{ "label": "/", "matrix": [0, 3], "x": 3, "y": 0 },
|
||||
{ "label": "MUTE", "matrix": [0, 4], "x": 4, "y": 0 },
|
||||
{ "label": "4", "matrix": [1, 0], "x": 0, "y": 1 },
|
||||
{ "label": "5", "matrix": [1, 1], "x": 1, "y": 1 },
|
||||
{ "label": "6", "matrix": [1, 2], "x": 2, "y": 1 },
|
||||
|
@ -16,20 +16,18 @@
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#if defined(DIP_SWITCH_ENABLE)
|
||||
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||
if (!dip_switch_update_user(index, active)) {
|
||||
return false;
|
||||
// Override the matrix read function to include the encoder button
|
||||
void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||
{
|
||||
if (current_row == ENCODER_BUTTON_ROW)
|
||||
{
|
||||
if (readPin(ENCODER_BUTTON_PIN) == 0)
|
||||
{
|
||||
current_matrix[current_row] |= (1 << ENCODER_BUTTON_COL);
|
||||
}
|
||||
else
|
||||
{
|
||||
current_matrix[current_row] &= ~(1 << ENCODER_BUTTON_COL);
|
||||
}
|
||||
}
|
||||
switch (index) {
|
||||
case 0:
|
||||
// Encoder Push Button Pressed
|
||||
if (active) {
|
||||
// Toggle Host Mute
|
||||
tap_code(KC_MUTE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
Loading…
Reference in New Issue
Block a user