make astyle

pull/389/head
Jesse Vincent 8 years ago
parent 903230ec14
commit 14d236ed39
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -22,26 +22,26 @@
using namespace KaleidoscopePlugins::Ranges; using namespace KaleidoscopePlugins::Ranges;
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
// --- state --- // --- state ---
Key Cycle::lastNonCycleKey; Key Cycle::lastNonCycleKey;
uint8_t Cycle::cycleCount; uint8_t Cycle::cycleCount;
// --- helpers --- // --- helpers ---
#define isCycle(k) (k.raw == CYCLE) #define isCycle(k) (k.raw == CYCLE)
// --- api --- // --- api ---
Cycle::Cycle (void) { Cycle::Cycle (void) {
} }
void void
Cycle::begin (void) { Cycle::begin (void) {
event_handler_hook_use (this->eventHandlerHook); event_handler_hook_use (this->eventHandlerHook);
} }
void void
Cycle::replace (Key key) { Cycle::replace (Key key) {
handle_keyswitch_event (Key_Backspace, UNKNOWN_KEYSWITCH_LOCATION, IS_PRESSED | INJECTED); handle_keyswitch_event (Key_Backspace, UNKNOWN_KEYSWITCH_LOCATION, IS_PRESSED | INJECTED);
Keyboard.sendReport (); Keyboard.sendReport ();
handle_keyswitch_event (Key_Backspace, UNKNOWN_KEYSWITCH_LOCATION, WAS_PRESSED | INJECTED); handle_keyswitch_event (Key_Backspace, UNKNOWN_KEYSWITCH_LOCATION, WAS_PRESSED | INJECTED);
@ -51,21 +51,21 @@ namespace KaleidoscopePlugins {
Keyboard.sendReport (); Keyboard.sendReport ();
handle_keyswitch_event (key, UNKNOWN_KEYSWITCH_LOCATION, WAS_PRESSED | INJECTED); handle_keyswitch_event (key, UNKNOWN_KEYSWITCH_LOCATION, WAS_PRESSED | INJECTED);
Keyboard.sendReport (); Keyboard.sendReport ();
} }
void void
Cycle::replace (uint8_t cycleSize, const Key cycleSteps[]) { Cycle::replace (uint8_t cycleSize, const Key cycleSteps[]) {
uint8_t idx = cycleCount % cycleSize; uint8_t idx = cycleCount % cycleSize;
Key key; Key key;
key.raw = pgm_read_word (cycleSteps + idx); key.raw = pgm_read_word (cycleSteps + idx);
replace (key); replace (key);
} }
// --- hooks --- // --- hooks ---
Key Key
Cycle::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) { Cycle::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
if (keyState & INJECTED) if (keyState & INJECTED)
return mappedKey; return mappedKey;
@ -89,7 +89,7 @@ namespace KaleidoscopePlugins {
cycleCount++; cycleCount++;
cycleAction (lastNonCycleKey, cycleCount); cycleAction (lastNonCycleKey, cycleCount);
return Key_NoKey; return Key_NoKey;
} }
}; };
__attribute__((weak)) __attribute__((weak))

@ -28,7 +28,7 @@
}) })
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
class Cycle : public KaleidoscopePlugin { class Cycle : public KaleidoscopePlugin {
public: public:
Cycle (void); Cycle (void);
@ -42,7 +42,7 @@ namespace KaleidoscopePlugins {
static uint8_t cycleCount; static uint8_t cycleCount;
static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState); static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState);
}; };
}; };
void cycleAction (Key previousKey, uint8_t cycleCount); void cycleAction (Key previousKey, uint8_t cycleCount);

Loading…
Cancel
Save