From e857491953a7292eafcb4279ca6527077f61f539 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Mon, 6 Jun 2022 15:33:26 +0200 Subject: [PATCH] Reformat the factory firmware sketches with clang-format Also replaced the old astyle `IDENT-OFF`/`INDENT-ON` comment pairs with `clang-format off`/`clang-format on`, respectively. No functional changes, just formatting. Signed-off-by: Gergely Nagy --- .../FactoryFirmware/FactoryFirmware.ino | 7 +- .../FactoryFirmware/FactoryFirmware.ino | 34 +++--- .../FactoryFirmware/FactoryFirmware.ino | 101 +++++++++--------- .../FactoryFirmware/FactoryFirmware.ino | 19 ++-- 4 files changed, 80 insertions(+), 81 deletions(-) diff --git a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/examples/FactoryFirmware/FactoryFirmware.ino b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/examples/FactoryFirmware/FactoryFirmware.ino index c074e9a3..13efd60e 100644 --- a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/examples/FactoryFirmware/FactoryFirmware.ino +++ b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/examples/FactoryFirmware/FactoryFirmware.ino @@ -30,7 +30,7 @@ #include "Kaleidoscope-MouseKeys.h" #include "Kaleidoscope-Qukeys.h" -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -105,7 +105,7 @@ KEYMAPS( XXX, XXX, XXX ), ) -/* *INDENT-ON* */ +// clang-format on KALEIDOSCOPE_INIT_PLUGINS( EEPROMSettings, @@ -114,8 +114,7 @@ KALEIDOSCOPE_INIT_PLUGINS( FocusEEPROMCommand, FocusSettingsCommand, Qukeys, - MouseKeys -); + MouseKeys); void blinkAllStatusLEDs() { for (auto i = 0; i <= 3; i++) { diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/examples/FactoryFirmware/FactoryFirmware.ino b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/examples/FactoryFirmware/FactoryFirmware.ino index 8eb85b8b..59542b2c 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/examples/FactoryFirmware/FactoryFirmware.ino +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/examples/FactoryFirmware/FactoryFirmware.ino @@ -90,8 +90,7 @@ enum { MACRO_VERSION_INFO, MACRO_ANY - }; - +}; /** The Model 01's key layouts are defined as 'keymaps'. By default, there are three @@ -142,7 +141,9 @@ enum { MACRO_VERSION_INFO, * */ -enum { PRIMARY, NUMPAD, FUNCTION }; // layers +enum { PRIMARY, + NUMPAD, + FUNCTION }; // layers /** @@ -164,11 +165,10 @@ enum { PRIMARY, NUMPAD, FUNCTION }; // layers // #define PRIMARY_KEYMAP_CUSTOM - /* This comment temporarily turns off astyle's indent enforcement * so we can make the keymaps actually resemble the physical key layout better */ -// *INDENT-OFF* +// clang-format off KEYMAPS( @@ -279,7 +279,7 @@ KEYMAPS( ) // KEYMAPS( /* Re-enable astyle's indent enforcement */ -// *INDENT-ON* +// clang-format on /** versionInfoMacro handles the 'firmware version info' macro * When a key bound to the macro is pressed, this macro @@ -336,7 +336,6 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { } - // These 'solid' color effect definitions define a rainbow of // LED color modes calibrated to draw 500mA or less on the // Keyboardio Model 01. @@ -412,12 +411,10 @@ static void enterHardwareTestMode(uint8_t combo_index) { */ USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol, // Left Fn + Esc + Shift - .keys = { R3C6, R2C6, R3C7 } -}, { - .action = enterHardwareTestMode, - // Left Fn + Prog + LED - .keys = { R3C6, R0C0, R0C6 } -}); + .keys = {R3C6, R2C6, R3C7}}, + {.action = enterHardwareTestMode, + // Left Fn + Prog + LED + .keys = {R3C6, R0C0, R0C6}}); // First, tell Kaleidoscope which plugins you want to use. // The order can be important. For example, LED effects are @@ -468,7 +465,13 @@ KALEIDOSCOPE_INIT_PLUGINS( LEDChaseEffect, // These static effects turn your keyboard's LEDs a variety of colors - solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet, + solidRed, + solidOrange, + solidYellow, + solidGreen, + solidBlue, + solidIndigo, + solidViolet, // The breathe effect slowly pulses all of the LEDs on your keyboard LEDBreatheEffect, @@ -510,8 +513,7 @@ KALEIDOSCOPE_INIT_PLUGINS( // comfortable - or able - to do automatically, but can be useful // nevertheless. Such as toggling the key report protocol between Boot (used // by BIOSes) and Report (NKRO). - USBQuirks -); + USBQuirks); /** The 'setup' function is one of the two standard Arduino sketch functions. * It's called when your keyboard first powers up. This is where you set up diff --git a/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/examples/FactoryFirmware/FactoryFirmware.ino b/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/examples/FactoryFirmware/FactoryFirmware.ino index d0e87d2a..9d22e423 100644 --- a/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/examples/FactoryFirmware/FactoryFirmware.ino +++ b/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/examples/FactoryFirmware/FactoryFirmware.ino @@ -43,56 +43,56 @@ enum { QWERTY_2 }; -#define QWERTY1 Key(QWERTY_1) -#define QWERTY2 Key(QWERTY_2) +#define QWERTY1 Key(QWERTY_1) +#define QWERTY2 Key(QWERTY_2) #define MO(layer) ShiftToLayer(layer) #define TO(layer) LockLayer(layer) -#define K_STP Consumer_Stop -#define K_PRV Consumer_ScanPreviousTrack -#define K_NXT Consumer_ScanNextTrack -#define K_PLY Consumer_PlaySlashPause +#define K_STP Consumer_Stop +#define K_PRV Consumer_ScanPreviousTrack +#define K_NXT Consumer_ScanNextTrack +#define K_PLY Consumer_PlaySlashPause // Key aliases -#define Key_PgUp Key_PageUp +#define Key_PgUp Key_PageUp #define Key_PageDn Key_PageDown -#define Key_PgDn Key_PageDown -#define Key_Del Key_Delete -#define Key_Grave Key_Backtick -#define K_APP Key_PcApplication -#define K_SCRLK Key_ScrollLock -#define K_CPSLK Key_CapsLock -#define K_PAUSE Key_Pause -#define K_PRSCR Key_PrintScreen -#define K_MUTE Consumer_Mute -#define K_VUp Consumer_VolumeIncrement -#define K_VDn Consumer_VolumeDecrement -#define K_PST LCTRL(Key_V) -#define K_CPY LCTRL(Key_LeftControl) -#define K_CUT LCTRL(Key_X) -#define K_UDO LCTRL(Key_Z) +#define Key_PgDn Key_PageDown +#define Key_Del Key_Delete +#define Key_Grave Key_Backtick +#define K_APP Key_PcApplication +#define K_SCRLK Key_ScrollLock +#define K_CPSLK Key_CapsLock +#define K_PAUSE Key_Pause +#define K_PRSCR Key_PrintScreen +#define K_MUTE Consumer_Mute +#define K_VUp Consumer_VolumeIncrement +#define K_VDn Consumer_VolumeDecrement +#define K_PST LCTRL(Key_V) +#define K_CPY LCTRL(Key_LeftControl) +#define K_CUT LCTRL(Key_X) +#define K_UDO LCTRL(Key_Z) -#define KP_0 Key_Keypad0 -#define KP_1 Key_Keypad1 -#define KP_2 Key_Keypad2 -#define KP_3 Key_Keypad3 -#define KP_4 Key_Keypad4 -#define KP_5 Key_Keypad5 -#define KP_6 Key_Keypad6 -#define KP_7 Key_Keypad7 -#define KP_8 Key_Keypad8 -#define KP_9 Key_Keypad9 +#define KP_0 Key_Keypad0 +#define KP_1 Key_Keypad1 +#define KP_2 Key_Keypad2 +#define KP_3 Key_Keypad3 +#define KP_4 Key_Keypad4 +#define KP_5 Key_Keypad5 +#define KP_6 Key_Keypad6 +#define KP_7 Key_Keypad7 +#define KP_8 Key_Keypad8 +#define KP_9 Key_Keypad9 -#define Key_Up Key_UpArrow -#define Key_Dn Key_DownArrow -#define Key_Left Key_LeftArrow -#define Key_Rgt Key_RightArrow -#define KP_SLS Key_KeypadDivide -#define KP_STR Key_KeypadMultiply -#define Key_Plus Key_KeypadAdd +#define Key_Up Key_UpArrow +#define Key_Dn Key_DownArrow +#define Key_Left Key_LeftArrow +#define Key_Rgt Key_RightArrow +#define KP_SLS Key_KeypadDivide +#define KP_STR Key_KeypadMultiply +#define Key_Plus Key_KeypadAdd -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( /* QWERTY * ,-------------------------. ,--------------------------. @@ -203,7 +203,7 @@ KEYMAPS( ,Key_C ,Key_V ,Key_N ,Key_M ) ); -/* *INDENT-ON* */ +// clang-format on namespace kaleidoscope { namespace plugin { @@ -233,20 +233,19 @@ class MultiSwitcher : public kaleidoscope::Plugin { private: uint8_t switch_state_ = 0; }; -} -} +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::MultiSwitcher MultiSwitcher; KALEIDOSCOPE_INIT_PLUGINS( - GeminiPR, - MultiSwitcher, - Focus, - EEPROMSettings, - EEPROMKeymap, - FocusEEPROMCommand, - FocusSettingsCommand -); + GeminiPR, + MultiSwitcher, + Focus, + EEPROMSettings, + EEPROMKeymap, + FocusEEPROMCommand, + FocusSettingsCommand); void setup() { Kaleidoscope.setup(); diff --git a/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/examples/FactoryFirmware/FactoryFirmware.ino b/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/examples/FactoryFirmware/FactoryFirmware.ino index 42c61893..1a8bea0f 100644 --- a/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/examples/FactoryFirmware/FactoryFirmware.ino +++ b/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/examples/FactoryFirmware/FactoryFirmware.ino @@ -32,12 +32,12 @@ enum { }; #define Key_Exclamation LSHIFT(Key_1) -#define Key_At LSHIFT(Key_2) -#define Key_Hash LSHIFT(Key_3) -#define Key_Dollar LSHIFT(Key_4) -#define Key_And LSHIFT(Key_7) -#define Key_Star LSHIFT(Key_8) -#define Key_Plus LSHIFT(Key_Equals) +#define Key_At LSHIFT(Key_2) +#define Key_Hash LSHIFT(Key_3) +#define Key_Dollar LSHIFT(Key_4) +#define Key_And LSHIFT(Key_7) +#define Key_Star LSHIFT(Key_8) +#define Key_Plus LSHIFT(Key_Equals) enum { _QW, @@ -45,7 +45,7 @@ enum { _LW }; -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [_QW] = KEYMAP_STACKED ( @@ -86,7 +86,7 @@ KEYMAPS( ,___ ,___ ,M(QW) ,Key_PrintScreen ,Key_ScrollLock ,Consumer_PlaySlashPause ) ) -/* *INDENT-ON* */ +// clang-format on KALEIDOSCOPE_INIT_PLUGINS( EEPROMSettings, @@ -94,8 +94,7 @@ KALEIDOSCOPE_INIT_PLUGINS( Focus, FocusEEPROMCommand, FocusSettingsCommand, - Macros -); + Macros); const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { switch (macro_id) {