Swapped TAB and ESC. Code cleanup

This commit is contained in:
Christoffer Martinsson 2023-05-29 20:50:51 +02:00
parent 7145eb582f
commit 2179cc47d5
2 changed files with 10 additions and 9 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
firmware/compile_commands.json
firmware/.cache/clangd/index

View File

@ -71,8 +71,8 @@
#define KEY_OFFSET 0xAA00 // Offset to apply for not interfere with already defined keyboard keys #define KEY_OFFSET 0xAA00 // Offset to apply for not interfere with already defined keyboard keys
#define KEY_FN1 10 + KEY_OFFSET // Function layer 1 button #define KEY_FN1 10 + KEY_OFFSET // Function layer 1 button
#define KEY_FN2 11 + KEY_OFFSET // Function layer 2 button #define KEY_FN2 11 + KEY_OFFSET // Function layer 2 button
#define KEY_WIN_LATCH 12 + KEY_OFFSET // Function layer 2 button #define KEY_WIN_LATCH 12 + KEY_OFFSET // Function layer 2 button
#define TAP_TIMEOUT 150 // Key tap timeout (ms) #define TAP_TIMEOUT 150 // Key tap timeout (ms)
@ -99,12 +99,12 @@ char kp_keys[KP_ROWS][KP_COLS] = {
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},
{13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}, {13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24},
{25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36}, {25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36},
{0, 0, 0, 37, 38, 39, 40, 41, 42, 0, 0, 0}}; {0, 0, 0, 37, 38, 39, 40, 41, 42, 0, 0, 0},
};
Keypad kp_keypad = Keypad(makeKeymap(kp_keys), kp_rowPins, kp_colPins, KP_ROWS, KP_COLS); Keypad kp_keypad = Keypad(makeKeymap(kp_keys), kp_rowPins, kp_colPins, KP_ROWS, KP_COLS);
/*
/*
* "Button ID" corresponding with the physical design of the actual keyboard. DO NOT CHANGE BTN ID! * "Button ID" corresponding with the physical design of the actual keyboard. DO NOT CHANGE BTN ID!
------------------------------------- ------------------------------------- ------------------------------------- -------------------------------------
@ -116,14 +116,14 @@ Keypad kp_keypad = Keypad(makeKeymap(kp_keys), kp_rowPins, kp_colPins, KP_ROWS,
* "Fn0 key" is the layer 0 key to use. * "Fn0 key" is the layer 0 key to use.
* "Fn1 key" is the layer 1 key to use. Don NOT add KEY_FN1 or KEY_FN2 to this layer. * "Fn1 key" is the layer 1 key to use. Don NOT add KEY_FN1 or KEY_FN2 to this layer.
* "Fn2 key" is the layer 2 key to use. Don NOT add KEY_FN1 or KEY_FN2 to this layer. * "Fn2 key" is the layer 2 key to use. Don NOT add KEY_FN1 or KEY_FN2 to this layer.
/* Keymap config ----------------------------------------------------------------------------------------------------------------------------------- */ /* Keymap config ----------------------------------------------------------------------------------------------------------------------------------- */
// clang-format off // clang-format off
Button buttons[NBR_OF_BUTTONS] = Button buttons[NBR_OF_BUTTONS] =
{ {
/* Btn ID Fn0 (hold) key Fn1 key Fn2 key */ /* Btn ID Fn0 (hold) key Fn1 key Fn2 key */
{1, KEY_ESC, KEY_TAB, KEY_F11, IDLE, NO_KEY, false}, {1, KEY_TAB, KEY_ESC, KEY_F11, IDLE, NO_KEY, false},
{2, KEY_Q, KEY_F1, KEY_F12, IDLE, NO_KEY, false}, {2, KEY_Q, KEY_F1, KEY_F12, IDLE, NO_KEY, false},
{3, KEY_W, KEY_F2, KEY_F13, IDLE, NO_KEY, false}, {3, KEY_W, KEY_F2, KEY_F13, IDLE, NO_KEY, false},
{4, KEY_E, KEY_F3, KEY_F14, IDLE, NO_KEY, false}, {4, KEY_E, KEY_F3, KEY_F14, IDLE, NO_KEY, false},
@ -243,7 +243,6 @@ void scan_buttons()
/* Scan keypad */ /* Scan keypad */
if (kp_keypad.getKeys()) if (kp_keypad.getKeys())
{ {
/* Enter bootloader if all four corner-buttons is pressed together */ /* Enter bootloader if all four corner-buttons is pressed together */
int reboot = 0; int reboot = 0;
for (int i = 0; i < LIST_MAX; i++) for (int i = 0; i < LIST_MAX; i++)
@ -290,7 +289,7 @@ void scan_buttons()
} }
} }
} }
/* Process key press/release */ /* Process key press/release */
for (int i = 0; i < LIST_MAX; i++) for (int i = 0; i < LIST_MAX; i++)
{ {