make astyle

pull/135/head
Jesse Vincent 8 years ago
parent 9825e4057a
commit d75939d456
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -58,12 +58,12 @@
) )
const Key keymaps[][ROWS][COLS] PROGMEM = { const Key keymaps[][ROWS][COLS] PROGMEM = {
QWERTY, QWERTY,
GENERIC_FN2, GENERIC_FN2,
NUMPAD NUMPAD
}; };
static LEDSolidColor solidRed (60, 0, 0); static LEDSolidColor solidRed (60, 0, 0);
static LEDSolidColor solidOrange (60, 20, 0); static LEDSolidColor solidOrange (60, 20, 0);

@ -49,93 +49,91 @@ Kaleidoscope_::use(KaleidoscopePlugin *plugin, ...) {
void void
Kaleidoscope_::replaceEventHandlerHook(eventHandlerHook oldHook, eventHandlerHook newHook) { Kaleidoscope_::replaceEventHandlerHook(eventHandlerHook oldHook, eventHandlerHook newHook) {
for (byte i = 0; i < HOOK_MAX; i++) { for (byte i = 0; i < HOOK_MAX; i++) {
if (eventHandlers[i] == oldHook) { if (eventHandlers[i] == oldHook) {
eventHandlers[i] = newHook; eventHandlers[i] = newHook;
return; return;
}
} }
}
} }
void void
Kaleidoscope_::appendEventHandlerHook (eventHandlerHook hook) { Kaleidoscope_::appendEventHandlerHook (eventHandlerHook hook) {
replaceEventHandlerHook((eventHandlerHook)NULL, hook); replaceEventHandlerHook((eventHandlerHook)NULL, hook);
} }
void void
Kaleidoscope_::useEventHandlerHook (eventHandlerHook hook) { Kaleidoscope_::useEventHandlerHook (eventHandlerHook hook) {
for (byte i = 0; i < HOOK_MAX; i++) { for (byte i = 0; i < HOOK_MAX; i++) {
if (eventHandlers[i] == hook) if (eventHandlers[i] == hook)
return; return;
} }
appendEventHandlerHook(hook); appendEventHandlerHook(hook);
} }
void void
Kaleidoscope_::replaceLoopHook(loopHook oldHook, loopHook newHook) { Kaleidoscope_::replaceLoopHook(loopHook oldHook, loopHook newHook) {
for (byte i = 0; i < HOOK_MAX; i++) { for (byte i = 0; i < HOOK_MAX; i++) {
if (loopHooks[i] == oldHook) { if (loopHooks[i] == oldHook) {
loopHooks[i] = newHook; loopHooks[i] = newHook;
return; return;
}
} }
}
} }
void void
Kaleidoscope_::appendLoopHook(loopHook hook) { Kaleidoscope_::appendLoopHook(loopHook hook) {
replaceLoopHook((loopHook)NULL, hook); replaceLoopHook((loopHook)NULL, hook);
} }
void void
Kaleidoscope_::useLoopHook(loopHook hook) { Kaleidoscope_::useLoopHook(loopHook hook) {
for (byte i = 0; i < HOOK_MAX; i++) { for (byte i = 0; i < HOOK_MAX; i++) {
if (loopHooks[i] == hook) if (loopHooks[i] == hook)
return; return;
} }
appendLoopHook (hook); appendLoopHook (hook);
} }
bool bool
Kaleidoscope_::focusHook(const char *command) { Kaleidoscope_::focusHook(const char *command) {
enum { enum {
ON, ON,
OFF, OFF,
GETSTATE, GETSTATE,
} subCommand; } subCommand;
if (strncmp_P(command, PSTR("layer."), 6) != 0) if (strncmp_P(command, PSTR("layer."), 6) != 0)
return false; return false;
if (strcmp_P (command + 6, PSTR("on")) == 0) if (strcmp_P (command + 6, PSTR("on")) == 0)
subCommand = ON; subCommand = ON;
else if (strcmp_P(command + 6, PSTR("off")) == 0) else if (strcmp_P(command + 6, PSTR("off")) == 0)
subCommand = OFF; subCommand = OFF;
else if (strcmp_P(command + 6, PSTR("getState")) == 0) else if (strcmp_P(command + 6, PSTR("getState")) == 0)
subCommand = GETSTATE; subCommand = GETSTATE;
else else
return false; return false;
switch (subCommand) { switch (subCommand) {
case ON: case ON: {
{ uint8_t layer = Serial.parseInt();
uint8_t layer = Serial.parseInt(); Layer.on(layer);
Layer.on(layer); break;
break;
} }
case OFF: case OFF: {
{ uint8_t layer = Serial.parseInt();
uint8_t layer = Serial.parseInt(); Layer.off(layer);
Layer.off(layer); break;
break;
} }
case GETSTATE: case GETSTATE:
Serial.println(Layer.getLayerState(), BIN); Serial.println(Layer.getLayerState(), BIN);
break; break;
} }
return true; return true;
} }
Kaleidoscope_ Kaleidoscope; Kaleidoscope_ Kaleidoscope;

@ -52,15 +52,17 @@ extern HARDWARE_IMPLEMENTATION KeyboardHardware;
}) })
class KaleidoscopePlugin { class KaleidoscopePlugin {
public: public:
virtual void begin(void) = 0; virtual void begin(void) = 0;
}; };
class Kaleidoscope_ { class Kaleidoscope_ {
public: public:
Kaleidoscope_(void); Kaleidoscope_(void);
void setup(const byte keymap_count) { setup(); }; void setup(const byte keymap_count) {
setup();
};
void setup(void); void setup(void);
void loop(void); void loop(void);
void use(KaleidoscopePlugin *plugin, ...) __attribute__((sentinel)); void use(KaleidoscopePlugin *plugin, ...) __attribute__((sentinel));

@ -10,15 +10,15 @@ static bool handle_synthetic_keyswitch_event(Key mappedKey, uint8_t keyState) {
if (mappedKey.flags & IS_INTERNAL) { if (mappedKey.flags & IS_INTERNAL) {
return false; return false;
} else if (mappedKey.flags & IS_CONSUMER) { } else if (mappedKey.flags & IS_CONSUMER) {
if (key_is_pressed(keyState)) if (key_is_pressed(keyState))
ConsumerControl.press(mappedKey.keyCode); ConsumerControl.press(mappedKey.keyCode);
else if (key_was_pressed(keyState)) else if (key_was_pressed(keyState))
ConsumerControl.release(mappedKey.keyCode); ConsumerControl.release(mappedKey.keyCode);
} else if (mappedKey.flags & IS_SYSCTL) { } else if (mappedKey.flags & IS_SYSCTL) {
if (key_is_pressed(keyState)) if (key_is_pressed(keyState))
SystemControl.press(mappedKey.keyCode); SystemControl.press(mappedKey.keyCode);
else if (key_was_pressed(keyState)) else if (key_was_pressed(keyState))
SystemControl.release(); SystemControl.release();
} else if (mappedKey.flags & SWITCH_TO_KEYMAP) { } else if (mappedKey.flags & SWITCH_TO_KEYMAP) {
// Should not happen, handled elsewhere. // Should not happen, handled elsewhere.
} }

@ -30,7 +30,7 @@ class Layer_ {
static Key getKeyFromPROGMEM(uint8_t layer, byte row, byte col); static Key getKeyFromPROGMEM(uint8_t layer, byte row, byte col);
private: private:
static uint8_t highestLayer; static uint8_t highestLayer;
static uint8_t keyMap[ROWS][COLS]; static uint8_t keyMap[ROWS][COLS];

Loading…
Cancel
Save