Merge pull request #1157 from gedankenexperimenter/clang-format-improved

Replace clang-format wrapper script
pull/1159/head
Jesse Vincent 3 years ago committed by GitHub
commit ea291858b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 .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: format:
bin/format-code.sh bin/format-code.py \
--exclude-dir 'testing/googletest' \
--exclude-file 'generated-testcase.cpp' \
src plugins examples testing
check-formatting: 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: cpplint-noisy:
-bin/cpplint.py --config=.cpplint-noisy --recursive src plugins examples -bin/cpplint.py --config=.cpplint-noisy --recursive src plugins examples

@ -0,0 +1,271 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Copyright (c) 2022 Michael Richters <gedankenexperimenter@gmail.com>
# 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 <http://unlicense.org/>
# ------------------------------------------------------------------------------
"""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="<path>",
dest='exclude_dirs',
help="Exclude dir from search (path relative to the pwd)",
action='append',
default=[],
)
parser.add_argument(
'-x',
'--exclude-file',
metavar="<file>",
dest='exclude_files',
help="Exclude <file> (base name only, not a full path) from formatting",
action='append',
default=[],
)
parser.add_argument(
'-e',
'--regex',
metavar="<regex>",
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="<search_dir>",
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:])

@ -1,25 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Allow the caller to specify a particular version of clang-format to use: : "${KALEIDOSCOPE_DIR:=$(pwd)}"
: "${CLANG_FORMAT_CMD:=clang-format}" cd "${KALEIDOSCOPE_DIR}" || exit 1
# Find all *.cpp and *.h files, except those in `testing/googletest/` and files : "${VERBOSE:=}"
# 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
# If we get the `--check` option, return an error if there are any changes to "${KALEIDOSCOPE_DIR}/bin/format-code.py" \
# the git working tree after running `clang-format`: --exclude-dir 'testing/googletest' \
if [[ $1 == '--check' ]]; then --exclude-file 'generated-testcase.cpp' \
--verbose \
if ! git diff --quiet; then src plugins testing
cat >&2 <<EOF
Differences found between git head and working tree. Either 'clang-format' made
formatting changes to your code, or you had uncommitted changes in your working
tree. Please remember to run 'bin/format-code.sh' before committing changes.
EOF
exit 1
fi
fi

@ -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. 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 ### Line Length

@ -17,7 +17,7 @@
#include "Kaleidoscope.h" #include "Kaleidoscope.h"
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -38,7 +38,7 @@ KEYMAPS(
Key_NoKey Key_NoKey
), ),
) )
/* *INDENT-ON* */ // clang-format on
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -19,7 +19,7 @@
#include "Kaleidoscope.h" #include "Kaleidoscope.h"
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -46,7 +46,7 @@ KEYMAPS(
Key_PageDown, Key_Tab, Key_Enter Key_PageDown, Key_Tab, Key_Enter
), ),
) )
/* *INDENT-ON* */ // clang-format on
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -31,7 +31,7 @@ enum {
#define MO(n) ShiftToLayer(n) #define MO(n) ShiftToLayer(n)
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
/* Qwerty /* Qwerty
@ -71,7 +71,7 @@ KEYMAPS(
,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___ ,___
) )
); );
/* *INDENT-ON* */ // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(Macros); KALEIDOSCOPE_INIT_PLUGINS(Macros);

@ -32,7 +32,6 @@
#include "Kaleidoscope-SpaceCadet.h" #include "Kaleidoscope-SpaceCadet.h"
#define MO(n) ShiftToLayer(n) #define MO(n) ShiftToLayer(n)
#define TG(n) LockLayer(n) #define TG(n) LockLayer(n)
@ -42,14 +41,14 @@ enum {
}; };
#define Key_Exclamation LSHIFT(Key_1) #define Key_Exclamation LSHIFT(Key_1)
#define Key_At LSHIFT(Key_2) #define Key_At LSHIFT(Key_2)
#define Key_Hash LSHIFT(Key_3) #define Key_Hash LSHIFT(Key_3)
#define Key_Dollar LSHIFT(Key_4) #define Key_Dollar LSHIFT(Key_4)
#define Key_Percent LSHIFT(Key_5) #define Key_Percent LSHIFT(Key_5)
#define Key_Caret LSHIFT(Key_6) #define Key_Caret LSHIFT(Key_6)
#define Key_And LSHIFT(Key_7) #define Key_And LSHIFT(Key_7)
#define Key_Star LSHIFT(Key_8) #define Key_Star LSHIFT(Key_8)
#define Key_Plus LSHIFT(Key_Equals) #define Key_Plus LSHIFT(Key_Equals)
enum { enum {
QWERTY, QWERTY,
@ -57,7 +56,7 @@ enum {
UPPER UPPER
}; };
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
[QWERTY] = KEYMAP_STACKED [QWERTY] = KEYMAP_STACKED
( (
@ -98,7 +97,7 @@ KEYMAPS(
,___ ,___ ,MoveToLayer(QWERTY) ,Key_PrintScreen ,Key_ScrollLock ,Consumer_PlaySlashPause ,___ ,___ ,MoveToLayer(QWERTY) ,Key_PrintScreen ,Key_ScrollLock ,Consumer_PlaySlashPause
) )
) )
/* *INDENT-ON* */ // clang-format on
KALEIDOSCOPE_INIT_PLUGINS( KALEIDOSCOPE_INIT_PLUGINS(
EEPROMSettings, EEPROMSettings,
@ -110,8 +109,7 @@ KALEIDOSCOPE_INIT_PLUGINS(
SpaceCadet, SpaceCadet,
OneShot, OneShot,
Macros, Macros,
MouseKeys MouseKeys);
);
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (keyToggledOn(event.state)) { if (keyToggledOn(event.state)) {

@ -50,11 +50,12 @@
#include "Kaleidoscope-USB-Quirks.h" #include "Kaleidoscope-USB-Quirks.h"
enum { _QWERTY, enum {
}; _QWERTY,
};
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
[_QWERTY] = KEYMAP( [_QWERTY] = KEYMAP(
@ -67,8 +68,7 @@ Key_F5, Key_LeftControl,Key_LeftAlt, Key_LeftGui, Key_Backspace, Key_LeftAr
)); ));
/* *INDENT-ON* */ // clang-format on
// These 'solid' color effect definitions define a rainbow of // These 'solid' color effect definitions define a rainbow of
@ -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 /** Magic combo list, a list of key combo and action pairs the firmware should
* recognise. * recognise.
*/ */
USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol, USE_MAGIC_COMBOS(
// Left Fn + Esc + Shift {.action = toggleKeyboardProtocol,
.keys = { R3C6, R2C6, R3C7 } // Left Fn + Esc + Shift
}); .keys = {R3C6, R2C6, R3C7}});
KALEIDOSCOPE_INIT_PLUGINS(Macros, KALEIDOSCOPE_INIT_PLUGINS(
Macros,
// LEDControl provides support for other LED modes // LEDControl provides support for other LED modes
LEDControl, LEDControl,
// The rainbow effect changes the color of all of the keyboard's keys at the same time // 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. // running through all the colors of the rainbow.
LEDRainbowEffect, LEDRainbowEffect,
// The rainbow wave effect lights up your keyboard with all the colors of a rainbow // The rainbow wave effect lights up your keyboard with all the colors of a rainbow
// and slowly moves the rainbow across your keyboard // and slowly moves the rainbow across your keyboard
LEDRainbowWaveEffect, LEDRainbowWaveEffect,
// The chase effect follows the adventure of a blue pixel which chases a red pixel across // 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 // your keyboard. Spoiler: the blue pixel never catches the red pixel
LEDChaseEffect, LEDChaseEffect,
// These static effects turn your keyboard's LEDs a variety of colors // 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 // The breathe effect slowly pulses all of the LEDs on your keyboard
LEDBreatheEffect, LEDBreatheEffect,
// The HostPowerManagement plugin allows us to turn LEDs off when then host // The HostPowerManagement plugin allows us to turn LEDs off when then host
// goes to sleep, and resume them when it wakes up. // goes to sleep, and resume them when it wakes up.
HostPowerManagement, HostPowerManagement,
// The MagicCombo plugin lets you use key combinations to trigger custom // The MagicCombo plugin lets you use key combinations to trigger custom
// actions - a bit like Macros, but triggered by pressing multiple keys at the // actions - a bit like Macros, but triggered by pressing multiple keys at the
// same time. // same time.
MagicCombo, MagicCombo,
// The USBQuirks plugin lets you do some things with USB that we aren't // The USBQuirks plugin lets you do some things with USB that we aren't
// comfortable - or able - to do automatically, but can be useful // comfortable - or able - to do automatically, but can be useful
// nevertheless. Such as toggling the key report protocol between Boot (used // nevertheless. Such as toggling the key report protocol between Boot (used
// by BIOSes) and Report (NKRO). // by BIOSes) and Report (NKRO).
USBQuirks USBQuirks);
);
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -32,7 +32,7 @@
#define NUMPAD_KEYMAP 2 #define NUMPAD_KEYMAP 2
// clang-format off
#define GENERIC_FN2 KEYMAP_STACKED ( \ #define GENERIC_FN2 KEYMAP_STACKED ( \
___, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, XXX, \ ___, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, XXX, \
Key_Tab, Key_mouseBtnM, Key_mouseUp, ___, Key_mouseWarpNW, Key_mouseWarpNE, Consumer_ScanNextTrack, \ Key_Tab, Key_mouseBtnM, Key_mouseUp, ___, Key_mouseWarpNW, Key_mouseWarpNE, Consumer_ScanNextTrack, \
@ -49,9 +49,6 @@
___\ ___\
) )
#define NUMPAD KEYMAP (\ #define NUMPAD KEYMAP (\
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadSubtract, ___, \ ___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadSubtract, ___, \
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadAdd, ___, \ ___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadAdd, ___, \
@ -75,7 +72,7 @@ KEYMAPS(
GENERIC_FN2, GENERIC_FN2,
NUMPAD NUMPAD
) )
// clang-format on
static kaleidoscope::plugin::LEDSolidColor solidRed(60, 0, 0); static kaleidoscope::plugin::LEDSolidColor solidRed(60, 0, 0);
static kaleidoscope::plugin::LEDSolidColor solidOrange(60, 20, 0); static kaleidoscope::plugin::LEDSolidColor solidOrange(60, 20, 0);
@ -89,10 +86,17 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (macro_id == 1 && keyToggledOn(event.state)) { if (macro_id == 1 && keyToggledOn(event.state)) {
Kaleidoscope.serialPort().print("Keyboard.IO keyboard driver v0.00"); Kaleidoscope.serialPort().print("Keyboard.IO keyboard driver v0.00");
return MACRO(I(25), 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), T(Spacebar),
W(100), W(100),
T(0), T(1)); T(0),
T(1));
} }
return MACRO_NONE; return MACRO_NONE;
} }
@ -108,16 +112,24 @@ static void enterHardwareTestMode(uint8_t combo_index) {
/** Magic combo list, a list of key combo and action pairs the firmware should /** Magic combo list, a list of key combo and action pairs the firmware should
* recognise. * recognise.
*/ */
USE_MAGIC_COMBOS({ USE_MAGIC_COMBOS({.action = enterHardwareTestMode,
.action = enterHardwareTestMode, // Left Fn + Prog + LED
// Left Fn + Prog + LED .keys = {R3C6, R0C0, R0C6}});
.keys = { R3C6, R0C0, R0C6 }
});
KALEIDOSCOPE_INIT_PLUGINS(HardwareTestMode, KALEIDOSCOPE_INIT_PLUGINS(HardwareTestMode,
LEDControl, LEDOff, LEDControl,
solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet, LEDOff,
LEDBreatheEffect, LEDRainbowEffect, LEDChaseEffect, NumPad, solidRed,
solidOrange,
solidYellow,
solidGreen,
solidBlue,
solidIndigo,
solidViolet,
LEDBreatheEffect,
LEDRainbowEffect,
LEDChaseEffect,
NumPad,
Macros, Macros,
MouseKeys, MouseKeys,
MagicCombo); MagicCombo);

@ -88,10 +88,10 @@
* a macro key is pressed. * a macro key is pressed.
*/ */
enum { MACRO_VERSION_INFO, enum {
MACRO_ANY MACRO_VERSION_INFO,
}; MACRO_ANY,
};
/** The Model 100's key layouts are defined as 'keymaps'. By default, there are three /** 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,11 +168,10 @@ enum { PRIMARY, NUMPAD, FUNCTION }; // layers
// #define PRIMARY_KEYMAP_CUSTOM // #define PRIMARY_KEYMAP_CUSTOM
/* This comment temporarily turns off astyle's indent enforcement /* This comment temporarily turns off astyle's indent enforcement
* so we can make the keymaps actually resemble the physical key layout better * so we can make the keymaps actually resemble the physical key layout better
*/ */
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
@ -279,7 +282,7 @@ KEYMAPS(
) // KEYMAPS( ) // KEYMAPS(
/* Re-enable astyle's indent enforcement */ /* Re-enable astyle's indent enforcement */
// *INDENT-ON* // clang-format on
/** versionInfoMacro handles the 'firmware version info' macro /** versionInfoMacro handles the 'firmware version info' macro
* When a key bound to the macro is pressed, this macro * When a key bound to the macro is pressed, this macro
@ -336,7 +339,6 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
} }
// These 'solid' color effect definitions define a rainbow of // These 'solid' color effect definitions define a rainbow of
// LED color modes calibrated to draw 500mA or less on the // LED color modes calibrated to draw 500mA or less on the
// Keyboardio Model 100. // Keyboardio Model 100.
@ -412,12 +414,10 @@ static void enterHardwareTestMode(uint8_t combo_index) {
*/ */
USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol, USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol,
// Left Fn + Esc + Shift // Left Fn + Esc + Shift
.keys = { R3C6, R2C6, R3C7 } .keys = {R3C6, R2C6, R3C7}},
}, { {.action = enterHardwareTestMode,
.action = enterHardwareTestMode, // Left Fn + Prog + LED
// Left Fn + Prog + LED .keys = {R3C6, R0C0, R0C6}});
.keys = { R3C6, R0C0, R0C6 }
});
// First, tell Kaleidoscope which plugins you want to use. // First, tell Kaleidoscope which plugins you want to use.
// The order can be important. For example, LED effects are // The order can be important. For example, LED effects are
@ -468,7 +468,13 @@ KALEIDOSCOPE_INIT_PLUGINS(
LEDChaseEffect, LEDChaseEffect,
// These static effects turn your keyboard's LEDs a variety of colors // 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 // The breathe effect slowly pulses all of the LEDs on your keyboard
LEDBreatheEffect, LEDBreatheEffect,
@ -510,8 +516,7 @@ KALEIDOSCOPE_INIT_PLUGINS(
// comfortable - or able - to do automatically, but can be useful // comfortable - or able - to do automatically, but can be useful
// nevertheless. Such as toggling the key report protocol between Boot (used // nevertheless. Such as toggling the key report protocol between Boot (used
// by BIOSes) and Report (NKRO). // by BIOSes) and Report (NKRO).
USBQuirks USBQuirks);
);
/** The 'setup' function is one of the two standard Arduino sketch functions. /** 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 * It's called when your keyboard first powers up. This is where you set up

@ -20,17 +20,18 @@
#include "Kaleidoscope.h" #include "Kaleidoscope.h"
#include "Kaleidoscope-Macros.h" #include "Kaleidoscope-Macros.h"
enum { _QWERTY, enum {
_COLEMAK, _QWERTY,
_DVORAK, _COLEMAK,
_LOWER, _DVORAK,
_RAISE, _LOWER,
_PLOVER, _RAISE,
_ADJUST _PLOVER,
}; _ADJUST
};
/* *INDENT-OFF* */
// clang-format off
KEYMAPS( KEYMAPS(
/* Qwerty /* Qwerty
@ -161,7 +162,7 @@ KEYMAPS(
// ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___ // ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___
//) //)
); );
/* *INDENT-ON* */ // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(Macros); KALEIDOSCOPE_INIT_PLUGINS(Macros);

@ -24,7 +24,7 @@ enum {
_STENO, _STENO,
}; };
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
/* Steno (GeminiPR) /* Steno (GeminiPR)
@ -45,7 +45,7 @@ KEYMAPS(
,S(A) ,S(O) ,S(E) ,S(U) ,S(A) ,S(O) ,S(E) ,S(U)
) )
); );
/* *INDENT-ON* */ // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(GeminiPR); KALEIDOSCOPE_INIT_PLUGINS(GeminiPR);

@ -30,14 +30,14 @@ enum {
}; };
#define Key_Exclamation LSHIFT(Key_1) #define Key_Exclamation LSHIFT(Key_1)
#define Key_At LSHIFT(Key_2) #define Key_At LSHIFT(Key_2)
#define Key_Hash LSHIFT(Key_3) #define Key_Hash LSHIFT(Key_3)
#define Key_Dollar LSHIFT(Key_4) #define Key_Dollar LSHIFT(Key_4)
#define Key_And LSHIFT(Key_7) #define Key_And LSHIFT(Key_7)
#define Key_Star LSHIFT(Key_8) #define Key_Star LSHIFT(Key_8)
#define Key_Plus LSHIFT(Key_Equals) #define Key_Plus LSHIFT(Key_Equals)
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
[QWERTY] = KEYMAP_STACKED [QWERTY] = KEYMAP_STACKED
( (
@ -78,7 +78,7 @@ KEYMAPS(
,___ ,___ ,M(QWERTY),Key_PrintScreen ,Key_ScrollLock ,Consumer_PlaySlashPause ,___ ,___ ,M(QWERTY),Key_PrintScreen ,Key_ScrollLock ,Consumer_PlaySlashPause
) )
) )
/* *INDENT-ON* */ // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(Macros); KALEIDOSCOPE_INIT_PLUGINS(Macros);

@ -24,14 +24,14 @@ enum {
}; };
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
[_DEFAULT] = KEYMAP( [_DEFAULT] = KEYMAP(
Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I, Key_O, Key_P, 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 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() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -24,13 +24,13 @@ enum {
}; };
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
[_DEFAULT] = KEYMAP( [_DEFAULT] = KEYMAP(
Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I
) )
); );
/* *INDENT-ON* */ // clang-format on
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -22,7 +22,7 @@
#include "AppSwitcher.h" #include "AppSwitcher.h"
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -43,7 +43,7 @@ KEYMAPS(
AppSwitcher_Prev AppSwitcher_Prev
), ),
) )
/* *INDENT-ON* */ // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(HostOS, KALEIDOSCOPE_INIT_PLUGINS(HostOS,
AppSwitcher); AppSwitcher);

@ -18,7 +18,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-CycleTimeReport.h> #include <Kaleidoscope-CycleTimeReport.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -38,7 +38,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(CycleTimeReport); KALEIDOSCOPE_INIT_PLUGINS(CycleTimeReport);

@ -21,7 +21,7 @@
#include <Kaleidoscope-DynamicMacros.h> #include <Kaleidoscope-DynamicMacros.h>
#include <Kaleidoscope-FocusSerial.h> #include <Kaleidoscope-FocusSerial.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey,
@ -40,14 +40,13 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS( KALEIDOSCOPE_INIT_PLUGINS(
EEPROMSettings, EEPROMSettings,
EEPROMKeymap, EEPROMKeymap,
DynamicMacros, DynamicMacros,
Focus Focus);
);
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -21,7 +21,7 @@
#include <Kaleidoscope-EEPROM-Keymap-Programmer.h> #include <Kaleidoscope-EEPROM-Keymap-Programmer.h>
#include <Kaleidoscope-Macros.h> #include <Kaleidoscope-Macros.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(M(0), Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (macro_id == 0 && keyToggledOff(event.state)) { if (macro_id == 0 && keyToggledOff(event.state)) {

@ -19,7 +19,7 @@
#include <Kaleidoscope-EEPROM-Keymap.h> #include <Kaleidoscope-EEPROM-Keymap.h>
#include <Kaleidoscope-FocusSerial.h> #include <Kaleidoscope-FocusSerial.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(EEPROMKeymap, Focus); KALEIDOSCOPE_INIT_PLUGINS(EEPROMKeymap, Focus);

@ -18,7 +18,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-EEPROM-Settings.h> #include <Kaleidoscope-EEPROM-Settings.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings); KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings);

@ -18,7 +18,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-FocusSerial.h> #include <Kaleidoscope-FocusSerial.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-OFF* // clang-format on
namespace kaleidoscope { namespace kaleidoscope {
class FocusTestCommand : public Plugin { class FocusTestCommand : public Plugin {
@ -70,7 +70,7 @@ class FocusHelpCommand : public Plugin {
} }
}; };
} } // namespace kaleidoscope
kaleidoscope::FocusTestCommand FocusTestCommand; kaleidoscope::FocusTestCommand FocusTestCommand;
kaleidoscope::FocusHelpCommand FocusHelpCommand; kaleidoscope::FocusHelpCommand FocusHelpCommand;

@ -27,7 +27,7 @@
// will type out the letters from A to N, but the right palm key can be used to // 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. // toggle the custom EventDropper plugin to suppress USB output.
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(___, ___, ___, ___, ___, ___, ___, (___, ___, ___, ___, ___, ___, ___,
@ -46,7 +46,7 @@ KEYMAPS(
___, ___, ___, ___, ___, ___, ___, ___,
M(1)), M(1)),
) )
// *INDENT-ON* // clang-format on
namespace kaleidoscope { namespace kaleidoscope {
namespace plugin { namespace plugin {
@ -61,12 +61,13 @@ class EventDropper : public Plugin {
void toggle() { void toggle() {
active_ = !active_; active_ = !active_;
} }
private: private:
bool active_ = false; bool active_ = false;
}; };
} // namespace plugin } // namespace plugin
} // namespace kaleidoscope } // namespace kaleidoscope
kaleidoscope::plugin::EventDropper EventDropper; kaleidoscope::plugin::EventDropper EventDropper;
@ -95,8 +96,7 @@ static const kaleidoscope::plugin::GhostInTheFirmware::GhostKey ghost_keys[] PRO
{KeyAddr(3, 14), 200, 50}, {KeyAddr(3, 14), 200, 50},
{KeyAddr(3, 15), 200, 50}, {KeyAddr(3, 15), 200, 50},
{KeyAddr::none(), 0, 0} {KeyAddr::none(), 0, 0}};
};
KALEIDOSCOPE_INIT_PLUGINS(GhostInTheFirmware, KALEIDOSCOPE_INIT_PLUGINS(GhostInTheFirmware,
LEDControl, LEDControl,
@ -107,7 +107,7 @@ KALEIDOSCOPE_INIT_PLUGINS(GhostInTheFirmware,
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();
StalkerEffect.variant = STALKER(BlazingTrail); StalkerEffect.variant = STALKER(BlazingTrail);
GhostInTheFirmware.ghost_keys = ghost_keys; GhostInTheFirmware.ghost_keys = ghost_keys;
} }

@ -19,7 +19,7 @@
#include <Kaleidoscope-EEPROM-Settings.h> #include <Kaleidoscope-EEPROM-Settings.h>
#include <Kaleidoscope-HostOS.h> #include <Kaleidoscope-HostOS.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, HostOS); KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, HostOS);

@ -20,7 +20,7 @@
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
#include <Kaleidoscope-HostPowerManagement.h> #include <Kaleidoscope-HostPowerManagement.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -41,7 +41,7 @@ KEYMAPS(
Key_NoKey Key_NoKey
), ),
) )
// *INDENT-ON* // clang-format on
void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::Event event) { void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::Event event) {
switch (event) { switch (event) {

@ -19,9 +19,13 @@
#include <Kaleidoscope-FocusSerial.h> #include <Kaleidoscope-FocusSerial.h>
#include <Kaleidoscope-MouseKeys.h> #include <Kaleidoscope-MouseKeys.h>
enum { PRIMARY, NUMPAD, FUNCTION }; // layers enum {
PRIMARY,
NUMPAD,
FUNCTION,
}; // layers
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[PRIMARY] = KEYMAP_STACKED [PRIMARY] = KEYMAP_STACKED
(___, Key_1, Key_2, Key_3, Key_4, Key_5, XXX, (___, Key_1, Key_2, Key_3, Key_4, Key_5, XXX,
@ -68,10 +72,10 @@ KEYMAPS(
___, ___, Key_Enter, ___, ___, ___, Key_Enter, ___,
___) ___)
) )
// *INDENT-OFF* // clang-format on
namespace kaleidoscope { namespace kaleidoscope {
class LayerDumper: public Plugin { class LayerDumper : public Plugin {
public: public:
LayerDumper() {} LayerDumper() {}
@ -89,7 +93,7 @@ class LayerDumper: public Plugin {
} }
}; };
} } // namespace kaleidoscope
kaleidoscope::LayerDumper LayerDumper; kaleidoscope::LayerDumper LayerDumper;

@ -18,7 +18,7 @@
#include "Kaleidoscope.h" #include "Kaleidoscope.h"
#include "Kaleidoscope-Macros.h" #include "Kaleidoscope-Macros.h"
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -39,7 +39,7 @@ KEYMAPS(
M(0) M(0)
), ),
) )
/* *INDENT-ON* */ // clang-format on
namespace kaleidoscope { namespace kaleidoscope {
namespace plugin { namespace plugin {
@ -64,11 +64,10 @@ class ShiftBlocker : public Plugin {
private: private:
bool active_{false}; bool active_{false};
}; };
} // namespace plugin } // namespace plugin
} // namespace kaleidoscope } // namespace kaleidoscope
kaleidoscope::plugin::ShiftBlocker ShiftBlocker; kaleidoscope::plugin::ShiftBlocker ShiftBlocker;

@ -20,7 +20,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-Steno.h> #include <Kaleidoscope-Steno.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (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), S(E), S(U), XXX, S(RE2),
___), ___),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(GeminiPR); KALEIDOSCOPE_INIT_PLUGINS(GeminiPR);

@ -19,7 +19,7 @@
#include <Kaleidoscope-EEPROM-Settings.h> #include <Kaleidoscope-EEPROM-Settings.h>
#include <Kaleidoscope-TypingBreaks.h> #include <Kaleidoscope-TypingBreaks.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -39,7 +39,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, TypingBreaks); KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, TypingBreaks);

@ -21,7 +21,7 @@
// This example demonstrates how a plugin can gather information about // This example demonstrates how a plugin can gather information about
// the keymap at compile time, e.g. to adapt its behavior, safe resources, ... // the keymap at compile time, e.g. to adapt its behavior, safe resources, ...
/* *INDENT-OFF* */ // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -42,9 +42,9 @@ KEYMAPS(
Key_NoKey Key_NoKey
), ),
) )
/* *INDENT-ON* */ // 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 BPlugin : public kaleidoscope::Plugin {};
class CPlugin : public kaleidoscope::Plugin {}; class CPlugin : public kaleidoscope::Plugin {};
@ -54,7 +54,8 @@ class CPlugin : public kaleidoscope::Plugin {};
class APlugin : public kaleidoscope::Plugin { class APlugin : public kaleidoscope::Plugin {
public: public:
APlugin() : has_key_1_{false} {} APlugin()
: has_key_1_{false} {}
template<typename _Sketch> template<typename _Sketch>
kaleidoscope::EventHandlerResult exploreSketch() { kaleidoscope::EventHandlerResult exploreSketch() {
@ -72,7 +73,7 @@ class APlugin : public kaleidoscope::Plugin {
constexpr bool has_key_1 = K::collect(HasKey{Key_1}); constexpr bool has_key_1 = K::collect(HasKey{Key_1});
static_assert(has_key_1, "Error querying key existence"); 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. // at compile time.
constexpr Key max_key = K::collect(MaxKeyRaw{}); 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, static_assert(K::getKey(0 /*layer*/, KeyAddr{2, 3}) == Key_D,
"Key lookup failed"); "Key lookup failed");
constexpr auto n_layers = K::nLayers(); constexpr auto n_layers = K::nLayers();
constexpr auto layer_size = K::layerSize(); constexpr auto layer_size = K::layerSize();
// Plugin exploration // Plugin exploration
@ -117,7 +118,6 @@ class APlugin : public kaleidoscope::Plugin {
} }
private: private:
bool has_key_1_; bool has_key_1_;
}; };
@ -127,8 +127,7 @@ BPlugin b_plugin;
KALEIDOSCOPE_INIT_PLUGINS( KALEIDOSCOPE_INIT_PLUGINS(
a_plugin1, a_plugin1,
b_plugin, b_plugin,
a_plugin2 a_plugin2)
)
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -12,7 +12,7 @@ enum {
TOGGLE_AUTOSHIFT, TOGGLE_AUTOSHIFT,
}; };
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -33,7 +33,7 @@ KEYMAPS(
XXX XXX
), ),
) )
// *INDENT-ON* // clang-format on
// Defining a macro (on the "any" key: see above) to turn AutoShift on and off // 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) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
@ -56,8 +56,8 @@ KALEIDOSCOPE_INIT_PLUGINS(
FocusEEPROMCommand, // for AutoShiftConfig FocusEEPROMCommand, // for AutoShiftConfig
FocusSettingsCommand, // for AutoShiftConfig FocusSettingsCommand, // for AutoShiftConfig
AutoShift, AutoShift,
AutoShiftConfig, // for AutoShiftConfig AutoShiftConfig, // for AutoShiftConfig
Macros // for toggle AutoShift Macro Macros // for toggle AutoShift Macro
); );
void setup() { void setup() {

@ -4,7 +4,7 @@
#include <Kaleidoscope-CharShift.h> #include <Kaleidoscope-CharShift.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -25,15 +25,15 @@ KEYMAPS(
XXX XXX
), ),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(CharShift); KALEIDOSCOPE_INIT_PLUGINS(CharShift);
void setup() { void setup() {
CS_KEYS( CS_KEYS(
kaleidoscope::plugin::CharShift::KeyPair(Key_Comma, Key_Semicolon), // CS(0) 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(Key_Period, LSHIFT(Key_Semicolon)), // CS(1)
kaleidoscope::plugin::CharShift::KeyPair(LSHIFT(Key_Comma), LSHIFT(Key_Period)), // CS(2) kaleidoscope::plugin::CharShift::KeyPair(LSHIFT(Key_Comma), LSHIFT(Key_Period)), // CS(2)
); );
Kaleidoscope.setup(); Kaleidoscope.setup();
} }

@ -18,7 +18,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-Cycle.h> #include <Kaleidoscope-Cycle.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_Cycle), Key_Cycle),
) )
// *INDENT-ON* // clang-format on
void cycleAction(Key previous_key, uint8_t cycle_count) { void cycleAction(Key previous_key, uint8_t cycle_count) {
if (previous_key == Key_E) { if (previous_key == Key_E) {

@ -22,7 +22,7 @@
#include <Kaleidoscope-TapDance.h> #include <Kaleidoscope-TapDance.h>
#include <Kaleidoscope-DynamicTapDance.h> #include <Kaleidoscope-DynamicTapDance.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -42,7 +42,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, TD(2), Key_RightShift, Key_RightAlt, Key_Spacebar, TD(2),
TD(1)), TD(1)),
) )
// *INDENT-ON* // clang-format on
enum { enum {
TD_TAB_ESC, TD_TAB_ESC,

@ -21,7 +21,7 @@
#include <Kaleidoscope-Escape-OneShot.h> #include <Kaleidoscope-Escape-OneShot.h>
#include <Kaleidoscope-FocusSerial.h> #include <Kaleidoscope-FocusSerial.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -61,7 +61,7 @@ KEYMAPS(
___ ___
), ),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings,
Focus, Focus,

@ -18,7 +18,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-Leader.h> #include <Kaleidoscope-Leader.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
LEAD(0)), LEAD(0)),
) )
// *INDENT-ON* // clang-format on
auto &serial_port = Kaleidoscope.serialPort(); auto &serial_port = Kaleidoscope.serialPort();
@ -50,8 +50,8 @@ static void leaderTestAA(uint8_t seq_index) {
} }
static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM = static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM =
LEADER_DICT({LEADER_SEQ(LEAD(0), Key_A), leaderTestA}, LEADER_DICT({LEADER_SEQ(LEAD(0), Key_A), leaderTestA},
{LEADER_SEQ(LEAD(0), Key_A, Key_A), leaderTestAA}); {LEADER_SEQ(LEAD(0), Key_A, Key_A), leaderTestAA});
KALEIDOSCOPE_INIT_PLUGINS(Leader); KALEIDOSCOPE_INIT_PLUGINS(Leader);

@ -24,7 +24,7 @@
#include "kaleidoscope/LiveKeys.h" #include "kaleidoscope/LiveKeys.h"
#include "kaleidoscope/plugin.h" #include "kaleidoscope/plugin.h"
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (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, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
LEAD(0)), LEAD(0)),
) )
// *INDENT-ON* // clang-format on
namespace kaleidoscope { namespace kaleidoscope {
namespace plugin { namespace plugin {
@ -74,7 +74,7 @@ class LeaderPrefix : public Plugin {
if (keyToggledOn(event.state) && isLeaderKey(event.key)) { if (keyToggledOn(event.state) && isLeaderKey(event.key)) {
// A Leader key toggled on, so we set our state to "active", and set the // A Leader key toggled on, so we set our state to "active", and set the
// arg value to zero. // arg value to zero.
active_ = true; active_ = true;
leader_arg_ = 0; leader_arg_ = 0;
} }
// Whether or not the plugin just became active, there's nothing more to // Whether or not the plugin just became active, there's nothing more to
@ -122,8 +122,16 @@ class LeaderPrefix : public Plugin {
private: private:
// The "digit keys": these are the keys on the number row of the Model01. // The "digit keys": these are the keys on the number row of the Model01.
KeyAddr digit_addrs_[10] = { KeyAddr digit_addrs_[10] = {
KeyAddr(0, 14), KeyAddr(0, 1), KeyAddr(0, 2), KeyAddr(0, 3), KeyAddr(0, 4), KeyAddr(0, 14),
KeyAddr(0, 5), KeyAddr(0, 10), KeyAddr(0, 11), KeyAddr(0, 12), KeyAddr(0, 13), 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 // This event tracker is necessary to prevent re-processing events. Any
@ -144,8 +152,8 @@ class LeaderPrefix : public Plugin {
} }
}; };
} // namespace plugin } // namespace plugin
} // namespace kaleidoscope } // namespace kaleidoscope
// This creates our plugin object. // This creates our plugin object.
kaleidoscope::plugin::LeaderPrefix LeaderPrefix; kaleidoscope::plugin::LeaderPrefix LeaderPrefix;
@ -172,9 +180,9 @@ void leaderTestPrefix(uint8_t seq_index) {
} }
static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM = static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM =
LEADER_DICT({LEADER_SEQ(LEAD(0), Key_X), leaderTestX}, LEADER_DICT({LEADER_SEQ(LEAD(0), Key_X), leaderTestX},
{LEADER_SEQ(LEAD(0), Key_X, Key_X), leaderTestXX}, {LEADER_SEQ(LEAD(0), Key_X, Key_X), leaderTestXX},
{LEADER_SEQ(LEAD(0), Key_Z), leaderTestPrefix}); {LEADER_SEQ(LEAD(0), Key_Z), leaderTestPrefix});
// The order matters here; LeaderPrefix won't work unless it precedes Leader in // 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 // this list. If there are other plugins in the list, these two should ideally

@ -24,7 +24,7 @@ enum {
TOGGLE_ONESHOT, TOGGLE_ONESHOT,
}; };
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(___, M(1), M(2), M(3), M(4), M(5), ___, (___, 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. // Example macro for typing a string of characters.
void macroTypeString(KeyEvent &event) { void macroTypeString(KeyEvent &event) {
@ -71,7 +71,7 @@ void macroTypeString(KeyEvent &event) {
} }
// Example macro for macro step sequence. // Example macro for macro step sequence.
const macro_t* macroSteps(KeyEvent &event) { const macro_t *macroSteps(KeyEvent &event) {
if (keyToggledOn(event.state)) { if (keyToggledOn(event.state)) {
// Note that the following sequence leaves two keys down (`Key_RightAlt` and // 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 // `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`. // Example macro that sets `event.key`.
const macro_t* macroNewSentence1(KeyEvent &event) { const macro_t *macroNewSentence1(KeyEvent &event) {
if (keyToggledOn(event.state)) { if (keyToggledOn(event.state)) {
event.key = OSM(LeftShift); event.key = OSM(LeftShift);
return MACRO(Tc(Period), Tc(Spacebar), Tc(Spacebar)); return MACRO(Tc(Period), Tc(Spacebar), Tc(Spacebar));
@ -114,7 +114,7 @@ void macroNewSentence3(KeyEvent &event) {
// Macro that auto-repeats? // 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) { switch (macro_id) {
case 0: case 0:

@ -29,7 +29,7 @@ void kindOfMagic(uint8_t combo_index) {
USE_MAGIC_COMBOS([KIND_OF_MAGIC] = {.action = kindOfMagic, .keys = {R3C6, R3C9}}); USE_MAGIC_COMBOS([KIND_OF_MAGIC] = {.action = kindOfMagic, .keys = {R3C6, R3C9}});
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -49,7 +49,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(MagicCombo, Macros); KALEIDOSCOPE_INIT_PLUGINS(MagicCombo, Macros);

@ -24,7 +24,7 @@ enum {
TOGGLE_ONESHOT, TOGGLE_ONESHOT,
}; };
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -62,7 +62,7 @@ KEYMAPS(
___, ___, ___, ___, ___, ___, ___, ___,
___), ___),
) )
// *INDENT-ON* // clang-format on
void macroToggleOneShot() { void macroToggleOneShot() {
OneShot.toggleAutoOneShot(); OneShot.toggleAutoOneShot();

@ -25,7 +25,7 @@ enum {
TOGGLE_ONESHOT, TOGGLE_ONESHOT,
}; };
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -63,7 +63,7 @@ KEYMAPS(
___, ___, ___, ___, ___, ___, ___, ___,
___), ___),
) )
// *INDENT-ON* // clang-format on
void macroToggleOneShot() { void macroToggleOneShot() {
OneShot.toggleAutoOneShot(); OneShot.toggleAutoOneShot();

@ -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) // for the home row on the right side of the keymap (and one of the palm keys)
// below. // below.
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [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 // 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) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {

@ -25,7 +25,7 @@ bool kaleidoscope::plugin::Redial::shouldRemember(Key mapped_key) {
return false; return false;
} }
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -45,7 +45,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_Redial), Key_Redial),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(Redial); KALEIDOSCOPE_INIT_PLUGINS(Redial);

@ -18,7 +18,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-ShapeShifter.h> #include <Kaleidoscope-ShapeShifter.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -38,7 +38,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
static const kaleidoscope::plugin::ShapeShifter::dictionary_t shape_shift_dictionary[] PROGMEM = { static const kaleidoscope::plugin::ShapeShifter::dictionary_t shape_shift_dictionary[] PROGMEM = {
{Key_1, Key_2}, {Key_1, Key_2},

@ -18,7 +18,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-SpaceCadet.h> #include <Kaleidoscope-SpaceCadet.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -38,7 +38,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(SpaceCadet); KALEIDOSCOPE_INIT_PLUGINS(SpaceCadet);
@ -49,14 +49,14 @@ void setup() {
//Setting is {KeyThatWasPressed, AlternativeKeyToSend, TimeoutInMS} //Setting is {KeyThatWasPressed, AlternativeKeyToSend, TimeoutInMS}
//Note: must end with the SPACECADET_MAP_END delimiter //Note: must end with the SPACECADET_MAP_END delimiter
static kaleidoscope::plugin::SpaceCadet::KeyBinding spacecadetmap[] = { static kaleidoscope::plugin::SpaceCadet::KeyBinding spacecadetmap[] = {
{Key_LeftShift, Key_LeftParen, 250} {Key_LeftShift, Key_LeftParen, 250},
, {Key_RightShift, Key_RightParen, 250} {Key_RightShift, Key_RightParen, 250},
, {Key_LeftGui, Key_LeftCurlyBracket, 250} {Key_LeftGui, Key_LeftCurlyBracket, 250},
, {Key_RightAlt, Key_RightCurlyBracket, 250} {Key_RightAlt, Key_RightCurlyBracket, 250},
, {Key_LeftAlt, Key_RightCurlyBracket, 250} {Key_LeftAlt, Key_RightCurlyBracket, 250},
, {Key_LeftControl, Key_LeftBracket, 250} {Key_LeftControl, Key_LeftBracket, 250},
, {Key_RightControl, Key_RightBracket, 250} {Key_RightControl, Key_RightBracket, 250},
, SPACECADET_MAP_END SPACECADET_MAP_END,
}; };
//Set the map. //Set the map.
SpaceCadet.map = spacecadetmap; SpaceCadet.map = spacecadetmap;

@ -21,7 +21,7 @@
#include <Kaleidoscope-Syster.h> #include <Kaleidoscope-Syster.h>
#include <Kaleidoscope-Unicode.h> #include <Kaleidoscope-Unicode.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -41,7 +41,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
SYSTER), SYSTER),
) )
// *INDENT-ON* // clang-format on
void systerAction(kaleidoscope::plugin::Syster::action_t action, const char *symbol) { void systerAction(kaleidoscope::plugin::Syster::action_t action, const char *symbol) {
switch (action) { switch (action) {

@ -18,7 +18,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-TapDance.h> #include <Kaleidoscope-TapDance.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -38,7 +38,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
TD(1)), 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) { 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); tapDanceActionKeys(tap_count, tap_dance_action, Key_Escape, Key_Tab);

@ -18,7 +18,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-TopsyTurvy.h> #include <Kaleidoscope-TopsyTurvy.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -38,7 +38,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(TopsyTurvy); KALEIDOSCOPE_INIT_PLUGINS(TopsyTurvy);

@ -19,7 +19,7 @@
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
#include <Kaleidoscope-Turbo.h> #include <Kaleidoscope-Turbo.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, Turbo); KALEIDOSCOPE_INIT_PLUGINS(LEDControl, Turbo);

@ -23,7 +23,7 @@
enum { MACRO_KEYBOARD_EMOJI }; enum { MACRO_KEYBOARD_EMOJI };
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
@ -44,7 +44,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
static void unicode(uint32_t character, uint8_t keyState) { static void unicode(uint32_t character, uint8_t keyState) {
if (keyToggledOn(keyState)) { if (keyToggledOn(keyState)) {

@ -28,11 +28,10 @@ void toggleWinKey(uint8_t index) {
} }
USE_MAGIC_COMBOS([WINKEYTOGGLE] = { USE_MAGIC_COMBOS([WINKEYTOGGLE] = {
.action = toggleWinKey, .action = toggleWinKey,
.keys = {R3C6, R3C9} .keys = {R3C6, R3C9}});
});
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -52,7 +51,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(MagicCombo, WinKeyToggle); KALEIDOSCOPE_INIT_PLUGINS(MagicCombo, WinKeyToggle);

@ -22,7 +22,7 @@
#include <Kaleidoscope-LED-Palette-Theme.h> #include <Kaleidoscope-LED-Palette-Theme.h>
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, (Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
@ -42,7 +42,7 @@ KEYMAPS(
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings,
LEDPaletteTheme, LEDPaletteTheme,

@ -22,7 +22,7 @@
#include <Kaleidoscope-FingerPainter.h> #include <Kaleidoscope-FingerPainter.h>
#include <Kaleidoscope-FocusSerial.h> #include <Kaleidoscope-FocusSerial.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, (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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
LEDOff, LEDOff,

@ -20,7 +20,7 @@
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
#include <Kaleidoscope-Heatmap.h> #include <Kaleidoscope-Heatmap.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, (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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
HeatmapEffect); HeatmapEffect);

@ -22,7 +22,7 @@
#include <Kaleidoscope-FocusSerial.h> #include <Kaleidoscope-FocusSerial.h>
#include <Kaleidoscope-IdleLEDs.h> #include <Kaleidoscope-IdleLEDs.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -42,7 +42,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
EEPROMSettings, EEPROMSettings,
@ -56,7 +56,7 @@ void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();
PersistentIdleLEDs.setIdleTimeoutSeconds(300); // 5 minutes PersistentIdleLEDs.setIdleTimeoutSeconds(300); // 5 minutes
LEDRainbowWaveEffect.activate(); LEDRainbowWaveEffect.activate();
} }

@ -19,7 +19,7 @@
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
#include <Kaleidoscope-LED-ActiveLayerColor.h> #include <Kaleidoscope-LED-ActiveLayerColor.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -58,7 +58,7 @@ KEYMAPS(
ShiftToLayer(0) ShiftToLayer(0)
) )
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
LEDActiveLayerColorEffect); LEDActiveLayerColorEffect);
@ -66,8 +66,7 @@ KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
void setup() { void setup() {
static const cRGB layerColormap[] PROGMEM = { static const cRGB layerColormap[] PROGMEM = {
CRGB(128, 0, 0), CRGB(128, 0, 0),
CRGB(0, 128, 0) CRGB(0, 128, 0)};
};
Kaleidoscope.setup(); Kaleidoscope.setup();
LEDActiveLayerColorEffect.setColormap(layerColormap); LEDActiveLayerColorEffect.setColormap(layerColormap);

@ -20,7 +20,7 @@
#include <Kaleidoscope-LED-ActiveModColor.h> #include <Kaleidoscope-LED-ActiveModColor.h>
#include <Kaleidoscope-OneShot.h> #include <Kaleidoscope-OneShot.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -40,7 +40,7 @@ KEYMAPS(
OSM(RightShift), OSM(RightAlt), Key_Spacebar, OSM(RightControl), OSM(RightShift), OSM(RightAlt), Key_Spacebar, OSM(RightControl),
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
// OneShot is included to illustrate the different colors highlighting sticky // 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 // and one-shot keys. LEDOff is included because we need an LED mode active to

@ -20,7 +20,7 @@
#include <Kaleidoscope-LED-AlphaSquare.h> #include <Kaleidoscope-LED-AlphaSquare.h>
#include <Kaleidoscope-Macros.h> #include <Kaleidoscope-Macros.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -40,7 +40,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
) )
// *INDENT-ON* // clang-format on
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (!keyToggledOn(event.state)) if (!keyToggledOn(event.state))
@ -57,12 +57,12 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
col = 10; col = 10;
for (uint8_t step = 0; step <= 0xf0; step += 8) { for (uint8_t step = 0; step <= 0xf0; step += 8) {
AlphaSquare.color = { step, step, step }; AlphaSquare.color = {step, step, step};
AlphaSquare.display({i, 0}, col); AlphaSquare.display({i, 0}, col);
delay(10); delay(10);
} }
for (uint8_t step = 0xff; step >= 8; step -= 8) { for (uint8_t step = 0xff; step >= 8; step -= 8) {
AlphaSquare.color = { step, step, step }; AlphaSquare.color = {step, step, step};
AlphaSquare.display({i, 0}, col); AlphaSquare.display({i, 0}, col);
delay(10); delay(10);
} }
@ -74,14 +74,14 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
delay(100); delay(100);
for (uint8_t step = 0; step <= 0xf0; step += 8) { 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, 2);
AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 10); AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 10);
delay(10); delay(10);
} }
for (uint8_t step = 0xff; step >= 8; step -= 8) { 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, 2);
AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 10); AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 10);
delay(10); delay(10);
@ -102,7 +102,7 @@ KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();
AlphaSquare.color = { 0xcb, 0xc0, 0xff }; AlphaSquare.color = {0xcb, 0xc0, 0xff};
} }
void loop() { void loop() {

@ -20,7 +20,7 @@
#include <Kaleidoscope-LEDEffect-Rainbow.h> #include <Kaleidoscope-LEDEffect-Rainbow.h>
#include <Kaleidoscope-Macros.h> #include <Kaleidoscope-Macros.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -40,7 +40,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
M(1)), M(1)),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
Macros, Macros,

@ -39,13 +39,11 @@ class TestLEDMode : public kaleidoscope::plugin::LEDMode {
uint16_t TestLEDMode::map_base_; uint16_t TestLEDMode::map_base_;
void void TestLEDMode::setup() {
TestLEDMode::setup() {
map_base_ = LEDPaletteTheme.reserveThemes(1); map_base_ = LEDPaletteTheme.reserveThemes(1);
} }
void void TestLEDMode::update(void) {
TestLEDMode::update(void) {
LEDPaletteTheme.updateHandler(map_base_, 0); LEDPaletteTheme.updateHandler(map_base_, 0);
} }
@ -54,11 +52,11 @@ TestLEDMode::onFocusEvent(const char *command) {
return LEDPaletteTheme.themeFocusEvent(command, PSTR("testLedMode.map"), map_base_, 1); return LEDPaletteTheme.themeFocusEvent(command, PSTR("testLedMode.map"), map_base_, 1);
} }
} } // namespace example
example::TestLEDMode TestLEDMode; example::TestLEDMode TestLEDMode;
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -78,7 +76,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(Focus, LEDPaletteTheme, TestLEDMode, EEPROMSettings); KALEIDOSCOPE_INIT_PLUGINS(Focus, LEDPaletteTheme, TestLEDMode, EEPROMSettings);

@ -19,7 +19,7 @@
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
#include <Kaleidoscope-LED-Stalker.h> #include <Kaleidoscope-LED-Stalker.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -39,7 +39,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
LEDOff, LEDOff,

@ -20,6 +20,7 @@
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
#include <Kaleidoscope-LED-Wavepool.h> #include <Kaleidoscope-LED-Wavepool.h>
// clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -46,12 +47,13 @@ KALEIDOSCOPE_INIT_PLUGINS(
LEDOff, LEDOff,
WavepoolEffect WavepoolEffect
); );
// clang-format on
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();
WavepoolEffect.idle_timeout = 5000; // 5 seconds WavepoolEffect.idle_timeout = 5000; // 5 seconds
WavepoolEffect.ripple_hue = WavepoolEffect.rainbow_hue; WavepoolEffect.ripple_hue = WavepoolEffect.rainbow_hue;
WavepoolEffect.activate(); WavepoolEffect.activate();
} }

@ -19,7 +19,7 @@
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
#include <Kaleidoscope-LEDEffect-BootGreeting.h> #include <Kaleidoscope-LEDEffect-BootGreeting.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -39,7 +39,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
BootGreetingEffect, BootGreetingEffect,

@ -19,7 +19,7 @@
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
#include <Kaleidoscope-LEDEffects.h> #include <Kaleidoscope-LEDEffects.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -39,7 +39,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
LEDOff, LEDOff,

@ -24,7 +24,7 @@
#include <Kaleidoscope-LEDEffect-Chase.h> #include <Kaleidoscope-LEDEffect-Chase.h>
#include <Kaleidoscope-PersistentLEDMode.h> #include <Kaleidoscope-PersistentLEDMode.h>
// *INDENT-OFF* // clang-format off
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
@ -44,7 +44,7 @@ KEYMAPS(
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
) )
// *INDENT-ON* // clang-format on
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
EEPROMSettings, EEPROMSettings,

Loading…
Cancel
Save