Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request #12 from keyboardio/f/settable-color
Browse files Browse the repository at this point in the history
Allow setting the highlight color & the breathe hue
  • Loading branch information
obra authored Jun 16, 2018
2 parents ff1d59a + 604ebc4 commit 2060a2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Kaleidoscope-NumPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ byte NumPad_::row = 255, NumPad_::col = 255;
uint8_t NumPad_::numPadLayer;
bool NumPad_::cleanupDone = true;
bool NumPad_::originalNumLockState = false;
cRGB numpad_color = CRGB(160, 0, 0);
cRGB NumPad_::color = CRGB(160, 0, 0);
uint8_t NumPad_::lock_hue = 170;

kaleidoscope::EventHandlerResult NumPad_::onSetup(void) {
originalNumLockState = !!(kaleidoscope::hid::getKeyboardLEDs() & LED_NUM_LOCK);
Expand Down Expand Up @@ -57,16 +58,16 @@ kaleidoscope::EventHandlerResult NumPad_::afterEachCycle() {
if ((k != layer_key) || (k == Key_NoKey) || (k.flags != KEY_FLAGS)) {
LEDControl.refreshAt(r, c);
} else {
LEDControl.setCrgbAt(r, c, numpad_color);
LEDControl.setCrgbAt(r, c, color);
}
}
}

if (row > ROWS || col > COLS)
return kaleidoscope::EventHandlerResult::OK;

cRGB color = breath_compute();
LEDControl.setCrgbAt(row, col, color);
cRGB lock_color = breath_compute(lock_hue);
LEDControl.setCrgbAt(row, col, lock_color);

return kaleidoscope::EventHandlerResult::OK;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Kaleidoscope-NumPad.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class NumPad_ : public kaleidoscope::Plugin {
NumPad_(void) {}

static uint8_t numPadLayer;
static cRGB color;
static uint8_t lock_hue;

kaleidoscope::EventHandlerResult onSetup(void);
kaleidoscope::EventHandlerResult afterEachCycle();
Expand Down

0 comments on commit 2060a2a

Please sign in to comment.