"make astyle" - no functionality changes

pull/102/head
Jesse Vincent 8 years ago
parent 285818c88e
commit f3b786dade

@ -22,41 +22,41 @@
#include "Macros.h" #include "Macros.h"
const Key keymaps[][ROWS][COLS] PROGMEM = { const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDn, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Esc, Key_PageDn, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Esc,
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift,
M(M_APPSWITCH), M(M_APPSWITCH),
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip, Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals, Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus, Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl,
M(M_APPCANCEL) M(M_APPCANCEL)
), ),
}; };
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
switch (macroIndex) { switch (macroIndex) {
case M_APPSWITCH: case M_APPSWITCH:
return macroAppSwitch (keyState); return macroAppSwitch (keyState);
case M_APPCANCEL: case M_APPCANCEL:
return macroAppCancel (keyState); return macroAppCancel (keyState);
} }
return MACRO_NONE; return MACRO_NONE;
} }
void setup () { void setup () {
Keyboardio.setup (KEYMAP_SIZE); Keyboardio.setup (KEYMAP_SIZE);
Keyboardio.use (&HostOS, &Macros, NULL); Keyboardio.use (&HostOS, &Macros, NULL);
} }
void loop () { void loop () {
Keyboardio.loop (); Keyboardio.loop ();
} }

@ -28,30 +28,30 @@ using namespace Akela::HostOS;
static bool appSwitchActive = false; static bool appSwitchActive = false;
const macro_t *macroAppSwitch (uint8_t keyState) { const macro_t *macroAppSwitch (uint8_t keyState) {
Key mod = Key_LAlt; Key mod = Key_LAlt;
if (HostOS.os () == OSX) if (HostOS.os () == OSX)
mod = Key_LGUI; mod = Key_LGUI;
// Key was just pressed, or is being held // Key was just pressed, or is being held
if (key_is_pressed(keyState)) { if (key_is_pressed(keyState)) {
return MACRO(Dr(mod), D(Tab), END); return MACRO(Dr(mod), D(Tab), END);
} }
// Key was just released // Key was just released
if (key_toggled_off(keyState)) { if (key_toggled_off(keyState)) {
return MACRO(U(Tab), Dr(mod), END); return MACRO(U(Tab), Dr(mod), END);
} }
// Key is not pressed, and was not just released. // Key is not pressed, and was not just released.
// if appSwitchActive is true, we continue holding Alt. // if appSwitchActive is true, we continue holding Alt.
if (appSwitchActive) { if (appSwitchActive) {
return MACRO(Dr(mod), END); return MACRO(Dr(mod), END);
} }
// otherwise we do nothing // otherwise we do nothing
return MACRO_NONE; return MACRO_NONE;
} }
const macro_t *macroAppCancel (uint8_t keyState) { const macro_t *macroAppCancel (uint8_t keyState) {
if (key_toggled_on (keyState)) if (key_toggled_on (keyState))
appSwitchActive = false; appSwitchActive = false;
return MACRO_NONE; return MACRO_NONE;
} }

@ -22,8 +22,8 @@
#include <Keyboardio-Macros.h> #include <Keyboardio-Macros.h>
enum { enum {
M_APPSWITCH, M_APPSWITCH,
M_APPCANCEL, M_APPCANCEL,
}; };
const macro_t *macroAppSwitch (uint8_t keyState); const macro_t *macroAppSwitch (uint8_t keyState);

