astyle with current project style guidelines

pull/389/head
Jesse Vincent 7 years ago
parent c069df3919
commit 7ec1fe2908
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -43,13 +43,13 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
), ),
}; };
static Key eventDropper (Key mappedKey, byte row, byte col, uint8_t keyState) { static Key eventDropper(Key mappedKey, byte row, byte col, uint8_t keyState) {
return Key_NoKey; return Key_NoKey;
} }
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
if (macroIndex == 0 && key_toggled_on (keyState)) if (macroIndex == 0 && key_toggled_on(keyState))
GhostInTheFirmware.activate (); GhostInTheFirmware.activate();
return MACRO_NONE; return MACRO_NONE;
} }
@ -123,19 +123,19 @@ static const KaleidoscopePlugins::GhostInTheFirmware::GhostKey ghostKeys[] PROGM
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
void setup () { void setup() {
Serial.begin (9600); Serial.begin(9600);
Kaleidoscope.setup (KEYMAP_SIZE); Kaleidoscope.setup(KEYMAP_SIZE);
GhostInTheFirmware.configure (ghostKeys); GhostInTheFirmware.configure(ghostKeys);
StalkerEffect.configure (STALKER (BlazingTrail, NULL)); StalkerEffect.configure(STALKER(BlazingTrail, NULL));
Kaleidoscope.use (&LEDControl, &GhostInTheFirmware, &StalkerEffect, &Macros, Kaleidoscope.use(&LEDControl, &GhostInTheFirmware, &StalkerEffect, &Macros,
NULL); NULL);
event_handler_hook_use (eventDropper); event_handler_hook_use(eventDropper);
} }
void loop () { void loop() {
Kaleidoscope.loop (); Kaleidoscope.loop();
} }

@ -28,32 +28,32 @@ uint32_t GhostInTheFirmware::startTime;
uint16_t GhostInTheFirmware::pressTimeOut; uint16_t GhostInTheFirmware::pressTimeOut;
uint16_t GhostInTheFirmware::delayTimeOut; uint16_t GhostInTheFirmware::delayTimeOut;
GhostInTheFirmware::GhostInTheFirmware (void) { GhostInTheFirmware::GhostInTheFirmware(void) {
} }
void void
GhostInTheFirmware::begin (void) { GhostInTheFirmware::begin(void) {
loop_hook_use (this->loopHook); loop_hook_use(this->loopHook);
} }
void void
GhostInTheFirmware::activate (void) { GhostInTheFirmware::activate(void) {
isActive = true; isActive = true;
} }
void void
GhostInTheFirmware::configure (const GhostKey ghostKeys_[]) { GhostInTheFirmware::configure(const GhostKey ghostKeys_[]) {
ghostKeys = (GhostKey *)ghostKeys_; ghostKeys = (GhostKey *)ghostKeys_;
} }
void void
GhostInTheFirmware::loopHook (bool postClear) { GhostInTheFirmware::loopHook(bool postClear) {
if (postClear || !isActive) if (postClear || !isActive)
return; return;
if (pressTimeOut == 0) { if (pressTimeOut == 0) {
pressTimeOut = pgm_read_word (&(ghostKeys[currentPos].pressTime)); pressTimeOut = pgm_read_word(&(ghostKeys[currentPos].pressTime));
delayTimeOut = pgm_read_word (&(ghostKeys[currentPos].delay)); delayTimeOut = pgm_read_word(&(ghostKeys[currentPos].delay));
if (pressTimeOut == 0) { if (pressTimeOut == 0) {
currentPos = 0; currentPos = 0;
@ -61,22 +61,22 @@ GhostInTheFirmware::loopHook (bool postClear) {
return; return;
} }
isPressed = true; isPressed = true;
startTime = millis (); startTime = millis();
} else { } else {
if (isPressed && ((millis () - startTime) > pressTimeOut)) { if (isPressed && ((millis() - startTime) > pressTimeOut)) {
isPressed = false; isPressed = false;
startTime = millis (); startTime = millis();
byte row = pgm_read_byte (&(ghostKeys[currentPos].row)); byte row = pgm_read_byte(&(ghostKeys[currentPos].row));
byte col = pgm_read_byte (&(ghostKeys[currentPos].col)); byte col = pgm_read_byte(&(ghostKeys[currentPos].col));
handle_keyswitch_event (Key_NoKey, row, col, WAS_PRESSED); handle_keyswitch_event(Key_NoKey, row, col, WAS_PRESSED);
} else if (isPressed) { } else if (isPressed) {
byte row = pgm_read_byte (&(ghostKeys[currentPos].row)); byte row = pgm_read_byte(&(ghostKeys[currentPos].row));
byte col = pgm_read_byte (&(ghostKeys[currentPos].col)); byte col = pgm_read_byte(&(ghostKeys[currentPos].col));
handle_keyswitch_event (Key_NoKey, row, col, IS_PRESSED); handle_keyswitch_event(Key_NoKey, row, col, IS_PRESSED);
} else if ((millis () - startTime) > delayTimeOut) { } else if ((millis() - startTime) > delayTimeOut) {
currentPos++; currentPos++;
pressTimeOut = 0; pressTimeOut = 0;
} }

@ -30,11 +30,11 @@ class GhostInTheFirmware : public KaleidoscopePlugin {
uint16_t delay; uint16_t delay;
} GhostKey; } GhostKey;
GhostInTheFirmware (void); GhostInTheFirmware(void);
virtual void begin (void) final; virtual void begin(void) final;
static void configure (const GhostKey ghostKeys[]); static void configure(const GhostKey ghostKeys[]);
static void activate (void); static void activate(void);
private: private:
static GhostKey *ghostKeys; static GhostKey *ghostKeys;
@ -45,7 +45,7 @@ class GhostInTheFirmware : public KaleidoscopePlugin {
static uint16_t pressTimeOut; static uint16_t pressTimeOut;
static uint16_t delayTimeOut; static uint16_t delayTimeOut;
static void loopHook (bool postClear); static void loopHook(bool postClear);
}; };
}; };

Loading…
Cancel
Save