Move layer handling back to keyboard_layout.c
And while there, also drop the helper functions, and just do the activation in the handler function. This simplifies the code a bit, as there is little point in lifting out an assignment into a function at this time. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
static uint8_t keyMasks[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
|
||||
|
||||
uint8_t ActiveLayer = LAYER_ID_BASE;
|
||||
uint8_t prevKeyStates[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
|
||||
|
||||
static inline __attribute__((always_inline)) uhk_key_t getKeycode(uint8_t slotId, uint8_t keyId)
|
||||
@@ -76,10 +77,10 @@ bool handleKey(uhk_key_t key, int scancodeIdx, usb_keyboard_report_t *report, co
|
||||
break;
|
||||
case UHK_KEY_LAYER:
|
||||
if (key_toggled_on(prevKeyStates, currKeyStates, keyId)) {
|
||||
Layer_MoveTo(key.layer.target);
|
||||
ActiveLayer = layer;
|
||||
}
|
||||
if (key_toggled_off(prevKeyStates, currKeyStates, keyId)) {
|
||||
Layer_MoveToBase();
|
||||
ActiveLayer = LAYER_ID_BASE;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#include "layer.h"
|
||||
|
||||
uint8_t ActiveLayer = LAYER_ID_BASE;
|
||||
|
||||
void Layer_MoveTo(uint8_t layer) {
|
||||
ActiveLayer = layer;
|
||||
}
|
||||
|
||||
void Layer_MoveToBase() {
|
||||
Layer_MoveTo(LAYER_ID_BASE);
|
||||
}
|
||||
@@ -14,7 +14,4 @@
|
||||
|
||||
extern uint8_t ActiveLayer;
|
||||
|
||||
void Layer_MoveTo(uint8_t layer);
|
||||
void Layer_MoveToBase();
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user