astyle with current project style guidelines

pull/389/head
Jesse Vincent 8 years ago
parent fcff6f3d20
commit 798fb5e0f0
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -40,11 +40,11 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
),
};
void setup () {
Kaleidoscope.setup ();
USE_PLUGINS (&SpaceCadetShift);
void setup() {
Kaleidoscope.setup();
USE_PLUGINS(&SpaceCadetShift);
}
void loop () {
Kaleidoscope.loop ();
void loop() {
Kaleidoscope.loop();
}

@ -25,37 +25,37 @@ uint32_t SpaceCadetShift::startTime;
uint16_t SpaceCadetShift::timeOut = 1000;
Key SpaceCadetShift::leftParen, SpaceCadetShift::rightParen;
SpaceCadetShift::SpaceCadetShift () {
SpaceCadetShift::SpaceCadetShift() {
leftParen.raw = Key_9.raw;
rightParen.raw = Key_0.raw;
}
void
SpaceCadetShift::begin () {
event_handler_hook_use (this->eventHandlerHook);
SpaceCadetShift::begin() {
event_handler_hook_use(this->eventHandlerHook);
}
void
SpaceCadetShift::configure (Key left, Key right) {
SpaceCadetShift::configure(Key left, Key right) {
leftParen = left;
rightParen = right;
}
Key
SpaceCadetShift::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
SpaceCadetShift::eventHandlerHook(Key mappedKey, byte row, byte col, uint8_t keyState) {
// If nothing happened, bail out fast.
if (!key_is_pressed (keyState) && !key_was_pressed (keyState)) {
if (!key_is_pressed(keyState) && !key_was_pressed(keyState)) {
return mappedKey;
}
// If a key has been just toggled on...
if (key_toggled_on (keyState)) {
if (key_toggled_on(keyState)) {
if (mappedKey.raw == Key_LeftShift.raw) { // if it is LShift, remember it
bitWrite (parenNeeded, 0, 1);
startTime = millis ();
bitWrite(parenNeeded, 0, 1);
startTime = millis();
} else if (mappedKey.raw == Key_RightShift.raw) { // if it is RShift, remember it
bitWrite (parenNeeded, 1, 1);
startTime = millis ();
bitWrite(parenNeeded, 1, 1);
startTime = millis();
} else { // if it is something else, we do not need a paren at the end.
parenNeeded = 0;
startTime = 0;
@ -72,7 +72,7 @@ SpaceCadetShift::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t ke
// if we timed out, that means we need to keep pressing shift, but won't
// need the parens in the end.
if ((millis () - startTime) >= timeOut) {
if ((millis() - startTime) >= timeOut) {
parenNeeded = 0;
return mappedKey;
}
@ -86,14 +86,14 @@ SpaceCadetShift::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t ke
// if a key toggled off (and that must be one of the shifts at this point),
// send the parens too (if we were interrupted, we bailed out earlier).
if (key_toggled_off (keyState)) {
if (key_toggled_off(keyState)) {
Key paren = leftParen;
if (bitRead (parenNeeded, 1))
if (bitRead(parenNeeded, 1))
paren = rightParen;
handle_keyswitch_event (mappedKey, row, col, IS_PRESSED | INJECTED);
handle_keyswitch_event (paren, row, col, IS_PRESSED | INJECTED);
Keyboard.sendReport ();
handle_keyswitch_event(mappedKey, row, col, IS_PRESSED | INJECTED);
handle_keyswitch_event(paren, row, col, IS_PRESSED | INJECTED);
Keyboard.sendReport();
parenNeeded = 0;
}

@ -23,11 +23,11 @@
namespace KaleidoscopePlugins {
class SpaceCadetShift : public KaleidoscopePlugin {
public:
SpaceCadetShift (void);
SpaceCadetShift(void);
void begin (void) final;
void begin(void) final;
static void configure (Key left, Key right);
static void configure(Key left, Key right);
static uint16_t timeOut;
private:
@ -35,7 +35,7 @@ class SpaceCadetShift : public KaleidoscopePlugin {
static uint32_t startTime;
static Key leftParen, rightParen;
static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState);
static Key eventHandlerHook(Key mappedKey, byte row, byte col, uint8_t keyState);
};
};

Loading…
Cancel
Save