From 69333badc982cdfab826a5442527bd1e5c23b55f Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Fri, 25 Mar 2022 13:15:46 -0500 Subject: [PATCH] Turn off clang-format for selected sections of code There are a number of places in our code where clang-format tries too hard, and destroys human readability, so I protected them with `clang-format off` directives. Signed-off-by: Michael Richters --- .../src/kaleidoscope/device/dygma/Raise.cpp | 6 ++++-- .../src/kaleidoscope/device/dygma/Raise.h | 8 ++++++-- .../src/kaleidoscope/device/ez/ErgoDox.h | 2 ++ .../src/kaleidoscope/device/gd32/Eval.h | 2 ++ .../src/kaleidoscope/device/kbdfans/KBD4x.h | 2 ++ .../src/kaleidoscope/device/keyboardio/Atreus2.h | 3 +++ .../src/kaleidoscope/device/keyboardio/Imago.h | 6 +++++- .../src/kaleidoscope/device/keyboardio/Model01.h | 8 ++++++-- .../src/kaleidoscope/device/keyboardio/Model100.h | 8 ++++++-- .../src/kaleidoscope/device/olkb/Planck.h | 2 ++ .../kaleidoscope/device/softhruf/Splitography.h | 4 ++++ .../src/kaleidoscope/device/technomancy/Atreus.h | 4 ++++ .../src/kaleidoscope/device/gheavy/ButterStick.h | 3 +++ .../src/kaleidoscope/device/gheavy/FaunchPad.h | 3 +++ .../src/kaleidoscope/plugin/LED-AlphaSquare.h | 4 +++- .../plugin/LED-AlphaSquare/Font-3x4.h | 1 + .../plugin/LED-AlphaSquare/Font-4x4.h | 2 ++ .../kaleidoscope/plugin/LED-AlphaSquare/Symbols.h | 3 +++ .../src/kaleidoscope/plugin/LED-Wavepool.cpp | 15 ++++++++++----- src/kaleidoscope/HIDTables.h | 1 + src/kaleidoscope/bitfields.h | 2 ++ .../device/virtual/DefaultHIDReportConsumer.cpp | 2 ++ src/kaleidoscope/event_handlers.h | 2 ++ src/kaleidoscope/hooks.cpp | 2 ++ src/kaleidoscope/hooks.h | 3 +++ src/kaleidoscope/key_defs/keymaps.h | 8 ++++++-- src/kaleidoscope/layers.h | 4 ++++ src/kaleidoscope/macro_helpers.h | 2 ++ src/kaleidoscope/macro_map.h | 2 ++ src/kaleidoscope/version.h | 2 ++ src/kaleidoscope_internal/LEDModeManager.h | 2 ++ src/kaleidoscope_internal/compiler_warnings.h | 4 ++++ src/kaleidoscope_internal/deprecations.h | 2 ++ src/kaleidoscope_internal/event_dispatch.h | 2 ++ .../eventhandler_signature_check.h | 2 ++ src/kaleidoscope_internal/shortname.h | 2 ++ .../sketch_exploration/keymap_exploration.h | 4 ++++ .../sketch_exploration/plugin_exploration.h | 2 ++ .../sketch_exploration/sketch_exploration.h | 2 ++ .../type_traits/has_member.h | 2 ++ .../type_traits/has_method.h | 2 ++ 41 files changed, 125 insertions(+), 17 deletions(-) diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.cpp b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.cpp index 825428cf..421302bd 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.cpp +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.cpp @@ -371,9 +371,11 @@ void RaiseKeyScanner::setKeyscanInterval(uint8_t interval) { } void RaiseKeyScanner::setup() { + // clang-format off static constexpr uint8_t keyscanner_pins[] = { - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 - }; + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + }; // clang-format on for (int i = 0; i < sizeof(keyscanner_pins); i++) { pinMode(keyscanner_pins[i], OUTPUT); digitalWrite(keyscanner_pins[i], LOW); diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h index eb6a8854..30c15437 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h @@ -44,6 +44,7 @@ using kaleidoscope::driver::led::no_led; struct RaiseLEDDriverProps : public kaleidoscope::driver::led::BaseProps { static constexpr uint8_t led_count = 132; + // clang-format off static constexpr uint8_t key_led_map[] = { // ISO & ANSI (ANSI has no LED at 20, but this key can never be pressed so we can have just one map). 0, 1, 2, 3, 4, 5, 6, no_led, no_led, 6 + LHK, 5 + LHK, 4 + LHK, 3 + LHK, 2 + LHK, 1 + LHK, 0 + LHK, @@ -51,7 +52,7 @@ struct RaiseLEDDriverProps : public kaleidoscope::driver::led::BaseProps { 13, 14, 15, 16, 17, 18, no_led, no_led, no_led, 21 + LHK, 20 + LHK, 19 + LHK, 18 + LHK, 17 + LHK, 16 + LHK, 15 + LHK, 19, 20, 21, 22, 23, 24, 25, no_led, no_led, no_led, 27 + LHK, 26 + LHK, 25 + LHK, 24 + LHK, 23 + LHK, 22 + LHK, 26, 27, 28, 29, 30, no_led, 31, 32, 35 + LHK, 34 + LHK, 33 + LHK, 32 + LHK, 31 + LHK, 30 + LHK, 29 + LHK, 28 + LHK - }; + }; // clang-format on }; #undef LHK @@ -76,6 +77,7 @@ class RaiseLEDDriver : public kaleidoscope::driver::led::Base { class ErgoDox; #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off + #define PER_KEY_DATA_STACKED(dflt, \ /* left hand, spatial positions */ \ r0c0, r0c1, r0c2, r0c3, r0c4, r0c5, r0c6, \ diff --git a/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.h b/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.h index 6da0820b..71269ac1 100644 --- a/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.h +++ b/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.h @@ -43,10 +43,12 @@ struct EvalProps: kaleidoscope::device::BaseProps { class Eval: public kaleidoscope::device::Base {}; +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1 \ ) \ R0C0, R0C1 +// clang-format on } // namespace gd32 } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.h b/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.h index 9bc0a9fd..17c25ac7 100644 --- a/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.h +++ b/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.h @@ -63,6 +63,7 @@ class KBD4x; #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, R0C10, R0C11, \ R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, \ @@ -73,6 +74,7 @@ class KBD4x; R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, \ R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, R2C7, R2C8, R2C9, R2C10, R2C11, \ R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C5, R3C7, R3C8, R3C9, R3C10, R3C11 +// clang-format on } // namespace kbdfans } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.h index 8229c650..3f1c2383 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.h @@ -61,6 +61,7 @@ class Atreus; #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C7, R0C8, R0C9, R0C10, R0C11, \ @@ -89,6 +90,8 @@ class Atreus; R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, R2C7, R2C8, R2C9, R2C10, R2C11, \ R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 +// clang-format on + } // namespace keyboardio } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.h index 8f080a02..31675fba 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.h @@ -43,11 +43,13 @@ using kaleidoscope::driver::led::no_led; struct ImagoLEDDriverProps: public kaleidoscope::driver::led::BaseProps { static constexpr uint8_t led_count = 78; static constexpr uint8_t key_led_map[/* 5*16 */] PROGMEM = { - 104, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 115, 12, 116, + // clang-format off + 104, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 115, 12, 116, 91, 13, no_led, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 102, 15, 103, 78, 26, 27, 28, 29, 30, 31, no_led, 33, 34, 35, 36, 37, 89, 38, no_led, 65, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, no_led, 90, 52, 66, 53, 54, no_led, 56, 57, 71, 59, no_led, 61, 62, 63, 64, no_led, 77 + // clang-format on }; }; @@ -107,6 +109,7 @@ class Imago: public kaleidoscope::device::ATmega32U4Keyboard { }; #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, R0C10, R0C11, R0C12, R0C13, R0C14, R0C15, \ R1C0, R1C1, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, R1C12, R1C13, R1C14, R1C15, \ @@ -119,6 +122,7 @@ class Imago: public kaleidoscope::device::ATmega32U4Keyboard { R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, XXX, R2C8, R2C9, R2C10, R2C11, R2C12, R2C13, R2C14, XXX , \ R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11, R3C12, R3C13, XXX, R3C15, \ R4C0, R4C1, R4C2, R4C3, XXX, R4C5, R4C6, R4C7, R4C8, XXX, R4C10, R4C11, R4C12, R4C13, XXX, R4C15 +// clang-format on } // namespace keyboardio } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.h index b3d292ad..060da4ae 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.h @@ -53,10 +53,12 @@ namespace keyboardio { struct Model01LEDDriverProps : public kaleidoscope::driver::led::BaseProps { static constexpr uint8_t led_count = 64; static constexpr uint8_t key_led_map[] PROGMEM = { + // clang-format off 3, 4, 11, 12, 19, 20, 26, 27, 36, 37, 43, 44, 51, 52, 59, 60, 2, 5, 10, 13, 18, 21, 25, 28, 35, 38, 42, 45, 50, 53, 58, 61, - 1, 6, 9, 14, 17, 22, 24, 29, 34, 39, 41, 46, 49, 54, 57, 62, - 0, 7, 8, 15, 16, 23, 31, 30, 33, 32, 40, 47, 48, 55, 56, 63, + 1, 6, 9, 14, 17, 22, 24, 29, 34, 39, 41, 46, 49, 54, 57, 62, + 0, 7, 8, 15, 16, 23, 31, 30, 33, 32, 40, 47, 48, 55, 56, 63, + // clang-format on }; }; @@ -143,6 +145,8 @@ EXPORT_DEVICE(kaleidoscope::device::keyboardio::Model01) } // namespace kaleidoscope +// clang-format off + #define PER_KEY_DATA_STACKED(dflt, \ r0c0, r0c1, r0c2, r0c3, r0c4, r0c5, r0c6, \ r1c0, r1c1, r1c2, r1c3, r1c4, r1c5, r1c6, \ diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h index eb4a8354..d093cde2 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h @@ -55,10 +55,12 @@ struct Model100StorageProps: public kaleidoscope::driver::storage::GD32FlashProp struct Model100LEDDriverProps : public kaleidoscope::driver::led::BaseProps { static constexpr uint8_t led_count = 64; static constexpr uint8_t key_led_map[] PROGMEM = { + // clang-format off 3, 4, 11, 12, 19, 20, 26, 27, 36, 37, 43, 44, 51, 52, 59, 60, 2, 5, 10, 13, 18, 21, 25, 28, 35, 38, 42, 45, 50, 53, 58, 61, - 1, 6, 9, 14, 17, 22, 24, 29, 34, 39, 41, 46, 49, 54, 57, 62, - 0, 7, 8, 15, 16, 23, 31, 30, 33, 32, 40, 47, 48, 55, 56, 63, + 1, 6, 9, 14, 17, 22, 24, 29, 34, 39, 41, 46, 49, 54, 57, 62, + 0, 7, 8, 15, 16, 23, 31, 30, 33, 32, 40, 47, 48, 55, 56, 63, + // clang-format on }; }; @@ -165,6 +167,8 @@ EXPORT_DEVICE(kaleidoscope::device::keyboardio::Model100) } // namespace kaleidoscope +// clang-format off + #define PER_KEY_DATA_STACKED(dflt, \ r0c0, r0c1, r0c2, r0c3, r0c4, r0c5, r0c6, \ r1c0, r1c1, r1c2, r1c3, r1c4, r1c5, r1c6, \ diff --git a/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.h b/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.h index 6916b684..2474bfa1 100644 --- a/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.h +++ b/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.h @@ -56,6 +56,7 @@ class Planck; #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, R0C10, R0C11, \ R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, \ @@ -66,6 +67,7 @@ class Planck; R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, \ R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, R2C7, R2C8, R2C9, R2C10, R2C11, \ R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 +// clang-format on } // namespace olkb } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.h b/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.h index b513028c..3a203ecd 100644 --- a/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.h +++ b/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.h @@ -68,6 +68,8 @@ class Splitography: public kaleidoscope::device::ATmega32U4Keyboard {}; class Atreus; #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off + #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C7, R0C8, R0C9, R0C10, R0C11, \ R1C0, R1C1, R1C2, R1C3, R1C4, R1C7, R1C8, R1C9, R1C10, R1C11, \ @@ -113,6 +115,8 @@ class Atreus; R2C0, R2C1, R2C2, R2C3, R2C4, R3C5, R2C7, R2C8, R2C9, R2C10, R2C11, \ R3C0, R3C1, R3C2, R3C3, R3C4, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 +// clang-format on + } // namespace technomancy } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.h b/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.h index 9cc5a0cb..1344fa39 100644 --- a/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.h +++ b/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.h @@ -58,12 +58,15 @@ class ButterStick; #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, \ R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9 \ ) \ R0C9, R0C8, R0C7, R0C6, R0C5, R0C4, R0C3, R0C2, R0C1, R0C0, \ R1C9, R1C8, R1C7, R1C6, R1C5, R1C4, R1C3, R1C2, R1C1, R1C0 +// clang-format on + } // namespace gheavy } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-gHeavy-FaunchPad/src/kaleidoscope/device/gheavy/FaunchPad.h b/plugins/Kaleidoscope-Hardware-gHeavy-FaunchPad/src/kaleidoscope/device/gheavy/FaunchPad.h index dfb85663..a5f2ca9c 100644 --- a/plugins/Kaleidoscope-Hardware-gHeavy-FaunchPad/src/kaleidoscope/device/gheavy/FaunchPad.h +++ b/plugins/Kaleidoscope-Hardware-gHeavy-FaunchPad/src/kaleidoscope/device/gheavy/FaunchPad.h @@ -58,11 +58,14 @@ class FaunchPad; #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7 \ ) \ R0C0, R0C1, R0C2, R0C3, \ R0C4, R0C5, R0C6, R0C7 +// clang-format on + } // namespace gheavy } // namespace device diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.h index 845da0ef..d2a85b49 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.h @@ -25,16 +25,18 @@ struct cRGB; +// clang-format off #define SYM4x4( \ p00, p01, p02, p03, \ p10, p11, p12, p13, \ p20, p21, p22, p23, \ - p30, p31, p32, p33) \ + p30, p31, p32, p33) \ (uint16_t) ( \ p00 << 0 | p01 << 1 | p02 << 2 | p03 << 3 | \ p10 << 4 | p11 << 5 | p12 << 6 | p13 << 7 | \ p20 << 8 | p21 << 9 | p22 << 10 | p23 << 11 | \ p30 << 12 | p31 << 13 | p32 << 14 | p33 << 15 ) +// clang-format on namespace kaleidoscope { namespace plugin { diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h index 2fae3bf0..74eb9982 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h @@ -14,6 +14,7 @@ * this program. If not, see . */ +// clang-format off #pragma once diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h index f33e3388..7a526a4d 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #ifndef KALEIDOSCOPE_LED_FONT diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h index 68361699..4bee0199 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h @@ -26,11 +26,14 @@ namespace plugin { namespace alpha_square { namespace symbols { +// clang-format off + /* λ */ static constexpr uint16_t Lambda = SYM4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1); +// clang-format on } // namespace symbols } // namespace alpha_square diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp index c5195187..ef4a6587 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp @@ -44,10 +44,12 @@ int16_t WavepoolEffect::ripple_hue = WavepoolEffect::rainbow_hue; // automatic h // map native keyboard coordinates (16x4) into geometric space (14x5) PROGMEM const uint8_t WavepoolEffect::TransientLEDMode::rc2pos[Runtime.device().numKeys()] = { + // clang-format off 0, 1, 2, 3, 4, 5, 6, 59, 66, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 34, 60, 65, 35, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 48, 61, 64, 49, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 58, 62, 63, 67, 50, 51, 52, 53, 54, 55, + // clang-format on }; WavepoolEffect::TransientLEDMode::TransientLEDMode(const WavepoolEffect *parent) @@ -162,11 +164,14 @@ void WavepoolEffect::TransientLEDMode::update(void) { uint8_t offset = (y * WP_WID) + x; int16_t value; - int8_t offsets[] = { -WP_WID, WP_WID, - -1, 1, - -WP_WID - 1, -WP_WID + 1, - WP_WID - 1, WP_WID + 1 - }; + int8_t offsets[] = { + // clang-format off + -WP_WID, WP_WID, + -1, 1, + -WP_WID - 1, -WP_WID + 1, + WP_WID - 1, WP_WID + 1 + // clang-format on + }; // don't wrap around edges or go out of bounds if (y == 0) { offsets[0] = 0; diff --git a/src/kaleidoscope/HIDTables.h b/src/kaleidoscope/HIDTables.h index 59784338..7e309df5 100644 --- a/src/kaleidoscope/HIDTables.h +++ b/src/kaleidoscope/HIDTables.h @@ -16,6 +16,7 @@ #pragma once +// clang-format off // These mappings were extracted and transcribed from // https://www.usb.org/sites/default/files/hut1_2.pdf diff --git a/src/kaleidoscope/bitfields.h b/src/kaleidoscope/bitfields.h index c7cb6d9a..d530021c 100644 --- a/src/kaleidoscope/bitfields.h +++ b/src/kaleidoscope/bitfields.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include // for PROGMEM diff --git a/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp b/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp index 3e54e268..b90f854d 100644 --- a/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp +++ b/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp @@ -72,6 +72,7 @@ void DefaultHIDReportConsumer::processHIDReport( if (!anything) { keypresses << "none"; } else { + // clang-format off FOREACHBIT(report_data.modifiers, keypresses, "lctrl ", "lshift ", "lalt ", "lgui ", "rctrl ", "rshift ", "ralt ", "rgui ") @@ -114,6 +115,7 @@ void DefaultHIDReportConsumer::processHIDReport( FOREACHBIT(report_data.keys[16], keypresses, "volup ", "voldn ", "capslock_l ", "numlock_l ", "scrolllock_l ", "num, ", "num= ", "(other) ") + // clang-format on for (int i = 17; i < KEY_BYTES; i++) { // A little imprecise, in two ways: diff --git a/src/kaleidoscope/event_handlers.h b/src/kaleidoscope/event_handlers.h index 806f89d2..0c99f1a8 100644 --- a/src/kaleidoscope/event_handlers.h +++ b/src/kaleidoscope/event_handlers.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once // This file defines the names and argument signatures for all event handlers diff --git a/src/kaleidoscope/hooks.cpp b/src/kaleidoscope/hooks.cpp index cdecf296..899a60e0 100644 --- a/src/kaleidoscope/hooks.cpp +++ b/src/kaleidoscope/hooks.cpp @@ -30,6 +30,7 @@ namespace kaleidoscope { // that we can compile sketches that use no plugins, without them having to use // KALEIDOSCOPE_INIT_PLUGINS() with a dummy plugin. +// clang-format off #define INSTANTIATE_WEAK_HOOK_FUNCTION( \ HOOK_NAME, HOOK_VERSION, DEPRECATION_TAG, \ SHOULD_EXIT_IF_RESULT_NOT_OK, \ @@ -43,6 +44,7 @@ namespace kaleidoscope { } _FOR_EACH_EVENT_HANDLER(INSTANTIATE_WEAK_HOOK_FUNCTION) +// clang-format on #undef INSTANTIATE_WEAK_HOOK_FUNCTION diff --git a/src/kaleidoscope/hooks.h b/src/kaleidoscope/hooks.h index 4481bc9d..584a22d4 100644 --- a/src/kaleidoscope/hooks.h +++ b/src/kaleidoscope/hooks.h @@ -64,6 +64,7 @@ class Hooks { // The following private functions are just to be called by classes // and functions that are declared as friends above. + // clang-format off #define DEFINE_WEAK_HOOK_FUNCTION( \ HOOK_NAME, HOOK_VERSION, DEPRECATION_TAG, \ SHOULD_EXIT_IF_RESULT_NOT_OK, \ @@ -76,6 +77,8 @@ class Hooks { _FOR_EACH_EVENT_HANDLER(DEFINE_WEAK_HOOK_FUNCTION) #undef DEFINE_WEAK_HOOK_FUNCTION + // clang-format on + }; } // namespace kaleidoscope diff --git a/src/kaleidoscope/key_defs/keymaps.h b/src/kaleidoscope/key_defs/keymaps.h index 22854edd..ea8c322f 100644 --- a/src/kaleidoscope/key_defs/keymaps.h +++ b/src/kaleidoscope/key_defs/keymaps.h @@ -22,6 +22,7 @@ static const uint8_t LAYER_OP_OFFSET = 42; static const uint8_t LAYER_SHIFT_OFFSET = LAYER_OP_OFFSET; static const uint8_t LAYER_MOVE_OFFSET = LAYER_SHIFT_OFFSET + LAYER_OP_OFFSET;; +// Layer number constants #define KEYMAP_0 0 #define KEYMAP_1 1 #define KEYMAP_2 2 @@ -31,17 +32,19 @@ static const uint8_t LAYER_MOVE_OFFSET = LAYER_SHIFT_OFFSET + LAYER_OP_OFFSET;; #define KEYMAP_6 6 #define KEYMAP_7 7 - +// Previous/next layer key constants #define KEYMAP_PREVIOUS 33 #define KEYMAP_NEXT 34 - +// Layer lock keys #define Key_Keymap0 Key(KEYMAP_0, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap1 Key(KEYMAP_1, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap2 Key(KEYMAP_2, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap3 Key(KEYMAP_3, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap4 Key(KEYMAP_4, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap5 Key(KEYMAP_5, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) + +// Layer shift keys #define Key_Keymap0_Momentary Key(KEYMAP_0 + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap1_Momentary Key(KEYMAP_1 + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap2_Momentary Key(KEYMAP_2 + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) @@ -49,6 +52,7 @@ static const uint8_t LAYER_MOVE_OFFSET = LAYER_SHIFT_OFFSET + LAYER_OP_OFFSET;; #define Key_Keymap4_Momentary Key(KEYMAP_4 + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap5_Momentary Key(KEYMAP_5 + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) +// Next/previous layer shift keys #define Key_KeymapNext_Momentary Key(KEYMAP_NEXT + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_KeymapPrevious_Momentary Key(KEYMAP_PREVIOUS + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) diff --git a/src/kaleidoscope/layers.h b/src/kaleidoscope/layers.h index 6966156d..36225a79 100644 --- a/src/kaleidoscope/layers.h +++ b/src/kaleidoscope/layers.h @@ -29,6 +29,8 @@ #include "kaleidoscope_internal/shortname.h" // for _INIT_HID_GETSHOR... #include "kaleidoscope_internal/sketch_exploration/sketch_exploration.h" // for _INIT_SKETCH_EXPL... +// clang-format off + #define START_KEYMAPS __NL__ \ constexpr Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns] PROGMEM = { @@ -48,6 +50,8 @@ layers __NL__ \ END_KEYMAPS +// clang-format on + extern uint8_t layer_count; namespace kaleidoscope { diff --git a/src/kaleidoscope/macro_helpers.h b/src/kaleidoscope/macro_helpers.h index 7ce9ab69..4016802b 100644 --- a/src/kaleidoscope/macro_helpers.h +++ b/src/kaleidoscope/macro_helpers.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once // Code generated by muli-line pre-processor macros is hard to read after diff --git a/src/kaleidoscope/macro_map.h b/src/kaleidoscope/macro_map.h index e5fd2082..e464a491 100644 --- a/src/kaleidoscope/macro_map.h +++ b/src/kaleidoscope/macro_map.h @@ -26,6 +26,8 @@ * prior written authorization from the authors. */ +// clang-format off + #pragma once #define EVAL0(...) __VA_ARGS__ diff --git a/src/kaleidoscope/version.h b/src/kaleidoscope/version.h index 97cf4171..ff58d767 100644 --- a/src/kaleidoscope/version.h +++ b/src/kaleidoscope/version.h @@ -1,5 +1,7 @@ // -*- mode: c++ -*- +// clang-format off + #pragma once // We use `include-what-you-use`, which uses `clang` to help manage header diff --git a/src/kaleidoscope_internal/LEDModeManager.h b/src/kaleidoscope_internal/LEDModeManager.h index 2bab69b1..f17da4da 100644 --- a/src/kaleidoscope_internal/LEDModeManager.h +++ b/src/kaleidoscope_internal/LEDModeManager.h @@ -383,6 +383,8 @@ class LEDModeManager { } // namespace internal } // namespace kaleidoscope +// clang-format off + // Some auxiliary macros that are mapped to the list of // plugins defined via KALEIDOSCOPE_INIT_PLUGINS follow. diff --git a/src/kaleidoscope_internal/compiler_warnings.h b/src/kaleidoscope_internal/compiler_warnings.h index 526abaee..cd4ddd82 100644 --- a/src/kaleidoscope_internal/compiler_warnings.h +++ b/src/kaleidoscope_internal/compiler_warnings.h @@ -14,8 +14,12 @@ * this program. If not, see . */ +// clang-format off + #pragma once +#include "kaleidoscope/macro_helpers.h" // for __NL__ + // Please note that due to a bug in older gcc versions the following // warning suppressions mechanism does not work for gcc versions below 6.1. diff --git a/src/kaleidoscope_internal/deprecations.h b/src/kaleidoscope_internal/deprecations.h index 5cedea76..ff38a46a 100644 --- a/src/kaleidoscope_internal/deprecations.h +++ b/src/kaleidoscope_internal/deprecations.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include "kaleidoscope/macro_helpers.h" diff --git a/src/kaleidoscope_internal/event_dispatch.h b/src/kaleidoscope_internal/event_dispatch.h index 0e58d9d4..c2594283 100644 --- a/src/kaleidoscope_internal/event_dispatch.h +++ b/src/kaleidoscope_internal/event_dispatch.h @@ -31,6 +31,8 @@ * generated code in an entirely different namespace. */ +// clang-format off + #pragma once #include "kaleidoscope/event_handlers.h" diff --git a/src/kaleidoscope_internal/eventhandler_signature_check.h b/src/kaleidoscope_internal/eventhandler_signature_check.h index 117e70c3..9269023c 100644 --- a/src/kaleidoscope_internal/eventhandler_signature_check.h +++ b/src/kaleidoscope_internal/eventhandler_signature_check.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include "kaleidoscope/event_handlers.h" // for _PROCESS_E... diff --git a/src/kaleidoscope_internal/shortname.h b/src/kaleidoscope_internal/shortname.h index caaedac4..80f6fa88 100644 --- a/src/kaleidoscope_internal/shortname.h +++ b/src/kaleidoscope_internal/shortname.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once /* diff --git a/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h b/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h index eb49fc0f..5a5fa05e 100644 --- a/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h +++ b/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h @@ -208,6 +208,8 @@ extern void pluginsExploreSketch(); // //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// clang-format off + // This macro defines a Sketch interface class that is passed to the // exploreSketch<_Sketch>(...)-hook. // @@ -302,5 +304,7 @@ extern void pluginsExploreSketch(); } /* namespace sketch_exploration */ \ } /* namespace kaleidoscope */ +// clang-format on + } // namespace sketch_exploration } // namespace kaleidoscope diff --git a/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h b/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h index e2085454..a2a93b9b 100644 --- a/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h +++ b/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h @@ -156,6 +156,8 @@ struct Plugins__ { } // namespace sketch_exploration } // namespace kaleidoscope +// clang-format off + #define _FIX_PLUGIN_TYPE_AND_NAME_AMBIGUITIES(T) T #define _INIT_PLUGIN_EXPLORATION(...) \ diff --git a/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h b/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h index 75dd6760..7e0aafa3 100644 --- a/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h +++ b/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include "kaleidoscope_internal/sketch_exploration/keymap_exploration.h" diff --git a/src/kaleidoscope_internal/type_traits/has_member.h b/src/kaleidoscope_internal/type_traits/has_member.h index 62de2755..9e49cb88 100644 --- a/src/kaleidoscope_internal/type_traits/has_member.h +++ b/src/kaleidoscope_internal/type_traits/has_member.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include "kaleidoscope/macro_helpers.h" // for __NL__ diff --git a/src/kaleidoscope_internal/type_traits/has_method.h b/src/kaleidoscope_internal/type_traits/has_method.h index a0961543..298a53e0 100644 --- a/src/kaleidoscope_internal/type_traits/has_method.h +++ b/src/kaleidoscope_internal/type_traits/has_method.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include "kaleidoscope/macro_helpers.h" // for __NL__, UNWRAP, ADD_TEMPLATE...