|
|
@ -36,32 +36,30 @@ static bool getNumlockState() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void syncNumlock(bool state) {
|
|
|
|
static void syncNumlock(bool state) {
|
|
|
|
bool numState = getNumlockState();
|
|
|
|
bool numLockLEDState = getNumlockState();
|
|
|
|
if (numState != state) {
|
|
|
|
if (numLockLEDState != state) {
|
|
|
|
kaleidoscope::hid::pressKey(Key_KeypadNumLock);
|
|
|
|
kaleidoscope::hid::pressKey(Key_KeypadNumLock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kaleidoscope::EventHandlerResult NumPad_::afterEachCycle() {
|
|
|
|
|
|
|
|
if (!Layer.isOn(numPadLayer)) {
|
|
|
|
|
|
|
|
bool numState = getNumlockState();
|
|
|
|
void NumPad_::cleanupNumlockState() {
|
|
|
|
|
|
|
|
bool numLockLEDState = getNumlockState();
|
|
|
|
if (!cleanupDone) {
|
|
|
|
if (!cleanupDone) {
|
|
|
|
LEDControl.set_mode(LEDControl.get_mode_index());
|
|
|
|
LEDControl.set_mode(LEDControl.get_mode_index());
|
|
|
|
|
|
|
|
|
|
|
|
if (!originalNumLockState) {
|
|
|
|
if (!originalNumLockState) {
|
|
|
|
syncNumlock(false);
|
|
|
|
syncNumlock(false);
|
|
|
|
numState = false;
|
|
|
|
numLockLEDState = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cleanupDone = true;
|
|
|
|
cleanupDone = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
originalNumLockState = numState;
|
|
|
|
originalNumLockState = numLockLEDState;
|
|
|
|
|
|
|
|
|
|
|
|
return kaleidoscope::EventHandlerResult::OK;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cleanupDone = false;
|
|
|
|
void NumPad_::setKeyboardLEDColors(void) {
|
|
|
|
syncNumlock(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LEDControl.set_mode(LEDControl.get_mode_index());
|
|
|
|
LEDControl.set_mode(LEDControl.get_mode_index());
|
|
|
|
|
|
|
|
|
|
|
|
for (uint8_t r = 0; r < ROWS; r++) {
|
|
|
|
for (uint8_t r = 0; r < ROWS; r++) {
|
|
|
@ -82,12 +80,28 @@ kaleidoscope::EventHandlerResult NumPad_::afterEachCycle() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((numpad_lock_key_row > ROWS) || (numpad_lock_key_col > COLS)) {
|
|
|
|
if ((numpad_lock_key_row <= ROWS) && (numpad_lock_key_col <= COLS)) {
|
|
|
|
return kaleidoscope::EventHandlerResult::OK;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cRGB lock_color = breath_compute(lock_hue);
|
|
|
|
LEDControl.setCrgbAt(numpad_lock_key_row, numpad_lock_key_col, lock_color);
|
|
|
|
LEDControl.setCrgbAt(numpad_lock_key_row, numpad_lock_key_col, lock_color);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kaleidoscope::EventHandlerResult NumPad_::afterEachCycle() {
|
|
|
|
|
|
|
|
if (!Layer.isOn(numPadLayer)) {
|
|
|
|
|
|
|
|
cleanupNumlockState();
|
|
|
|
return kaleidoscope::EventHandlerResult::OK;
|
|
|
|
return kaleidoscope::EventHandlerResult::OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanupDone = false;
|
|
|
|
|
|
|
|
syncNumlock(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setKeyboardLEDColors();
|
|
|
|
|
|
|
|
return kaleidoscope::EventHandlerResult::OK;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NumPad_ NumPad;
|
|
|
|
NumPad_ NumPad;
|
|
|
|