@ -55,7 +55,7 @@ void setup() {
Keyboardio.setup(KEYMAP_SIZE); Keyboardio.setup(KEYMAP_SIZE);
Keyboardio.use(&TestMode, Keyboardio.use(&TestMode,
&LEDControl, &LEDOff, &LEDControl, &LEDOff,
&solidRed, &solidOrange, &solidYellow, &solidGreen, &solidBlue, &solidIndigo, &solidViolet, &solidRed, &solidOrange, &solidYellow, &solidGreen, &solidBlue, &solidIndigo, &solidViolet,
&LEDBreatheEffect, &LEDRainbowEffect, &LEDChaseEffect, &NumLock, &LEDBreatheEffect, &LEDRainbowEffect, &LEDChaseEffect, &NumLock,

@ -26,16 +26,16 @@ Keyboardio_::loop(void) {
KeyboardHardware.scan_matrix(); KeyboardHardware.scan_matrix();
for (byte i = 0; loopHooks[i] != NULL && i < HOOK_MAX; i++) { for (byte i = 0; loopHooks[i] != NULL && i < HOOK_MAX; i++) {
custom_loop_t hook = loopHooks[i]; custom_loop_t hook = loopHooks[i];
(*hook)(false); (*hook)(false);
} }
Keyboard.sendReport(); Keyboard.sendReport();
Keyboard.releaseAll(); Keyboard.releaseAll();
for (byte i = 0; loopHooks[i] != NULL && i < HOOK_MAX; i++) { for (byte i = 0; loopHooks[i] != NULL && i < HOOK_MAX; i++) {
custom_loop_t hook = loopHooks[i]; custom_loop_t hook = loopHooks[i];
(*hook)(true); (*hook)(true);
} }
} }
@ -47,7 +47,7 @@ Keyboardio_::use(KeyboardioPlugin *plugin, ...) {
plugin->begin(); plugin->begin();
va_start(ap, plugin); va_start(ap, plugin);
while ((p = va_arg(ap, KeyboardioPlugin*)) != NULL) { while ((p = va_arg(ap, KeyboardioPlugin*)) != NULL) {
p->begin(); p->begin();
}; };
va_end(ap); va_end(ap);
} }

@ -10,18 +10,43 @@ typedef union Key_ {
}; };
uint16_t raw; uint16_t raw;
inline bool operator==(uint16_t rhs) { return this->raw == rhs; }; inline bool operator==(uint16_t rhs) {
inline bool operator==(const Key_ rhs) { return this->raw == rhs.raw; }; return this->raw == rhs;
inline Key_& operator=(uint16_t raw) { this->raw = raw; return *this; }; };
inline bool operator!=(const Key_& rhs) { return !(*this == rhs); }; inline bool operator==(const Key_ rhs) {
inline bool operator>=(uint16_t raw) { return this->raw >= raw; }; return this->raw == rhs.raw;
inline bool operator<=(uint16_t raw) { return this->raw <= raw; }; };
inline bool operator>(uint16_t raw) { return this->raw > raw; }; inline Key_& operator=(uint16_t raw) {
inline bool operator<(uint16_t raw) { return this->raw < raw; }; this->raw = raw;
inline bool operator>=(const Key_& other) { return this->raw >= other.raw; }; return *this;
inline bool operator<=(const Key_& other) { return this->raw <= other.raw; }; };
inline bool operator>(const Key_& other) { return this->raw > other.raw; }; inline bool operator!=(const Key_& rhs) {
inline bool operator<(const Key_& other) { return this->raw < other.raw; }; return !(*this == rhs);
};
inline bool operator>=(uint16_t raw) {
return this->raw >= raw;
};
inline bool operator<=(uint16_t raw) {
return this->raw <= raw;
};
inline bool operator>(uint16_t raw) {
return this->raw > raw;
};
inline bool operator<(uint16_t raw) {
return this->raw < raw;
};
inline bool operator>=(const Key_& other) {
return this->raw >= other.raw;
};
inline bool operator<=(const Key_& other) {
return this->raw <= other.raw;
};
inline bool operator>(const Key_& other) {
return this->raw > other.raw;
};
inline bool operator<(const Key_& other) {
return this->raw < other.raw;
};
} Key; } Key;

@ -91,6 +91,6 @@ void handle_key_event(Key mappedKey, byte row, byte col, uint8_t keyState) {
} }
mappedKey = Layer.eventHandler(mappedKey, row, col, keyState); mappedKey = Layer.eventHandler(mappedKey, row, col, keyState);
if (mappedKey.raw == Key_NoKey.raw) if (mappedKey.raw == Key_NoKey.raw)
return; return;
handle_key_event_default(mappedKey, row, col, keyState); handle_key_event_default(mappedKey, row, col, keyState);
} }

@ -56,7 +56,7 @@ Key Layer_::lookup(byte row, byte col) {
mappedKey.raw = Key_Transparent.raw; mappedKey.raw = Key_Transparent.raw;
while (mappedKey.raw == Key_Transparent.raw && while (mappedKey.raw == Key_Transparent.raw &&
layer >= DefaultLayer) { layer >= DefaultLayer) {
if (Layer.isOn (layer)) if (Layer.isOn (layer))
mappedKey.raw = pgm_read_word(&(keymaps[layer][row][col])); mappedKey.raw = pgm_read_word(&(keymaps[layer][row][col]));
layer--; layer--;

@ -1,7 +1,7 @@
#pragma once #pragma once
class KeyboardioPlugin { class KeyboardioPlugin {
public: public:
virtual void begin(void) = 0; virtual void begin(void) = 0;
}; };

Loading…
Cancel
Save