Add a FnLock key

Implement a FnLock toggle that behaves as follows:

- Disabled: F1-F12 are normal
- Enabled: F1-F12 are the alternate function

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2023-07-21 09:40:43 -06:00
committed by Jeremy Soller
parent b63e2092ce
commit 01907011bb
9 changed files with 150 additions and 0 deletions

View File

@ -3,6 +3,8 @@
#include <board/flash.h>
#include <board/keymap.h>
bool keymap_fnlock = false;
uint16_t __xdata DYNAMIC_KEYMAP[KM_LAY][KM_OUT][KM_IN];
// Config is in the last sector of flash
@ -69,6 +71,8 @@ bool keymap_save_config(void) {
bool keymap_get(uint8_t layer, uint8_t output, uint8_t input, uint16_t *value) {
if (layer < KM_LAY && output < KM_OUT && input < KM_IN) {
if (keymap_fnlock && keymap_is_f_key(output, input))
layer ^= 1;
*value = DYNAMIC_KEYMAP[layer][output][input];
return true;
} else {