|
|
|
@ -3,31 +3,22 @@
|
|
|
|
|
#include "Kaleidoscope.h"
|
|
|
|
|
#include "layers.h"
|
|
|
|
|
|
|
|
|
|
uint8_t NumLock_::previousLEDMode;
|
|
|
|
|
uint8_t NumLock_::us;
|
|
|
|
|
bool NumLock_::isActive;
|
|
|
|
|
byte NumLock_::row = 255, NumLock_::col = 255;
|
|
|
|
|
cRGB numpad_color;
|
|
|
|
|
cRGB numpad_color = CRGB(255, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NumLock_::NumLock_(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
NumLock_::begin(void) {
|
|
|
|
|
us = LEDControl.mode_add(this);
|
|
|
|
|
numpad_color.r = 255;
|
|
|
|
|
void NumLock_::begin(void) {
|
|
|
|
|
loop_hook_use(loopHook);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
NumLock_::init(void) {
|
|
|
|
|
if (!isActive) {
|
|
|
|
|
LEDControl.next_mode();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void NumLock_::loopHook(bool postClear) {
|
|
|
|
|
if (!postClear || !isActive)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
NumLock_::update(void) {
|
|
|
|
|
for (uint8_t r = 0; r < ROWS; r++) {
|
|
|
|
|
for (uint8_t c = 0; c < COLS; c++) {
|
|
|
|
|
Key k = Layer.lookup(r, c);
|
|
|
|
@ -46,21 +37,17 @@ NumLock_::update(void) {
|
|
|
|
|
LEDControl.led_set_crgb_at(row, col, color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const macro_t *
|
|
|
|
|
NumLock_::toggle(byte row_, byte col_, uint8_t numPadLayer) {
|
|
|
|
|
const macro_t *NumLock_::toggle(byte row_, byte col_, uint8_t numPadLayer) {
|
|
|
|
|
row = row_;
|
|
|
|
|
col = col_;
|
|
|
|
|
|
|
|
|
|
if (Layer.isOn(numPadLayer)) {
|
|
|
|
|
isActive = false;
|
|
|
|
|
LEDControl.set_mode(previousLEDMode);
|
|
|
|
|
Layer.off(numPadLayer);
|
|
|
|
|
LEDControl.init_mode();
|
|
|
|
|
} else {
|
|
|
|
|
isActive = true;
|
|
|
|
|
previousLEDMode = LEDControl.get_mode();
|
|
|
|
|
LEDControl.set_mode(us);
|
|
|
|
|
Layer.on(numPadLayer);
|
|
|
|
|
}
|
|
|
|
|
isActive = Layer.isOn(numPadLayer);
|
|
|
|
|
|
|
|
|
|
return MACRO(T(KeypadNumLock), END);
|
|
|
|
|
}
|
|
|
|
|