Move Mouse & AbsoluteMouse initialization to MouseWrapper.begin

To avoid issues with static initialization order, move the Mouse & AbsoluteMouse
initialization from the MouseWrapper constructor to MouseWrapper.begin, which
will be called from MouseKeys.begin. Thus, user code does not need to change.

This fixes keyboardio/Kaleidoscope#140.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/365/head
Gergely Nagy 7 years ago
parent 5e79b16923
commit 65fee12dad

@ -112,6 +112,7 @@ MouseKeys_::MouseKeys_(void) {
void
MouseKeys_::begin(void) {
MouseWrapper.begin();
event_handler_hook_use(eventHandlerHook);
loop_hook_use(loopHook);
}

@ -14,6 +14,9 @@ boolean MouseWrapper_::is_warping;
uint8_t MouseWrapper_::accelStep;
MouseWrapper_::MouseWrapper_(void) {
}
void MouseWrapper_::begin(void) {
kaleidoscope::hid::initializeMouse();
kaleidoscope::hid::initializeAbsoluteMouse();
}

@ -31,6 +31,7 @@ class MouseWrapper_ {
public:
MouseWrapper_(void);
static void begin(void);
static void move(int8_t x, int8_t y);
static void warp(uint8_t warp_cmd);
static void pressButton(uint8_t button);

Loading…
Cancel
Save