From 97008a28f07e7ff7b5adbd56f0547622770a0000 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 26 May 2017 15:41:19 -0700 Subject: [PATCH] "make astyle --- examples/EEPROM-Keymap/EEPROM-Keymap.ino | 54 +++++------ src/Kaleidoscope/EEPROM-Keymap.cpp | 116 +++++++++++------------ src/Kaleidoscope/EEPROM-Keymap.h | 4 +- 3 files changed, 87 insertions(+), 87 deletions(-) diff --git a/examples/EEPROM-Keymap/EEPROM-Keymap.ino b/examples/EEPROM-Keymap/EEPROM-Keymap.ino index eaa58201..e3480f37 100644 --- a/examples/EEPROM-Keymap/EEPROM-Keymap.ino +++ b/examples/EEPROM-Keymap/EEPROM-Keymap.ino @@ -21,45 +21,45 @@ #include const Key keymaps[][ROWS][COLS] PROGMEM = { - [0] = KEYMAP_STACKED - ( - 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_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, - Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape, + [0] = KEYMAP_STACKED + ( + 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_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, + Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape, - Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, - Key_skip, + Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, + 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_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_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_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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, - Key_skip - ), + Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, + Key_skip + ), }; void setup () { - Serial.begin (9600); + Serial.begin (9600); - Kaleidoscope.setup (); + Kaleidoscope.setup (); - USE_PLUGINS (&EEPROMKeymap, &Focus); + USE_PLUGINS (&EEPROMKeymap, &Focus); - Focus.addHook (FOCUS_HOOK_SETTINGS); - Focus.addHook (FOCUS_HOOK_KEYMAP); - Focus.addHook (FOCUS_HOOK_KEYMAP_TRANSFER); - Focus.addHook (FOCUS_HOOK_HELP); - Focus.addHook (FOCUS_HOOK_VERSION); + Focus.addHook (FOCUS_HOOK_SETTINGS); + Focus.addHook (FOCUS_HOOK_KEYMAP); + Focus.addHook (FOCUS_HOOK_KEYMAP_TRANSFER); + Focus.addHook (FOCUS_HOOK_HELP); + Focus.addHook (FOCUS_HOOK_VERSION); - Layer.getKey = EEPROMKeymap.getKeyOverride; + Layer.getKey = EEPROMKeymap.getKeyOverride; - EEPROMKeymap.reserveSpace (1); - EEPROMSettings.seal (); + EEPROMKeymap.reserveSpace (1); + EEPROMSettings.seal (); } void loop () { - Kaleidoscope.loop (); + Kaleidoscope.loop (); } diff --git a/src/Kaleidoscope/EEPROM-Keymap.cpp b/src/Kaleidoscope/EEPROM-Keymap.cpp index 11b0fc8a..314b65a2 100644 --- a/src/Kaleidoscope/EEPROM-Keymap.cpp +++ b/src/Kaleidoscope/EEPROM-Keymap.cpp @@ -21,29 +21,29 @@ #include namespace KaleidoscopePlugins { - uint16_t EEPROMKeymap::keymapBase; - uint8_t EEPROMKeymap::maxLayers; +uint16_t EEPROMKeymap::keymapBase; +uint8_t EEPROMKeymap::maxLayers; - EEPROMKeymap::EEPROMKeymap (void) { - } +EEPROMKeymap::EEPROMKeymap (void) { +} - void - EEPROMKeymap::begin (void) { +void +EEPROMKeymap::begin (void) { USE_PLUGINS (&::EEPROMSettings); - } +} - void - EEPROMKeymap::reserveSpace (uint8_t layers) { +void +EEPROMKeymap::reserveSpace (uint8_t layers) { maxLayers = layers; keymapBase = ::EEPROMSettings.requestSlice (maxLayers * ROWS * COLS * 2); - } +} - Key - EEPROMKeymap::getKey (uint8_t layer, byte row, byte col) { +Key +EEPROMKeymap::getKey (uint8_t layer, byte row, byte col) { Key key; if (layer >= maxLayers) - return Key_NoKey; + return Key_NoKey; uint16_t pos = ((layer * ROWS * COLS) + (row * COLS) + col) * 2; @@ -51,89 +51,89 @@ namespace KaleidoscopePlugins { key.keyCode = EEPROM.read (keymapBase + pos + 1); return key; - } +} - Key - EEPROMKeymap::getKeyOverride (uint8_t layer, byte row, byte col) { +Key +EEPROMKeymap::getKeyOverride (uint8_t layer, byte row, byte col) { Key key; key = getKey (layer, row, col); if (key == Key_Transparent) - key = Layer.getKeyFromPROGMEM (layer, row, col); + key = Layer.getKeyFromPROGMEM (layer, row, col); return key; - } +} - uint16_t - EEPROMKeymap::base (void) { +uint16_t +EEPROMKeymap::base (void) { return keymapBase; - } +} - void - EEPROMKeymap::updateKey (uint16_t basePos, Key key) { +void +EEPROMKeymap::updateKey (uint16_t basePos, Key key) { EEPROM.update (keymapBase + basePos * 2, key.flags); EEPROM.update (keymapBase + basePos * 2 + 1, key.keyCode); - } +} - Key - EEPROMKeymap::parseKey (void) { +Key +EEPROMKeymap::parseKey (void) { Key key; key.raw = Serial.parseInt (); return key; - } +} - void - EEPROMKeymap::printKey (Key k) { +void +EEPROMKeymap::printKey (Key k) { ::Focus.printNumber (k.raw); - } +} - bool - EEPROMKeymap::focusKeymap (const char *command) { +bool +EEPROMKeymap::focusKeymap (const char *command) { if (strcmp_P (command, PSTR ("keymap.map")) != 0) - return false; + return false; if (Serial.peek () == '\n') { - for (uint8_t layer = 0; layer < maxLayers; layer++) { - for (uint8_t row = 0; row < ROWS; row++) { - for (uint8_t col = 0; col < COLS; col++) { - Key k = getKey (layer, row, col); - - printKey (k); - ::Focus.printSpace (); - } + for (uint8_t layer = 0; layer < maxLayers; layer++) { + for (uint8_t row = 0; row < ROWS; row++) { + for (uint8_t col = 0; col < COLS; col++) { + Key k = getKey (layer, row, col); + + printKey (k); + ::Focus.printSpace (); + } + } } - } - Serial.println (); + Serial.println (); } else { - uint16_t i = 0; - while ((Serial.peek () != '\n') && (i < ROWS * COLS * maxLayers)) { - updateKey (i, parseKey ()); - i++; - } + uint16_t i = 0; + while ((Serial.peek () != '\n') && (i < ROWS * COLS * maxLayers)) { + updateKey (i, parseKey ()); + i++; + } } return true; - } +} - bool - EEPROMKeymap::focusKeymapTransfer (const char *command) { +bool +EEPROMKeymap::focusKeymapTransfer (const char *command) { if (strcmp_P (command, PSTR ("keymap.transfer")) != 0) - return false; + return false; uint8_t layer = Serial.parseInt (); for (uint8_t row = 0; row < ROWS; row++) { - for (uint8_t col = 0; col < COLS; col++) { - Key k = Layer.getKeyFromPROGMEM (layer, row, col); - uint16_t pos = ((layer * ROWS * COLS) + (row * COLS) + col); + for (uint8_t col = 0; col < COLS; col++) { + Key k = Layer.getKeyFromPROGMEM (layer, row, col); + uint16_t pos = ((layer * ROWS * COLS) + (row * COLS) + col); - updateKey (pos, k); - } + updateKey (pos, k); + } } return true; - } +} }; diff --git a/src/Kaleidoscope/EEPROM-Keymap.h b/src/Kaleidoscope/EEPROM-Keymap.h index 65574d23..511cab35 100644 --- a/src/Kaleidoscope/EEPROM-Keymap.h +++ b/src/Kaleidoscope/EEPROM-Keymap.h @@ -22,7 +22,7 @@ #include namespace KaleidoscopePlugins { - class EEPROMKeymap : public KaleidoscopePlugin { +class EEPROMKeymap : public KaleidoscopePlugin { public: EEPROMKeymap (void); @@ -45,7 +45,7 @@ namespace KaleidoscopePlugins { static Key parseKey (void); static void printKey (Key key); - }; +}; }; extern KaleidoscopePlugins::EEPROMKeymap EEPROMKeymap;