Drop the V1 plugin API compatibility code

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/365/head
Gergely Nagy 6 years ago
parent 03801306cd
commit bcac993d0a

@ -20,12 +20,6 @@ kaleidoscope::EventHandlerResult LEDMode::onSetup() {
return EventHandlerResult::OK; return EventHandlerResult::OK;
} }
#if KALEIDOSCOPE_ENABLE_V1_PLUGIN_API
void LEDMode::begin() {
onSetup();
}
#endif
LEDControl::LEDControl(void) { LEDControl::LEDControl(void) {
mode = 0; mode = 0;
memset(modes, 0, LED_MAX_MODES * sizeof(modes[0])); memset(modes, 0, LED_MAX_MODES * sizeof(modes[0]));
@ -258,29 +252,6 @@ bool LEDControl::focusHook(const char *command) {
return true; return true;
} }
// Legacy V1 API
#if KALEIDOSCOPE_ENABLE_V1_PLUGIN_API
void LEDControl::begin() {
::LEDControl.onSetup();
Kaleidoscope.useEventHandlerHook(legacyEventHandler);
Kaleidoscope.useLoopHook(legacyLoopHook);
}
Key LEDControl::legacyEventHandler(Key mapped_key, byte row, byte col, uint8_t key_state) {
EventHandlerResult r = ::LEDControl.onKeyswitchEvent(mapped_key, row, col, key_state);
if (r == EventHandlerResult::OK)
return mapped_key;
return Key_NoKey;
}
void LEDControl::legacyLoopHook(bool is_post_clear) {
if (is_post_clear)
return;
::LEDControl.beforeReportingState();
}
#endif
} }
kaleidoscope::LEDControl LEDControl; kaleidoscope::LEDControl LEDControl;

@ -82,10 +82,6 @@ class LEDMode : public kaleidoscope::Plugin {
* necessary initialization steps. Calls @ref setup at the end. * necessary initialization steps. Calls @ref setup at the end.
*/ */
kaleidoscope::EventHandlerResult onSetup(); kaleidoscope::EventHandlerResult onSetup();
#if KALEIDOSCOPE_ENABLE_V1_PLUGIN_API
void begin();
#endif
}; };
class LEDControl : public kaleidoscope::Plugin { class LEDControl : public kaleidoscope::Plugin {
@ -136,13 +132,6 @@ class LEDControl : public kaleidoscope::Plugin {
kaleidoscope::EventHandlerResult onKeyswitchEvent(Key &mappedKey, byte row, byte col, uint8_t keyState); kaleidoscope::EventHandlerResult onKeyswitchEvent(Key &mappedKey, byte row, byte col, uint8_t keyState);
kaleidoscope::EventHandlerResult beforeReportingState(); kaleidoscope::EventHandlerResult beforeReportingState();
#if KALEIDOSCOPE_ENABLE_V1_PLUGIN_API
protected:
void begin();
static Key legacyEventHandler(Key mapped_key, byte row, byte col, uint8_t key_state);
static void legacyLoopHook(bool is_post_clear);
#endif
private: private:
static uint16_t syncTimer; static uint16_t syncTimer;
static LEDMode *modes[LED_MAX_MODES]; static LEDMode *modes[LED_MAX_MODES];

Loading…
Cancel
Save