|
|
@ -27,6 +27,15 @@
|
|
|
|
#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult
|
|
|
|
#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult
|
|
|
|
#include "kaleidoscope/key_defs.h" // for Key, Key_NoKey
|
|
|
|
#include "kaleidoscope/key_defs.h" // for Key, Key_NoKey
|
|
|
|
#include "kaleidoscope/plugin.h" // for Plugin
|
|
|
|
#include "kaleidoscope/plugin.h" // for Plugin
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Deprecation warning messages
|
|
|
|
|
|
|
|
#include "kaleidoscope_internal/deprecations.h" // for DEPRECATED
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define _DEPRECATED_MESSAGE_SPACECADET_TIME_OUT \
|
|
|
|
|
|
|
|
"The `SpaceCadet.time_out` variable is deprecated. Please use the\n" \
|
|
|
|
|
|
|
|
"`SpaceCadet.setTimeout()` function instead.\n" \
|
|
|
|
|
|
|
|
"This variable will be removed after 2022-09-01."
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SPACECADET_MAP_END
|
|
|
|
#ifndef SPACECADET_MAP_END
|
|
|
|
#define SPACECADET_MAP_END \
|
|
|
|
#define SPACECADET_MAP_END \
|
|
|
@ -79,9 +88,27 @@ class SpaceCadet : public kaleidoscope::Plugin {
|
|
|
|
return (mode_ == Mode::ON || mode_ == Mode::NO_DELAY);
|
|
|
|
return (mode_ == Mode::ON || mode_ == Mode::NO_DELAY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef NDEPRECATED
|
|
|
|
// Publically accessible variables
|
|
|
|
// Publically accessible variables
|
|
|
|
|
|
|
|
DEPRECATED(SPACECADET_TIME_OUT)
|
|
|
|
static uint16_t time_out; // The global timeout in milliseconds
|
|
|
|
static uint16_t time_out; // The global timeout in milliseconds
|
|
|
|
static SpaceCadet::KeyBinding *map; // The map of key bindings
|
|
|
|
static SpaceCadet::KeyBinding *map; // The map of key bindings
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setTimeout(uint16_t timeout) {
|
|
|
|
|
|
|
|
#ifndef NDEPRECATED
|
|
|
|
|
|
|
|
#pragma GCC diagnostic push
|
|
|
|
|
|
|
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
|
|
|
|
time_out = timeout;
|
|
|
|
|
|
|
|
#pragma GCC diagnostic pop
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
timeout_ = timeout;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setMap(KeyBinding *bindings) {
|
|
|
|
|
|
|
|
map = bindings;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EventHandlerResult onNameQuery();
|
|
|
|
EventHandlerResult onNameQuery();
|
|
|
|
EventHandlerResult onKeyswitchEvent(KeyEvent &event);
|
|
|
|
EventHandlerResult onKeyswitchEvent(KeyEvent &event);
|
|
|
@ -95,7 +122,17 @@ class SpaceCadet : public kaleidoscope::Plugin {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
uint8_t mode_;
|
|
|
|
uint8_t mode_;
|
|
|
|
|
|
|
|
|
|
|
|
static KeyEventTracker event_tracker_;
|
|
|
|
#ifdef NDEPRECATED
|
|
|
|
|
|
|
|
// Global timeout in milliseconds
|
|
|
|
|
|
|
|
uint16_t timeout_ = 200;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The map of keybindings
|
|
|
|
|
|
|
|
KeyBinding *map = nullptr;
|
|
|
|
|
|
|
|
// When DEPRECATED public `map[]` variable is removed, this variable name
|
|
|
|
|
|
|
|
// should be given a trailing underscore to conform to code style guide.
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KeyEventTracker event_tracker_;
|
|
|
|
|
|
|
|
|
|
|
|
// The maximum number of events in the queue at a time.
|
|
|
|
// The maximum number of events in the queue at a time.
|
|
|
|
static constexpr uint8_t queue_capacity_{4};
|
|
|
|
static constexpr uint8_t queue_capacity_{4};
|
|
|
|