astyle pass

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

@ -50,18 +50,18 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
switch (macroIndex) {
case M_APPSWITCH:
return macroAppSwitch (keyState);
return macroAppSwitch(keyState);
case M_APPCANCEL:
return macroAppCancel (keyState);
return macroAppCancel(keyState);
}
return MACRO_NONE;
}
void setup () {
Kaleidoscope.setup (KEYMAP_SIZE);
Kaleidoscope.use (&HostOS, &Macros, NULL);
void setup() {
Kaleidoscope.setup(KEYMAP_SIZE);
Kaleidoscope.use(&HostOS, &Macros, NULL);
}
void loop () {
Kaleidoscope.loop ();
void loop() {
Kaleidoscope.loop();
}

@ -27,10 +27,10 @@ using namespace KaleidoscopePlugins::HostOS;
static bool appSwitchActive = false;
const macro_t *macroAppSwitch (uint8_t keyState) {
const macro_t *macroAppSwitch(uint8_t keyState) {
Key mod = Key_LeftAlt;
if (HostOS.os () == OSX)
if (HostOS.os() == OSX)
mod = Key_LeftGui;
// Key was just pressed, or is being held
@ -50,8 +50,8 @@ const macro_t *macroAppSwitch (uint8_t keyState) {
return MACRO_NONE;
}
const macro_t *macroAppCancel (uint8_t keyState) {
if (key_toggled_on (keyState))
const macro_t *macroAppCancel(uint8_t keyState) {
if (key_toggled_on(keyState))
appSwitchActive = false;
return MACRO_NONE;
}

@ -26,5 +26,5 @@ enum {
M_APPCANCEL,
};
const macro_t *macroAppSwitch (uint8_t keyState);
const macro_t *macroAppCancel (uint8_t keyState);
const macro_t *macroAppSwitch(uint8_t keyState);
const macro_t *macroAppCancel(uint8_t keyState);

@ -26,13 +26,13 @@
Key_Home, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseWarpSW, Key_mouseWarpSE, \
Key_End, Key_Z, Key_X, Key_C, Key_V, Key_mouseWarpEnd, ___, \
Key_LeftControl, Key_mouseBtnL, Key_LeftGui, Key_LeftShift, \
___,\
___, \
\
XXX, Key_F6, Key_F7, Key_F8, Key_F9, ___, ___,\
Key_Delete, Consumer_PlaySlashPause, Key_LeftCurlyBracket, Key_RightCurlyBracket, Key_LeftBracket, Key_RightBracket, System_Sleep,\
Key_LeftArrow, Key_DownArrow, Key_UpArrow, Key_RightArrow, Key_F11, Key_F12,\
___, Consumer_VolumeDecrement, Consumer_VolumeIncrement, Key_BacklightDown, Key_BacklightUp, Key_Backslash, Key_Pipe,\
Key_RightShift, Key_RightAlt, Key_mouseBtnR, Key_RightControl,\
XXX, Key_F6, Key_F7, Key_F8, Key_F9, ___, ___, \
Key_Delete, Consumer_PlaySlashPause, Key_LeftCurlyBracket, Key_RightCurlyBracket, Key_LeftBracket, Key_RightBracket, System_Sleep, \
Key_LeftArrow, Key_DownArrow, Key_UpArrow, Key_RightArrow, Key_F11, Key_F12, \
___, Consumer_VolumeDecrement, Consumer_VolumeIncrement, Key_BacklightDown, Key_BacklightUp, Key_Backslash, Key_Pipe, \
Key_RightShift, Key_RightAlt, Key_mouseBtnR, Key_RightControl, \
___\
)
@ -44,7 +44,7 @@
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadAdd, ___, \
___, ___, ___, ___, ___, ___, ___, Key_Keypad1, Key_Keypad2, Key_Keypad3, Key_Equals, Key_Quote, \
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad0, Key_KeypadDot, Key_KeypadMultiply, Key_KeypadDivide, Key_Enter, \
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,\
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, \
Key_Keymap1_Momentary, Key_Keymap1_Momentary \
)
@ -53,7 +53,7 @@
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals, \
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, \
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape, ___, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus, \
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,\
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, \
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
)
@ -65,17 +65,17 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
};
static LEDSolidColor solidRed (60, 0, 0);
static LEDSolidColor solidOrange (60, 20, 0);
static LEDSolidColor solidYellow (40, 35, 0);
static LEDSolidColor solidGreen (0, 100, 0);
static LEDSolidColor solidBlue (0, 15, 100);
static LEDSolidColor solidIndigo (0, 0, 100);
static LEDSolidColor solidViolet (70, 0, 60);
static LEDSolidColor solidRed(60, 0, 0);
static LEDSolidColor solidOrange(60, 20, 0);
static LEDSolidColor solidYellow(40, 35, 0);
static LEDSolidColor solidGreen(0, 100, 0);
static LEDSolidColor solidBlue(0, 15, 100);
static LEDSolidColor solidIndigo(0, 0, 100);
static LEDSolidColor solidViolet(70, 0, 60);
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
if (macroIndex == TOGGLENUMLOCK && key_toggled_on(keyState)) {
return NumLock.toggle (Macros.row, Macros.col, NUMPAD_KEYMAP);
return NumLock.toggle(Macros.row, Macros.col, NUMPAD_KEYMAP);
}
if (macroIndex == 1 && key_toggled_on(keyState)) {

@ -13,7 +13,7 @@ Kaleidoscope_::setup(void) {
Keyboard.begin();
// A workaround, so that the compiler does not optimize this out...
handle_keyswitch_event (Key_NoKey, 255, 255, 0);
handle_keyswitch_event(Key_NoKey, 255, 255, 0);
}
void
@ -58,12 +58,12 @@ Kaleidoscope_::replaceEventHandlerHook(eventHandlerHook oldHook, eventHandlerHoo
}
void
Kaleidoscope_::appendEventHandlerHook (eventHandlerHook hook) {
Kaleidoscope_::appendEventHandlerHook(eventHandlerHook hook) {
replaceEventHandlerHook((eventHandlerHook)NULL, hook);
}
void
Kaleidoscope_::useEventHandlerHook (eventHandlerHook hook) {
Kaleidoscope_::useEventHandlerHook(eventHandlerHook hook) {
for (byte i = 0; i < HOOK_MAX; i++) {
if (eventHandlers[i] == hook)
return;
@ -92,7 +92,7 @@ Kaleidoscope_::useLoopHook(loopHook hook) {
if (loopHooks[i] == hook)
return;
}
appendLoopHook (hook);
appendLoopHook(hook);
}
bool
@ -106,7 +106,7 @@ Kaleidoscope_::focusHook(const char *command) {
if (strncmp_P(command, PSTR("layer."), 6) != 0)
return false;
if (strcmp_P (command + 6, PSTR("on")) == 0)
if (strcmp_P(command + 6, PSTR("on")) == 0)
subCommand = ON;
else if (strcmp_P(command + 6, PSTR("off")) == 0)
subCommand = OFF;

@ -82,7 +82,7 @@ class Kaleidoscope_ {
* functions will, on the other hand, just append the hooks, and not care about
* protection.
*/
typedef Key (*eventHandlerHook)(Key mappedKey, byte row, byte col, uint8_t keyState);
typedef Key(*eventHandlerHook)(Key mappedKey, byte row, byte col, uint8_t keyState);
static eventHandlerHook eventHandlers[HOOK_MAX];
static void replaceEventHandlerHook(eventHandlerHook oldHook, eventHandlerHook newHook);

@ -31,7 +31,7 @@ static bool handle_keyswitch_event_default(Key mappedKey, byte row, byte col, ui
// for every newly released button, figure out what logical key it is and send a key up event
if (mappedKey.flags & SYNTHETIC) {
handle_synthetic_keyswitch_event( mappedKey, keyState);
handle_synthetic_keyswitch_event(mappedKey, keyState);
} else if (key_is_pressed(keyState)) {
press_key(mappedKey);
} else if (key_toggled_off(keyState) && (keyState & INJECTED)) {

@ -5,25 +5,25 @@ static uint32_t LayerState;
uint8_t Layer_::highestLayer;
uint8_t Layer_::keyMap[ROWS][COLS];
Key (*Layer_::getKey)(uint8_t layer, byte row, byte col) = Layer.getKeyFromPROGMEM;
Key(*Layer_::getKey)(uint8_t layer, byte row, byte col) = Layer.getKeyFromPROGMEM;
static void handle_keymap_keyswitch_event(Key keymapEntry, uint8_t keyState) {
if (keymapEntry.keyCode >= MOMENTARY_OFFSET) {
uint8_t target = keymapEntry.keyCode - MOMENTARY_OFFSET;
if (key_toggled_on(keyState)) {
if ( target == KEYMAP_NEXT) {
if (target == KEYMAP_NEXT) {
Layer.next();
} else if ( target == KEYMAP_PREVIOUS) {
} else if (target == KEYMAP_PREVIOUS) {
Layer.previous();
} else {
Layer.on(target);
}
}
if (key_toggled_off(keyState)) {
if ( target == KEYMAP_NEXT) {
if (target == KEYMAP_NEXT) {
Layer.previous();
} else if ( target == KEYMAP_PREVIOUS) {
} else if (target == KEYMAP_PREVIOUS) {
Layer.next();
} else {
Layer.off(target);
@ -32,7 +32,7 @@ static void handle_keymap_keyswitch_event(Key keymapEntry, uint8_t keyState) {
// switch keymap and stay there
} else if (key_toggled_on(keyState)) {
if (Layer.isOn (keymapEntry.keyCode) && keymapEntry.keyCode)
if (Layer.isOn(keymapEntry.keyCode) && keymapEntry.keyCode)
Layer.off(keymapEntry.keyCode);
else
Layer.on(keymapEntry.keyCode);
@ -48,12 +48,12 @@ Layer_::eventHandler(Key mappedKey, byte row, byte col, uint8_t keyState) {
return Key_NoKey;
}
Layer_::Layer_ (void) {
defaultLayer (0);
Layer_::Layer_(void) {
defaultLayer(0);
}
Key
Layer_::getKeyFromPROGMEM (uint8_t layer, byte row, byte col) {
Layer_::getKeyFromPROGMEM(uint8_t layer, byte row, byte col) {
Key key;
key.raw = pgm_read_word(&(keymaps[layer][row][col]));
@ -64,7 +64,7 @@ Layer_::getKeyFromPROGMEM (uint8_t layer, byte row, byte col) {
void
Layer_::mergeLayers(void) {
memset (keyMap, DefaultLayer, ROWS * COLS);
memset(keyMap, DefaultLayer, ROWS * COLS);
if (LayerState == (uint32_t)(1 << DefaultLayer))
return;
@ -74,7 +74,7 @@ Layer_::mergeLayers(void) {
int8_t layer = highestLayer;
while (layer > DefaultLayer) {
if (Layer.isOn (layer)) {
if (Layer.isOn(layer)) {
Key mappedKey = (*getKey)(layer, r, c);
if (mappedKey != Key_Transparent) {
@ -94,55 +94,55 @@ Key Layer_::lookup(byte row, byte col) {
return (*getKey)(layer, row, col);
}
uint8_t Layer_::top (void) {
uint8_t Layer_::top(void) {
for (int8_t i = 31; i >= 0; i--) {
if (bitRead (LayerState, i))
if (bitRead(LayerState, i))
return i;
}
return 0;
}
void Layer_::move (uint8_t layer) {
void Layer_::move(uint8_t layer) {
LayerState = 0;
on (layer);
on(layer);
}
void Layer_::on (uint8_t layer) {
bitSet (LayerState, layer);
void Layer_::on(uint8_t layer) {
bitSet(LayerState, layer);
if (layer > highestLayer)
highestLayer = layer;
mergeLayers();
}
void Layer_::off (uint8_t layer) {
bitClear (LayerState, layer);
void Layer_::off(uint8_t layer) {
bitClear(LayerState, layer);
if (layer == highestLayer)
highestLayer = top();
mergeLayers();
}
boolean Layer_::isOn (uint8_t layer) {
boolean Layer_::isOn(uint8_t layer) {
return bitRead(LayerState, layer);
}
void Layer_::next (void) {
on (top () + 1);
void Layer_::next(void) {
on(top() + 1);
}
void Layer_::previous (void) {
off (top ());
void Layer_::previous(void) {
off(top());
}
void Layer_::defaultLayer (uint8_t layer) {
move (layer);
void Layer_::defaultLayer(uint8_t layer) {
move(layer);
DefaultLayer = layer;
}
uint8_t Layer_::defaultLayer (void) {
uint8_t Layer_::defaultLayer(void) {
return DefaultLayer;
}
uint32_t Layer_::getLayerState (void) {
uint32_t Layer_::getLayerState(void) {
return LayerState;
}

@ -26,7 +26,7 @@ class Layer_ {
static Key eventHandler(Key mappedKey, byte row, byte col, uint8_t keyState);
static Key (*getKey)(uint8_t layer, byte row, byte col);
static Key(*getKey)(uint8_t layer, byte row, byte col);
static Key getKeyFromPROGMEM(uint8_t layer, byte row, byte col);
@ -37,6 +37,6 @@ class Layer_ {
static void mergeLayers(void);
};
Key layer_getKey (uint8_t layer, uint8_t r, uint8_t c);
Key layer_getKey(uint8_t layer, uint8_t r, uint8_t c);
extern Layer_ Layer;

Loading…
Cancel
Save