Updated to use the new plugin API

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/365/head
Gergely Nagy 7 years ago
parent b565dab644
commit dbb4152cb2

@ -13,22 +13,26 @@
TestMode_::TestMode_(void) { #if KALEIDOSCOPE_ENABLE_V1_PLUGIN_API
void TestMode_::begin(void) {
Kaleidoscope.useLoopHook(this->legacyLoopHook);
} }
void TestMode_::legacyLoopHook(bool is_post_clear) {
if (is_post_clear)
return;
void TestMode_::begin(void) { TestMode.beforeReportingState();
Kaleidoscope.useLoopHook(this->loopHook);
} }
#endif
void TestMode_::loopHook(bool postClear) { kaleidoscope::EventHandlerResult TestMode_::beforeReportingState() {
if (postClear)
return;
if (KeyboardHardware.leftHandState.all == TEST_MODE_KEY_COMBO if (KeyboardHardware.leftHandState.all == TEST_MODE_KEY_COMBO
// && KeyboardHardware.rightHandState.all == combo.rightHand // && KeyboardHardware.rightHandState.all == combo.rightHand
) { ) {
run_tests(); run_tests();
} }
return kaleidoscope::EventHandlerResult::OK;
} }
void TestMode_::waitForKeypress() { void TestMode_::waitForKeypress() {

@ -12,10 +12,17 @@ typedef struct {
uint32_t badKeys; uint32_t badKeys;
} side_data_t; } side_data_t;
class TestMode_ : public KaleidoscopePlugin { class TestMode_ : public kaleidoscope::Plugin {
public: public:
TestMode_(void); TestMode_(void) {};
kaleidoscope::EventHandlerResult beforeReportingState();
#if KALEIDOSCOPE_ENABLE_V1_PLUGIN_API
protected:
void begin(); void begin();
static void legacyLoopHook(bool is_post_clear);
#endif
private: private:
static void run_tests(); static void run_tests();
@ -24,7 +31,6 @@ class TestMode_ : public KaleidoscopePlugin {
static void toggle_programming_leds_on(); static void toggle_programming_leds_on();
static void handleKeyEvent(side_data_t *side, keydata_t *oldState, keydata_t *newState, uint8_t row, uint8_t col, uint8_t col_offset); static void handleKeyEvent(side_data_t *side, keydata_t *oldState, keydata_t *newState, uint8_t row, uint8_t col, uint8_t col_offset);
static void waitForKeypress(); static void waitForKeypress();
static void loopHook(bool postClear);
static void set_leds(cRGB color); static void set_leds(cRGB color);
}; };

Loading…
Cancel
Save