2022-06-03 04:44:09 +00:00
|
|
|
#include "LayerBasedTheme.h"
|
|
|
|
|
|
|
|
#include "kaleidoscope/layers.h"
|
|
|
|
#include "kaleidoscope/plugin/LEDControl.h"
|
|
|
|
|
|
|
|
namespace kaleidoscope {
|
|
|
|
namespace plugin {
|
2022-06-05 05:24:33 +00:00
|
|
|
EventHandlerResult LayerBasedTheme::onLayerChange() {
|
|
|
|
uint8_t current_layer = Layer.mostRecent();
|
|
|
|
uint8_t current_mode = ::LEDControl.get_mode_index();
|
|
|
|
uint8_t new_mode;
|
2022-06-03 04:44:09 +00:00
|
|
|
|
2022-06-05 05:24:33 +00:00
|
|
|
if (current_layer <= 3) {
|
|
|
|
new_mode = 2;
|
|
|
|
} else {
|
|
|
|
new_mode = 3;
|
|
|
|
}
|
2022-06-03 04:44:09 +00:00
|
|
|
|
2022-06-05 05:24:33 +00:00
|
|
|
if (new_mode != current_mode) {
|
|
|
|
::LEDControl.set_mode(new_mode);
|
|
|
|
}
|
2022-06-03 04:44:09 +00:00
|
|
|
|
2022-06-05 05:24:33 +00:00
|
|
|
return EventHandlerResult::OK;
|
|
|
|
}
|
2022-06-03 04:44:09 +00:00
|
|
|
|
2022-06-05 05:24:33 +00:00
|
|
|
LayerBasedTheme::TransientLEDMode::TransientLEDMode(
|
|
|
|
const LayerBasedTheme *parent)
|
|
|
|
: parent_(parent){};
|
2022-06-03 04:44:09 +00:00
|
|
|
} // namespace plugin
|
|
|
|
} // namespace kaleidoscope
|
|
|
|
|
|
|
|
kaleidoscope::plugin::LayerBasedTheme LayerBasedTheme;
|