|
|
@ -20,16 +20,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include <Kaleidoscope.h>
|
|
|
|
#include <Kaleidoscope.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SPACECADET_MAP_END
|
|
|
|
|
|
|
|
#define SPACECADET_MAP_END {Key_NoKey, Key_NoKey, 0}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
namespace kaleidoscope {
|
|
|
|
namespace kaleidoscope {
|
|
|
|
|
|
|
|
//Declaration for the method (implementing KaleidoscopePlugin)
|
|
|
|
|
|
|
|
class SpaceCadet : public KaleidoscopePlugin {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
//Empty constructor
|
|
|
|
|
|
|
|
SpaceCadet(void) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Methods
|
|
|
|
|
|
|
|
void begin(void) final;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Publically accessible variables
|
|
|
|
|
|
|
|
static uint16_t time_out; // The global timeout in milliseconds
|
|
|
|
|
|
|
|
static KeyBinding * map; // The map of key bindings
|
|
|
|
|
|
|
|
|
|
|
|
//Declarations for the modifier key mapping
|
|
|
|
//Declarations for the modifier key mapping
|
|
|
|
class ModifierKeyMap {
|
|
|
|
class KeyBinding {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
//Empty constructor; set the vars separately
|
|
|
|
//Empty constructor; set the vars separately
|
|
|
|
ModifierKeyMap(void);
|
|
|
|
KeyBinding(void) {}
|
|
|
|
//Constructor with input and output
|
|
|
|
//Constructor with input and output
|
|
|
|
ModifierKeyMap(Key input_, Key output_);
|
|
|
|
KeyBinding(Key input_, Key output_);
|
|
|
|
//Constructor with all three set
|
|
|
|
//Constructor with all three set
|
|
|
|
ModifierKeyMap(Key input_, Key output_, uint16_t timeout_);
|
|
|
|
KeyBinding(Key input_, Key output_, uint16_t timeout_);
|
|
|
|
//The key that is pressed
|
|
|
|
//The key that is pressed
|
|
|
|
Key input;
|
|
|
|
Key input;
|
|
|
|
//the key that is sent
|
|
|
|
//the key that is sent
|
|
|
@ -41,22 +58,7 @@ class ModifierKeyMap {
|
|
|
|
//the start time for this key press
|
|
|
|
//the start time for this key press
|
|
|
|
uint32_t start_time = 0;
|
|
|
|
uint32_t start_time = 0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//Declaration for the method (implementing KaleidoscopePlugin)
|
|
|
|
|
|
|
|
class SpaceCadet : public KaleidoscopePlugin {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
//Empty constructor
|
|
|
|
|
|
|
|
SpaceCadet(void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Methods
|
|
|
|
|
|
|
|
void setMap(ModifierKeyMap * map, uint8_t map_size);
|
|
|
|
|
|
|
|
void begin(void) final;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint16_t time_out;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
static uint8_t map_size_;
|
|
|
|
|
|
|
|
static ModifierKeyMap * map_;
|
|
|
|
|
|
|
|
static Key eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_state);
|
|
|
|
static Key eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_state);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|