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 = {
QWERTY,
GENERIC_FN2,
NUMPAD
QWERTY,
GENERIC_FN2,
NUMPAD
};
};
static LEDSolidColor solidRed (60, 0, 0);
static LEDSolidColor solidOrange (60, 20, 0);

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

@ -52,15 +52,17 @@ extern HARDWARE_IMPLEMENTATION KeyboardHardware;
})
class KaleidoscopePlugin {
public:
virtual void begin(void) = 0;
public:
virtual void begin(void) = 0;
};
class Kaleidoscope_ {
public:
Kaleidoscope_(void);
void setup(const byte keymap_count) { setup(); };
void setup(const byte keymap_count) {
setup();
};
void setup(void);
void loop(void);
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) {
return false;
} else if (mappedKey.flags & IS_CONSUMER) {
if (key_is_pressed(keyState))
ConsumerControl.press(mappedKey.keyCode);
else if (key_was_pressed(keyState))
ConsumerControl.release(mappedKey.keyCode);
if (key_is_pressed(keyState))
ConsumerControl.press(mappedKey.keyCode);
else if (key_was_pressed(keyState))
ConsumerControl.release(mappedKey.keyCode);
} else if (mappedKey.flags & IS_SYSCTL) {
if (key_is_pressed(keyState))
SystemControl.press(mappedKey.keyCode);
else if (key_was_pressed(keyState))
SystemControl.release();
if (key_is_pressed(keyState))
SystemControl.press(mappedKey.keyCode);
else if (key_was_pressed(keyState))
SystemControl.release();
} else if (mappedKey.flags & SWITCH_TO_KEYMAP) {
// Should not happen, handled elsewhere.
}

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

Loading…
Cancel
Save