From da03cbeccb4474e374dfc67c1208e1becb403e08 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Tue, 5 Apr 2022 12:46:42 -0500 Subject: [PATCH 1/4] Replace clang-format wrapper script with something more configurable This python script is more configurable than the shell script that it replaces, and makes it clearer when looking at the makefile what it's acting on. Signed-off-by: Michael Richters --- Makefile | 12 +- bin/format-code.py | 271 +++++++++++++++++++++++++++++++++++++++++++++ bin/format-code.sh | 29 ++--- 3 files changed, 289 insertions(+), 23 deletions(-) create mode 100755 bin/format-code.py diff --git a/Makefile b/Makefile index 29a3464f..25246a54 100644 --- a/Makefile +++ b/Makefile @@ -106,10 +106,18 @@ find-filename-conflicts: .PHONY: format check-formatting cpplint cpplint-noisy shellcheck smoke-examples find-filename-conflicts prepare-virtual checkout-platform adjust-git-timestamps docker-bash docker-simulator-tests run-tests simulator-tests setup format: - bin/format-code.sh + bin/format-code.py \ + --exclude-dir 'testing/googletest' \ + --exclude-file 'generated-testcase.cpp' \ + src plugins examples testing check-formatting: - bin/format-code.sh --check + bin/format-code.py \ + --exclude-dir 'testing/googletest' \ + --exclude-file 'generated-testcase.cpp' \ + --check \ + --verbose \ + src plugins examples testing cpplint-noisy: -bin/cpplint.py --filter=-legal/copyright,-build/include,-readability/namespace,-whitespace/line_length,-runtime/references --recursive --extensions=cpp,h,ino src examples diff --git a/bin/format-code.py b/bin/format-code.py new file mode 100755 index 00000000..a71c19ba --- /dev/null +++ b/bin/format-code.py @@ -0,0 +1,271 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# Copyright (c) 2022 Michael Richters + +# This is free and unencumbered software released into the public domain. + +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. + +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# For more information, please refer to +# ------------------------------------------------------------------------------ +"""This script runs clang-format on Kaleidoscope's codebase.""" + +import argparse +import glob +import logging +import os +import re +import subprocess +import sys + + +# ============================================================================== +def parse_args(args): + """Parse command line parameters + + Args: + args (List[str]): command line parameters as list of strings + (for example ``["--help"]``). + + Returns: + :obj:`argparse.Namespace`: command line parameters namespace + """ + parser = argparse.ArgumentParser( + description=""" + Recursively search specified directories and format source files with + clang-format. By default, it operates on Arduino C++ source files with + extensions: *.{cpp,h,hpp,inc,ino}.""") + parser.add_argument( + '-v', + '--verbose', + dest='loglevel', + help="Verbose output", + action='store_const', + const=logging.INFO, + ) + parser.add_argument( + '-q', + '--quiet', + dest='loglevel', + help="Suppress all non-error output", + action='store_const', + const=logging.ERROR, + ) + parser.add_argument( + '-X', + '--exclude-dir', + metavar="", + dest='exclude_dirs', + help="Exclude dir from search (path relative to the pwd)", + action='append', + default=[], + ) + parser.add_argument( + '-x', + '--exclude-file', + metavar="", + dest='exclude_files', + help="Exclude (base name only, not a full path) from formatting", + action='append', + default=[], + ) + parser.add_argument( + '-e', + '--regex', + metavar="", + dest='src_re_str', + help="Regular expression for matching source file names", + default=r'\.(cpp|h|hpp|inc|ino)$', + ) + parser.add_argument( + '-f', + '--force', + action='store_true', + help="Format code even if there are unstaged changes", + ) + parser.add_argument( + '--check', + action='store_true', + help="Check for changes after formatting", + ) + parser.add_argument( + 'targets', + metavar="", + nargs='+', + help="""A list of files and/or directories to search for source files to format""", + ) + return parser.parse_args(args) + + +# ============================================================================== +def setup_logging(loglevel): + """Setup basic logging + + Args: + loglevel (int): minimum loglevel for emitting messages + """ + logformat = "%(message)s" + logging.basicConfig( + level=loglevel, + stream=sys.stdout, + format=logformat, + datefmt="", + ) + return logging.getLogger() + + +# ============================================================================== +def format_code(path, opts, clang_format_cmd): + """Run clang-format on a directory.""" + logging.info("Formatting code in %s...", path) + + src_regex = re.compile(opts.src_re_str) + + src_files = [] + + for root, dirs, files in os.walk(path): + for exclude_path in opts.exclude_dirs: + exclude_path = exclude_path.rstrip(os.path.sep) + if os.path.dirname(exclude_path) == root: + exclude_dir = os.path.basename(exclude_path) + if exclude_dir in dirs: + dirs.remove(exclude_dir) + + for name in files: + if name in opts.exclude_files: + continue + if src_regex.search(name): + src_files.append(os.path.join(root, name)) + + proc = subprocess.run(clang_format_cmd + src_files) + if proc.returncode != 0: + logging.error("Error: clang-format returned non-zero status: %s", proc.returncode) + return + + +# ============================================================================== +def build_file_list(path, src_regex): + """Docstring""" + + # If the specified path is a filename, return it (as a list), regardless of + # whether or not it matches the regex. + if os.path.isfile(path): + return [path] + + # If the specified path is not valid, just return an empty list. + if not os.path.isdir(path): + return [] + + # The specified path is a directory, so we search recursively for files + # contained therein that match the specified regular expression. + source_files = [] + for root, dirs, files in os.walk(path): + # First, ignore all dotfiles (and directories). + dotfiles = set(glob.glob('.*')) + dirs = set(dirs) - dotfiles + files = set(dirs) - dotfiles + + # Check for a list of file glob patterns that should be excluded. + if IWYU_IGNORE_FILE in files: + with open(os.path.join(root, IWYU_IGNORE_FILE)) as f: + for pattern in f.read().splitlines(): + matches = set(glob.glob(os.path.join(root, pattern))) + dirs = set(dirs) - matches + files = set(files) - matches + + # Add all matching files to the list of source files to be formatted. + for f in filter(src_regex.search, files): + source_files.append(os.path.join(root, f)) + + return source_files + + +# ============================================================================== +def warn_if_output(byte_str, msg): + """Convert a string of bytes to a UTF-8 string, break it on newlines. If + there is any output, print a warning message, followed by each line, + indented by four spaces.""" + lines = byte_str.decode('utf-8').splitlines() + if '' in lines: + lines.remove('') + if len(lines) > 0: + logging.warning('%s', msg) + for line in lines: + logging.warning(' %s', line) + return + + +# ============================================================================== +def main(cli_args): + """Parse command-line arguments and format source files.""" + args = parse_args(cli_args) + if args.loglevel is None: + args.loglevel = logging.WARNING + setup_logging(args.loglevel) + + clang_format = os.getenv('CLANG_FORMAT_CMD') + if clang_format is None: + clang_format = 'clang-format' + + clang_format_cmd = [clang_format, '-i'] + + git_diff_cmd = ['git', 'diff', '--exit-code'] + + proc = subprocess.run(git_diff_cmd + ['--name-only'], capture_output=True) + if proc.returncode != 0: + warn_if_output(proc.stdout, 'Warning: you have unstaged changes to these files:') + if not args.force: + logging.warning( + 'Formatting aborted. Stage your changes or use --force to override.') + sys.exit(proc.returncode) + + if args.loglevel >= logging.WARNING: + git_diff_cmd.append('--quiet') + elif args.loglevel <= logging.INFO: + git_diff_cmd.append('--name-only') + + for path in args.targets: + format_code(path, args, clang_format_cmd) + + if args.check: + logging.warning('Checking for changes made by the formatter...') + + proc = subprocess.run(git_diff_cmd + ['--cached'], capture_output=True) + if proc.returncode != 0: + logging.warning( + 'Warning: Your working tree has staged changes. ' + + 'Committed changes might not pass this check.') + warn_if_output(proc.stdout, 'The following files have unstaged changes:') + + proc = subprocess.run(git_diff_cmd, capture_output=True) + if proc.returncode != 0: + warn_if_output(proc.stdout, 'The following files have changes:') + logging.error( + 'Check failed: Please commit formatting changes before submitting.') + sys.exit(proc.returncode) + return + + +# ============================================================================== +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/bin/format-code.sh b/bin/format-code.sh index e81dda2e..db0cc137 100755 --- a/bin/format-code.sh +++ b/bin/format-code.sh @@ -1,25 +1,12 @@ #!/usr/bin/env bash -# Allow the caller to specify a particular version of clang-format to use: -: "${CLANG_FORMAT_CMD:=clang-format}" +: "${KALEIDOSCOPE_DIR:=$(pwd)}" +cd "${KALEIDOSCOPE_DIR}" || exit 1 -# Find all *.cpp and *.h files, except those in `testing/googletest/` and files -# generated by testcase scripts, and run `clang-format` on them: -find ./* -type f \( -name '*.h' -o -name '*.cpp' \) \ - -not \( -path './testing/googletest/*' -o -name 'generated-testcase.cpp' \) \ - -print0 | \ - xargs -0 "${CLANG_FORMAT_CMD}" -i +: "${VERBOSE:=}" -# If we get the `--check` option, return an error if there are any changes to -# the git working tree after running `clang-format`: -if [[ $1 == '--check' ]]; then - - if ! git diff --quiet; then - cat >&2 < Date: Sun, 3 Apr 2022 23:42:40 -0500 Subject: [PATCH 2/4] Replace `astyle` comments with `clang-format` equivalents in examples This applies to turning off formatting of keymaps. There were a few files that were missing these comments, so those were added where necessary, as well. Signed-off-by: Michael Richters --- examples/Basic/Basic.ino | 4 ++-- examples/Devices/EZ/ErgoDox/ErgoDox.ino | 4 ++-- examples/Devices/KBDFans/KBD4x/KBD4x.ino | 4 ++-- examples/Devices/Keyboardio/Atreus/Atreus.ino | 4 ++-- examples/Devices/Keyboardio/Imago/Imago.ino | 4 ++-- examples/Devices/Keyboardio/Model01/Model01.ino | 7 ++----- examples/Devices/Keyboardio/Model100/Model100.ino | 4 ++-- examples/Devices/OLKB/Planck/Planck.ino | 4 ++-- examples/Devices/SOFTHRUF/Splitography/Splitography.ino | 4 ++-- examples/Devices/Technomancy/Atreus/Atreus.ino | 4 ++-- examples/Devices/gHeavy/ButterStick/ButterStick.ino | 4 ++-- examples/Devices/gHeavy/FaunchPad/FaunchPad.ino | 4 ++-- examples/Features/AppSwitcher/AppSwitcher.ino | 4 ++-- examples/Features/CycleTimeReport/CycleTimeReport.ino | 4 ++-- examples/Features/EEPROM/DynamicMacros/DynamicMacros.ino | 4 ++-- .../EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino | 4 ++-- examples/Features/EEPROM/EEPROM-Keymap/EEPROM-Keymap.ino | 4 ++-- .../Features/EEPROM/EEPROM-Settings/EEPROM-Settings.ino | 4 ++-- examples/Features/FocusSerial/FocusSerial.ino | 4 ++-- .../Features/GhostInTheFirmware/GhostInTheFirmware.ino | 4 ++-- examples/Features/HostOS/HostOS.ino | 4 ++-- .../Features/HostPowerManagement/HostPowerManagement.ino | 4 ++-- examples/Features/Layers/Layers.ino | 4 ++-- examples/Features/ShiftBlocker/ShiftBlocker.ino | 4 ++-- examples/Features/Steno/Steno.ino | 4 ++-- examples/Features/TypingBreaks/TypingBreaks.ino | 4 ++-- .../Internal/Sketch_Exploration/Sketch_Exploration.ino | 4 ++-- examples/Keystrokes/AutoShift/AutoShift.ino | 4 ++-- examples/Keystrokes/CharShift/CharShift.ino | 4 ++-- examples/Keystrokes/Cycle/Cycle.ino | 4 ++-- examples/Keystrokes/DynamicTapDance/DynamicTapDance.ino | 4 ++-- examples/Keystrokes/Escape-OneShot/Escape-OneShot.ino | 4 ++-- examples/Keystrokes/Leader/Leader.ino | 4 ++-- examples/Keystrokes/LeaderPrefix/LeaderPrefix.ino | 4 ++-- examples/Keystrokes/Macros/Macros.ino | 4 ++-- examples/Keystrokes/MagicCombo/MagicCombo.ino | 4 ++-- examples/Keystrokes/OneShot/OneShot.ino | 4 ++-- examples/Keystrokes/OneShotMetaKeys/OneShotMetaKeys.ino | 4 ++-- examples/Keystrokes/Qukeys/Qukeys.ino | 4 ++-- examples/Keystrokes/Redial/Redial.ino | 4 ++-- examples/Keystrokes/ShapeShifter/ShapeShifter.ino | 4 ++-- examples/Keystrokes/SpaceCadet/SpaceCadet.ino | 4 ++-- examples/Keystrokes/Syster/Syster.ino | 4 ++-- examples/Keystrokes/TapDance/TapDance.ino | 4 ++-- examples/Keystrokes/TopsyTurvy/TopsyTurvy.ino | 4 ++-- examples/Keystrokes/Turbo/Turbo.ino | 4 ++-- examples/Keystrokes/Unicode/Unicode.ino | 4 ++-- examples/Keystrokes/WinKeyToggle/WinKeyToggle.ino | 4 ++-- examples/LEDs/Colormap/Colormap.ino | 4 ++-- examples/LEDs/FingerPainter/FingerPainter.ino | 4 ++-- examples/LEDs/Heatmap/Heatmap.ino | 4 ++-- examples/LEDs/IdleLEDs/IdleLEDs.ino | 4 ++-- .../LEDs/LED-ActiveLayerColor/LED-ActiveLayerColor.ino | 4 ++-- examples/LEDs/LED-ActiveModColor/LED-ActiveModColor.ino | 4 ++-- examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino | 4 ++-- examples/LEDs/LED-Brightness/LED-Brightness.ino | 4 ++-- examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino | 4 ++-- examples/LEDs/LED-Stalker/LED-Stalker.ino | 4 ++-- examples/LEDs/LED-Wavepool/LED-Wavepool.ino | 2 ++ .../LEDs/LEDEffect-BootGreeting/LEDEffect-BootGreeting.ino | 4 ++-- examples/LEDs/LEDEffects/LEDEffects.ino | 4 ++-- examples/LEDs/PersistentLEDMode/PersistentLEDMode.ino | 4 ++-- 62 files changed, 124 insertions(+), 125 deletions(-) diff --git a/examples/Basic/Basic.ino b/examples/Basic/Basic.ino index 91f76053..6030da8d 100644 --- a/examples/Basic/Basic.ino +++ b/examples/Basic/Basic.ino @@ -17,7 +17,7 @@ #include "Kaleidoscope.h" -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -38,7 +38,7 @@ KEYMAPS( Key_NoKey ), ) -/* *INDENT-ON* */ +// clang-format on void setup() { Kaleidoscope.setup(); diff --git a/examples/Devices/EZ/ErgoDox/ErgoDox.ino b/examples/Devices/EZ/ErgoDox/ErgoDox.ino index d78779e2..a2e11e52 100644 --- a/examples/Devices/EZ/ErgoDox/ErgoDox.ino +++ b/examples/Devices/EZ/ErgoDox/ErgoDox.ino @@ -19,7 +19,7 @@ #include "Kaleidoscope.h" -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -46,7 +46,7 @@ KEYMAPS( Key_PageDown, Key_Tab, Key_Enter ), ) -/* *INDENT-ON* */ +// clang-format on void setup() { Kaleidoscope.setup(); diff --git a/examples/Devices/KBDFans/KBD4x/KBD4x.ino b/examples/Devices/KBDFans/KBD4x/KBD4x.ino index 3dddaa1e..31d03b20 100644 --- a/examples/Devices/KBDFans/KBD4x/KBD4x.ino +++ b/examples/Devices/KBDFans/KBD4x/KBD4x.ino @@ -31,7 +31,7 @@ enum { #define MO(n) ShiftToLayer(n) -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( /* Qwerty @@ -71,7 +71,7 @@ KEYMAPS( ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ) ); -/* *INDENT-ON* */ +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(Macros); diff --git a/examples/Devices/Keyboardio/Atreus/Atreus.ino b/examples/Devices/Keyboardio/Atreus/Atreus.ino index 2a360d0a..e036466b 100644 --- a/examples/Devices/Keyboardio/Atreus/Atreus.ino +++ b/examples/Devices/Keyboardio/Atreus/Atreus.ino @@ -57,7 +57,7 @@ enum { UPPER }; -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [QWERTY] = KEYMAP_STACKED ( @@ -98,7 +98,7 @@ KEYMAPS( ,___ ,___ ,MoveToLayer(QWERTY) ,Key_PrintScreen ,Key_ScrollLock ,Consumer_PlaySlashPause ) ) -/* *INDENT-ON* */ +// clang-format on KALEIDOSCOPE_INIT_PLUGINS( EEPROMSettings, diff --git a/examples/Devices/Keyboardio/Imago/Imago.ino b/examples/Devices/Keyboardio/Imago/Imago.ino index f76df8ad..9813eece 100644 --- a/examples/Devices/Keyboardio/Imago/Imago.ino +++ b/examples/Devices/Keyboardio/Imago/Imago.ino @@ -54,7 +54,7 @@ enum { _QWERTY, }; -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [_QWERTY] = KEYMAP( @@ -67,7 +67,7 @@ Key_F5, Key_LeftControl,Key_LeftAlt, Key_LeftGui, Key_Backspace, Key_LeftAr )); -/* *INDENT-ON* */ +// clang-format on diff --git a/examples/Devices/Keyboardio/Model01/Model01.ino b/examples/Devices/Keyboardio/Model01/Model01.ino index 823f04d0..d8aef7ab 100644 --- a/examples/Devices/Keyboardio/Model01/Model01.ino +++ b/examples/Devices/Keyboardio/Model01/Model01.ino @@ -32,7 +32,7 @@ #define NUMPAD_KEYMAP 2 - +// clang-format off #define GENERIC_FN2 KEYMAP_STACKED ( \ ___, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, XXX, \ Key_Tab, Key_mouseBtnM, Key_mouseUp, ___, Key_mouseWarpNW, Key_mouseWarpNE, Consumer_ScanNextTrack, \ @@ -49,9 +49,6 @@ ___\ ) - - - #define NUMPAD KEYMAP (\ ___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadSubtract, ___, \ ___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadAdd, ___, \ @@ -75,7 +72,7 @@ KEYMAPS( GENERIC_FN2, NUMPAD ) - +// clang-format on static kaleidoscope::plugin::LEDSolidColor solidRed(60, 0, 0); static kaleidoscope::plugin::LEDSolidColor solidOrange(60, 20, 0); diff --git a/examples/Devices/Keyboardio/Model100/Model100.ino b/examples/Devices/Keyboardio/Model100/Model100.ino index 879f3985..7311780d 100644 --- a/examples/Devices/Keyboardio/Model100/Model100.ino +++ b/examples/Devices/Keyboardio/Model100/Model100.ino @@ -168,7 +168,7 @@ enum { PRIMARY, NUMPAD, FUNCTION }; // layers /* 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 diff --git a/examples/Devices/OLKB/Planck/Planck.ino b/examples/Devices/OLKB/Planck/Planck.ino index 6fd163de..a6c2f46a 100644 --- a/examples/Devices/OLKB/Planck/Planck.ino +++ b/examples/Devices/OLKB/Planck/Planck.ino @@ -30,7 +30,7 @@ enum { _QWERTY, }; -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( /* Qwerty @@ -161,7 +161,7 @@ KEYMAPS( // ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___ //) ); -/* *INDENT-ON* */ +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(Macros); diff --git a/examples/Devices/SOFTHRUF/Splitography/Splitography.ino b/examples/Devices/SOFTHRUF/Splitography/Splitography.ino index d0a83bd7..43a76cfb 100644 --- a/examples/Devices/SOFTHRUF/Splitography/Splitography.ino +++ b/examples/Devices/SOFTHRUF/Splitography/Splitography.ino @@ -24,7 +24,7 @@ enum { _STENO, }; -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( /* Steno (GeminiPR) @@ -45,7 +45,7 @@ KEYMAPS( ,S(A) ,S(O) ,S(E) ,S(U) ) ); -/* *INDENT-ON* */ +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(GeminiPR); diff --git a/examples/Devices/Technomancy/Atreus/Atreus.ino b/examples/Devices/Technomancy/Atreus/Atreus.ino index b5760783..004e6389 100644 --- a/examples/Devices/Technomancy/Atreus/Atreus.ino +++ b/examples/Devices/Technomancy/Atreus/Atreus.ino @@ -37,7 +37,7 @@ enum { #define Key_Star LSHIFT(Key_8) #define Key_Plus LSHIFT(Key_Equals) -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [QWERTY] = KEYMAP_STACKED ( @@ -78,7 +78,7 @@ KEYMAPS( ,___ ,___ ,M(QWERTY),Key_PrintScreen ,Key_ScrollLock ,Consumer_PlaySlashPause ) ) -/* *INDENT-ON* */ +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(Macros); diff --git a/examples/Devices/gHeavy/ButterStick/ButterStick.ino b/examples/Devices/gHeavy/ButterStick/ButterStick.ino index 35cf5aff..8443be1c 100644 --- a/examples/Devices/gHeavy/ButterStick/ButterStick.ino +++ b/examples/Devices/gHeavy/ButterStick/ButterStick.ino @@ -24,14 +24,14 @@ enum { }; -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [_DEFAULT] = KEYMAP( Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_A, Key_S, Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Semicolon ) ); -/* *INDENT-ON* */ +// clang-format on void setup() { Kaleidoscope.setup(); diff --git a/examples/Devices/gHeavy/FaunchPad/FaunchPad.ino b/examples/Devices/gHeavy/FaunchPad/FaunchPad.ino index 5b69281c..232b4a1d 100644 --- a/examples/Devices/gHeavy/FaunchPad/FaunchPad.ino +++ b/examples/Devices/gHeavy/FaunchPad/FaunchPad.ino @@ -24,13 +24,13 @@ enum { }; -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [_DEFAULT] = KEYMAP( Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I ) ); -/* *INDENT-ON* */ +// clang-format on void setup() { Kaleidoscope.setup(); diff --git a/examples/Features/AppSwitcher/AppSwitcher.ino b/examples/Features/AppSwitcher/AppSwitcher.ino index 56f3c0ac..0ab0d44f 100644 --- a/examples/Features/AppSwitcher/AppSwitcher.ino +++ b/examples/Features/AppSwitcher/AppSwitcher.ino @@ -22,7 +22,7 @@ #include "AppSwitcher.h" -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -43,7 +43,7 @@ KEYMAPS( AppSwitcher_Prev ), ) -/* *INDENT-ON* */ +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(HostOS, AppSwitcher); diff --git a/examples/Features/CycleTimeReport/CycleTimeReport.ino b/examples/Features/CycleTimeReport/CycleTimeReport.ino index 4248e90d..be45aebc 100644 --- a/examples/Features/CycleTimeReport/CycleTimeReport.ino +++ b/examples/Features/CycleTimeReport/CycleTimeReport.ino @@ -18,7 +18,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -38,7 +38,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(CycleTimeReport); diff --git a/examples/Features/EEPROM/DynamicMacros/DynamicMacros.ino b/examples/Features/EEPROM/DynamicMacros/DynamicMacros.ino index 60bc9f24..b2c7fa60 100644 --- a/examples/Features/EEPROM/DynamicMacros/DynamicMacros.ino +++ b/examples/Features/EEPROM/DynamicMacros/DynamicMacros.ino @@ -21,7 +21,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -40,7 +40,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS( EEPROMSettings, diff --git a/examples/Features/EEPROM/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino b/examples/Features/EEPROM/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino index a3ddd53d..e614907b 100644 --- a/examples/Features/EEPROM/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino +++ b/examples/Features/EEPROM/EEPROM-Keymap-Programmer/EEPROM-Keymap-Programmer.ino @@ -21,7 +21,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (M(0), Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -40,7 +40,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { if (macro_id == 0 && keyToggledOff(event.state)) { diff --git a/examples/Features/EEPROM/EEPROM-Keymap/EEPROM-Keymap.ino b/examples/Features/EEPROM/EEPROM-Keymap/EEPROM-Keymap.ino index 89c331ca..7f7f1b89 100644 --- a/examples/Features/EEPROM/EEPROM-Keymap/EEPROM-Keymap.ino +++ b/examples/Features/EEPROM/EEPROM-Keymap/EEPROM-Keymap.ino @@ -19,7 +19,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -38,7 +38,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(EEPROMKeymap, Focus); diff --git a/examples/Features/EEPROM/EEPROM-Settings/EEPROM-Settings.ino b/examples/Features/EEPROM/EEPROM-Settings/EEPROM-Settings.ino index 81e3f3f6..54230144 100644 --- a/examples/Features/EEPROM/EEPROM-Settings/EEPROM-Settings.ino +++ b/examples/Features/EEPROM/EEPROM-Settings/EEPROM-Settings.ino @@ -18,7 +18,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -37,7 +37,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings); diff --git a/examples/Features/FocusSerial/FocusSerial.ino b/examples/Features/FocusSerial/FocusSerial.ino index 26de9f28..ce11cbae 100644 --- a/examples/Features/FocusSerial/FocusSerial.ino +++ b/examples/Features/FocusSerial/FocusSerial.ino @@ -18,7 +18,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -37,7 +37,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-OFF* +// clang-format on namespace kaleidoscope { class FocusTestCommand : public Plugin { diff --git a/examples/Features/GhostInTheFirmware/GhostInTheFirmware.ino b/examples/Features/GhostInTheFirmware/GhostInTheFirmware.ino index 5cd5a108..9c9b6544 100644 --- a/examples/Features/GhostInTheFirmware/GhostInTheFirmware.ino +++ b/examples/Features/GhostInTheFirmware/GhostInTheFirmware.ino @@ -27,7 +27,7 @@ // will type out the letters from A to N, but the right palm key can be used to // toggle the custom EventDropper plugin to suppress USB output. -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (___, ___, ___, ___, ___, ___, ___, @@ -46,7 +46,7 @@ KEYMAPS( ___, ___, ___, ___, M(1)), ) -// *INDENT-ON* +// clang-format on namespace kaleidoscope { namespace plugin { diff --git a/examples/Features/HostOS/HostOS.ino b/examples/Features/HostOS/HostOS.ino index 8803f9d7..802c5491 100644 --- a/examples/Features/HostOS/HostOS.ino +++ b/examples/Features/HostOS/HostOS.ino @@ -19,7 +19,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -38,7 +38,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, HostOS); diff --git a/examples/Features/HostPowerManagement/HostPowerManagement.ino b/examples/Features/HostPowerManagement/HostPowerManagement.ino index cb5c9f49..d159eca6 100644 --- a/examples/Features/HostPowerManagement/HostPowerManagement.ino +++ b/examples/Features/HostPowerManagement/HostPowerManagement.ino @@ -20,7 +20,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -41,7 +41,7 @@ KEYMAPS( Key_NoKey ), ) -// *INDENT-ON* +// clang-format on void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::Event event) { switch (event) { diff --git a/examples/Features/Layers/Layers.ino b/examples/Features/Layers/Layers.ino index a1f749c4..0dece439 100644 --- a/examples/Features/Layers/Layers.ino +++ b/examples/Features/Layers/Layers.ino @@ -21,7 +21,7 @@ enum { PRIMARY, NUMPAD, FUNCTION }; // layers -// *INDENT-OFF* +// clang-format off KEYMAPS( [PRIMARY] = KEYMAP_STACKED (___, Key_1, Key_2, Key_3, Key_4, Key_5, XXX, @@ -68,7 +68,7 @@ KEYMAPS( ___, ___, Key_Enter, ___, ___) ) -// *INDENT-OFF* +// clang-format on namespace kaleidoscope { class LayerDumper: public Plugin { diff --git a/examples/Features/ShiftBlocker/ShiftBlocker.ino b/examples/Features/ShiftBlocker/ShiftBlocker.ino index 46770e8c..23a5113d 100644 --- a/examples/Features/ShiftBlocker/ShiftBlocker.ino +++ b/examples/Features/ShiftBlocker/ShiftBlocker.ino @@ -18,7 +18,7 @@ #include "Kaleidoscope.h" #include "Kaleidoscope-Macros.h" -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -39,7 +39,7 @@ KEYMAPS( M(0) ), ) -/* *INDENT-ON* */ +// clang-format on namespace kaleidoscope { namespace plugin { diff --git a/examples/Features/Steno/Steno.ino b/examples/Features/Steno/Steno.ino index 91f4e709..0415d5cc 100644 --- a/examples/Features/Steno/Steno.ino +++ b/examples/Features/Steno/Steno.ino @@ -20,7 +20,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -56,7 +56,7 @@ KEYMAPS( S(E), S(U), XXX, S(RE2), ___), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(GeminiPR); diff --git a/examples/Features/TypingBreaks/TypingBreaks.ino b/examples/Features/TypingBreaks/TypingBreaks.ino index c031cb77..687e43a0 100644 --- a/examples/Features/TypingBreaks/TypingBreaks.ino +++ b/examples/Features/TypingBreaks/TypingBreaks.ino @@ -19,7 +19,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -39,7 +39,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, TypingBreaks); diff --git a/examples/Internal/Sketch_Exploration/Sketch_Exploration.ino b/examples/Internal/Sketch_Exploration/Sketch_Exploration.ino index 980de7f6..4027e8fc 100644 --- a/examples/Internal/Sketch_Exploration/Sketch_Exploration.ino +++ b/examples/Internal/Sketch_Exploration/Sketch_Exploration.ino @@ -21,7 +21,7 @@ // This example demonstrates how a plugin can gather information about // the keymap at compile time, e.g. to adapt its behavior, safe resources, ... -/* *INDENT-OFF* */ +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -42,7 +42,7 @@ KEYMAPS( Key_NoKey ), ) -/* *INDENT-ON* */ +// clang-format on using namespace kaleidoscope::sketch_exploration; // NOLINT(build/namespaces) diff --git a/examples/Keystrokes/AutoShift/AutoShift.ino b/examples/Keystrokes/AutoShift/AutoShift.ino index 333e9d58..2997508f 100644 --- a/examples/Keystrokes/AutoShift/AutoShift.ino +++ b/examples/Keystrokes/AutoShift/AutoShift.ino @@ -12,7 +12,7 @@ enum { TOGGLE_AUTOSHIFT, }; -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -33,7 +33,7 @@ KEYMAPS( XXX ), ) -// *INDENT-ON* +// clang-format on // Defining a macro (on the "any" key: see above) to turn AutoShift on and off const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { diff --git a/examples/Keystrokes/CharShift/CharShift.ino b/examples/Keystrokes/CharShift/CharShift.ino index b1aa83ec..ff6c9a83 100644 --- a/examples/Keystrokes/CharShift/CharShift.ino +++ b/examples/Keystrokes/CharShift/CharShift.ino @@ -4,7 +4,7 @@ #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -25,7 +25,7 @@ KEYMAPS( XXX ), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(CharShift); diff --git a/examples/Keystrokes/Cycle/Cycle.ino b/examples/Keystrokes/Cycle/Cycle.ino index b8b33dd0..aed91b32 100644 --- a/examples/Keystrokes/Cycle/Cycle.ino +++ b/examples/Keystrokes/Cycle/Cycle.ino @@ -18,7 +18,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -37,7 +37,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_Cycle), ) -// *INDENT-ON* +// clang-format on void cycleAction(Key previous_key, uint8_t cycle_count) { if (previous_key == Key_E) { diff --git a/examples/Keystrokes/DynamicTapDance/DynamicTapDance.ino b/examples/Keystrokes/DynamicTapDance/DynamicTapDance.ino index aacc4b01..b70501af 100644 --- a/examples/Keystrokes/DynamicTapDance/DynamicTapDance.ino +++ b/examples/Keystrokes/DynamicTapDance/DynamicTapDance.ino @@ -22,7 +22,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -42,7 +42,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, TD(2), TD(1)), ) -// *INDENT-ON* +// clang-format on enum { TD_TAB_ESC, diff --git a/examples/Keystrokes/Escape-OneShot/Escape-OneShot.ino b/examples/Keystrokes/Escape-OneShot/Escape-OneShot.ino index 921d4d92..da312d23 100644 --- a/examples/Keystrokes/Escape-OneShot/Escape-OneShot.ino +++ b/examples/Keystrokes/Escape-OneShot/Escape-OneShot.ino @@ -21,7 +21,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -61,7 +61,7 @@ KEYMAPS( ___ ), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, Focus, diff --git a/examples/Keystrokes/Leader/Leader.ino b/examples/Keystrokes/Leader/Leader.ino index fc6f65c2..c2ea13a2 100644 --- a/examples/Keystrokes/Leader/Leader.ino +++ b/examples/Keystrokes/Leader/Leader.ino @@ -18,7 +18,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -37,7 +37,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, LEAD(0)), ) -// *INDENT-ON* +// clang-format on auto &serial_port = Kaleidoscope.serialPort(); diff --git a/examples/Keystrokes/LeaderPrefix/LeaderPrefix.ino b/examples/Keystrokes/LeaderPrefix/LeaderPrefix.ino index 6de00bf6..8aa6a129 100644 --- a/examples/Keystrokes/LeaderPrefix/LeaderPrefix.ino +++ b/examples/Keystrokes/LeaderPrefix/LeaderPrefix.ino @@ -24,7 +24,7 @@ #include "kaleidoscope/LiveKeys.h" #include "kaleidoscope/plugin.h" -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -43,7 +43,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, LEAD(0)), ) -// *INDENT-ON* +// clang-format on namespace kaleidoscope { namespace plugin { diff --git a/examples/Keystrokes/Macros/Macros.ino b/examples/Keystrokes/Macros/Macros.ino index 5e0badb4..ae5a6609 100644 --- a/examples/Keystrokes/Macros/Macros.ino +++ b/examples/Keystrokes/Macros/Macros.ino @@ -24,7 +24,7 @@ enum { TOGGLE_ONESHOT, }; -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (___, M(1), M(2), M(3), M(4), M(5), ___, @@ -61,7 +61,7 @@ KEYMAPS( ___, ___, ___, ___, ___), ) -// *INDENT-ON* +// clang-format on // Example macro for typing a string of characters. void macroTypeString(KeyEvent &event) { diff --git a/examples/Keystrokes/MagicCombo/MagicCombo.ino b/examples/Keystrokes/MagicCombo/MagicCombo.ino index 0bb6606b..7b1ed943 100644 --- a/examples/Keystrokes/MagicCombo/MagicCombo.ino +++ b/examples/Keystrokes/MagicCombo/MagicCombo.ino @@ -29,7 +29,7 @@ void kindOfMagic(uint8_t combo_index) { USE_MAGIC_COMBOS([KIND_OF_MAGIC] = {.action = kindOfMagic, .keys = {R3C6, R3C9}}); -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -49,7 +49,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(MagicCombo, Macros); diff --git a/examples/Keystrokes/OneShot/OneShot.ino b/examples/Keystrokes/OneShot/OneShot.ino index 96a249ca..4cff49a0 100644 --- a/examples/Keystrokes/OneShot/OneShot.ino +++ b/examples/Keystrokes/OneShot/OneShot.ino @@ -24,7 +24,7 @@ enum { TOGGLE_ONESHOT, }; -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -62,7 +62,7 @@ KEYMAPS( ___, ___, ___, ___, ___), ) -// *INDENT-ON* +// clang-format on void macroToggleOneShot() { OneShot.toggleAutoOneShot(); diff --git a/examples/Keystrokes/OneShotMetaKeys/OneShotMetaKeys.ino b/examples/Keystrokes/OneShotMetaKeys/OneShotMetaKeys.ino index 1a155c4a..389ba845 100644 --- a/examples/Keystrokes/OneShotMetaKeys/OneShotMetaKeys.ino +++ b/examples/Keystrokes/OneShotMetaKeys/OneShotMetaKeys.ino @@ -25,7 +25,7 @@ enum { TOGGLE_ONESHOT, }; -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -63,7 +63,7 @@ KEYMAPS( ___, ___, ___, ___, ___), ) -// *INDENT-ON* +// clang-format on void macroToggleOneShot() { OneShot.toggleAutoOneShot(); diff --git a/examples/Keystrokes/Qukeys/Qukeys.ino b/examples/Keystrokes/Qukeys/Qukeys.ino index bee8538e..c1fe890f 100644 --- a/examples/Keystrokes/Qukeys/Qukeys.ino +++ b/examples/Keystrokes/Qukeys/Qukeys.ino @@ -11,7 +11,7 @@ enum { MACRO_TOGGLE_QUKEYS }; // for the home row on the right side of the keymap (and one of the palm keys) // below. -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -51,7 +51,7 @@ KEYMAPS( ___ ), ) -// *INDENT-ON* +// clang-format on // Defining a macro (on the "any" key: see above) to toggle Qukeys on and off const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { diff --git a/examples/Keystrokes/Redial/Redial.ino b/examples/Keystrokes/Redial/Redial.ino index ebc7bdf4..e9bb976f 100644 --- a/examples/Keystrokes/Redial/Redial.ino +++ b/examples/Keystrokes/Redial/Redial.ino @@ -25,7 +25,7 @@ bool kaleidoscope::plugin::Redial::shouldRemember(Key mapped_key) { return false; } -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -45,7 +45,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_Redial), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(Redial); diff --git a/examples/Keystrokes/ShapeShifter/ShapeShifter.ino b/examples/Keystrokes/ShapeShifter/ShapeShifter.ino index 372bcae0..8572e698 100644 --- a/examples/Keystrokes/ShapeShifter/ShapeShifter.ino +++ b/examples/Keystrokes/ShapeShifter/ShapeShifter.ino @@ -18,7 +18,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -38,7 +38,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on static const kaleidoscope::plugin::ShapeShifter::dictionary_t shape_shift_dictionary[] PROGMEM = { {Key_1, Key_2}, diff --git a/examples/Keystrokes/SpaceCadet/SpaceCadet.ino b/examples/Keystrokes/SpaceCadet/SpaceCadet.ino index 11ff205a..bffacbde 100644 --- a/examples/Keystrokes/SpaceCadet/SpaceCadet.ino +++ b/examples/Keystrokes/SpaceCadet/SpaceCadet.ino @@ -18,7 +18,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -38,7 +38,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(SpaceCadet); diff --git a/examples/Keystrokes/Syster/Syster.ino b/examples/Keystrokes/Syster/Syster.ino index ba82a04b..387dacf6 100644 --- a/examples/Keystrokes/Syster/Syster.ino +++ b/examples/Keystrokes/Syster/Syster.ino @@ -21,7 +21,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -41,7 +41,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, SYSTER), ) -// *INDENT-ON* +// clang-format on void systerAction(kaleidoscope::plugin::Syster::action_t action, const char *symbol) { switch (action) { diff --git a/examples/Keystrokes/TapDance/TapDance.ino b/examples/Keystrokes/TapDance/TapDance.ino index 1e14eb94..5d282924 100644 --- a/examples/Keystrokes/TapDance/TapDance.ino +++ b/examples/Keystrokes/TapDance/TapDance.ino @@ -18,7 +18,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -38,7 +38,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, TD(1)), ) -// *INDENT-ON* +// clang-format on static void tapDanceEsc(uint8_t tap_dance_index, uint8_t tap_count, kaleidoscope::plugin::TapDance::ActionType tap_dance_action) { tapDanceActionKeys(tap_count, tap_dance_action, Key_Escape, Key_Tab); diff --git a/examples/Keystrokes/TopsyTurvy/TopsyTurvy.ino b/examples/Keystrokes/TopsyTurvy/TopsyTurvy.ino index e01babb9..dd705364 100644 --- a/examples/Keystrokes/TopsyTurvy/TopsyTurvy.ino +++ b/examples/Keystrokes/TopsyTurvy/TopsyTurvy.ino @@ -18,7 +18,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -38,7 +38,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(TopsyTurvy); diff --git a/examples/Keystrokes/Turbo/Turbo.ino b/examples/Keystrokes/Turbo/Turbo.ino index 5827c5b1..892a4c90 100644 --- a/examples/Keystrokes/Turbo/Turbo.ino +++ b/examples/Keystrokes/Turbo/Turbo.ino @@ -19,7 +19,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, @@ -38,7 +38,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(LEDControl, Turbo); diff --git a/examples/Keystrokes/Unicode/Unicode.ino b/examples/Keystrokes/Unicode/Unicode.ino index 34c00e7c..22a2503a 100644 --- a/examples/Keystrokes/Unicode/Unicode.ino +++ b/examples/Keystrokes/Unicode/Unicode.ino @@ -23,7 +23,7 @@ enum { MACRO_KEYBOARD_EMOJI }; -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED @@ -44,7 +44,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on static void unicode(uint32_t character, uint8_t keyState) { if (keyToggledOn(keyState)) { diff --git a/examples/Keystrokes/WinKeyToggle/WinKeyToggle.ino b/examples/Keystrokes/WinKeyToggle/WinKeyToggle.ino index b75fdf01..35e03c06 100644 --- a/examples/Keystrokes/WinKeyToggle/WinKeyToggle.ino +++ b/examples/Keystrokes/WinKeyToggle/WinKeyToggle.ino @@ -32,7 +32,7 @@ USE_MAGIC_COMBOS([WINKEYTOGGLE] = { .keys = {R3C6, R3C9} }); -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -52,7 +52,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(MagicCombo, WinKeyToggle); diff --git a/examples/LEDs/Colormap/Colormap.ino b/examples/LEDs/Colormap/Colormap.ino index f26d6054..4699b093 100644 --- a/examples/LEDs/Colormap/Colormap.ino +++ b/examples/LEDs/Colormap/Colormap.ino @@ -22,7 +22,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, @@ -42,7 +42,7 @@ KEYMAPS( Key_NoKey), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, LEDPaletteTheme, diff --git a/examples/LEDs/FingerPainter/FingerPainter.ino b/examples/LEDs/FingerPainter/FingerPainter.ino index da0b58fc..1894a4f5 100644 --- a/examples/LEDs/FingerPainter/FingerPainter.ino +++ b/examples/LEDs/FingerPainter/FingerPainter.ino @@ -22,7 +22,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, @@ -41,7 +41,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(LEDControl, LEDOff, diff --git a/examples/LEDs/Heatmap/Heatmap.ino b/examples/LEDs/Heatmap/Heatmap.ino index 49ee4855..30cc6978 100644 --- a/examples/LEDs/Heatmap/Heatmap.ino +++ b/examples/LEDs/Heatmap/Heatmap.ino @@ -20,7 +20,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED (Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, @@ -39,7 +39,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(LEDControl, HeatmapEffect); diff --git a/examples/LEDs/IdleLEDs/IdleLEDs.ino b/examples/LEDs/IdleLEDs/IdleLEDs.ino index 44732f37..ca33b35e 100644 --- a/examples/LEDs/IdleLEDs/IdleLEDs.ino +++ b/examples/LEDs/IdleLEDs/IdleLEDs.ino @@ -22,7 +22,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -42,7 +42,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(LEDControl, EEPROMSettings, diff --git a/examples/LEDs/LED-ActiveLayerColor/LED-ActiveLayerColor.ino b/examples/LEDs/LED-ActiveLayerColor/LED-ActiveLayerColor.ino index 714a9902..e65ab57d 100644 --- a/examples/LEDs/LED-ActiveLayerColor/LED-ActiveLayerColor.ino +++ b/examples/LEDs/LED-ActiveLayerColor/LED-ActiveLayerColor.ino @@ -19,7 +19,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -58,7 +58,7 @@ KEYMAPS( ShiftToLayer(0) ) ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(LEDControl, LEDActiveLayerColorEffect); diff --git a/examples/LEDs/LED-ActiveModColor/LED-ActiveModColor.ino b/examples/LEDs/LED-ActiveModColor/LED-ActiveModColor.ino index 6213dd36..b1b86767 100644 --- a/examples/LEDs/LED-ActiveModColor/LED-ActiveModColor.ino +++ b/examples/LEDs/LED-ActiveModColor/LED-ActiveModColor.ino @@ -20,7 +20,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -40,7 +40,7 @@ KEYMAPS( OSM(RightShift), OSM(RightAlt), Key_Spacebar, OSM(RightControl), Key_skip), ) -// *INDENT-ON* +// clang-format on // OneShot is included to illustrate the different colors highlighting sticky // and one-shot keys. LEDOff is included because we need an LED mode active to diff --git a/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino b/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino index f3ef2d7a..57d8c958 100644 --- a/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino +++ b/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino @@ -20,7 +20,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -40,7 +40,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_skip), ) -// *INDENT-ON* +// clang-format on const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { if (!keyToggledOn(event.state)) diff --git a/examples/LEDs/LED-Brightness/LED-Brightness.ino b/examples/LEDs/LED-Brightness/LED-Brightness.ino index b17a354d..574e1205 100644 --- a/examples/LEDs/LED-Brightness/LED-Brightness.ino +++ b/examples/LEDs/LED-Brightness/LED-Brightness.ino @@ -20,7 +20,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -40,7 +40,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, M(1)), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(LEDControl, Macros, diff --git a/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino b/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino index e587ef3b..a9ec1d58 100644 --- a/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino +++ b/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino @@ -58,7 +58,7 @@ TestLEDMode::onFocusEvent(const char *command) { example::TestLEDMode TestLEDMode; -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -78,7 +78,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(Focus, LEDPaletteTheme, TestLEDMode, EEPROMSettings); diff --git a/examples/LEDs/LED-Stalker/LED-Stalker.ino b/examples/LEDs/LED-Stalker/LED-Stalker.ino index 9306513a..cf66f19c 100644 --- a/examples/LEDs/LED-Stalker/LED-Stalker.ino +++ b/examples/LEDs/LED-Stalker/LED-Stalker.ino @@ -19,7 +19,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -39,7 +39,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(LEDControl, LEDOff, diff --git a/examples/LEDs/LED-Wavepool/LED-Wavepool.ino b/examples/LEDs/LED-Wavepool/LED-Wavepool.ino index 404eb295..581fa84b 100644 --- a/examples/LEDs/LED-Wavepool/LED-Wavepool.ino +++ b/examples/LEDs/LED-Wavepool/LED-Wavepool.ino @@ -20,6 +20,7 @@ #include #include +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -46,6 +47,7 @@ KALEIDOSCOPE_INIT_PLUGINS( LEDOff, WavepoolEffect ); +// clang-format on void setup() { Kaleidoscope.setup(); diff --git a/examples/LEDs/LEDEffect-BootGreeting/LEDEffect-BootGreeting.ino b/examples/LEDs/LEDEffect-BootGreeting/LEDEffect-BootGreeting.ino index c17fd55a..de152232 100644 --- a/examples/LEDs/LEDEffect-BootGreeting/LEDEffect-BootGreeting.ino +++ b/examples/LEDs/LEDEffect-BootGreeting/LEDEffect-BootGreeting.ino @@ -19,7 +19,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -39,7 +39,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(LEDControl, BootGreetingEffect, diff --git a/examples/LEDs/LEDEffects/LEDEffects.ino b/examples/LEDs/LEDEffects/LEDEffects.ino index 02d79b15..6f5ad6c5 100644 --- a/examples/LEDs/LEDEffects/LEDEffects.ino +++ b/examples/LEDs/LEDEffects/LEDEffects.ino @@ -19,7 +19,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -39,7 +39,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(LEDControl, LEDOff, diff --git a/examples/LEDs/PersistentLEDMode/PersistentLEDMode.ino b/examples/LEDs/PersistentLEDMode/PersistentLEDMode.ino index b262047d..4d5fca73 100644 --- a/examples/LEDs/PersistentLEDMode/PersistentLEDMode.ino +++ b/examples/LEDs/PersistentLEDMode/PersistentLEDMode.ino @@ -24,7 +24,7 @@ #include #include -// *INDENT-OFF* +// clang-format off KEYMAPS( [0] = KEYMAP_STACKED ( @@ -44,7 +44,7 @@ KEYMAPS( Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_NoKey), ) -// *INDENT-ON* +// clang-format on KALEIDOSCOPE_INIT_PLUGINS(LEDControl, EEPROMSettings, From f9697e25f388880ce147229dd648dfc82fa1572a Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Mon, 4 Apr 2022 00:30:49 -0500 Subject: [PATCH 3/4] Apply `clang-format` to example sketches Signed-off-by: Michael Richters --- examples/Devices/Keyboardio/Atreus/Atreus.ino | 20 +++-- examples/Devices/Keyboardio/Imago/Imago.ino | 78 ++++++++++--------- .../Devices/Keyboardio/Model01/Model01.ino | 35 ++++++--- .../Devices/Keyboardio/Model100/Model100.ino | 37 +++++---- examples/Devices/OLKB/Planck/Planck.ino | 17 ++-- .../Devices/Technomancy/Atreus/Atreus.ino | 12 +-- .../EEPROM/DynamicMacros/DynamicMacros.ino | 3 +- examples/Features/FocusSerial/FocusSerial.ino | 2 +- .../GhostInTheFirmware/GhostInTheFirmware.ino | 10 +-- examples/Features/Layers/Layers.ino | 10 ++- .../Features/ShiftBlocker/ShiftBlocker.ino | 5 +- .../Sketch_Exploration/Sketch_Exploration.ino | 13 ++-- examples/Keystrokes/AutoShift/AutoShift.ino | 4 +- examples/Keystrokes/CharShift/CharShift.ino | 6 +- examples/Keystrokes/Leader/Leader.ino | 4 +- .../Keystrokes/LeaderPrefix/LeaderPrefix.ino | 24 ++++-- examples/Keystrokes/Macros/Macros.ino | 6 +- examples/Keystrokes/SpaceCadet/SpaceCadet.ino | 16 ++-- .../Keystrokes/WinKeyToggle/WinKeyToggle.ino | 5 +- examples/LEDs/IdleLEDs/IdleLEDs.ino | 2 +- .../LED-ActiveLayerColor.ino | 3 +- .../LEDs/LED-AlphaSquare/LED-AlphaSquare.ino | 10 +-- .../LED-Palette-Theme/LED-Palette-Theme.ino | 8 +- examples/LEDs/LED-Wavepool/LED-Wavepool.ino | 2 +- 24 files changed, 181 insertions(+), 151 deletions(-) diff --git a/examples/Devices/Keyboardio/Atreus/Atreus.ino b/examples/Devices/Keyboardio/Atreus/Atreus.ino index e036466b..9215fa20 100644 --- a/examples/Devices/Keyboardio/Atreus/Atreus.ino +++ b/examples/Devices/Keyboardio/Atreus/Atreus.ino @@ -32,7 +32,6 @@ #include "Kaleidoscope-SpaceCadet.h" - #define MO(n) ShiftToLayer(n) #define TG(n) LockLayer(n) @@ -42,14 +41,14 @@ 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_Percent LSHIFT(Key_5) -#define Key_Caret LSHIFT(Key_6) -#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_Percent LSHIFT(Key_5) +#define Key_Caret LSHIFT(Key_6) +#define Key_And LSHIFT(Key_7) +#define Key_Star LSHIFT(Key_8) +#define Key_Plus LSHIFT(Key_Equals) enum { QWERTY, @@ -110,8 +109,7 @@ KALEIDOSCOPE_INIT_PLUGINS( SpaceCadet, OneShot, Macros, - MouseKeys -); + MouseKeys); const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { if (keyToggledOn(event.state)) { diff --git a/examples/Devices/Keyboardio/Imago/Imago.ino b/examples/Devices/Keyboardio/Imago/Imago.ino index 9813eece..b36acdb2 100644 --- a/examples/Devices/Keyboardio/Imago/Imago.ino +++ b/examples/Devices/Keyboardio/Imago/Imago.ino @@ -50,8 +50,9 @@ #include "Kaleidoscope-USB-Quirks.h" -enum { _QWERTY, - }; +enum { + _QWERTY, +}; // clang-format off @@ -70,7 +71,6 @@ Key_F5, Key_LeftControl,Key_LeftAlt, Key_LeftGui, Key_Backspace, Key_LeftAr // clang-format on - // These 'solid' color effect definitions define a rainbow of // LED color modes calibrated to draw 500mA or less on the // Keyboardio Model 01. @@ -133,51 +133,57 @@ static void toggleKeyboardProtocol(uint8_t combo_index) { /** Magic combo list, a list of key combo and action pairs the firmware should * recognise. */ -USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol, - // Left Fn + Esc + Shift - .keys = { R3C6, R2C6, R3C7 } - }); +USE_MAGIC_COMBOS( + {.action = toggleKeyboardProtocol, + // Left Fn + Esc + Shift + .keys = {R3C6, R2C6, R3C7}}); -KALEIDOSCOPE_INIT_PLUGINS(Macros, +KALEIDOSCOPE_INIT_PLUGINS( + Macros, - // LEDControl provides support for other LED modes - LEDControl, + // LEDControl provides support for other LED modes + LEDControl, - // The rainbow effect changes the color of all of the keyboard's keys at the same time - // running through all the colors of the rainbow. - LEDRainbowEffect, + // The rainbow effect changes the color of all of the keyboard's keys at the same time + // running through all the colors of the rainbow. + LEDRainbowEffect, - // The rainbow wave effect lights up your keyboard with all the colors of a rainbow - // and slowly moves the rainbow across your keyboard - LEDRainbowWaveEffect, + // The rainbow wave effect lights up your keyboard with all the colors of a rainbow + // and slowly moves the rainbow across your keyboard + LEDRainbowWaveEffect, - // The chase effect follows the adventure of a blue pixel which chases a red pixel across - // your keyboard. Spoiler: the blue pixel never catches the red pixel - LEDChaseEffect, + // The chase effect follows the adventure of a blue pixel which chases a red pixel across + // your keyboard. Spoiler: the blue pixel never catches the red pixel + LEDChaseEffect, - // These static effects turn your keyboard's LEDs a variety of colors - solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet, + // These static effects turn your keyboard's LEDs a variety of colors + solidRed, + solidOrange, + solidYellow, + solidGreen, + solidBlue, + solidIndigo, + solidViolet, - // The breathe effect slowly pulses all of the LEDs on your keyboard - LEDBreatheEffect, + // The breathe effect slowly pulses all of the LEDs on your keyboard + LEDBreatheEffect, - // The HostPowerManagement plugin allows us to turn LEDs off when then host - // goes to sleep, and resume them when it wakes up. - HostPowerManagement, + // The HostPowerManagement plugin allows us to turn LEDs off when then host + // goes to sleep, and resume them when it wakes up. + HostPowerManagement, - // The MagicCombo plugin lets you use key combinations to trigger custom - // actions - a bit like Macros, but triggered by pressing multiple keys at the - // same time. - MagicCombo, + // The MagicCombo plugin lets you use key combinations to trigger custom + // actions - a bit like Macros, but triggered by pressing multiple keys at the + // same time. + MagicCombo, - // The USBQuirks plugin lets you do some things with USB that we aren't - // 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 - ); + // The USBQuirks plugin lets you do some things with USB that we aren't + // 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); void setup() { Kaleidoscope.setup(); diff --git a/examples/Devices/Keyboardio/Model01/Model01.ino b/examples/Devices/Keyboardio/Model01/Model01.ino index d8aef7ab..b66cc0d2 100644 --- a/examples/Devices/Keyboardio/Model01/Model01.ino +++ b/examples/Devices/Keyboardio/Model01/Model01.ino @@ -86,10 +86,17 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { if (macro_id == 1 && keyToggledOn(event.state)) { Kaleidoscope.serialPort().print("Keyboard.IO keyboard driver v0.00"); return MACRO(I(25), - D(LeftShift), T(M), U(LeftShift), T(O), T(D), T(E), T(L), + D(LeftShift), + T(M), + U(LeftShift), + T(O), + T(D), + T(E), + T(L), T(Spacebar), W(100), - T(0), T(1)); + T(0), + T(1)); } return MACRO_NONE; } @@ -105,16 +112,24 @@ static void enterHardwareTestMode(uint8_t combo_index) { /** Magic combo list, a list of key combo and action pairs the firmware should * recognise. */ -USE_MAGIC_COMBOS({ - .action = enterHardwareTestMode, - // Left Fn + Prog + LED - .keys = { R3C6, R0C0, R0C6 } -}); +USE_MAGIC_COMBOS({.action = enterHardwareTestMode, + // Left Fn + Prog + LED + .keys = {R3C6, R0C0, R0C6}}); KALEIDOSCOPE_INIT_PLUGINS(HardwareTestMode, - LEDControl, LEDOff, - solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet, - LEDBreatheEffect, LEDRainbowEffect, LEDChaseEffect, NumPad, + LEDControl, + LEDOff, + solidRed, + solidOrange, + solidYellow, + solidGreen, + solidBlue, + solidIndigo, + solidViolet, + LEDBreatheEffect, + LEDRainbowEffect, + LEDChaseEffect, + NumPad, Macros, MouseKeys, MagicCombo); diff --git a/examples/Devices/Keyboardio/Model100/Model100.ino b/examples/Devices/Keyboardio/Model100/Model100.ino index 7311780d..2a720a17 100644 --- a/examples/Devices/Keyboardio/Model100/Model100.ino +++ b/examples/Devices/Keyboardio/Model100/Model100.ino @@ -88,10 +88,10 @@ * a macro key is pressed. */ -enum { MACRO_VERSION_INFO, - MACRO_ANY - }; - +enum { + MACRO_VERSION_INFO, + MACRO_ANY, +}; /** The Model 100's key layouts are defined as 'keymaps'. By default, there are three @@ -142,7 +142,11 @@ enum { MACRO_VERSION_INFO, * */ -enum { PRIMARY, NUMPAD, FUNCTION }; // layers +enum { + PRIMARY, + NUMPAD, + FUNCTION, +}; // layers /** @@ -164,7 +168,6 @@ 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 */ @@ -336,7 +339,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 100. @@ -412,12 +414,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 +468,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 +516,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/examples/Devices/OLKB/Planck/Planck.ino b/examples/Devices/OLKB/Planck/Planck.ino index a6c2f46a..18f17a69 100644 --- a/examples/Devices/OLKB/Planck/Planck.ino +++ b/examples/Devices/OLKB/Planck/Planck.ino @@ -20,14 +20,15 @@ #include "Kaleidoscope.h" #include "Kaleidoscope-Macros.h" -enum { _QWERTY, - _COLEMAK, - _DVORAK, - _LOWER, - _RAISE, - _PLOVER, - _ADJUST - }; +enum { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _PLOVER, + _ADJUST +}; // clang-format off diff --git a/examples/Devices/Technomancy/Atreus/Atreus.ino b/examples/Devices/Technomancy/Atreus/Atreus.ino index 004e6389..51c302b5 100644 --- a/examples/Devices/Technomancy/Atreus/Atreus.ino +++ b/examples/Devices/Technomancy/Atreus/Atreus.ino @@ -30,12 +30,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) // clang-format off KEYMAPS( diff --git a/examples/Features/EEPROM/DynamicMacros/DynamicMacros.ino b/examples/Features/EEPROM/DynamicMacros/DynamicMacros.ino index b2c7fa60..1a6267c0 100644 --- a/examples/Features/EEPROM/DynamicMacros/DynamicMacros.ino +++ b/examples/Features/EEPROM/DynamicMacros/DynamicMacros.ino @@ -46,8 +46,7 @@ KALEIDOSCOPE_INIT_PLUGINS( EEPROMSettings, EEPROMKeymap, DynamicMacros, - Focus -); + Focus); void setup() { Kaleidoscope.setup(); diff --git a/examples/Features/FocusSerial/FocusSerial.ino b/examples/Features/FocusSerial/FocusSerial.ino index ce11cbae..dd6c00d7 100644 --- a/examples/Features/FocusSerial/FocusSerial.ino +++ b/examples/Features/FocusSerial/FocusSerial.ino @@ -70,7 +70,7 @@ class FocusHelpCommand : public Plugin { } }; -} +} // namespace kaleidoscope kaleidoscope::FocusTestCommand FocusTestCommand; kaleidoscope::FocusHelpCommand FocusHelpCommand; diff --git a/examples/Features/GhostInTheFirmware/GhostInTheFirmware.ino b/examples/Features/GhostInTheFirmware/GhostInTheFirmware.ino index 9c9b6544..2236c728 100644 --- a/examples/Features/GhostInTheFirmware/GhostInTheFirmware.ino +++ b/examples/Features/GhostInTheFirmware/GhostInTheFirmware.ino @@ -61,12 +61,13 @@ class EventDropper : public Plugin { void toggle() { active_ = !active_; } + private: bool active_ = false; }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::EventDropper EventDropper; @@ -95,8 +96,7 @@ static const kaleidoscope::plugin::GhostInTheFirmware::GhostKey ghost_keys[] PRO {KeyAddr(3, 14), 200, 50}, {KeyAddr(3, 15), 200, 50}, - {KeyAddr::none(), 0, 0} -}; + {KeyAddr::none(), 0, 0}}; KALEIDOSCOPE_INIT_PLUGINS(GhostInTheFirmware, LEDControl, @@ -107,7 +107,7 @@ KALEIDOSCOPE_INIT_PLUGINS(GhostInTheFirmware, void setup() { Kaleidoscope.setup(); - StalkerEffect.variant = STALKER(BlazingTrail); + StalkerEffect.variant = STALKER(BlazingTrail); GhostInTheFirmware.ghost_keys = ghost_keys; } diff --git a/examples/Features/Layers/Layers.ino b/examples/Features/Layers/Layers.ino index 0dece439..b5cfd177 100644 --- a/examples/Features/Layers/Layers.ino +++ b/examples/Features/Layers/Layers.ino @@ -19,7 +19,11 @@ #include #include -enum { PRIMARY, NUMPAD, FUNCTION }; // layers +enum { + PRIMARY, + NUMPAD, + FUNCTION, +}; // layers // clang-format off KEYMAPS( @@ -71,7 +75,7 @@ KEYMAPS( // clang-format on namespace kaleidoscope { -class LayerDumper: public Plugin { +class LayerDumper : public Plugin { public: LayerDumper() {} @@ -89,7 +93,7 @@ class LayerDumper: public Plugin { } }; -} +} // namespace kaleidoscope kaleidoscope::LayerDumper LayerDumper; diff --git a/examples/Features/ShiftBlocker/ShiftBlocker.ino b/examples/Features/ShiftBlocker/ShiftBlocker.ino index 23a5113d..02400dbd 100644 --- a/examples/Features/ShiftBlocker/ShiftBlocker.ino +++ b/examples/Features/ShiftBlocker/ShiftBlocker.ino @@ -64,11 +64,10 @@ class ShiftBlocker : public Plugin { private: bool active_{false}; - }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::ShiftBlocker ShiftBlocker; diff --git a/examples/Internal/Sketch_Exploration/Sketch_Exploration.ino b/examples/Internal/Sketch_Exploration/Sketch_Exploration.ino index 4027e8fc..91c3ef2c 100644 --- a/examples/Internal/Sketch_Exploration/Sketch_Exploration.ino +++ b/examples/Internal/Sketch_Exploration/Sketch_Exploration.ino @@ -44,7 +44,7 @@ KEYMAPS( ) // clang-format on -using namespace kaleidoscope::sketch_exploration; // NOLINT(build/namespaces) +using namespace kaleidoscope::sketch_exploration; // NOLINT(build/namespaces) class BPlugin : public kaleidoscope::Plugin {}; class CPlugin : public kaleidoscope::Plugin {}; @@ -54,7 +54,8 @@ class CPlugin : public kaleidoscope::Plugin {}; class APlugin : public kaleidoscope::Plugin { public: - APlugin() : has_key_1_{false} {} + APlugin() + : has_key_1_{false} {} template kaleidoscope::EventHandlerResult exploreSketch() { @@ -72,7 +73,7 @@ class APlugin : public kaleidoscope::Plugin { constexpr bool has_key_1 = K::collect(HasKey{Key_1}); static_assert(has_key_1, "Error querying key existence"); - has_key_1_ = has_key_1; // Assign the temporary that was computed + has_key_1_ = has_key_1; // Assign the temporary that was computed // at compile time. constexpr Key max_key = K::collect(MaxKeyRaw{}); @@ -81,7 +82,7 @@ class APlugin : public kaleidoscope::Plugin { static_assert(K::getKey(0 /*layer*/, KeyAddr{2, 3}) == Key_D, "Key lookup failed"); - constexpr auto n_layers = K::nLayers(); + constexpr auto n_layers = K::nLayers(); constexpr auto layer_size = K::layerSize(); // Plugin exploration @@ -117,7 +118,6 @@ class APlugin : public kaleidoscope::Plugin { } private: - bool has_key_1_; }; @@ -127,8 +127,7 @@ BPlugin b_plugin; KALEIDOSCOPE_INIT_PLUGINS( a_plugin1, b_plugin, - a_plugin2 -) + a_plugin2) void setup() { Kaleidoscope.setup(); diff --git a/examples/Keystrokes/AutoShift/AutoShift.ino b/examples/Keystrokes/AutoShift/AutoShift.ino index 2997508f..4b6cbc35 100644 --- a/examples/Keystrokes/AutoShift/AutoShift.ino +++ b/examples/Keystrokes/AutoShift/AutoShift.ino @@ -56,8 +56,8 @@ KALEIDOSCOPE_INIT_PLUGINS( FocusEEPROMCommand, // for AutoShiftConfig FocusSettingsCommand, // for AutoShiftConfig AutoShift, - AutoShiftConfig, // for AutoShiftConfig - Macros // for toggle AutoShift Macro + AutoShiftConfig, // for AutoShiftConfig + Macros // for toggle AutoShift Macro ); void setup() { diff --git a/examples/Keystrokes/CharShift/CharShift.ino b/examples/Keystrokes/CharShift/CharShift.ino index ff6c9a83..ac3ad49c 100644 --- a/examples/Keystrokes/CharShift/CharShift.ino +++ b/examples/Keystrokes/CharShift/CharShift.ino @@ -31,9 +31,9 @@ KALEIDOSCOPE_INIT_PLUGINS(CharShift); void setup() { CS_KEYS( - kaleidoscope::plugin::CharShift::KeyPair(Key_Comma, Key_Semicolon), // CS(0) - kaleidoscope::plugin::CharShift::KeyPair(Key_Period, LSHIFT(Key_Semicolon)), // CS(1) - kaleidoscope::plugin::CharShift::KeyPair(LSHIFT(Key_Comma), LSHIFT(Key_Period)), // CS(2) + kaleidoscope::plugin::CharShift::KeyPair(Key_Comma, Key_Semicolon), // CS(0) + kaleidoscope::plugin::CharShift::KeyPair(Key_Period, LSHIFT(Key_Semicolon)), // CS(1) + kaleidoscope::plugin::CharShift::KeyPair(LSHIFT(Key_Comma), LSHIFT(Key_Period)), // CS(2) ); Kaleidoscope.setup(); } diff --git a/examples/Keystrokes/Leader/Leader.ino b/examples/Keystrokes/Leader/Leader.ino index c2ea13a2..b1c1163d 100644 --- a/examples/Keystrokes/Leader/Leader.ino +++ b/examples/Keystrokes/Leader/Leader.ino @@ -50,8 +50,8 @@ static void leaderTestAA(uint8_t seq_index) { } static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM = -LEADER_DICT({LEADER_SEQ(LEAD(0), Key_A), leaderTestA}, -{LEADER_SEQ(LEAD(0), Key_A, Key_A), leaderTestAA}); + LEADER_DICT({LEADER_SEQ(LEAD(0), Key_A), leaderTestA}, + {LEADER_SEQ(LEAD(0), Key_A, Key_A), leaderTestAA}); KALEIDOSCOPE_INIT_PLUGINS(Leader); diff --git a/examples/Keystrokes/LeaderPrefix/LeaderPrefix.ino b/examples/Keystrokes/LeaderPrefix/LeaderPrefix.ino index 8aa6a129..14ee4a33 100644 --- a/examples/Keystrokes/LeaderPrefix/LeaderPrefix.ino +++ b/examples/Keystrokes/LeaderPrefix/LeaderPrefix.ino @@ -74,7 +74,7 @@ class LeaderPrefix : public Plugin { if (keyToggledOn(event.state) && isLeaderKey(event.key)) { // A Leader key toggled on, so we set our state to "active", and set the // arg value to zero. - active_ = true; + active_ = true; leader_arg_ = 0; } // Whether or not the plugin just became active, there's nothing more to @@ -122,8 +122,16 @@ class LeaderPrefix : public Plugin { private: // The "digit keys": these are the keys on the number row of the Model01. KeyAddr digit_addrs_[10] = { - KeyAddr(0, 14), KeyAddr(0, 1), KeyAddr(0, 2), KeyAddr(0, 3), KeyAddr(0, 4), - KeyAddr(0, 5), KeyAddr(0, 10), KeyAddr(0, 11), KeyAddr(0, 12), KeyAddr(0, 13), + KeyAddr(0, 14), + KeyAddr(0, 1), + KeyAddr(0, 2), + KeyAddr(0, 3), + KeyAddr(0, 4), + KeyAddr(0, 5), + KeyAddr(0, 10), + KeyAddr(0, 11), + KeyAddr(0, 12), + KeyAddr(0, 13), }; // This event tracker is necessary to prevent re-processing events. Any @@ -144,8 +152,8 @@ class LeaderPrefix : public Plugin { } }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope // This creates our plugin object. kaleidoscope::plugin::LeaderPrefix LeaderPrefix; @@ -172,9 +180,9 @@ void leaderTestPrefix(uint8_t seq_index) { } static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM = -LEADER_DICT({LEADER_SEQ(LEAD(0), Key_X), leaderTestX}, -{LEADER_SEQ(LEAD(0), Key_X, Key_X), leaderTestXX}, -{LEADER_SEQ(LEAD(0), Key_Z), leaderTestPrefix}); + LEADER_DICT({LEADER_SEQ(LEAD(0), Key_X), leaderTestX}, + {LEADER_SEQ(LEAD(0), Key_X, Key_X), leaderTestXX}, + {LEADER_SEQ(LEAD(0), Key_Z), leaderTestPrefix}); // The order matters here; LeaderPrefix won't work unless it precedes Leader in // this list. If there are other plugins in the list, these two should ideally diff --git a/examples/Keystrokes/Macros/Macros.ino b/examples/Keystrokes/Macros/Macros.ino index ae5a6609..c7fba475 100644 --- a/examples/Keystrokes/Macros/Macros.ino +++ b/examples/Keystrokes/Macros/Macros.ino @@ -71,7 +71,7 @@ void macroTypeString(KeyEvent &event) { } // Example macro for macro step sequence. -const macro_t* macroSteps(KeyEvent &event) { +const macro_t *macroSteps(KeyEvent &event) { if (keyToggledOn(event.state)) { // Note that the following sequence leaves two keys down (`Key_RightAlt` and // `Key_C`). These virtual keys will remain in effect until the Macros key @@ -82,7 +82,7 @@ const macro_t* macroSteps(KeyEvent &event) { } // Example macro that sets `event.key`. -const macro_t* macroNewSentence1(KeyEvent &event) { +const macro_t *macroNewSentence1(KeyEvent &event) { if (keyToggledOn(event.state)) { event.key = OSM(LeftShift); return MACRO(Tc(Period), Tc(Spacebar), Tc(Spacebar)); @@ -114,7 +114,7 @@ void macroNewSentence3(KeyEvent &event) { // Macro that auto-repeats? -const macro_t* macroAction(uint8_t macro_id, KeyEvent &event) { +const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { switch (macro_id) { case 0: diff --git a/examples/Keystrokes/SpaceCadet/SpaceCadet.ino b/examples/Keystrokes/SpaceCadet/SpaceCadet.ino index bffacbde..c9b983ca 100644 --- a/examples/Keystrokes/SpaceCadet/SpaceCadet.ino +++ b/examples/Keystrokes/SpaceCadet/SpaceCadet.ino @@ -49,14 +49,14 @@ void setup() { //Setting is {KeyThatWasPressed, AlternativeKeyToSend, TimeoutInMS} //Note: must end with the SPACECADET_MAP_END delimiter static kaleidoscope::plugin::SpaceCadet::KeyBinding spacecadetmap[] = { - {Key_LeftShift, Key_LeftParen, 250} - , {Key_RightShift, Key_RightParen, 250} - , {Key_LeftGui, Key_LeftCurlyBracket, 250} - , {Key_RightAlt, Key_RightCurlyBracket, 250} - , {Key_LeftAlt, Key_RightCurlyBracket, 250} - , {Key_LeftControl, Key_LeftBracket, 250} - , {Key_RightControl, Key_RightBracket, 250} - , SPACECADET_MAP_END + {Key_LeftShift, Key_LeftParen, 250}, + {Key_RightShift, Key_RightParen, 250}, + {Key_LeftGui, Key_LeftCurlyBracket, 250}, + {Key_RightAlt, Key_RightCurlyBracket, 250}, + {Key_LeftAlt, Key_RightCurlyBracket, 250}, + {Key_LeftControl, Key_LeftBracket, 250}, + {Key_RightControl, Key_RightBracket, 250}, + SPACECADET_MAP_END, }; //Set the map. SpaceCadet.map = spacecadetmap; diff --git a/examples/Keystrokes/WinKeyToggle/WinKeyToggle.ino b/examples/Keystrokes/WinKeyToggle/WinKeyToggle.ino index 35e03c06..c4a69b9b 100644 --- a/examples/Keystrokes/WinKeyToggle/WinKeyToggle.ino +++ b/examples/Keystrokes/WinKeyToggle/WinKeyToggle.ino @@ -28,9 +28,8 @@ void toggleWinKey(uint8_t index) { } USE_MAGIC_COMBOS([WINKEYTOGGLE] = { - .action = toggleWinKey, - .keys = {R3C6, R3C9} -}); + .action = toggleWinKey, + .keys = {R3C6, R3C9}}); // clang-format off KEYMAPS( diff --git a/examples/LEDs/IdleLEDs/IdleLEDs.ino b/examples/LEDs/IdleLEDs/IdleLEDs.ino index ca33b35e..55018e51 100644 --- a/examples/LEDs/IdleLEDs/IdleLEDs.ino +++ b/examples/LEDs/IdleLEDs/IdleLEDs.ino @@ -56,7 +56,7 @@ void setup() { Kaleidoscope.setup(); - PersistentIdleLEDs.setIdleTimeoutSeconds(300); // 5 minutes + PersistentIdleLEDs.setIdleTimeoutSeconds(300); // 5 minutes LEDRainbowWaveEffect.activate(); } diff --git a/examples/LEDs/LED-ActiveLayerColor/LED-ActiveLayerColor.ino b/examples/LEDs/LED-ActiveLayerColor/LED-ActiveLayerColor.ino index e65ab57d..fcd36c5e 100644 --- a/examples/LEDs/LED-ActiveLayerColor/LED-ActiveLayerColor.ino +++ b/examples/LEDs/LED-ActiveLayerColor/LED-ActiveLayerColor.ino @@ -66,8 +66,7 @@ KALEIDOSCOPE_INIT_PLUGINS(LEDControl, void setup() { static const cRGB layerColormap[] PROGMEM = { CRGB(128, 0, 0), - CRGB(0, 128, 0) - }; + CRGB(0, 128, 0)}; Kaleidoscope.setup(); LEDActiveLayerColorEffect.setColormap(layerColormap); diff --git a/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino b/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino index 57d8c958..2a46ba8e 100644 --- a/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino +++ b/examples/LEDs/LED-AlphaSquare/LED-AlphaSquare.ino @@ -57,12 +57,12 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { col = 10; for (uint8_t step = 0; step <= 0xf0; step += 8) { - AlphaSquare.color = { step, step, step }; + AlphaSquare.color = {step, step, step}; AlphaSquare.display({i, 0}, col); delay(10); } for (uint8_t step = 0xff; step >= 8; step -= 8) { - AlphaSquare.color = { step, step, step }; + AlphaSquare.color = {step, step, step}; AlphaSquare.display({i, 0}, col); delay(10); } @@ -74,14 +74,14 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { delay(100); for (uint8_t step = 0; step <= 0xf0; step += 8) { - AlphaSquare.color = { step, step, step }; + AlphaSquare.color = {step, step, step}; AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 2); AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 10); delay(10); } for (uint8_t step = 0xff; step >= 8; step -= 8) { - AlphaSquare.color = { step, step, step }; + AlphaSquare.color = {step, step, step}; AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 2); AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 10); delay(10); @@ -102,7 +102,7 @@ KALEIDOSCOPE_INIT_PLUGINS(LEDControl, void setup() { Kaleidoscope.setup(); - AlphaSquare.color = { 0xcb, 0xc0, 0xff }; + AlphaSquare.color = {0xcb, 0xc0, 0xff}; } void loop() { diff --git a/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino b/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino index a9ec1d58..25e0e2ea 100644 --- a/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino +++ b/examples/LEDs/LED-Palette-Theme/LED-Palette-Theme.ino @@ -39,13 +39,11 @@ class TestLEDMode : public kaleidoscope::plugin::LEDMode { uint16_t TestLEDMode::map_base_; -void -TestLEDMode::setup() { +void TestLEDMode::setup() { map_base_ = LEDPaletteTheme.reserveThemes(1); } -void -TestLEDMode::update(void) { +void TestLEDMode::update(void) { LEDPaletteTheme.updateHandler(map_base_, 0); } @@ -54,7 +52,7 @@ TestLEDMode::onFocusEvent(const char *command) { return LEDPaletteTheme.themeFocusEvent(command, PSTR("testLedMode.map"), map_base_, 1); } -} +} // namespace example example::TestLEDMode TestLEDMode; diff --git a/examples/LEDs/LED-Wavepool/LED-Wavepool.ino b/examples/LEDs/LED-Wavepool/LED-Wavepool.ino index 581fa84b..3cd8486e 100644 --- a/examples/LEDs/LED-Wavepool/LED-Wavepool.ino +++ b/examples/LEDs/LED-Wavepool/LED-Wavepool.ino @@ -53,7 +53,7 @@ void setup() { Kaleidoscope.setup(); WavepoolEffect.idle_timeout = 5000; // 5 seconds - WavepoolEffect.ripple_hue = WavepoolEffect.rainbow_hue; + WavepoolEffect.ripple_hue = WavepoolEffect.rainbow_hue; WavepoolEffect.activate(); } From 5d5ad0871d93849e6d69ac4aa1304a55314b9cea Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Wed, 6 Apr 2022 10:08:36 -0500 Subject: [PATCH 4/4] Update code style documentation from astyle to clang-format Signed-off-by: Michael Richters --- docs/codebase/code-style.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/codebase/code-style.md b/docs/codebase/code-style.md index f7562d05..ca5a4fab 100644 --- a/docs/codebase/code-style.md +++ b/docs/codebase/code-style.md @@ -2398,7 +2398,7 @@ New code should not contain calls to deprecated interface points. Use the new in Coding style and formatting are pretty arbitrary, but a project is much easier to follow if everyone uses the same style. Individuals may not agree with every aspect of the formatting rules, and some of the rules may take some getting used to, but it is important that all project contributors follow the style rules so that they can all read and understand everyone's code easily. -To help you format code correctly, we use "Artistic Style" 3.0. The `make astyle` target is available in the Kaleidoscope and plugin Makefiles. Our CI infrastructure enforces `astyle`'s decisions. +To help format code in compliance with this style guide, we use `clang-format`, which many editors can be configured to call automatically. There is also `make format` target available in the Kaleidoscope Makefile that will use `clang-format` to format all the core and plugin code. Our CI infrastructure checks to ensure that code has been formatted to these specifications. ### Line Length