diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..54e20335 --- /dev/null +++ b/.clang-format @@ -0,0 +1,47 @@ +# -*- mode: yaml -*- +--- +BasedOnStyle: Google +--- +Language: Cpp + +AlignConsecutiveAssignments: Consecutive +## clang-format-15 +# AlignConsecutiveAssignments: +# Enabled: true +# AlignCompound: true +# PadOperators: true +AlignConsecutiveDeclarations: None +AlignConsecutiveMacros: AcrossEmptyLines +AlignEscapedNewlines: Right +AllowShortBlocksOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortFunctionsOnASingleLine: Inline +AllowShortLoopsOnASingleLine: true +AttributeMacros: + - __attribute__((weak)) + - __attribute__((always_inline)) + - __attribute__((noinline)) + - __attribute__((packed)) + - __attribute__((optimize(3))) + - __attribute__((unused)) +BinPackArguments: false +BinPackParameters: false +# BraceWrapping: +# SplitEmptyFunction: false +# SplitEmptyRecord: true +# SplitEmptyNamespace: true +# BreakBeforeBraces: Custom +ColumnLimit: 0 +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 2 +DerivePointerAlignment: false +FixNamespaceComments: true +IndentCaseLabels: false +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 2 +# PackConstructorInitializers: CurrentLine +PointerAlignment: Right +# ReferenceAlignment: Right +ReflowComments: false +SortIncludes: false +SpaceAfterTemplateKeyword: false diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1a23b8a..37905e72 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,7 @@ env: LC_ALL: C KALEIDOSCOPE_CCACHE: 1 ARDUINO_DIRECTORIES_USER: ${{ github.workspace }}/.arduino/user + CLANG_FORMAT_CMD: clang-format-12 jobs: smoke-sketches: runs-on: ubuntu-latest @@ -25,12 +26,11 @@ jobs: - run: sudo apt-get install ccache - run: make setup - run: make -j $(nproc) simulator-tests - check-astyle: + check-formatting: runs-on: ubuntu-latest steps: - - run: sudo apt-get install astyle - uses: actions/checkout@v2 - - run: make check-astyle + - run: make check-formatting check-shellcheck: runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index 2ef20932..c940d834 100644 --- a/Makefile +++ b/Makefile @@ -88,17 +88,13 @@ adjust-git-timestamps: find-filename-conflicts: bin/find-filename-conflicts -.PHONY: astyle test 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 -astyle: - find ./* -type f \( -name '*.h' -o -name '*.cpp' -o -name '*.ino' \) | grep -v "testing/googletest" | xargs -n 1 astyle --project +format: + bin/format-code.sh -check-astyle: astyle - if ! git diff --exit-code; then \ - >&2 echo "'astyle' found code style differences. Please make astyle and commit your changes"; \ - exit 1; \ - fi; \ - exit 0; +check-formatting: + bin/format-code.sh --check 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.sh b/bin/format-code.sh new file mode 100755 index 00000000..e81dda2e --- /dev/null +++ b/bin/format-code.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Allow the caller to specify a particular version of clang-format to use: +: "${CLANG_FORMAT_CMD:=clang-format}" + +# 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 + +# 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 < // for uint8_t, uint16_t +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddrEventQueue.h" // for KeyAddrEventQueue #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -63,16 +63,17 @@ class AutoShift : public Plugin { uint8_t raw_bits_{0}; // constants for bits in the `raw_bits_` bitfield - static constexpr uint8_t LETTERS = 1 << 0; - static constexpr uint8_t NUMBERS = 1 << 1; - static constexpr uint8_t SYMBOLS = 1 << 2; - static constexpr uint8_t ARROWS = 1 << 3; - static constexpr uint8_t FUNCTIONS = 1 << 4; - static constexpr uint8_t ALL = 1 << 7; + static constexpr uint8_t LETTERS = 1 << 0; + static constexpr uint8_t NUMBERS = 1 << 1; + static constexpr uint8_t SYMBOLS = 1 << 2; + static constexpr uint8_t ARROWS = 1 << 3; + static constexpr uint8_t FUNCTIONS = 1 << 4; + static constexpr uint8_t ALL = 1 << 7; public: // Basic un-checked constructor - constexpr Categories(uint8_t raw_bits) : raw_bits_(raw_bits) {} + constexpr Categories(uint8_t raw_bits) + : raw_bits_(raw_bits) {} static constexpr Categories letterKeys() { return Categories(LETTERS); @@ -276,8 +277,8 @@ class AutoShiftConfig : public Plugin { static uint16_t settings_base_; }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope extern kaleidoscope::plugin::AutoShift AutoShift; extern kaleidoscope::plugin::AutoShiftConfig AutoShiftConfig; diff --git a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp index ac2b7085..d59309f1 100644 --- a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp +++ b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/AutoShift.h" // IWYU pragma: associated -#include // for PSTR, strcmp_P, str... -#include // for EEPROMSettings -#include // for Focus, FocusSerial -#include // for uint16_t, uint8_t +#include // for PSTR, strcmp_P, str... +#include // for EEPROMSettings +#include // for Focus, FocusSerial +#include // for uint16_t, uint8_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/Base.h" // for Base<>::Storage @@ -118,7 +118,7 @@ EventHandlerResult AutoShiftConfig::onFocusEvent(const char *command) { return EventHandlerResult::EVENT_CONSUMED; } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::AutoShiftConfig AutoShiftConfig; diff --git a/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.cpp b/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.cpp index 245062d9..207a160c 100644 --- a/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.cpp +++ b/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.cpp @@ -17,9 +17,9 @@ #include "kaleidoscope/plugin/CharShift.h" -#include // for F, __FlashS... -#include // for Focus, Focu... -#include // for CS_FIRST +#include // for F, __FlashS... +#include // for Focus, Focu... +#include // for CS_FIRST #include "kaleidoscope/KeyAddrMap.h" // for KeyAddrMap<... #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -38,7 +38,7 @@ namespace plugin { // ============================================================================= // CharShift class variables -CharShift::KeyPair const * CharShift::progmem_keypairs_{nullptr}; +CharShift::KeyPair const *CharShift::progmem_keypairs_{nullptr}; uint8_t CharShift::num_keypairs_{0}; bool CharShift::reverse_shift_state_{false}; @@ -131,13 +131,15 @@ CharShift::KeyPair CharShift::decodeCharShiftKey(Key key) { // This should be overridden if the KeyPairs array is stored in EEPROM __attribute__((weak)) -uint8_t CharShift::numKeyPairs() { +uint8_t +CharShift::numKeyPairs() { return numProgmemKeyPairs(); } // This should be overridden if the KeyPairs array is stored in EEPROM __attribute__((weak)) -CharShift::KeyPair CharShift::readKeyPair(uint8_t n) { +CharShift::KeyPair +CharShift::readKeyPair(uint8_t n) { return readKeyPairFromProgmem(n); } @@ -149,7 +151,7 @@ CharShift::KeyPair CharShift::readKeyPairFromProgmem(uint8_t n) { return cloneFromProgmem(progmem_keypairs_[n]); } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::CharShift CharShift; diff --git a/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.h b/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.h index b62cfcda..01601d76 100644 --- a/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.h +++ b/plugins/Kaleidoscope-CharShift/src/kaleidoscope/plugin/CharShift.h @@ -17,8 +17,8 @@ #pragma once -#include // for CS_FIRST -#include // for uint8_t +#include // for CS_FIRST +#include // for uint8_t #include "Arduino.h" // for PROGMEM #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -59,7 +59,8 @@ class CharShift : public Plugin { /// /// This constructor is used when defining an array of `KeyPair` objects in /// PROGMEM (though it can also be used elsewhere). - constexpr KeyPair(Key lower, Key upper) : lower(lower), upper(upper) {} + constexpr KeyPair(Key lower, Key upper) + : lower(lower), upper(upper) {} /// Constructor for reading from PROGMEM /// @@ -75,15 +76,15 @@ class CharShift : public Plugin { /// `keypairs` array given, which must be a fixed-sized array, not a pointer. /// Generally, it will be called via the `KEYPAIRS()` preprocessor macro, not /// directly by user code. - template - static void setProgmemKeyPairs(KeyPair const(&keypairs)[_num_keypairs]) { + template + static void setProgmemKeyPairs(KeyPair const (&keypairs)[_num_keypairs]) { progmem_keypairs_ = keypairs; - num_keypairs_ = _num_keypairs; + num_keypairs_ = _num_keypairs; } private: // A pointer to an array of `KeyPair` objects in PROGMEM - static KeyPair const * progmem_keypairs_; + static KeyPair const *progmem_keypairs_; // The size of the PROGMEM array of `KeyPair` objects static uint8_t num_keypairs_; @@ -114,8 +115,8 @@ class CharShift : public Plugin { static KeyPair readKeyPairFromProgmem(uint8_t n); }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope extern kaleidoscope::plugin::CharShift CharShift; @@ -125,12 +126,12 @@ extern kaleidoscope::plugin::CharShift CharShift; /// defines them as an array in PROGMEM, and configures `CharShift` to use that /// array, automatically setting the count correctly to prevent out-of-bounds /// lookups. -#define CS_KEYS(keypairs...) { \ +#define CS_KEYS(keypairs...) \ + { \ static kaleidoscope::plugin::CharShift::KeyPair const kp_table[] PROGMEM = { \ - keypairs \ - }; \ - CharShift.setProgmemKeyPairs(kp_table); \ -} + keypairs}; \ + CharShift.setProgmemKeyPairs(kp_table); \ + } /// Define an `KeyPair` entry in a keymap /// diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp index 1426572e..5d565210 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/Colormap.h" -#include // for F, PSTR, __FlashStrin... -#include // for Focus, FocusSerial -#include // for LEDPaletteTheme -#include // for uint8_t, uint16_t +#include // for F, PSTR, __FlashStrin... +#include // for Focus, FocusSerial +#include // for LEDPaletteTheme +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ @@ -40,7 +40,7 @@ void ColormapEffect::max_layers(uint8_t max_) { return; max_layers_ = max_; - map_base_ = ::LEDPaletteTheme.reserveThemes(max_layers_); + map_base_ = ::LEDPaletteTheme.reserveThemes(max_layers_); } EventHandlerResult ColormapEffect::onNameQuery() { @@ -68,8 +68,7 @@ EventHandlerResult ColormapEffect::onLayerChange() { } EventHandlerResult ColormapEffect::onFocusEvent(const char *command) { - return ::LEDPaletteTheme.themeFocusEvent(command, PSTR("colormap.map"), - map_base_, max_layers_); + return ::LEDPaletteTheme.themeFocusEvent(command, PSTR("colormap.map"), map_base_, max_layers_); } } // namespace plugin diff --git a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h index 6075a870..7e47877e 100644 --- a/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h +++ b/plugins/Kaleidoscope-Colormap/src/kaleidoscope/plugin/Colormap.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint8_t, uin... +#include // for uint8_t, uin... #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/event_handler_result.h" // for EventHandler... @@ -29,8 +29,8 @@ namespace kaleidoscope { namespace plugin { class ColormapEffect : public Plugin, - public LEDModeInterface, - public AccessTransientLEDMode { + public LEDModeInterface, + public AccessTransientLEDMode { public: ColormapEffect(void) {} @@ -44,21 +44,20 @@ class ColormapEffect : public Plugin, // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. // - explicit TransientLEDMode(const ColormapEffect *parent) : parent_(parent) {} + explicit TransientLEDMode(const ColormapEffect *parent) + : parent_(parent) {} protected: - friend class ColormapEffect; void onActivate(void) final; void refreshAt(KeyAddr key_addr) final; - private: + private: const ColormapEffect *parent_; }; diff --git a/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp b/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp index c6444b1d..bb553e82 100644 --- a/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp +++ b/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/Cycle.h" -#include // for F, __FlashStringHelper -#include // for Focus, FocusSerial -#include // for CYCLE -#include // for uint8_t +#include // for F, __FlashStringHelper +#include // for Focus, FocusSerial +#include // for CYCLE +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr, MatrixAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -113,8 +113,7 @@ uint8_t Cycle::toModFlag(uint8_t keyCode) { } // namespace plugin } // namespace kaleidoscope -__attribute__((weak)) -void cycleAction(Key previous_key, uint8_t cycle_count) { +__attribute__((weak)) void cycleAction(Key previous_key, uint8_t cycle_count) { } kaleidoscope::plugin::Cycle Cycle; diff --git a/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.h b/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.h index d7eb6eb8..5a70b6a9 100644 --- a/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.h +++ b/plugins/Kaleidoscope-Cycle/src/kaleidoscope/plugin/Cycle.h @@ -17,8 +17,8 @@ #pragma once -#include // for CYCLE -#include // for uint8_t +#include // for CYCLE +#include // for uint8_t #include "Arduino.h" // for PROGMEM #include "kaleidoscope/KeyAddr.h" // for KeyAddr @@ -29,10 +29,10 @@ constexpr Key Key_Cycle = Key(kaleidoscope::ranges::CYCLE); -#define cycleThrough(...) ({ \ - static const Key __k[] PROGMEM = { __VA_ARGS__ }; \ - Cycle.replace(sizeof(__k) / sizeof(Key), &__k[0]); \ - }) +#define cycleThrough(...) ({ \ + static const Key __k[] PROGMEM = {__VA_ARGS__}; \ + Cycle.replace(sizeof(__k) / sizeof(Key), &__k[0]); \ +}) namespace kaleidoscope { namespace plugin { diff --git a/plugins/Kaleidoscope-CycleTimeReport/src/kaleidoscope/plugin/CycleTimeReport.cpp b/plugins/Kaleidoscope-CycleTimeReport/src/kaleidoscope/plugin/CycleTimeReport.cpp index f674477c..443d45fc 100644 --- a/plugins/Kaleidoscope-CycleTimeReport/src/kaleidoscope/plugin/CycleTimeReport.cpp +++ b/plugins/Kaleidoscope-CycleTimeReport/src/kaleidoscope/plugin/CycleTimeReport.cpp @@ -17,9 +17,9 @@ #include "kaleidoscope/plugin/CycleTimeReport.h" -#include // for micros, F, __FlashStr... -#include // for Focus, FocusSerial -#include // for uint16_t, uint32_t +#include // for micros, F, __FlashStr... +#include // for Focus, FocusSerial +#include // for uint16_t, uint32_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -62,8 +62,7 @@ EventHandlerResult CycleTimeReport::afterEachCycle() { } // namespace kaleidoscope __attribute__((weak)) void cycleTimeReport(void) { - Focus.send(Focus.COMMENT, F("average loop time:"), CycleTimeReport.average_loop_time, - Focus.NEWLINE); + Focus.send(Focus.COMMENT, F("average loop time:"), CycleTimeReport.average_loop_time, Focus.NEWLINE); } kaleidoscope::plugin::CycleTimeReport CycleTimeReport; diff --git a/plugins/Kaleidoscope-CycleTimeReport/src/kaleidoscope/plugin/CycleTimeReport.h b/plugins/Kaleidoscope-CycleTimeReport/src/kaleidoscope/plugin/CycleTimeReport.h index 48f57a2a..5b70dd4d 100644 --- a/plugins/Kaleidoscope-CycleTimeReport/src/kaleidoscope/plugin/CycleTimeReport.h +++ b/plugins/Kaleidoscope-CycleTimeReport/src/kaleidoscope/plugin/CycleTimeReport.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint32_t, uint16_t +#include // for uint32_t, uint16_t #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/plugin.h" // for Plugin diff --git a/plugins/Kaleidoscope-Devel-ArduinoTrace/src/ArduinoTrace.h b/plugins/Kaleidoscope-Devel-ArduinoTrace/src/ArduinoTrace.h index 611dd9c1..00edd99c 100644 --- a/plugins/Kaleidoscope-Devel-ArduinoTrace/src/ArduinoTrace.h +++ b/plugins/Kaleidoscope-Devel-ArduinoTrace/src/ArduinoTrace.h @@ -57,7 +57,7 @@ constexpr size_t strlen(const char *str) { return str[0] ? strlen(str + 1) + 1 : 0; } -template +template struct string { #if ARDUINOTRACE_ENABLE_PROGMEM const __FlashStringHelper *data() { @@ -72,52 +72,47 @@ struct string { #endif }; -template +template struct string_maker { using result = - typename string_maker < TSourceString, remainingLength - 1, - TSourceString::data()[remainingLength - 1], - collectedChars... >::result; + typename string_maker::result; }; #if ARDUINOTRACE_ENABLE_FULLPATH == 0 -template +template struct string_maker { using result = string; }; -template +template struct string_maker { using result = string; }; #endif -template +template struct string_maker { using result = string; }; -template +template using make_string = typename string_maker::result; struct Initializer { - template + template Initializer(TSerial &serial, int bauds) { serial.begin(bauds); while (!serial) continue; } }; -template +template struct Printer { - template + template Printer(TSerial &serial, const TValue &content) { - serial.print(make_string {}.data()); - serial.print(make_string {}.data()); + serial.print(make_string{}.data()); + serial.print(make_string{}.data()); serial.println(content); serial.flush(); } @@ -154,7 +149,7 @@ struct Printer { #define ARDUINOTRACE_INITIALIZE(id, bauds) \ ArduinoTrace::Initializer ARDUINOTRACE_CONCAT(__initializer, id)( \ - ARDUINOTRACE_SERIAL, bauds); + ARDUINOTRACE_SERIAL, bauds); #define ARDUINOTRACE_TRACE_PREFIX(line) ":" ARDUINOTRACE_STRINGIFY(line) ": " @@ -172,19 +167,16 @@ struct Printer { // Call this macro anywhere, including at global scope. // However, if you use it at global scope, you need to call ARDUINOTRACE_INIT() // first, otherwise, the Serial port will not be ready. -#define TRACE() \ - ARDUINOTRACE_PRINT(__COUNTER__, __FILE__, \ - ARDUINOTRACE_TRACE_PREFIX(__LINE__), \ - ARDUINOTRACE_FUNCTION_NAME) +#define TRACE() \ + ARDUINOTRACE_PRINT(__COUNTER__, __FILE__, ARDUINOTRACE_TRACE_PREFIX(__LINE__), ARDUINOTRACE_FUNCTION_NAME) // Prints the value of a variable. // // This function will print the name and the value of the variable to the // Serial. If you use it at global scope, you need to call ARDUINOTRACE_INIT() // first, otherwise, the Serial port will not be ready. -#define DUMP(variable) \ - ARDUINOTRACE_PRINT(__COUNTER__, __FILE__, \ - ARDUINOTRACE_DUMP_PREFIX(__LINE__, variable), variable) +#define DUMP(variable) \ + ARDUINOTRACE_PRINT(__COUNTER__, __FILE__, ARDUINOTRACE_DUMP_PREFIX(__LINE__, variable), variable) #else // ie ARDUINOTRACE_ENABLE == 0 diff --git a/plugins/Kaleidoscope-DynamicMacros/src/Kaleidoscope-DynamicMacros.h b/plugins/Kaleidoscope-DynamicMacros/src/Kaleidoscope-DynamicMacros.h index 05cd26b0..e86ca280 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/Kaleidoscope-DynamicMacros.h +++ b/plugins/Kaleidoscope-DynamicMacros/src/Kaleidoscope-DynamicMacros.h @@ -16,6 +16,6 @@ #pragma once -#include // IWYU pragma: keep +#include // IWYU pragma: keep #include "kaleidoscope/plugin/DynamicMacros.h" // IWYU pragma: export diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp index 2a24f730..28230a44 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp @@ -16,16 +16,16 @@ #include "kaleidoscope/plugin/DynamicMacros.h" -#include // for delay, PSTR, strc... -#include // for Focus, FocusSerial -#include // for DYNAMIC_MACRO_FIRST +#include // for delay, PSTR, strc... +#include // for Focus, FocusSerial +#include // for DYNAMIC_MACRO_FIRST -#include "kaleidoscope/KeyAddr.h" // for KeyAddr -#include "kaleidoscope/KeyEvent.h" // for KeyEvent -#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ -#include "kaleidoscope/device/device.h" // for VirtualProps::Sto... -#include "kaleidoscope/keyswitch_state.h" // for INJECTED, IS_PRESSED -#include "kaleidoscope/plugin/EEPROM-Settings.h" // for EEPROMSettings +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ +#include "kaleidoscope/device/device.h" // for VirtualProps::Sto... +#include "kaleidoscope/keyswitch_state.h" // for INJECTED, IS_PRESSED +#include "kaleidoscope/plugin/EEPROM-Settings.h" // for EEPROMSettings // This is a special exception to the rule of only including a plugin's // top-level header file, because DynamicMacros doesn't depend on the Macros @@ -67,9 +67,9 @@ void DynamicMacros::tap(Key key) { } void DynamicMacros::updateDynamicMacroCache() { - uint16_t pos = storage_base_; - uint8_t current_id = 0; - macro_t macro = MACRO_ACTION_END; + uint16_t pos = storage_base_; + uint8_t current_id = 0; + macro_t macro = MACRO_ACTION_END; bool previous_macro_ended = false; map_[0] = 0; @@ -103,7 +103,7 @@ void DynamicMacros::updateDynamicMacroCache() { previous_macro_ended = false; uint8_t keyCode, flags; do { - flags = Runtime.storage().read(pos++); + flags = Runtime.storage().read(pos++); keyCode = Runtime.storage().read(pos++); } while (!(flags == 0 && keyCode == 0)); break; @@ -132,7 +132,7 @@ void DynamicMacros::updateDynamicMacroCache() { // public void DynamicMacros::play(uint8_t macro_id) { - macro_t macro = MACRO_ACTION_END; + macro_t macro = MACRO_ACTION_END; uint8_t interval = 0; uint16_t pos; Key key; @@ -289,7 +289,7 @@ void DynamicMacros::reserve_storage(uint16_t size) { updateDynamicMacroCache(); } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::DynamicMacros DynamicMacros; diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h index ead0b83f..93a0a2af 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.h @@ -16,15 +16,15 @@ #pragma once -#include // for DYNAMIC_MACRO_FIRST -#include // for uint16_t, uint8_t +#include // for DYNAMIC_MACRO_FIRST +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/key_defs.h" // for Key #include "kaleidoscope/plugin.h" // for Plugin -#define DM(n) ::kaleidoscope::plugin::DynamicMacrosKey(n) +#define DM(n) ::kaleidoscope::plugin::DynamicMacrosKey(n) #define MAX_CONCURRENT_DYNAMIC_MACRO_KEYS 8 @@ -56,7 +56,7 @@ class DynamicMacros : public kaleidoscope::Plugin { static void tap(Key key); }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope extern kaleidoscope::plugin::DynamicMacros DynamicMacros; diff --git a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp index a79e9fd5..13675c0f 100644 --- a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp +++ b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/DynamicTapDance.h" -#include // for PSTR, F, __FlashStrin... -#include // for EEPROMSettings -#include // for Focus, FocusSerial -#include // for uint16_t, uint8_t +#include // for PSTR, F, __FlashStrin... +#include // for EEPROMSettings +#include // for Focus, FocusSerial +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -42,12 +42,12 @@ uint8_t DynamicTapDance::dance_count_; constexpr uint8_t DynamicTapDance::reserved_tap_dance_key_count_; void DynamicTapDance::updateDynamicTapDanceCache() { - uint16_t pos = storage_base_; - uint8_t current_id = 0; + uint16_t pos = storage_base_; + uint8_t current_id = 0; bool previous_dance_ended = false; dance_count_ = 0; - map_[0] = 0; + map_[0] = 0; while (pos < storage_base_ + storage_size_) { uint16_t raw_key = Runtime.storage().read(pos); @@ -68,9 +68,8 @@ void DynamicTapDance::updateDynamicTapDanceCache() { } } -bool DynamicTapDance::dance(uint8_t tap_dance_index, KeyAddr key_addr, - uint8_t tap_count, TapDance::ActionType tap_dance_action) { - uint16_t pos = map_[tap_dance_index - offset_] + ((tap_count - 1) * 2); +bool DynamicTapDance::dance(uint8_t tap_dance_index, KeyAddr key_addr, uint8_t tap_count, TapDance::ActionType tap_dance_action) { + uint16_t pos = map_[tap_dance_index - offset_] + ((tap_count - 1) * 2); uint16_t next_pos = map_[tap_dance_index - offset_ + 1]; if (next_pos <= pos || (tap_dance_index > offset_ + dance_count_)) return false; @@ -136,7 +135,7 @@ EventHandlerResult DynamicTapDance::onFocusEvent(const char *command) { void DynamicTapDance::setup(uint8_t dynamic_offset, uint16_t size) { storage_base_ = ::EEPROMSettings.requestSlice(size); storage_size_ = size; - offset_ = dynamic_offset; + offset_ = dynamic_offset; updateDynamicTapDanceCache(); } diff --git a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h index 2dde39b8..0d8147d6 100644 --- a/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h +++ b/plugins/Kaleidoscope-DynamicTapDance/src/kaleidoscope/plugin/DynamicTapDance.h @@ -17,9 +17,9 @@ #pragma once -#include // for TD_FIRST, TD_LAST -#include // for TapDance, TapDance::A... -#include // for uint8_t, uint16_t +#include // for TD_FIRST, TD_LAST +#include // for TapDance, TapDance::A... +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -28,7 +28,7 @@ namespace kaleidoscope { namespace plugin { -class DynamicTapDance: public kaleidoscope::Plugin { +class DynamicTapDance : public kaleidoscope::Plugin { public: DynamicTapDance() {} @@ -37,8 +37,7 @@ class DynamicTapDance: public kaleidoscope::Plugin { static void setup(uint8_t dynamic_offset, uint16_t size); - static bool dance(uint8_t tap_dance_index, KeyAddr key_addr, uint8_t tap_count, - TapDance::ActionType tap_dance_action); + static bool dance(uint8_t tap_dance_index, KeyAddr key_addr, uint8_t tap_count, TapDance::ActionType tap_dance_action); private: static uint16_t storage_base_; diff --git a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp index 0cb831ce..ea993e70 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp +++ b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/EEPROM-Keymap-Programmer.h" -#include // for PSTR, strcmp_P -#include // for EEPROMKeymap -#include // for Focus, FocusSerial -#include // for uint16_t, uint8_t +#include // for PSTR, strcmp_P +#include // for EEPROMKeymap +#include // for Focus, FocusSerial +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -60,8 +60,8 @@ void EEPROMKeymapProgrammer::nextState(void) { void EEPROMKeymapProgrammer::cancel(void) { update_position_ = 0; - new_key_ = Key_NoKey; - state_ = INACTIVE; + new_key_ = Key_NoKey; + state_ = INACTIVE; } EventHandlerResult EEPROMKeymapProgrammer::onKeyEvent(KeyEvent &event) { diff --git a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h index 84b726fb..d178b4bf 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h +++ b/plugins/Kaleidoscope-EEPROM-Keymap-Programmer/src/kaleidoscope/plugin/EEPROM-Keymap-Programmer.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult diff --git a/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp b/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp index 3849cd1d..1493b0dc 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp +++ b/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/EEPROM-Keymap.h" -#include // for PSTR, strcmp_P, F -#include // for EEPROMSettings -#include // for Focus, FocusSerial -#include // for uint8_t, uint16_t +#include // for PSTR, strcmp_P, F +#include // for EEPROMSettings +#include // for Focus, FocusSerial +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr, MatrixAddr #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ @@ -57,7 +57,7 @@ void EEPROMKeymap::setup(uint8_t max) { } void EEPROMKeymap::max_layers(uint8_t max) { - max_layers_ = max; + max_layers_ = max; keymap_base_ = ::EEPROMSettings.requestSlice(max_layers_ * Runtime.device().numKeys() * 2); } @@ -67,8 +67,8 @@ Key EEPROMKeymap::getKey(uint8_t layer, KeyAddr key_addr) { uint16_t pos = ((layer * Runtime.device().numKeys()) + key_addr.toInt()) * 2; - return Key(Runtime.storage().read(keymap_base_ + pos + 1), // key_code - Runtime.storage().read(keymap_base_ + pos)); // flags + return Key(Runtime.storage().read(keymap_base_ + pos + 1), // key_code + Runtime.storage().read(keymap_base_ + pos)); // flags } Key EEPROMKeymap::getKeyExtended(uint8_t layer, KeyAddr key_addr) { @@ -91,7 +91,7 @@ void EEPROMKeymap::updateKey(uint16_t base_pos, Key key) { Runtime.storage().update(keymap_base_ + base_pos * 2 + 1, key.getKeyCode()); } -void EEPROMKeymap::dumpKeymap(uint8_t layers, Key(*getkey)(uint8_t, KeyAddr)) { +void EEPROMKeymap::dumpKeymap(uint8_t layers, Key (*getkey)(uint8_t, KeyAddr)) { for (uint8_t layer = 0; layer < layers; layer++) { for (auto key_addr : KeyAddr::all()) { Key k = (*getkey)(layer, key_addr); @@ -134,7 +134,7 @@ EventHandlerResult EEPROMKeymap::onFocusEvent(const char *command) { // we actully want. // dumpKeymap(progmem_layers_, - static_cast(Layer_::getKeyFromPROGMEM)); + static_cast(Layer_::getKeyFromPROGMEM)); return EventHandlerResult::EVENT_CONSUMED; } @@ -146,7 +146,7 @@ EventHandlerResult EEPROMKeymap::onFocusEvent(const char *command) { // tell the compiler which overload of getKey // we actually want. // - dumpKeymap(max_layers_, static_cast(getKey)); + dumpKeymap(max_layers_, static_cast(getKey)); } else { uint16_t i = 0; diff --git a/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.h b/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.h index 6239a2a6..070d6f57 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.h +++ b/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint8_t, uint16_t +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -57,7 +57,7 @@ class EEPROMKeymap : public kaleidoscope::Plugin { static Key parseKey(void); static void printKey(Key key); - static void dumpKeymap(uint8_t layers, Key(*getkey)(uint8_t, KeyAddr)); + static void dumpKeymap(uint8_t layers, Key (*getkey)(uint8_t, KeyAddr)); }; } // namespace plugin diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp index 5e57263f..a8aef233 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp @@ -17,9 +17,9 @@ #include "kaleidoscope/plugin/EEPROM-Settings.h" -#include // for PSTR, strcmp_P, F -#include // for Focus, FocusSerial -#include // for uint16_t, uint8_t +#include // for PSTR, strcmp_P, F +#include // for Focus, FocusSerial +#include // for uint16_t, uint8_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for VirtualProps::S... @@ -47,7 +47,7 @@ EventHandlerResult EEPROMSettings::onSetup() { uninitialized state, we do not override them, to avoid overwriting user settings. */ settings_.ignore_hardcoded_layers = false; - settings_.default_layer = 0; + settings_.default_layer = 0; } /* If the version is undefined, we'll set it to our current one. */ diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h index 9235b3fc..481a601e 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint8_t, uint16_t +#include // for uint8_t, uint16_t #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/plugin.h" // for Plugin @@ -74,8 +74,8 @@ class EEPROMSettings : public kaleidoscope::Plugin { static bool sealed_; static struct settings { - uint8_t default_layer: 7; - bool ignore_hardcoded_layers: 1; + uint8_t default_layer : 7; + bool ignore_hardcoded_layers : 1; uint8_t version; uint16_t crc; } settings_; diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings/crc.cpp b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings/crc.cpp index 6201ed09..a603ba2e 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings/crc.cpp +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings/crc.cpp @@ -28,8 +28,7 @@ #include "crc.h" -void -CRC_::reflect(uint8_t len) { +void CRC_::reflect(uint8_t len) { uint8_t i; uint16_t newCRC; @@ -42,8 +41,7 @@ CRC_::reflect(uint8_t len) { crc = newCRC; } -void -CRC_::update(const void *data, uint8_t len) { +void CRC_::update(const void *data, uint8_t len) { const uint8_t *d = (const uint8_t *)data; uint8_t i; bool bit; diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings/crc.h b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings/crc.h index baaa8c1f..bc193109 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings/crc.h +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings/crc.h @@ -34,7 +34,7 @@ class CRC_ { public: uint16_t crc = 0; - CRC_(void) {}; + CRC_(void){}; void update(const void *data, uint8_t len); void finalize(void) { diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp index 59a29b61..c920ca4b 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/Escape-OneShot.h" // IWYU pragma: associated -#include // for PSTR, F, __FlashStrin... -#include // for EEPROMSettings -#include // for Focus, FocusSerial -#include // for uint16_t +#include // for PSTR, F, __FlashStrin... +#include // for EEPROMSettings +#include // for Focus, FocusSerial +#include // for uint16_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for VirtualProps::Storage @@ -71,7 +71,7 @@ EventHandlerResult EscapeOneShotConfig::onFocusEvent(const char *command) { return EventHandlerResult::EVENT_CONSUMED; } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::EscapeOneShotConfig EscapeOneShotConfig; diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp index f50fa272..02d5e8dc 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp @@ -17,7 +17,7 @@ #include "kaleidoscope/plugin/Escape-OneShot.h" -#include // for OneShot +#include // for OneShot #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -28,8 +28,7 @@ namespace kaleidoscope { namespace plugin { EscapeOneShot::Settings EscapeOneShot::settings_ = { - .cancel_oneshot_key = Key_Escape -}; + .cancel_oneshot_key = Key_Escape}; EventHandlerResult EscapeOneShot::onKeyEvent(KeyEvent &event) { // We only act on an escape key (or `cancel_oneshot_key_`, if that has been diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h index 3f192008..e4ea77f8 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h @@ -17,8 +17,8 @@ #pragma once -#include // for OS_CANCEL -#include // for uint16_t +#include // for OS_CANCEL +#include // for uint16_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -27,8 +27,8 @@ // DEPRECATED: `OneShotCancelKey` doesn't match our normal naming, and should // eventually be removed. -constexpr Key OneShotCancelKey {kaleidoscope::ranges::OS_CANCEL}; -constexpr Key Key_OneShotCancel {kaleidoscope::ranges::OS_CANCEL}; +constexpr Key OneShotCancelKey{kaleidoscope::ranges::OS_CANCEL}; +constexpr Key Key_OneShotCancel{kaleidoscope::ranges::OS_CANCEL}; namespace kaleidoscope { namespace plugin { diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp index 0c76c34d..c3399846 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp @@ -17,11 +17,11 @@ #include "kaleidoscope/plugin/FingerPainter.h" -#include // for PSTR, strcmp_P, F -#include // for Focus, FocusSerial -#include // for LEDPaletteTheme -#include // for uint16_t, uint8_t -#include // for memcmp +#include // for PSTR, strcmp_P, F +#include // for Focus, FocusSerial +#include // for LEDPaletteTheme +#include // for uint16_t, uint8_t +#include // for memcmp #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -71,8 +71,8 @@ EventHandlerResult FingerPainter::onKeyEvent(KeyEvent &event) { // TODO(anyone): The following works only for keyboards with LEDs for each key. uint8_t color_index = ::LEDPaletteTheme - .lookupColorIndexAtPosition(color_base_, - Runtime.device().getLedIndex(event.addr)); + .lookupColorIndexAtPosition(color_base_, + Runtime.device().getLedIndex(event.addr)); // Find the next color in the palette that is different. // But do not loop forever! diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h index 96c280ce..934133c9 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent diff --git a/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.h b/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.h index 39d25480..f1f2f3d0 100644 --- a/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.h +++ b/plugins/Kaleidoscope-FirmwareDump/src/kaleidoscope/plugin/FirmwareDump.h @@ -23,7 +23,7 @@ #ifdef __AVR__ -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/plugin.h" // for Plugin @@ -37,6 +37,7 @@ class FirmwareDump : public kaleidoscope::Plugin { EventHandlerResult onSetup(); EventHandlerResult onFocusEvent(const char *command); + private: uint16_t bootloader_size_; }; diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index d0413759..6551fd1f 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/FocusSerial.h" -#include // for __FlashStringHelper, F -#include // for HardwareSerial -#include // for uint8_t -#include // for memset +#include // for __FlashStringHelper, F +#include // for HardwareSerial +#include // for uint8_t +#include // for memset #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -44,10 +44,7 @@ EventHandlerResult FocusSerial::afterEachCycle() { do { command_[buf_cursor_++] = Runtime.serialPort().read(); - } while (command_[buf_cursor_ - 1] != SEPARATOR - && buf_cursor_ < sizeof(command_) - && Runtime.serialPort().available() - && (Runtime.serialPort().peek() != NEWLINE)); + } while (command_[buf_cursor_ - 1] != SEPARATOR && buf_cursor_ < sizeof(command_) && Runtime.serialPort().available() && (Runtime.serialPort().peek() != NEWLINE)); // If there was no command, there's nothing to do @@ -57,9 +54,7 @@ EventHandlerResult FocusSerial::afterEachCycle() { return EventHandlerResult::OK; } - if ((command_[buf_cursor_ - 1] != SEPARATOR) && (Runtime.serialPort().peek() != NEWLINE) - && buf_cursor_ < sizeof(command_) - ) { + if ((command_[buf_cursor_ - 1] != SEPARATOR) && (Runtime.serialPort().peek() != NEWLINE) && buf_cursor_ < sizeof(command_)) { // We don't have enough command to work with yet. // Let's leave the buffer around for another cycle return EventHandlerResult::OK; @@ -74,7 +69,7 @@ EventHandlerResult FocusSerial::afterEachCycle() { // Then process the command Runtime.onFocusEvent(command_); while (Runtime.serialPort().available()) { - char c = Runtime.serialPort().read(); + char c = Runtime.serialPort().read(); if (c == NEWLINE) { // newline serves as an end-of-command marker // don't drain the buffer past there @@ -86,7 +81,6 @@ EventHandlerResult FocusSerial::afterEachCycle() { buf_cursor_ = 0; memset(command_, 0, sizeof(command_)); return EventHandlerResult::OK; - } bool FocusSerial::handleHelp(const char *command, diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h index a4832991..7ffa91e7 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h @@ -17,9 +17,9 @@ #pragma once -#include // for __FlashStringHelper -#include // for HardwareSerial -#include // for uint8_t, uint16_t +#include // for __FlashStringHelper +#include // for HardwareSerial +#include // for uint8_t, uint16_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for cRGB @@ -33,9 +33,9 @@ class FocusSerial : public kaleidoscope::Plugin { public: FocusSerial(void) {} - static constexpr char COMMENT = '#'; + static constexpr char COMMENT = '#'; static constexpr char SEPARATOR = ' '; - static constexpr char NEWLINE = '\n'; + static constexpr char NEWLINE = '\n'; bool handleHelp(const char *command, const char *help_message); @@ -57,19 +57,19 @@ class FocusSerial : public kaleidoscope::Plugin { printBool(b); Runtime.serialPort().print(SEPARATOR); } - template + template void send(V v) { Runtime.serialPort().print(v); Runtime.serialPort().print(SEPARATOR); } - template + template void send(Var v, Vars... vars) { send(v); send(vars...); } void sendRaw() {} - template + template void sendRaw(Var v, Vars... vars) { Runtime.serialPort().print(v); sendRaw(vars...); diff --git a/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.cpp b/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.cpp index fe02d799..38cfba9a 100644 --- a/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.cpp +++ b/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.cpp @@ -17,7 +17,7 @@ #include "kaleidoscope/plugin/GhostInTheFirmware.h" -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -29,7 +29,7 @@ namespace kaleidoscope { namespace plugin { const GhostInTheFirmware::GhostKey *GhostInTheFirmware::ghost_keys; -bool GhostInTheFirmware::is_active_ = false; +bool GhostInTheFirmware::is_active_ = false; uint16_t GhostInTheFirmware::current_pos_ = 0; uint16_t GhostInTheFirmware::start_time_; @@ -53,9 +53,9 @@ EventHandlerResult GhostInTheFirmware::afterEachCycle() { // value (i.e. KeyAddr::none()). If we read this sentinel value, reset and // deactivate. if (!ghost_key.addr.isValid()) { - current_pos_ = 0; + current_pos_ = 0; ghost_key.delay = 0; - is_active_ = false; + is_active_ = false; return EventHandlerResult::OK; } // If we're not at the end of the sequence, send the first keypress event, diff --git a/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.h b/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.h index f3c911f8..b89817f7 100644 --- a/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.h +++ b/plugins/Kaleidoscope-GhostInTheFirmware/src/kaleidoscope/plugin/GhostInTheFirmware.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.cpp b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.cpp index 825428cf..9c7ba287 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.cpp +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.cpp @@ -28,13 +28,13 @@ #include "kaleidoscope/driver/keyscanner/Base_Impl.h" #include "kaleidoscope/util/crc16.h" -#define I2C_CLOCK_KHZ 100 -#define I2C_FLASH_CLOCK_KHZ 100 // flashing doesn't work reliably at higher clock speeds +#define I2C_CLOCK_KHZ 100 +#define I2C_FLASH_CLOCK_KHZ 100 // flashing doesn't work reliably at higher clock speeds -#define SIDE_POWER 1 // side power switch pa10 +#define SIDE_POWER 1 // side power switch pa10 -#define LAYOUT_ISO 0 -#define LAYOUT_ANSI 1 +#define LAYOUT_ISO 0 +#define LAYOUT_ANSI 1 namespace kaleidoscope { namespace device { @@ -148,7 +148,7 @@ void RaiseLEDDriver::setBrightness(uint8_t brightness) { RaiseHands::leftHand.setBrightness(brightness); RaiseHands::rightHand.setBrightness(brightness); for (uint8_t i = 0; i < LED_BANKS; i++) { - isLEDChangedLeft[i] = true; + isLEDChangedLeft[i] = true; isLEDChangedRight[i] = true; } } @@ -159,7 +159,7 @@ uint8_t RaiseLEDDriver::getBrightness() { void RaiseLEDDriver::syncLeds() { // left and right sides - for (uint8_t i = 0; i < LED_BANKS; i ++) { + for (uint8_t i = 0; i < LED_BANKS; i++) { // only send the banks that have changed - try to improve jitter performance if (isLEDChangedLeft[i]) { RaiseHands::leftHand.sendLEDBank(i); @@ -180,7 +180,7 @@ void RaiseLEDDriver::syncLeds() { void RaiseLEDDriver::updateNeuronLED() { static constexpr struct { uint8_t r, g, b; - } pins = { 3, 5, 4 }; + } pins = {3, 5, 4}; auto constexpr gamma8 = kaleidoscope::driver::color::gamma_correction; // invert as these are common anode, and make sure we reach 65535 to be able @@ -207,13 +207,13 @@ void RaiseLEDDriver::setCrgbAt(uint8_t i, cRGB crgb) { // get the SLED index uint8_t sled_num = led_map[RaiseHands::layout][i]; if (sled_num < LEDS_PER_HAND) { - cRGB oldColor = RaiseHands::leftHand.led_data.leds[sled_num]; + cRGB oldColor = RaiseHands::leftHand.led_data.leds[sled_num]; RaiseHands::leftHand.led_data.leds[sled_num] = crgb; isLEDChangedLeft[uint8_t(sled_num / 8)] |= !(oldColor.r == crgb.r && oldColor.g == crgb.g && oldColor.b == crgb.b); } else if (sled_num < 2 * LEDS_PER_HAND) { - cRGB oldColor = RaiseHands::rightHand.led_data.leds[sled_num - LEDS_PER_HAND]; + cRGB oldColor = RaiseHands::rightHand.led_data.leds[sled_num - LEDS_PER_HAND]; RaiseHands::rightHand.led_data.leds[sled_num - LEDS_PER_HAND] = crgb; isLEDChangedRight[uint8_t((sled_num - LEDS_PER_HAND) / 8)] |= !(oldColor.r == crgb.r && @@ -253,7 +253,7 @@ void RaiseLEDDriver::setup() { delay(10); RaiseHands::setSidePower(true); - delay(500); // wait for sides to power up and finish bootloader + delay(500); // wait for sides to power up and finish bootloader } /********* Key scanner *********/ @@ -266,7 +266,7 @@ bool RaiseKeyScanner::lastLeftOnline; bool RaiseKeyScanner::lastRightOnline; void RaiseKeyScanner::readMatrix() { - previousLeftHandState = leftHandState; + previousLeftHandState = leftHandState; previousRightHandState = rightHandState; if (RaiseHands::leftHand.readKeys()) { @@ -275,8 +275,8 @@ void RaiseKeyScanner::readMatrix() { if (RaiseHands::layout == LAYOUT_ANSI) { // only swap if bits are different if ((leftHandState.rows[3] & (1 << 0)) ^ leftHandState.rows[3] & (1 << 1)) { - leftHandState.rows[3] ^= (1 << 0); // flip the bit - leftHandState.rows[3] ^= (1 << 1); // flip the bit + leftHandState.rows[3] ^= (1 << 0); // flip the bit + leftHandState.rows[3] ^= (1 << 1); // flip the bit } } } @@ -305,7 +305,7 @@ void RaiseKeyScanner::readMatrix() { rightHandState.all = 0; // store previous state of whether the sides are plugged in - lastLeftOnline = RaiseHands::leftHand.online; + lastLeftOnline = RaiseHands::leftHand.online; lastRightOnline = RaiseHands::rightHand.online; } @@ -371,9 +371,11 @@ void RaiseKeyScanner::setKeyscanInterval(uint8_t interval) { } void RaiseKeyScanner::setup() { + // clang-format off static constexpr uint8_t keyscanner_pins[] = { - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 - }; + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + }; // clang-format on for (int i = 0; i < sizeof(keyscanner_pins); i++) { pinMode(keyscanner_pins[i], OUTPUT); digitalWrite(keyscanner_pins[i], LOW); @@ -381,7 +383,7 @@ void RaiseKeyScanner::setup() { } void RaiseKeyScanner::reset() { - leftHandState.all = 0; + leftHandState.all = 0; rightHandState.all = 0; Runtime.hid().keyboard().releaseAllKeys(); Runtime.hid().keyboard().sendReport(); diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h index eb6a8854..70cbadf3 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/Raise.h @@ -23,7 +23,8 @@ #include "kaleidoscope/device/dygma/raise/RaiseSide.h" -#define CRGB(r,g,b) (cRGB){b, g, r} +#define CRGB(r, g, b) \ + (cRGB) { b, g, r } #include "kaleidoscope/device/Base.h" #include "kaleidoscope/driver/bootloader/samd/Bossac.h" @@ -44,6 +45,7 @@ using kaleidoscope::driver::led::no_led; struct RaiseLEDDriverProps : public kaleidoscope::driver::led::BaseProps { static constexpr uint8_t led_count = 132; + // clang-format off static constexpr uint8_t key_led_map[] = { // ISO & ANSI (ANSI has no LED at 20, but this key can never be pressed so we can have just one map). 0, 1, 2, 3, 4, 5, 6, no_led, no_led, 6 + LHK, 5 + LHK, 4 + LHK, 3 + LHK, 2 + LHK, 1 + LHK, 0 + LHK, @@ -51,7 +53,7 @@ struct RaiseLEDDriverProps : public kaleidoscope::driver::led::BaseProps { 13, 14, 15, 16, 17, 18, no_led, no_led, no_led, 21 + LHK, 20 + LHK, 19 + LHK, 18 + LHK, 17 + LHK, 16 + LHK, 15 + LHK, 19, 20, 21, 22, 23, 24, 25, no_led, no_led, no_led, 27 + LHK, 26 + LHK, 25 + LHK, 24 + LHK, 23 + LHK, 22 + LHK, 26, 27, 28, 29, 30, no_led, 31, 32, 35 + LHK, 34 + LHK, 33 + LHK, 32 + LHK, 31 + LHK, 30 + LHK, 29 + LHK, 28 + LHK - }; + }; // clang-format on }; #undef LHK @@ -66,6 +68,7 @@ class RaiseLEDDriver : public kaleidoscope::driver::led::Base KeyAddr; - static constexpr uint8_t left_columns = 8; + static constexpr uint8_t left_columns = 8; static constexpr uint8_t right_columns = matrix_columns - left_columns; }; @@ -124,6 +128,7 @@ class RaiseKeyScanner : public kaleidoscope::driver::keyscanner::Base HID; - typedef RaiseLEDDriverProps LEDDriverProps; + typedef RaiseLEDDriverProps LEDDriverProps; typedef RaiseLEDDriver LEDDriver; typedef RaiseKeyScannerProps KeyScannerProps; typedef RaiseKeyScanner KeyScanner; @@ -172,9 +177,10 @@ struct RaiseProps : kaleidoscope::device::BaseProps { static constexpr const char *short_name = "raise"; }; -class Raise: public kaleidoscope::device::Base { +class Raise : public kaleidoscope::device::Base { private: static RaiseProps::SideFlasher SideFlasher; + public: static void setup(); @@ -206,7 +212,7 @@ class Raise: public kaleidoscope::device::Base { void prepareForFlash(); // Side bootloader addresses - static constexpr uint8_t left_boot_address = 0x50; + static constexpr uint8_t left_boot_address = 0x50; static constexpr uint8_t right_boot_address = 0x51; } side; @@ -230,6 +236,8 @@ typedef kaleidoscope::device::dygma::Raise Device; } // namespace kaleidoscope +// clang-format off + #define PER_KEY_DATA(dflt, \ r0c0, r0c1, r0c2, r0c3, r0c4, r0c5, r0c6, r0c9, r0c10, r0c11, r0c12, r0c13, r0c14, r0c15, \ r1c0, r1c1, r1c2, r1c3, r1c4, r1c5, r1c8, r1c9, r1c10, r1c11, r1c12, r1c13, r1c14, r1c15, \ diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/RaiseSide.cpp b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/RaiseSide.cpp index e854daac..df0d27bc 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/RaiseSide.cpp +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/RaiseSide.cpp @@ -29,42 +29,42 @@ namespace device { namespace dygma { namespace raise { -#define TWI_CMD_NONE 0x00 -#define TWI_CMD_VERSION 0x01 -#define TWI_CMD_KEYSCAN_INTERVAL 0x02 -#define TWI_CMD_LED_SET_ALL_TO 0x03 -#define TWI_CMD_LED_SET_ONE_TO 0x04 -#define TWI_CMD_COLS_USE_PULLUPS 0x05 -#define TWI_CMD_LED_SPI_FREQUENCY 0x06 +#define TWI_CMD_NONE 0x00 +#define TWI_CMD_VERSION 0x01 +#define TWI_CMD_KEYSCAN_INTERVAL 0x02 +#define TWI_CMD_LED_SET_ALL_TO 0x03 +#define TWI_CMD_LED_SET_ONE_TO 0x04 +#define TWI_CMD_COLS_USE_PULLUPS 0x05 +#define TWI_CMD_LED_SPI_FREQUENCY 0x06 #define TWI_CMD_LED_GLOBAL_BRIGHTNESS 0x07 -#define TWI_CMD_SLED_STATUS 0x08 -#define TWI_CMD_LED_OPEN 0x09 -#define TWI_CMD_LED_SHORT 0x0A -#define TWI_CMD_JOINED 0x0B -#define TWI_CMD_LAYOUT 0x0C -#define TWI_CMD_SLED_CURRENT 0x0D -#define TWI_CMD_SLED_SELF_TEST 0x0E - -#define LED_SPI_FREQUENCY_4MHZ 0x07 -#define LED_SPI_FREQUENCY_2MHZ 0x06 -#define LED_SPI_FREQUENCY_1MHZ 0x05 -#define LED_SPI_FREQUENCY_512KHZ 0x04 -#define LED_SPI_FREQUENCY_256KHZ 0x03 -#define LED_SPI_FREQUENCY_128KHZ 0x02 -#define LED_SPI_FREQUENCY_64KHZ 0x01 -#define LED_SPI_OFF 0x00 +#define TWI_CMD_SLED_STATUS 0x08 +#define TWI_CMD_LED_OPEN 0x09 +#define TWI_CMD_LED_SHORT 0x0A +#define TWI_CMD_JOINED 0x0B +#define TWI_CMD_LAYOUT 0x0C +#define TWI_CMD_SLED_CURRENT 0x0D +#define TWI_CMD_SLED_SELF_TEST 0x0E + +#define LED_SPI_FREQUENCY_4MHZ 0x07 +#define LED_SPI_FREQUENCY_2MHZ 0x06 +#define LED_SPI_FREQUENCY_1MHZ 0x05 +#define LED_SPI_FREQUENCY_512KHZ 0x04 +#define LED_SPI_FREQUENCY_256KHZ 0x03 +#define LED_SPI_FREQUENCY_128KHZ 0x02 +#define LED_SPI_FREQUENCY_64KHZ 0x01 +#define LED_SPI_OFF 0x00 // 512KHZ seems to be the sweet spot in early testing // so make it the default #define LED_SPI_FREQUENCY_DEFAULT LED_SPI_FREQUENCY_512KHZ -#define TWI_CMD_LED_BASE 0x80 +#define TWI_CMD_LED_BASE 0x80 -#define TWI_REPLY_NONE 0x00 -#define TWI_REPLY_KEYDATA 0x01 +#define TWI_REPLY_NONE 0x00 +#define TWI_REPLY_KEYDATA 0x01 -#define ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) +#define ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) // Returns the relative controller addresss. The expected range is 0-3 uint8_t RaiseSide::controllerAddress() { @@ -221,9 +221,9 @@ void RaiseSide::sendLEDData() { auto constexpr gamma8 = kaleidoscope::driver::color::gamma_correction; void RaiseSide::sendLEDBank(uint8_t bank) { - uint8_t data[LED_BYTES_PER_BANK + 1]; // + 1 for the update LED command itself - data[0] = TWI_CMD_LED_BASE + bank; - for (uint8_t i = 0 ; i < LED_BYTES_PER_BANK; i++) { + uint8_t data[LED_BYTES_PER_BANK + 1]; // + 1 for the update LED command itself + data[0] = TWI_CMD_LED_BASE + bank; + for (uint8_t i = 0; i < LED_BYTES_PER_BANK; i++) { uint8_t c = led_data.bytes[bank][i]; if (c > brightness_adjustment_) c -= brightness_adjustment_; diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/RaiseSide.h b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/RaiseSide.h index 85d2abc3..c1d28055 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/RaiseSide.h +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/RaiseSide.h @@ -35,11 +35,11 @@ namespace device { namespace dygma { namespace raise { -#define LED_BANKS 9 +#define LED_BANKS 9 -#define LEDS_PER_HAND 72 -#define LPH LEDS_PER_HAND -#define LEDS_PER_BANK 8 +#define LEDS_PER_HAND 72 +#define LPH LEDS_PER_HAND +#define LEDS_PER_BANK 8 #define LED_BYTES_PER_BANK (sizeof(cRGB) * LEDS_PER_BANK) typedef union { @@ -57,7 +57,8 @@ typedef union { class RaiseSide { public: - explicit RaiseSide(uint8_t ad01) : ad01_(ad01), twi_(i2c_addr_base_ | ad01) {} + explicit RaiseSide(uint8_t ad01) + : ad01_(ad01), twi_(i2c_addr_base_ | ad01) {} int readVersion(); int readSLEDVersion(); diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/SideFlash.h b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/SideFlash.h index 513df50d..54fb01d4 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/SideFlash.h +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/SideFlash.h @@ -28,10 +28,11 @@ namespace device { namespace dygma { namespace raise { -template +template class SideFlash : public kaleidoscope::Plugin { private: _Firmware firmware; + public: EventHandlerResult onFocusEvent(const char *command) { if (::Focus.handleHelp(command, PSTR("hardware.flash_left_side\nhardware.flash_right_side\nhardware.verify_left_side\nhardware.verify_right_side"))) @@ -40,8 +41,8 @@ class SideFlash : public kaleidoscope::Plugin { if (strncmp_P(command, PSTR("hardware."), 9) != 0) return EventHandlerResult::OK; - auto sideFlasher = Runtime.device().sideFlasher(); - uint8_t left_boot_address = Runtime.device().side.left_boot_address; + auto sideFlasher = Runtime.device().sideFlasher(); + uint8_t left_boot_address = Runtime.device().side.left_boot_address; uint8_t right_boot_address = Runtime.device().side.right_boot_address; enum { FLASH, @@ -51,16 +52,16 @@ class SideFlash : public kaleidoscope::Plugin { if (strcmp_P(command + 9, PSTR("flash_left_side")) == 0) { sub_command = FLASH; - address = left_boot_address; + address = left_boot_address; } else if (strcmp_P(command + 9, PSTR("flash_right_side")) == 0) { sub_command = FLASH; - address = right_boot_address; + address = right_boot_address; } else if (strcmp_P(command + 9, PSTR("verify_left_side")) == 0) { sub_command = VERIFY; - address = left_boot_address; + address = left_boot_address; } else if (strcmp_P(command + 9, PSTR("verify_right_side")) == 0) { sub_command = VERIFY; - address = right_boot_address; + address = right_boot_address; } else { return EventHandlerResult::OK; } diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/TWI.cpp b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/TWI.cpp index 3ab30a79..fc7e4b86 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/TWI.cpp +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/TWI.cpp @@ -32,7 +32,7 @@ uint8_t TWI::writeTo(uint8_t *data, size_t length) { Wire.beginTransmission(addr_); // calc cksum - uint16_t crc16 = 0xffff; + uint16_t crc16 = 0xffff; uint8_t *buffer = data; for (uint8_t i = 0; i < length; i++) { crc16 = _crc_ccitt_update(crc16, *buffer); @@ -50,12 +50,12 @@ uint8_t TWI::writeTo(uint8_t *data, size_t length) { return 0; } -uint8_t TWI::readFrom(uint8_t* data, size_t length) { +uint8_t TWI::readFrom(uint8_t *data, size_t length) { uint8_t counter = 0; uint32_t timeout; uint8_t *buffer = data; - if (!Wire.requestFrom(addr_, length + 2, true)) { // + 2 for the cksum + if (!Wire.requestFrom(addr_, length + 2, true)) { // + 2 for the cksum // in case slave is not responding - return 0 (0 length of received data). return 0; } @@ -65,7 +65,7 @@ uint8_t TWI::readFrom(uint8_t* data, size_t length) { counter++; } - uint16_t crc16 = 0xffff; + uint16_t crc16 = 0xffff; uint16_t rx_cksum = (Wire.read() << 8) + Wire.read(); for (uint8_t i = 0; i < length; i++) { crc16 = _crc_ccitt_update(crc16, *buffer); diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/TWI.h b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/TWI.h index e0e31c3d..97cbc402 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/TWI.h +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/TWI.h @@ -29,10 +29,11 @@ namespace raise { class TWI { public: - explicit TWI(int addr) : addr_(addr), crc_errors_(0) {} + explicit TWI(int addr) + : addr_(addr), crc_errors_(0) {} uint8_t writeTo(uint8_t *data, size_t length); - uint8_t readFrom(uint8_t* data, size_t length); + uint8_t readFrom(uint8_t *data, size_t length); void disable(); void init(uint16_t clock_khz); uint8_t crc_errors() { diff --git a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.cpp b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.cpp index 39176862..f2974393 100644 --- a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.cpp +++ b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.cpp @@ -53,12 +53,12 @@ void ErgoDox::setup(void) { TCCR1A = 0b10101001; TCCR1B = 0b00001001; - DDRB &= ~(1 << 4); + DDRB &= ~(1 << 4); PORTB &= ~(1 << 4); - DDRC &= ~(1 << 7); - DDRD &= ~(1 << 5 | 1 << 4); - DDRE &= ~(1 << 6); + DDRC &= ~(1 << 7); + DDRD &= ~(1 << 5 | 1 << 4); + DDRE &= ~(1 << 6); PORTC |= (1 << 7); PORTD |= (1 << 5 | 1 << 4); PORTE |= (1 << 6); @@ -75,7 +75,7 @@ void ErgoDox::setup(void) { const uint32_t cycles = (F_CPU / 2000000) * 1700; - ICR1 = cycles; + ICR1 = cycles; TCCR1B = _BV(WGM13) | _BV(CS10); TIMSK1 = _BV(TOIE1); @@ -148,9 +148,8 @@ void ErgoDox::setStatusLED(uint8_t led, bool state) { } void ErgoDox::setStatusLEDBrightness(uint8_t led, uint8_t brightness) { - (led == 1) ? (OCR1A = brightness) : - (led == 2) ? (OCR1B = brightness) : - (OCR1C = brightness); + (led == 1) ? (OCR1A = brightness) : (led == 2) ? (OCR1B = brightness) + : (OCR1C = brightness); } uint8_t ErgoDox::debounceMaskForRow(uint8_t row) { @@ -215,4 +214,4 @@ uint8_t ErgoDox::pressedKeyswitchCount() { } // namespace kaleidoscope #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.h b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.h index aa2a1b5b..abf278f9 100644 --- a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.h +++ b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox.h @@ -33,14 +33,15 @@ struct cRGB { uint8_t r, g, b; }; -#define CRGB(r,g,b) (cRGB){b, g, r} +#define CRGB(r, g, b) \ + (cRGB) { b, g, r } #include "kaleidoscope/device/ATmega32U4Keyboard.h" #include "kaleidoscope/driver/bootloader/avr/HalfKay.h" #include "kaleidoscope/driver/keyscanner/Base.h" #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include "kaleidoscope/device/ez/ErgoDox/ErgoDoxScanner.h" -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD namespace kaleidoscope { namespace device { @@ -48,10 +49,9 @@ namespace ez { struct ErgoDoxProps : public kaleidoscope::device::ATmega32U4KeyboardProps { struct KeyScannerProps : kaleidoscope::driver::keyscanner::BaseProps { - static constexpr uint8_t matrix_rows = 14; + static constexpr uint8_t matrix_rows = 14; static constexpr uint8_t matrix_columns = 6; typedef MatrixAddr KeyAddr; - }; typedef kaleidoscope::driver::bootloader::avr::HalfKay Bootloader; static constexpr const char *short_name = "ErgoDox-EZ"; @@ -92,9 +92,11 @@ class ErgoDox : public kaleidoscope::device::ATmega32U4Keyboard { static void debounceRow(uint8_t change, uint8_t row); static void readMatrixRow(uint8_t row); }; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD class ErgoDox; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD + +// clang-format off #define PER_KEY_DATA_STACKED(dflt, \ /* left hand, spatial positions */ \ diff --git a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/ErgoDoxScanner.cpp b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/ErgoDoxScanner.cpp index da434a6f..e87cf18d 100644 --- a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/ErgoDoxScanner.cpp +++ b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/ErgoDoxScanner.cpp @@ -34,17 +34,17 @@ #include "kaleidoscope/device/avr/pins_and_ports.h" #include "kaleidoscope/device/ez/ErgoDox/i2cmaster.h" -#define I2C_ADDR 0b0100000 -#define I2C_ADDR_WRITE ( (I2C_ADDR<<1) | I2C_WRITE ) -#define I2C_ADDR_READ ( (I2C_ADDR<<1) | I2C_READ ) -#define IODIRA 0x00 -#define IODIRB 0x01 -#define GPPUA 0x0C -#define GPPUB 0x0D -#define GPIOA 0x12 -#define GPIOB 0x13 -#define OLATA 0x14 -#define OLATB 0x15 +#define I2C_ADDR 0b0100000 +#define I2C_ADDR_WRITE ((I2C_ADDR << 1) | I2C_WRITE) +#define I2C_ADDR_READ ((I2C_ADDR << 1) | I2C_READ) +#define IODIRA 0x00 +#define IODIRB 0x01 +#define GPPUA 0x0C +#define GPPUB 0x0D +#define GPIOA 0x12 +#define GPIOB 0x13 +#define OLATA 0x14 +#define OLATB 0x15 namespace kaleidoscope { namespace device { @@ -90,20 +90,19 @@ out: return status; } -void -ErgoDoxScanner::begin() { +void ErgoDoxScanner::begin() { expander_error_ = initExpander(); // Init columns - DDRF &= ~(1 << 7 | 1 << 6 | 1 << 5 | 1 << 4 | 1 << 1 | 1 << 0); + DDRF &= ~(1 << 7 | 1 << 6 | 1 << 5 | 1 << 4 | 1 << 1 | 1 << 0); PORTF |= (1 << 7 | 1 << 6 | 1 << 5 | 1 << 4 | 1 << 1 | 1 << 0); // Init rows - DDRB |= (1 << 0 | 1 << 1 | 1 << 2 | 1 << 3); + DDRB |= (1 << 0 | 1 << 1 | 1 << 2 | 1 << 3); PORTB |= (1 << 0 | 1 << 1 | 1 << 2 | 1 << 3); - DDRD |= (1 << 2 | 1 << 3); + DDRD |= (1 << 2 | 1 << 3); PORTD |= (1 << 2 | 1 << 3); - DDRC |= (1 << 6); + DDRC |= (1 << 6); PORTC |= (1 << 6); } @@ -118,13 +117,13 @@ void __attribute__((optimize(3))) ErgoDoxScanner::selectExtenderRow(int row) { expander_error_ = i2c_write(0xFF & ~(1 << row)); if (expander_error_) goto out; -out: + out: i2c_stop(); } } void __attribute__((optimize(3))) ErgoDoxScanner::toggleATMegaRow(int row) { - static uint8_t row_pins[] = { PIN_B0, PIN_B1, PIN_B2, PIN_B3, PIN_D2, PIN_D3, PIN_C6 }; + static uint8_t row_pins[] = {PIN_B0, PIN_B1, PIN_B2, PIN_B3, PIN_D2, PIN_D3, PIN_C6}; OUTPUT_TOGGLE(row_pins[row]); } @@ -148,7 +147,7 @@ ErgoDoxScanner::readCols(int row) { data = i2c_readNak(); data = ~data; -out: + out: i2c_stop(); return data; } else { @@ -156,8 +155,7 @@ out: } } -void -ErgoDoxScanner::reattachExpanderOnError() { +void ErgoDoxScanner::reattachExpanderOnError() { static uint32_t start_time = millis(); if (!expander_error_) @@ -167,7 +165,7 @@ ErgoDoxScanner::reattachExpanderOnError() { return; expander_error_ = initExpander(); - start_time = millis(); + start_time = millis(); } } // namespace ez @@ -175,4 +173,4 @@ ErgoDoxScanner::reattachExpanderOnError() { } // namespace kaleidoscope #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/i2cmaster.cpp b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/i2cmaster.cpp index 6e7eb8dd..bbbd3c22 100644 --- a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/i2cmaster.cpp +++ b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/i2cmaster.cpp @@ -21,7 +21,7 @@ #endif /* I2C clock in Hz */ -#define SCL_CLOCK 400000L +#define SCL_CLOCK 400000L /************************************************************************* @@ -36,10 +36,10 @@ void i2c_init(void) { * for more details, see 20.5.2 in ATmega16/32 secification */ - TWSR = 0; /* no prescaler */ - TWBR = 10; /* must be >= 10 for stable operation */ + TWSR = 0; /* no prescaler */ + TWBR = 10; /* must be >= 10 for stable operation */ -}/* i2c_init */ +} /* i2c_init */ /************************************************************************* @@ -47,13 +47,14 @@ void i2c_init(void) { return 0 = device accessible, 1= failed to access device *************************************************************************/ unsigned char i2c_start(unsigned char address) { - uint8_t twst; + uint8_t twst; // send START condition TWCR = (1 << TWINT) | (1 << TWSTA) | (1 << TWEN); // wait until transmission completed - while (!(TWCR & (1 << TWINT))); + while (!(TWCR & (1 << TWINT))) + ; // check value of TWI Status Register. Mask prescaler bits. twst = TW_STATUS & 0xF8; @@ -64,7 +65,8 @@ unsigned char i2c_start(unsigned char address) { TWCR = (1 << TWINT) | (1 << TWEN); // wail until transmission completed and ACK/NACK has been received - while (!(TWCR & (1 << TWINT))); + while (!(TWCR & (1 << TWINT))) + ; // check value of TWI Status Register. Mask prescaler bits. twst = TW_STATUS & 0xF8; @@ -72,7 +74,7 @@ unsigned char i2c_start(unsigned char address) { return 0; -}/* i2c_start */ +} /* i2c_start */ /************************************************************************* @@ -82,7 +84,7 @@ unsigned char i2c_start(unsigned char address) { Input: address and transfer direction of I2C device *************************************************************************/ void i2c_start_wait(unsigned char address) { - uint8_t twst; + uint8_t twst; while (1) { @@ -90,7 +92,8 @@ void i2c_start_wait(unsigned char address) { TWCR = (1 << TWINT) | (1 << TWSTA) | (1 << TWEN); // wait until transmission completed - while (!(TWCR & (1 << TWINT))); + while (!(TWCR & (1 << TWINT))) + ; // check value of TWI Status Register. Mask prescaler bits. twst = TW_STATUS & 0xF8; @@ -101,7 +104,8 @@ void i2c_start_wait(unsigned char address) { TWCR = (1 << TWINT) | (1 << TWEN); // wail until transmission completed - while (!(TWCR & (1 << TWINT))); + while (!(TWCR & (1 << TWINT))) + ; // check value of TWI Status Register. Mask prescaler bits. twst = TW_STATUS & 0xF8; @@ -110,7 +114,8 @@ void i2c_start_wait(unsigned char address) { TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWSTO); // wait until stop condition is executed and bus released - while (TWCR & (1 << TWSTO)); + while (TWCR & (1 << TWSTO)) + ; continue; } @@ -118,7 +123,7 @@ void i2c_start_wait(unsigned char address) { break; } -}/* i2c_start_wait */ +} /* i2c_start_wait */ /************************************************************************* @@ -132,7 +137,7 @@ void i2c_start_wait(unsigned char address) { unsigned char i2c_rep_start(unsigned char address) { return i2c_start(address); -}/* i2c_rep_start */ +} /* i2c_rep_start */ /************************************************************************* @@ -143,9 +148,10 @@ void i2c_stop(void) { TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWSTO); // wait until stop condition is executed and bus released - while (TWCR & (1 << TWSTO)); + while (TWCR & (1 << TWSTO)) + ; -}/* i2c_stop */ +} /* i2c_stop */ /************************************************************************* @@ -156,21 +162,22 @@ void i2c_stop(void) { 1 write failed *************************************************************************/ unsigned char i2c_write(unsigned char data) { - uint8_t twst; + uint8_t twst; // send data to the previously addressed device TWDR = data; TWCR = (1 << TWINT) | (1 << TWEN); // wait until transmission completed - while (!(TWCR & (1 << TWINT))); + while (!(TWCR & (1 << TWINT))) + ; // check value of TWI Status Register. Mask prescaler bits twst = TW_STATUS & 0xF8; if (twst != TW_MT_DATA_ACK) return 1; return 0; -}/* i2c_write */ +} /* i2c_write */ /************************************************************************* @@ -180,11 +187,12 @@ unsigned char i2c_write(unsigned char data) { *************************************************************************/ unsigned char i2c_readAck(void) { TWCR = (1 << TWINT) | (1 << TWEN) | (1 << TWEA); - while (!(TWCR & (1 << TWINT))); + while (!(TWCR & (1 << TWINT))) + ; return TWDR; -}/* i2c_readAck */ +} /* i2c_readAck */ /************************************************************************* @@ -194,11 +202,12 @@ unsigned char i2c_readAck(void) { *************************************************************************/ unsigned char i2c_readNak(void) { TWCR = (1 << TWINT) | (1 << TWEN); - while (!(TWCR & (1 << TWINT))); + while (!(TWCR & (1 << TWINT))) + ; return TWDR; -}/* i2c_readNak */ +} /* i2c_readNak */ #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/i2cmaster.h b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/i2cmaster.h index 65533c59..77fc8b07 100644 --- a/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/i2cmaster.h +++ b/plugins/Kaleidoscope-Hardware-EZ-ErgoDox/src/kaleidoscope/device/ez/ErgoDox/i2cmaster.h @@ -89,10 +89,10 @@ #include /** defines the data direction (reading from I2C device) in i2c_start(),i2c_rep_start() */ -#define I2C_READ 1 +#define I2C_READ 1 /** defines the data direction (writing to I2C device) in i2c_start(),i2c_rep_start() */ -#define I2C_WRITE 0 +#define I2C_WRITE 0 /** @@ -172,7 +172,7 @@ extern unsigned char i2c_readNak(void); @return byte read from I2C device */ extern unsigned char i2c_read(unsigned char ack); -#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); +#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); /**@}*/ diff --git a/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.cpp b/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.cpp index 8cf696f5..44549b41 100644 --- a/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.cpp +++ b/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.cpp @@ -24,8 +24,8 @@ namespace kaleidoscope { namespace device { namespace gd32 { -} // namespace gd32 -} // namespace device -} // namespace kaleidoscope +} // namespace gd32 +} // namespace device +} // namespace kaleidoscope -#endif // ifdef ARDUINO_GD32F303ZE_EVAL +#endif // ifdef ARDUINO_GD32F303ZE_EVAL diff --git a/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.h b/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.h index 6da0820b..76c4a6ea 100644 --- a/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.h +++ b/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/Eval.h @@ -30,9 +30,9 @@ namespace kaleidoscope { namespace device { namespace gd32 { -struct EvalStorageProps: kaleidoscope::driver::storage::GD32FlashProps {}; +struct EvalStorageProps : kaleidoscope::driver::storage::GD32FlashProps {}; -struct EvalProps: kaleidoscope::device::BaseProps { +struct EvalProps : kaleidoscope::device::BaseProps { typedef kaleidoscope::driver::bootloader::gd32::Base BootLoader; typedef eval::KeyScannerProps KeyScannerProps; typedef eval::KeyScanner KeyScanner; @@ -41,18 +41,20 @@ struct EvalProps: kaleidoscope::device::BaseProps { static constexpr const char *short_name = "GD32Eval"; }; -class Eval: public kaleidoscope::device::Base {}; +class Eval : public kaleidoscope::device::Base {}; +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1 \ ) \ R0C0, R0C1 +// clang-format on -} // namespace gd32 -} // namespace device +} // namespace gd32 +} // namespace device EXPORT_DEVICE(kaleidoscope::device::gd32::Eval) -} // namespace kaleidoscope +} // namespace kaleidoscope #endif diff --git a/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/eval/KeyScanner.cpp b/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/eval/KeyScanner.cpp index d3da6021..24daccde 100644 --- a/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/eval/KeyScanner.cpp +++ b/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/eval/KeyScanner.cpp @@ -160,9 +160,9 @@ uint8_t KeyScanner::previousPressedKeyswitchCount() { return count; } -} // namespace eval -} // namespace gd32 -} // namespace device -} // namespace kaleidoscope +} // namespace eval +} // namespace gd32 +} // namespace device +} // namespace kaleidoscope #endif diff --git a/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/eval/KeyScanner.h b/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/eval/KeyScanner.h index a289a0ec..554c283a 100644 --- a/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/eval/KeyScanner.h +++ b/plugins/Kaleidoscope-Hardware-GD32-Eval/src/kaleidoscope/device/gd32/eval/KeyScanner.h @@ -29,19 +29,20 @@ namespace gd32 { namespace eval { struct KeyScannerProps : public kaleidoscope::driver::keyscanner::BaseProps { - static constexpr uint8_t matrix_rows = 1; + static constexpr uint8_t matrix_rows = 1; static constexpr uint8_t matrix_columns = 2; - static constexpr uint8_t matrix_row_pins[] = { PA3 }; - static constexpr uint8_t matrix_col_pins[] = { PE4, PD12 }; + static constexpr uint8_t matrix_row_pins[] = {PA3}; + static constexpr uint8_t matrix_col_pins[] = {PE4, PD12}; typedef MatrixAddr KeyAddr; }; -class KeyScanner: public kaleidoscope::driver::keyscanner::Base { +class KeyScanner : public kaleidoscope::driver::keyscanner::Base { private: typedef KeyScanner ThisType; typedef KeyScannerProps Props_; + public: static bool do_scan; @@ -55,6 +56,7 @@ class KeyScanner: public kaleidoscope::driver::keyscanner::Base static bool wasKeyswitchPressed(KeyAddr key_addr); static uint8_t previousPressedKeyswitchCount(); + private: /* each of these variables are storing the state for a row of keys @@ -63,8 +65,8 @@ class KeyScanner: public kaleidoscope::driver::keyscanner::Base and the state in debounced_state[0]. */ struct debounce_t { - uint16_t db0; // counter bit 0 - uint16_t db1; // counter bit 1 + uint16_t db0; // counter bit 0 + uint16_t db1; // counter bit 1 uint16_t debounced_state; // debounced state }; @@ -79,9 +81,9 @@ class KeyScanner: public kaleidoscope::driver::keyscanner::Base static uint16_t readRows(); }; -} // namespace eval -} // namespace gd32 -} // namespace device -} // namespace kaleidoscope +} // namespace eval +} // namespace gd32 +} // namespace device +} // namespace kaleidoscope #endif diff --git a/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.cpp b/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.cpp index 28963fb5..11870be4 100644 --- a/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.cpp +++ b/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.cpp @@ -26,7 +26,7 @@ // in the global namespace within the scope of this file. We'll use these // aliases to simplify some template initialization code below. using KeyScannerProps = typename kaleidoscope::device::kbdfans::KBD4xProps::KeyScannerProps; -using KeyScanner = typename kaleidoscope::device::kbdfans::KBD4xProps::KeyScanner; +using KeyScanner = typename kaleidoscope::device::kbdfans::KBD4xProps::KeyScanner; namespace kaleidoscope { namespace device { @@ -44,7 +44,8 @@ constexpr uint8_t KeyScannerProps::matrix_col_pins[matrix_columns]; // `KeyScanner` here refers to the alias set up above, just like in the // `KeyScannerProps` case above. -template<> KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; +template<> +KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; // We set up the TIMER1 interrupt vector here. Due to dependency reasons, this // cannot be in a header-only driver, and must be placed here. @@ -58,9 +59,9 @@ ISR(TIMER1_OVF_vect) { Runtime.device().keyScanner().do_scan_ = true; } -} // namespace kbdfans -} // namespace device -} // namespace kaleidoscope +} // namespace kbdfans +} // namespace device +} // namespace kaleidoscope #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.h b/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.h index 9bc0a9fd..459b7649 100644 --- a/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.h +++ b/plugins/Kaleidoscope-Hardware-KBDFans-KBD4x/src/kaleidoscope/device/kbdfans/KBD4x.h @@ -32,19 +32,19 @@ namespace device { namespace kbdfans { struct KBD4xProps : kaleidoscope::device::ATmega32U4KeyboardProps { - struct MCUProps: public kaleidoscope::driver::mcu::ATmega32U4Props { - static constexpr bool disable_jtag = true; + struct MCUProps : public kaleidoscope::driver::mcu::ATmega32U4Props { + static constexpr bool disable_jtag = true; static constexpr bool disable_clock_division = true; }; typedef kaleidoscope::driver::mcu::ATmega32U4 MCU; struct KeyScannerProps : public kaleidoscope::driver::keyscanner::ATmegaProps { - static constexpr uint8_t matrix_rows = 4; + static constexpr uint8_t matrix_rows = 4; static constexpr uint8_t matrix_columns = 12; typedef MatrixAddr KeyAddr; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD - static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D1, PIN_D2, PIN_D3}; - static constexpr uint8_t matrix_col_pins[matrix_columns] = { PIN_F0, PIN_F1, PIN_F4, PIN_F5, PIN_F6, PIN_F7, PIN_B3, PIN_B1, PIN_B0, PIN_D5, PIN_B7, PIN_C7 }; -#endif // KALEIDOSCOPE_VIRTUAL_BUILD + static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D1, PIN_D2, PIN_D3}; + static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_F0, PIN_F1, PIN_F4, PIN_F5, PIN_F6, PIN_F7, PIN_B3, PIN_B1, PIN_B0, PIN_D5, PIN_B7, PIN_C7}; +#endif // KALEIDOSCOPE_VIRTUAL_BUILD }; typedef kaleidoscope::driver::keyscanner::ATmega KeyScanner; typedef kaleidoscope::driver::bootloader::avr::FLIP Bootloader; @@ -52,8 +52,8 @@ struct KBD4xProps : kaleidoscope::device::ATmega32U4KeyboardProps { }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -class KBD4x: public kaleidoscope::device::ATmega32U4Keyboard {}; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +class KBD4x : public kaleidoscope::device::ATmega32U4Keyboard {}; +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD /* Device definition omitted for virtual device builds. * We need to forward declare the device name, though, as there are * some legacy extern references to boards whose definition @@ -61,8 +61,9 @@ class KBD4x: public kaleidoscope::device::ATmega32U4Keyboard {}; */ class KBD4x; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, R0C10, R0C11, \ R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, \ @@ -73,6 +74,7 @@ class KBD4x; R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, \ R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, R2C7, R2C8, R2C9, R2C10, R2C11, \ R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C5, R3C7, R3C8, R3C9, R3C10, R3C11 +// clang-format on } // namespace kbdfans } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.cpp index 13cfe224..03a70249 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.cpp @@ -27,7 +27,7 @@ // in the global namespace within the scope of this file. We'll use these // aliases to simplify some template initialization code below. using KeyScannerProps = typename kaleidoscope::device::keyboardio::AtreusProps::KeyScannerProps; -using KeyScanner = typename kaleidoscope::device::keyboardio::AtreusProps::KeyScanner; +using KeyScanner = typename kaleidoscope::device::keyboardio::AtreusProps::KeyScanner; namespace kaleidoscope { namespace device { @@ -45,7 +45,8 @@ constexpr uint8_t KeyScannerProps::matrix_col_pins[matrix_columns]; // `KeyScanner` here refers to the alias set up above, just like in the // `KeyScannerProps` case above. -template<> KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; +template<> +KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; // We set up the TIMER1 interrupt vector here. Due to dependency reasons, this // cannot be in a header-only driver, and must be placed here. @@ -64,4 +65,4 @@ ISR(TIMER1_OVF_vect) { } // namespace kaleidoscope #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.h index 8229c650..eb3108df 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Atreus/src/kaleidoscope/device/keyboardio/Atreus2.h @@ -35,13 +35,13 @@ struct AtreusProps : kaleidoscope::device::ATmega32U4KeyboardProps { struct KeyScannerProps : public kaleidoscope::driver::keyscanner::ATmegaProps { - static constexpr uint8_t matrix_rows = 4; + static constexpr uint8_t matrix_rows = 4; static constexpr uint8_t matrix_columns = 12; typedef MatrixAddr KeyAddr; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD - static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_F6, PIN_F5, PIN_F4, PIN_F1}; + static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_F6, PIN_F5, PIN_F4, PIN_F1}; static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_F7, PIN_E2, PIN_C7, PIN_C6, PIN_B6, PIN_B5, PIN_D7, PIN_D6, PIN_D4, PIN_D5, PIN_D3, PIN_D2}; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD }; typedef kaleidoscope::driver::keyscanner::ATmega KeyScanner; @@ -50,8 +50,8 @@ struct AtreusProps : kaleidoscope::device::ATmega32U4KeyboardProps { }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -class Atreus: public kaleidoscope::device::ATmega32U4Keyboard {}; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +class Atreus : public kaleidoscope::device::ATmega32U4Keyboard {}; +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD /* Device definition omitted for virtual device builds. * We need to forward declare the device name, though, as there are * some legacy extern references to boards whose definition @@ -59,8 +59,9 @@ class Atreus: public kaleidoscope::device::ATmega32U4Keyboard {}; */ class Atreus; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C7, R0C8, R0C9, R0C10, R0C11, \ @@ -89,6 +90,8 @@ class Atreus; R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, R2C7, R2C8, R2C9, R2C10, R2C11, \ R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 +// clang-format on + } // namespace keyboardio } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.cpp index 88206319..db419ecd 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.cpp @@ -24,7 +24,7 @@ extern "C" { #include "twi.h" } -#define ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) +#define ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) #define LED_DRIVER_ADDR 0x30 @@ -32,7 +32,7 @@ extern "C" { // in the global namespace within the scope of this file. We'll use these // aliases to simplify some template initialization code below. using KeyScannerProps = typename kaleidoscope::device::keyboardio::ImagoProps::KeyScannerProps; -using KeyScanner = typename kaleidoscope::device::keyboardio::ImagoProps::KeyScanner; +using KeyScanner = typename kaleidoscope::device::keyboardio::ImagoProps::KeyScanner; namespace kaleidoscope { namespace device { @@ -42,18 +42,18 @@ constexpr uint8_t ImagoLEDDriverProps::key_led_map[] PROGMEM; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -static constexpr uint8_t CMD_SET_REGISTER = 0xFD; -static constexpr uint8_t CMD_WRITE_ENABLE = 0xFE; +static constexpr uint8_t CMD_SET_REGISTER = 0xFD; +static constexpr uint8_t CMD_WRITE_ENABLE = 0xFE; static constexpr uint8_t WRITE_ENABLE_ONCE = 0b11000101; -static constexpr uint8_t LED_REGISTER_PWM0 = 0x00; -static constexpr uint8_t LED_REGISTER_PWM1 = 0x01; -static constexpr uint8_t LED_REGISTER_DATA0 = 0x02; -static constexpr uint8_t LED_REGISTER_DATA1 = 0x03; +static constexpr uint8_t LED_REGISTER_PWM0 = 0x00; +static constexpr uint8_t LED_REGISTER_PWM1 = 0x01; +static constexpr uint8_t LED_REGISTER_DATA0 = 0x02; +static constexpr uint8_t LED_REGISTER_DATA1 = 0x03; static constexpr uint8_t LED_REGISTER_CONTROL = 0x04; -static constexpr uint8_t LED_REGISTER_PWM0_SIZE = 0xB4; -static constexpr uint8_t LED_REGISTER_PWM1_SIZE = 0xAB; +static constexpr uint8_t LED_REGISTER_PWM0_SIZE = 0xB4; +static constexpr uint8_t LED_REGISTER_PWM1_SIZE = 0xAB; static constexpr uint8_t LED_REGISTER_DATA0_SIZE = 0xB4; static constexpr uint8_t LED_REGISTER_DATA1_SIZE = 0xAB; @@ -71,7 +71,8 @@ constexpr uint8_t KeyScannerProps::matrix_col_pins[matrix_columns]; // `KeyScanner` here refers to the alias set up above, just like in the // `KeyScannerProps` case above. -template<> KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; +template<> +KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; // We set up the TIMER1 interrupt vector here. Due to dependency reasons, this // cannot be in a header-only driver, and must be placed here. @@ -92,17 +93,17 @@ uint8_t ImagoLEDDriver::brightness_adjustment_; void ImagoLEDDriver::setup() { setAllPwmTo(0xFF); selectRegister(LED_REGISTER_CONTROL); - twiSend(LED_DRIVER_ADDR, 0x01, 0xFF); //global current - twiSend(LED_DRIVER_ADDR, 0x00, 0x01); //normal operation + twiSend(LED_DRIVER_ADDR, 0x01, 0xFF); //global current + twiSend(LED_DRIVER_ADDR, 0x00, 0x01); //normal operation } void ImagoLEDDriver::twiSend(uint8_t addr, uint8_t Reg_Add, uint8_t Reg_Dat) { - uint8_t data[] = {Reg_Add, Reg_Dat }; + uint8_t data[] = {Reg_Add, Reg_Dat}; uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0); } void ImagoLEDDriver::unlockRegister(void) { - twiSend(LED_DRIVER_ADDR, CMD_WRITE_ENABLE, WRITE_ENABLE_ONCE); //unlock + twiSend(LED_DRIVER_ADDR, CMD_WRITE_ENABLE, WRITE_ENABLE_ONCE); //unlock } void ImagoLEDDriver::selectRegister(uint8_t page) { @@ -139,18 +140,18 @@ uint8_t ImagoLEDDriver::adjustBrightness(uint8_t value) { } void ImagoLEDDriver::syncLeds() { -// if (!isLEDChanged) -// return; + // if (!isLEDChanged) + // return; uint8_t data[LED_REGISTER_DATA_LARGEST + 1]; - data[0] = 0;// the address of the first byte to copy in + data[0] = 0; // the address of the first byte to copy in uint8_t last_led = 0; // Write the first LED bank selectRegister(LED_REGISTER_DATA0); for (auto i = 1; i < LED_REGISTER_DATA0_SIZE; i += 3) { - data[i] = adjustBrightness(led_data[last_led].b); + data[i] = adjustBrightness(led_data[last_led].b); data[i + 1] = adjustBrightness(led_data[last_led].g); data[i + 2] = adjustBrightness(led_data[last_led].r); last_led++; @@ -170,7 +171,7 @@ void ImagoLEDDriver::syncLeds() { selectRegister(LED_REGISTER_DATA1); for (auto i = 1; i < LED_REGISTER_DATA1_SIZE; i += 3) { - data[i] = adjustBrightness(led_data[last_led].b); + data[i] = adjustBrightness(led_data[last_led].b); data[i + 1] = adjustBrightness(led_data[last_led].g); data[i + 2] = adjustBrightness(led_data[last_led].r); last_led++; @@ -186,11 +187,10 @@ void ImagoLEDDriver::setAllPwmTo(uint8_t step) { selectRegister(LED_REGISTER_PWM0); uint8_t data[0xB5] = {}; - data[0] = 0; + data[0] = 0; // PWM Register 0 is 0x00 to 0xB3 for (auto i = 1; i <= 0xB4; i++) { data[i] = step; - } twi_writeTo(LED_DRIVER_ADDR, data, 0xB5, 1, 0); @@ -198,7 +198,6 @@ void ImagoLEDDriver::setAllPwmTo(uint8_t step) { // PWM Register 1 is 0x00 to 0xAA for (auto i = 1; i <= LED_REGISTER_PWM1_SIZE; i++) { data[i] = step; - } twi_writeTo(LED_DRIVER_ADDR, data, 0xAC, 1, 0); } @@ -215,7 +214,7 @@ void Imago::setup() { kaleidoscope::device::ATmega32U4Keyboard::setup(); } -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD } // namespace keyboardio } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.h index 8f080a02..dd6103a1 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/Imago.h @@ -27,7 +27,8 @@ struct cRGB { uint8_t r; }; -#define CRGB(r,g,b) (cRGB){b, g, r} +#define CRGB(r, g, b) \ + (cRGB) { b, g, r } #include "kaleidoscope/device/ATmega32U4Keyboard.h" #include "kaleidoscope/driver/bootloader/avr/Caterina.h" @@ -40,14 +41,16 @@ namespace keyboardio { using kaleidoscope::driver::led::no_led; -struct ImagoLEDDriverProps: public kaleidoscope::driver::led::BaseProps { - static constexpr uint8_t led_count = 78; +struct ImagoLEDDriverProps : public kaleidoscope::driver::led::BaseProps { + static constexpr uint8_t led_count = 78; static constexpr uint8_t key_led_map[/* 5*16 */] PROGMEM = { - 104, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 115, 12, 116, + // clang-format off + 104, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 115, 12, 116, 91, 13, no_led, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 102, 15, 103, 78, 26, 27, 28, 29, 30, 31, no_led, 33, 34, 35, 36, 37, 89, 38, no_led, 65, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, no_led, 90, 52, 66, 53, 54, no_led, 56, 57, 71, 59, no_led, 61, 62, 63, 64, no_led, 77 + // clang-format on }; }; @@ -60,14 +63,14 @@ class ImagoLEDDriver : public kaleidoscope::driver::led::Base KeyAddr; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD - static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_F6, PIN_F5, PIN_F4, PIN_F1, PIN_F0}; - static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_B2, PIN_B7, PIN_E2, PIN_C7, PIN_C6, PIN_B6, PIN_B5, PIN_B4, PIN_D7, PIN_D6, PIN_D4, PIN_D5, PIN_D3, PIN_D2, PIN_E6, PIN_F7}; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD + static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_F6, PIN_F5, PIN_F4, PIN_F1, PIN_F0}; + static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_B2, PIN_B7, PIN_E2, PIN_C7, PIN_C6, PIN_B6, PIN_B5, PIN_B4, PIN_D7, PIN_D6, PIN_D4, PIN_D5, PIN_D3, PIN_D2, PIN_E6, PIN_F7}; +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD }; typedef kaleidoscope::driver::keyscanner::ATmega KeyScanner; typedef ImagoLEDDriverProps LEDDriverProps; @@ -101,12 +104,13 @@ struct ImagoProps : kaleidoscope::device::ATmega32U4KeyboardProps { }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -class Imago: public kaleidoscope::device::ATmega32U4Keyboard { +class Imago : public kaleidoscope::device::ATmega32U4Keyboard { public: void setup(); }; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, R0C10, R0C11, R0C12, R0C13, R0C14, R0C15, \ R1C0, R1C1, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, R1C12, R1C13, R1C14, R1C15, \ @@ -119,6 +123,7 @@ class Imago: public kaleidoscope::device::ATmega32U4Keyboard { R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, XXX, R2C8, R2C9, R2C10, R2C11, R2C12, R2C13, R2C14, XXX , \ R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11, R3C12, R3C13, XXX, R3C15, \ R4C0, R4C1, R4C2, R4C3, XXX, R4C5, R4C6, R4C7, R4C8, XXX, R4C10, R4C11, R4C12, R4C13, XXX, R4C15 +// clang-format on } // namespace keyboardio } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/twi.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/twi.h index 773ce9cb..13ebcdc3 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/twi.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Imago/src/kaleidoscope/device/keyboardio/twi.h @@ -44,14 +44,14 @@ void twi_init(void); void twi_disable(void); void twi_setAddress(uint8_t); void twi_setFrequency(uint32_t); -uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t); -uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t); -uint8_t twi_transmit(const uint8_t*, uint8_t); -void twi_attachSlaveRxEvent(void (*)(uint8_t*, int)); +uint8_t twi_readFrom(uint8_t, uint8_t *, uint8_t, uint8_t); +uint8_t twi_writeTo(uint8_t, uint8_t *, uint8_t, uint8_t, uint8_t); +uint8_t twi_transmit(const uint8_t *, uint8_t); +void twi_attachSlaveRxEvent(void (*)(uint8_t *, int)); void twi_attachSlaveTxEvent(void (*)(void)); void twi_reply(uint8_t); void twi_stop(void); void twi_releaseBus(void); -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #endif diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.cpp index 7811c3d8..bb5d5c5b 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.cpp @@ -20,15 +20,15 @@ #include "kaleidoscope/device/keyboardio/Model01.h" // System headers -#include // for uint8_t +#include // for uint8_t // Arduino headers -#include // for PROGMEM +#include // for PROGMEM #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include #include -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD // Kaleidoscope headers #include "kaleidoscope/driver/keyscanner/Base_Impl.h" // IWYU pragma: keep @@ -63,8 +63,8 @@ void Model01Hands::setup(void) { PORTE &= ~_BV(6); // Set B4, the overcurrent check to an input with an internal pull-up - DDRB &= ~_BV(4); // set bit, input - PORTB &= ~_BV(4); // set bit, enable pull-up resistor + DDRB &= ~_BV(4); // set bit, input + PORTB &= ~_BV(4); // set bit, enable pull-up resistor } /********* LED Driver *********/ @@ -163,7 +163,7 @@ void Model01KeyScanner::setup() { void Model01KeyScanner::readMatrix() { //scan the Keyboard matrix looking for connections - previousLeftHandState = leftHandState; + previousLeftHandState = leftHandState; previousRightHandState = rightHandState; if (Model01Hands::leftHand.readKeys()) { @@ -180,12 +180,12 @@ void Model01KeyScanner::actOnHalfRow(uint8_t row, uint8_t colState, uint8_t colP for (uint8_t col = 0; col < 8; col++) { // Build up the key state for row, col uint8_t keyState = ((bitRead(colPrevState, 0) << 0) | - (bitRead(colState, 0) << 1)); + (bitRead(colState, 0) << 1)); if (keyState) ThisType::handleKeyswitchEvent(Key_NoKey, KeyAddr(row, startPos - col), keyState); // Throw away the data we've just used, so we can read the next column - colState = colState >> 1; + colState = colState >> 1; colPrevState = colPrevState >> 1; } } @@ -243,7 +243,7 @@ void Model01::setup() { Model01Hands::setup(); kaleidoscope::device::Base::setup(); - TWBR = 12; // This is 400mhz, which is the fastest we can drive the ATTiny + TWBR = 12; // This is 400mhz, which is the fastest we can drive the ATTiny } void Model01::enableHardwareTestMode() { diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.h index b3d292ad..cbd6d6a8 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/Model01.h @@ -22,15 +22,16 @@ #ifdef ARDUINO_AVR_MODEL01 // System headers -#include // for uint8_t +#include // for uint8_t // Arduino headers -#include // for PROGMEM +#include // for PROGMEM // Kaleidoscope headers -#include "kaleidoscope/MatrixAddr.h" // for MatrixAddr -#include "kaleidoscope/macro_helpers.h" // for RESTRICT_AR... +#include "kaleidoscope/MatrixAddr.h" // for MatrixAddr +#include "kaleidoscope/macro_helpers.h" // for RESTRICT_AR... -#define CRGB(r,g,b) (cRGB){b, g, r} +#define CRGB(r, g, b) \ + (cRGB) { b, g, r } struct cRGB { uint8_t b; @@ -44,19 +45,21 @@ struct cRGB { #include "kaleidoscope/driver/led/Base.h" // for BaseProps // Kaleidoscope-Hardware-Keyboardio-Model01 headers -#include "kaleidoscope/driver/keyboardio/Model01Side.h" // for keydata_t +#include "kaleidoscope/driver/keyboardio/Model01Side.h" // for keydata_t namespace kaleidoscope { namespace device { namespace keyboardio { struct Model01LEDDriverProps : public kaleidoscope::driver::led::BaseProps { - static constexpr uint8_t led_count = 64; + static constexpr uint8_t led_count = 64; static constexpr uint8_t key_led_map[] PROGMEM = { + // clang-format off 3, 4, 11, 12, 19, 20, 26, 27, 36, 37, 43, 44, 51, 52, 59, 60, 2, 5, 10, 13, 18, 21, 25, 28, 35, 38, 42, 45, 50, 53, 58, 61, - 1, 6, 9, 14, 17, 22, 24, 29, 34, 39, 41, 46, 49, 54, 57, 62, - 0, 7, 8, 15, 16, 23, 31, 30, 33, 32, 40, 47, 48, 55, 56, 63, + 1, 6, 9, 14, 17, 22, 24, 29, 34, 39, 41, 46, 49, 54, 57, 62, + 0, 7, 8, 15, 16, 23, 31, 30, 33, 32, 40, 47, 48, 55, 56, 63, + // clang-format on }; }; @@ -75,12 +78,12 @@ class Model01LEDDriver : public kaleidoscope::driver::led::Base KeyAddr; }; @@ -89,6 +92,7 @@ struct Model01KeyScannerProps : public kaleidoscope::driver::keyscanner::BasePro class Model01KeyScanner : public kaleidoscope::driver::keyscanner::Base { private: typedef Model01KeyScanner ThisType; + public: static void setup(); static void scanMatrix(); @@ -112,12 +116,12 @@ class Model01KeyScanner : public kaleidoscope::driver::keyscanner::Base { static void enableHardwareTestMode(); }; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD -} // namespace keyboardio -} // namespace device +} // namespace keyboardio +} // namespace device EXPORT_DEVICE(kaleidoscope::device::keyboardio::Model01) } // namespace kaleidoscope +// clang-format off + #define PER_KEY_DATA_STACKED(dflt, \ r0c0, r0c1, r0c2, r0c3, r0c4, r0c5, r0c6, \ r1c0, r1c1, r1c2, r1c3, r1c4, r1c5, r1c6, \ diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/twi.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/twi.h index 773ce9cb..13ebcdc3 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/twi.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/device/keyboardio/twi.h @@ -44,14 +44,14 @@ void twi_init(void); void twi_disable(void); void twi_setAddress(uint8_t); void twi_setFrequency(uint32_t); -uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t); -uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t); -uint8_t twi_transmit(const uint8_t*, uint8_t); -void twi_attachSlaveRxEvent(void (*)(uint8_t*, int)); +uint8_t twi_readFrom(uint8_t, uint8_t *, uint8_t, uint8_t); +uint8_t twi_writeTo(uint8_t, uint8_t *, uint8_t, uint8_t, uint8_t); +uint8_t twi_transmit(const uint8_t *, uint8_t); +void twi_attachSlaveRxEvent(void (*)(uint8_t *, int)); void twi_attachSlaveTxEvent(void (*)(void)); void twi_reply(uint8_t); void twi_stop(void); void twi_releaseBus(void); -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #endif diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/Model01Side.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/Model01Side.cpp index d2f7b6eb..d16da4d1 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/Model01Side.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/Model01Side.cpp @@ -40,7 +40,7 @@ namespace driver { namespace keyboardio { #define SCANNER_I2C_ADDR_BASE 0x58 -#define ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) +#define ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) uint8_t twi_uninitialized = 1; @@ -82,8 +82,6 @@ uint8_t Model01Side::setKeyscanInterval(uint8_t delay) { } - - // returns -1 on error, otherwise returns the scanner version integer int Model01Side::readVersion() { return readRegister(TWI_CMD_VERSION); @@ -113,7 +111,6 @@ uint8_t Model01Side::setLEDSPIFrequency(uint8_t frequency) { } - int Model01Side::readRegister(uint8_t cmd) { uint8_t return_value = 0; @@ -122,8 +119,7 @@ int Model01Side::readRegister(uint8_t cmd) { uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0); - - delayMicroseconds(15); // We may be able to drop this in the future + delayMicroseconds(15); // We may be able to drop this in the future // but will need to verify with correctly // sized pull-ups on both the left and right // hands' i2c SDA and SCL lines @@ -137,7 +133,6 @@ int Model01Side::readRegister(uint8_t cmd) { } else { return -1; } - } @@ -174,8 +169,8 @@ auto constexpr gamma8 = kaleidoscope::driver::color::gamma_correction; void Model01Side::sendLEDBank(uint8_t bank) { uint8_t data[LED_BYTES_PER_BANK + 1]; - data[0] = TWI_CMD_LED_BASE + bank; - for (uint8_t i = 0 ; i < LED_BYTES_PER_BANK; i++) { + data[0] = TWI_CMD_LED_BASE + bank; + for (uint8_t i = 0; i < LED_BYTES_PER_BANK; i++) { /* While the ATTiny controller does have a global brightness command, it is * limited to 32 levels, and those aren't nicely spread out either. For this * reason, we're doing our own brightness adjustment on this side, because @@ -195,8 +190,7 @@ void Model01Side::setAllLEDsTo(cRGB color) { uint8_t data[] = {TWI_CMD_LED_SET_ALL_TO, pgm_read_byte(&gamma8[color.b]), pgm_read_byte(&gamma8[color.g]), - pgm_read_byte(&gamma8[color.r]) - }; + pgm_read_byte(&gamma8[color.r])}; uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0); } @@ -205,14 +199,12 @@ void Model01Side::setOneLEDTo(uint8_t led, cRGB color) { led, pgm_read_byte(&gamma8[color.b]), pgm_read_byte(&gamma8[color.g]), - pgm_read_byte(&gamma8[color.r]) - }; + pgm_read_byte(&gamma8[color.r])}; uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0); - } -} // namespace keyboardio -} // namespace driver -} // namespace kaleidoscope +} // namespace keyboardio +} // namespace driver +} // namespace kaleidoscope -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/Model01Side.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/Model01Side.h index ec1de304..d78da676 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/Model01Side.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/Model01Side.h @@ -34,13 +34,14 @@ struct cRGB { uint8_t g; uint8_t r; }; -#define CRGB(r,g,b) (cRGB){b, g, r} +#define CRGB(r, g, b) \ + (cRGB) { b, g, r } #endif -#define LED_BANKS 4 +#define LED_BANKS 4 -#define LEDS_PER_HAND 32 -#define LED_BYTES_PER_BANK sizeof(cRGB) * LEDS_PER_HAND/LED_BANKS +#define LEDS_PER_HAND 32 +#define LED_BYTES_PER_BANK sizeof(cRGB) * LEDS_PER_HAND / LED_BANKS namespace kaleidoscope { namespace driver { @@ -97,8 +98,8 @@ class Model01Side { void sendLEDBank(uint8_t bank); int readRegister(uint8_t cmd); }; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD -} // namespace keyboardio -} // namespace driver -} // namespace kaleidoscope +} // namespace keyboardio +} // namespace driver +} // namespace kaleidoscope diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/wire-protocol-constants.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/wire-protocol-constants.h index 67c4ca0b..df185fb2 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/wire-protocol-constants.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model01/src/kaleidoscope/driver/keyboardio/wire-protocol-constants.h @@ -22,22 +22,22 @@ #pragma once -#define TWI_CMD_NONE 0x00 -#define TWI_CMD_VERSION 0x01 -#define TWI_CMD_KEYSCAN_INTERVAL 0x02 -#define TWI_CMD_LED_SET_ALL_TO 0x03 -#define TWI_CMD_LED_SET_ONE_TO 0x04 -#define TWI_CMD_COLS_USE_PULLUPS 0x05 +#define TWI_CMD_NONE 0x00 +#define TWI_CMD_VERSION 0x01 +#define TWI_CMD_KEYSCAN_INTERVAL 0x02 +#define TWI_CMD_LED_SET_ALL_TO 0x03 +#define TWI_CMD_LED_SET_ONE_TO 0x04 +#define TWI_CMD_COLS_USE_PULLUPS 0x05 #define TWI_CMD_LED_SPI_FREQUENCY 0x06 -#define LED_SPI_FREQUENCY_4MHZ 0x07 -#define LED_SPI_FREQUENCY_2MHZ 0x06 -#define LED_SPI_FREQUENCY_1MHZ 0x05 -#define LED_SPI_FREQUENCY_512KHZ 0x04 -#define LED_SPI_FREQUENCY_256KHZ 0x03 -#define LED_SPI_FREQUENCY_128KHZ 0x02 -#define LED_SPI_FREQUENCY_64KHZ 0x01 -#define LED_SPI_OFF 0x00 +#define LED_SPI_FREQUENCY_4MHZ 0x07 +#define LED_SPI_FREQUENCY_2MHZ 0x06 +#define LED_SPI_FREQUENCY_1MHZ 0x05 +#define LED_SPI_FREQUENCY_512KHZ 0x04 +#define LED_SPI_FREQUENCY_256KHZ 0x03 +#define LED_SPI_FREQUENCY_128KHZ 0x02 +#define LED_SPI_FREQUENCY_64KHZ 0x01 +#define LED_SPI_OFF 0x00 // 512KHZ seems to be the sweet spot in early testing @@ -45,7 +45,7 @@ #define LED_SPI_FREQUENCY_DEFAULT LED_SPI_FREQUENCY_512KHZ -#define TWI_CMD_LED_BASE 0x80 +#define TWI_CMD_LED_BASE 0x80 -#define TWI_REPLY_NONE 0x00 -#define TWI_REPLY_KEYDATA 0x01 +#define TWI_REPLY_NONE 0x00 +#define TWI_REPLY_KEYDATA 0x01 diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp index b1abbc2b..34a33b14 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.cpp @@ -19,8 +19,8 @@ #include "kaleidoscope/device/keyboardio/Model100.h" -#include // for PROGMEM -#include // for Wire +#include // for PROGMEM +#include // for Wire #include "kaleidoscope/driver/keyscanner/Base_Impl.h" // For Base<> @@ -48,7 +48,6 @@ void Model100Hands::setup(void) { Model100KeyScanner::enableScannerPower(); Wire.begin(); Wire.setClock(400000); - } /********* LED Driver *********/ @@ -125,9 +124,9 @@ driver::keyboardio::keydata_t Model100KeyScanner::previousLeftHandState; driver::keyboardio::keydata_t Model100KeyScanner::previousRightHandState; void Model100KeyScanner::enableScannerPower(void) { -// Turn on the switched 5V network. -// make sure this happens at least 100ms after USB connect -// to satisfy inrush limits + // Turn on the switched 5V network. + // make sure this happens at least 100ms after USB connect + // to satisfy inrush limits // pinMode(PB9, OUTPUT_OPEN_DRAIN); digitalWrite(PB9, LOW); @@ -141,7 +140,6 @@ void Model100KeyScanner::disableScannerPower(void) { } - void Model100KeyScanner::setup() { enableScannerPower(); delay(250); @@ -149,7 +147,7 @@ void Model100KeyScanner::setup() { void Model100KeyScanner::readMatrix() { //scan the Keyboard matrix looking for connections - previousLeftHandState = leftHandState; + previousLeftHandState = leftHandState; previousRightHandState = rightHandState; if (Model100Hands::leftHand.readKeys()) { @@ -166,12 +164,12 @@ void Model100KeyScanner::actOnHalfRow(uint8_t row, uint8_t colState, uint8_t col for (uint8_t col = 0; col < 8; col++) { // Build up the key state for row, col uint8_t keyState = ((bitRead(colPrevState, 0) << 0) | - (bitRead(colState, 0) << 1)); + (bitRead(colState, 0) << 1)); if (keyState) ThisType::handleKeyswitchEvent(Key_NoKey, KeyAddr(row, startPos - col), keyState); // Throw away the data we've just used, so we can read the next column - colState = colState >> 1; + colState = colState >> 1; colPrevState = colPrevState >> 1; } } diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h index eb4a8354..bd6ebd08 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/device/keyboardio/Model100.h @@ -25,7 +25,8 @@ #include -#define CRGB(r,g,b) (cRGB){b, g, r} +#define CRGB(r, g, b) \ + (cRGB) { b, g, r } struct cRGB { uint8_t b; @@ -47,18 +48,20 @@ namespace kaleidoscope { namespace device { namespace keyboardio { -struct Model100StorageProps: public kaleidoscope::driver::storage::GD32FlashProps { +struct Model100StorageProps : public kaleidoscope::driver::storage::GD32FlashProps { static constexpr uint16_t length = EEPROM_EMULATION_SIZE; }; struct Model100LEDDriverProps : public kaleidoscope::driver::led::BaseProps { - static constexpr uint8_t led_count = 64; + static constexpr uint8_t led_count = 64; static constexpr uint8_t key_led_map[] PROGMEM = { + // clang-format off 3, 4, 11, 12, 19, 20, 26, 27, 36, 37, 43, 44, 51, 52, 59, 60, 2, 5, 10, 13, 18, 21, 25, 28, 35, 38, 42, 45, 50, 53, 58, 61, - 1, 6, 9, 14, 17, 22, 24, 29, 34, 39, 41, 46, 49, 54, 57, 62, - 0, 7, 8, 15, 16, 23, 31, 30, 33, 32, 40, 47, 48, 55, 56, 63, + 1, 6, 9, 14, 17, 22, 24, 29, 34, 39, 41, 46, 49, 54, 57, 62, + 0, 7, 8, 15, 16, 23, 31, 30, 33, 32, 40, 47, 48, 55, 56, 63, + // clang-format on }; }; @@ -76,12 +79,12 @@ class Model100LEDDriver : public kaleidoscope::driver::led::Base KeyAddr; }; @@ -90,6 +93,7 @@ struct Model100KeyScannerProps : public kaleidoscope::driver::keyscanner::BasePr class Model100KeyScanner : public kaleidoscope::driver::keyscanner::Base { private: typedef Model100KeyScanner ThisType; + public: static void setup(); static void scanMatrix(); @@ -114,13 +118,13 @@ class Model100KeyScanner : public kaleidoscope::driver::keyscanner::Base AbsoluteMouse; }; @@ -130,7 +134,7 @@ struct Model100Props : public kaleidoscope::device::BaseProps { typedef Model100HIDProps HIDProps; typedef kaleidoscope::driver::hid::Keyboardio HID; - typedef Model100LEDDriverProps LEDDriverProps; + typedef Model100LEDDriverProps LEDDriverProps; typedef Model100LEDDriver LEDDriver; typedef Model100KeyScannerProps KeyScannerProps; @@ -156,15 +160,17 @@ class Model100 : public kaleidoscope::device::Base { static void enableHardwareTestMode(); }; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD -} // namespace keyboardio -} // namespace device +} // namespace keyboardio +} // namespace device EXPORT_DEVICE(kaleidoscope::device::keyboardio::Model100) } // namespace kaleidoscope +// clang-format off + #define PER_KEY_DATA_STACKED(dflt, \ r0c0, r0c1, r0c2, r0c3, r0c4, r0c5, r0c6, \ r1c0, r1c1, r1c2, r1c3, r1c4, r1c5, r1c6, \ diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.cpp b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.cpp index f86d2be6..00b7458f 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.cpp +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.cpp @@ -36,7 +36,7 @@ namespace driver { namespace keyboardio { #define SCANNER_I2C_ADDR_BASE 0x58 -#define ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) +#define ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) uint8_t twi_uninitialized = 1; @@ -75,8 +75,6 @@ uint8_t Model100Side::setKeyscanInterval(uint8_t delay) { } - - // returns -1 on error, otherwise returns the scanner version integer int Model100Side::readVersion() { return readRegister(TWI_CMD_VERSION); @@ -100,7 +98,7 @@ int Model100Side::readLEDSPIFrequency() { // https://www.arduino.cc/en/Reference/WireEndTransmission uint8_t Model100Side::setLEDSPIFrequency(uint8_t frequency) { uint8_t data[] = {TWI_CMD_LED_SPI_FREQUENCY, frequency}; - uint8_t result = writeData(data, ELEMENTS(data)); + uint8_t result = writeData(data, ELEMENTS(data)); return result; } @@ -134,11 +132,10 @@ bool Model100Side::isDeviceAvailable() { // we've decremented the counter, but it's not time to probe for the device yet. return false; } - } void Model100Side::markDeviceUnavailable() { - unavailable_device_check_countdown_ = 1; // We think there was a comms problem. Check on the next cycle + unavailable_device_check_countdown_ = 1; // We think there was a comms problem. Check on the next cycle } uint8_t Model100Side::writeData(uint8_t *data, uint8_t length) { @@ -156,15 +153,15 @@ uint8_t Model100Side::writeData(uint8_t *data, uint8_t length) { int Model100Side::readRegister(uint8_t cmd) { uint8_t return_value = 0; - uint8_t data[] = {cmd}; - uint8_t result = writeData(data, ELEMENTS(data)); + uint8_t data[] = {cmd}; + uint8_t result = writeData(data, ELEMENTS(data)); // If the setup failed, return. This means there was a problem asking for the register if (result) { return -1; } - delayMicroseconds(50); // TODO We may be able to drop this in the future + delayMicroseconds(50); // TODO We may be able to drop this in the future // but will need to verify with correctly // sized pull-ups on both the left and right // hands' i2c SDA and SCL lines @@ -173,14 +170,13 @@ int Model100Side::readRegister(uint8_t cmd) { // perform blocking read into buffer - Wire.requestFrom(addr, 1); // request 1 byte from the keyscanner + Wire.requestFrom(addr, 1); // request 1 byte from the keyscanner if (Wire.available()) { return Wire.read(); } else { markDeviceUnavailable(); return -1; } - } @@ -192,9 +188,9 @@ bool Model100Side::readKeys() { uint8_t row_counter = 0; // perform blocking read into buffer - uint8_t read = 0; + uint8_t read = 0; uint8_t bytes_returned = 0; - bytes_returned = Wire.requestFrom(addr, 5); // request 5 bytes from the keyscanner + bytes_returned = Wire.requestFrom(addr, 5); // request 5 bytes from the keyscanner if (bytes_returned < 5) { return false; } @@ -224,8 +220,8 @@ void Model100Side::sendLEDData() { void Model100Side::sendLEDBank(uint8_t bank) { uint8_t data[LED_BYTES_PER_BANK + 1]; - data[0] = TWI_CMD_LED_BASE + bank; - for (uint8_t i = 0 ; i < LED_BYTES_PER_BANK; i++) { + data[0] = TWI_CMD_LED_BASE + bank; + for (uint8_t i = 0; i < LED_BYTES_PER_BANK; i++) { /* While the ATTiny controller does have a global brightness command, it is * limited to 32 levels, and those aren't nicely spread out either. For this * reason, we're doing our own brightness adjustment on this side, because @@ -238,16 +234,15 @@ void Model100Side::sendLEDBank(uint8_t bank) { data[i + 1] = c; } - uint8_t result = writeData(data, ELEMENTS(data)); + uint8_t result = writeData(data, ELEMENTS(data)); } void Model100Side::setAllLEDsTo(cRGB color) { uint8_t data[] = {TWI_CMD_LED_SET_ALL_TO, color.b, color.g, - color.r - }; - uint8_t result = writeData(data, ELEMENTS(data)); + color.r}; + uint8_t result = writeData(data, ELEMENTS(data)); } void Model100Side::setOneLEDTo(uint8_t led, cRGB color) { @@ -255,14 +250,12 @@ void Model100Side::setOneLEDTo(uint8_t led, cRGB color) { led, color.b, color.g, - color.r - }; - uint8_t result = writeData(data, ELEMENTS(data)); - + color.r}; + uint8_t result = writeData(data, ELEMENTS(data)); } -} // namespace keyboardio -} // namespace driver -} // namespace kaleidoscope +} // namespace keyboardio +} // namespace driver +} // namespace kaleidoscope -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.h index edd92eb0..81b3fe64 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/Model100Side.h @@ -34,13 +34,14 @@ struct cRGB { uint8_t g; uint8_t r; }; -#define CRGB(r,g,b) (cRGB){b, g, r} +#define CRGB(r, g, b) \ + (cRGB) { b, g, r } #endif -#define LED_BANKS 4 +#define LED_BANKS 4 -#define LEDS_PER_HAND 32 -#define LED_BYTES_PER_BANK sizeof(cRGB) * LEDS_PER_HAND/LED_BANKS +#define LEDS_PER_HAND 32 +#define LED_BYTES_PER_BANK sizeof(cRGB) * LEDS_PER_HAND / LED_BANKS namespace kaleidoscope { namespace driver { @@ -98,15 +99,15 @@ class Model100Side { keydata_t keyData; // a value of 0 is "device seen" - anything else is how many cycles before we should // check for the device - uint16_t unavailable_device_check_countdown_ = 0; + uint16_t unavailable_device_check_countdown_ = 0; static const uint16_t UNAVAILABLE_DEVICE_COUNTDOWN_MAX = 0x00FFU; - byte nextLEDBank = 0; + byte nextLEDBank = 0; void sendLEDBank(byte bank); int readRegister(uint8_t cmd); - uint8_t writeData(uint8_t* data, uint8_t length); + uint8_t writeData(uint8_t *data, uint8_t length); }; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD -} // namespace keyboardio -} // namespace driver -} // namespace kaleidoscope +} // namespace keyboardio +} // namespace driver +} // namespace kaleidoscope diff --git a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/wire-protocol-constants.h b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/wire-protocol-constants.h index 67c4ca0b..df185fb2 100644 --- a/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/wire-protocol-constants.h +++ b/plugins/Kaleidoscope-Hardware-Keyboardio-Model100/src/kaleidoscope/driver/keyboardio/wire-protocol-constants.h @@ -22,22 +22,22 @@ #pragma once -#define TWI_CMD_NONE 0x00 -#define TWI_CMD_VERSION 0x01 -#define TWI_CMD_KEYSCAN_INTERVAL 0x02 -#define TWI_CMD_LED_SET_ALL_TO 0x03 -#define TWI_CMD_LED_SET_ONE_TO 0x04 -#define TWI_CMD_COLS_USE_PULLUPS 0x05 +#define TWI_CMD_NONE 0x00 +#define TWI_CMD_VERSION 0x01 +#define TWI_CMD_KEYSCAN_INTERVAL 0x02 +#define TWI_CMD_LED_SET_ALL_TO 0x03 +#define TWI_CMD_LED_SET_ONE_TO 0x04 +#define TWI_CMD_COLS_USE_PULLUPS 0x05 #define TWI_CMD_LED_SPI_FREQUENCY 0x06 -#define LED_SPI_FREQUENCY_4MHZ 0x07 -#define LED_SPI_FREQUENCY_2MHZ 0x06 -#define LED_SPI_FREQUENCY_1MHZ 0x05 -#define LED_SPI_FREQUENCY_512KHZ 0x04 -#define LED_SPI_FREQUENCY_256KHZ 0x03 -#define LED_SPI_FREQUENCY_128KHZ 0x02 -#define LED_SPI_FREQUENCY_64KHZ 0x01 -#define LED_SPI_OFF 0x00 +#define LED_SPI_FREQUENCY_4MHZ 0x07 +#define LED_SPI_FREQUENCY_2MHZ 0x06 +#define LED_SPI_FREQUENCY_1MHZ 0x05 +#define LED_SPI_FREQUENCY_512KHZ 0x04 +#define LED_SPI_FREQUENCY_256KHZ 0x03 +#define LED_SPI_FREQUENCY_128KHZ 0x02 +#define LED_SPI_FREQUENCY_64KHZ 0x01 +#define LED_SPI_OFF 0x00 // 512KHZ seems to be the sweet spot in early testing @@ -45,7 +45,7 @@ #define LED_SPI_FREQUENCY_DEFAULT LED_SPI_FREQUENCY_512KHZ -#define TWI_CMD_LED_BASE 0x80 +#define TWI_CMD_LED_BASE 0x80 -#define TWI_REPLY_NONE 0x00 -#define TWI_REPLY_KEYDATA 0x01 +#define TWI_REPLY_NONE 0x00 +#define TWI_REPLY_KEYDATA 0x01 diff --git a/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.cpp b/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.cpp index aec13aa9..6c69e907 100644 --- a/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.cpp +++ b/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.cpp @@ -27,7 +27,7 @@ // in the global namespace within the scope of this file. We'll use these // aliases to simplify some template initialization code below. using KeyScannerProps = typename kaleidoscope::device::olkb::PlanckProps::KeyScannerProps; -using KeyScanner = typename kaleidoscope::device::olkb::PlanckProps::KeyScanner; +using KeyScanner = typename kaleidoscope::device::olkb::PlanckProps::KeyScanner; namespace kaleidoscope { namespace device { @@ -45,7 +45,8 @@ constexpr uint8_t KeyScannerProps::matrix_col_pins[matrix_columns]; // `KeyScanner` here refers to the alias set up above, just like in the // `KeyScannerProps` case above. -template<> KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; +template<> +KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; // We set up the TIMER1 interrupt vector here. Due to dependency reasons, this // cannot be in a header-only driver, and must be placed here. @@ -59,9 +60,9 @@ ISR(TIMER1_OVF_vect) { Runtime.device().keyScanner().do_scan_ = true; } -} // namespace olkb -} // namespace device -} // namespace kaleidoscope +} // namespace olkb +} // namespace device +} // namespace kaleidoscope #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.h b/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.h index 6916b684..ec191ce5 100644 --- a/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.h +++ b/plugins/Kaleidoscope-Hardware-OLKB-Planck/src/kaleidoscope/device/olkb/Planck.h @@ -31,13 +31,13 @@ namespace olkb { struct PlanckProps : kaleidoscope::device::ATmega32U4KeyboardProps { struct KeyScannerProps : public kaleidoscope::driver::keyscanner::ATmegaProps { - static constexpr uint8_t matrix_rows = 4; + static constexpr uint8_t matrix_rows = 4; static constexpr uint8_t matrix_columns = 12; typedef MatrixAddr KeyAddr; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD - static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D5, PIN_B5, PIN_B6}; + static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D5, PIN_B5, PIN_B6}; static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_F0, PIN_F1, PIN_F4, PIN_F5, PIN_F6, PIN_F7, PIN_B3, PIN_B1, PIN_B0, PIN_D5, PIN_B7, PIN_C7}; -#endif // KALEIDOSCOPE_VIRTUAL_BUILD +#endif // KALEIDOSCOPE_VIRTUAL_BUILD }; typedef kaleidoscope::driver::keyscanner::ATmega KeyScanner; typedef kaleidoscope::driver::bootloader::avr::HalfKay Bootloader; @@ -45,8 +45,8 @@ struct PlanckProps : kaleidoscope::device::ATmega32U4KeyboardProps { }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -class Planck: public kaleidoscope::device::ATmega32U4Keyboard {}; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +class Planck : public kaleidoscope::device::ATmega32U4Keyboard {}; +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD /* Device definition omitted for virtual device builds. * We need to forward declare the device name, though, as there are * some legacy extern references to boards whose definition @@ -54,8 +54,9 @@ class Planck: public kaleidoscope::device::ATmega32U4Keyboard {}; */ class Planck; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, R0C10, R0C11, \ R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, \ @@ -66,6 +67,7 @@ class Planck; R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, \ R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, R2C7, R2C8, R2C9, R2C10, R2C11, \ R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 +// clang-format on } // namespace olkb } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.cpp b/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.cpp index 8d522429..4ac2c96a 100644 --- a/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.cpp +++ b/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.cpp @@ -34,7 +34,7 @@ // in the global namespace within the scope of this file. We'll use these // aliases to simplify some template initialization code below. using KeyScannerProps = typename kaleidoscope::device::softhruf::SplitographyProps::KeyScannerProps; -using KeyScanner = typename kaleidoscope::device::softhruf::SplitographyProps::KeyScanner; +using KeyScanner = typename kaleidoscope::device::softhruf::SplitographyProps::KeyScanner; namespace kaleidoscope { namespace device { @@ -52,7 +52,8 @@ constexpr uint8_t KeyScannerProps::matrix_col_pins[matrix_columns]; // `KeyScanner` here refers to the alias set up above, just like in the // `KeyScannerProps` case above. -template<> KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; +template<> +KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; // We set up the TIMER1 interrupt vector here. Due to dependency reasons, this // cannot be in a header-only driver, and must be placed here. @@ -66,9 +67,9 @@ ISR(TIMER1_OVF_vect) { Runtime.device().keyScanner().do_scan_ = true; } -} // namespace softhruf -} // namespace device -} // namespace kaleidoscope +} // namespace softhruf +} // namespace device +} // namespace kaleidoscope #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.h b/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.h index b513028c..706322c7 100644 --- a/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.h +++ b/plugins/Kaleidoscope-Hardware-SOFTHRUF-Splitography/src/kaleidoscope/device/softhruf/Splitography.h @@ -39,18 +39,18 @@ namespace device { namespace softhruf { struct SplitographyProps : kaleidoscope::device::ATmega32U4KeyboardProps { - struct MCUProps: kaleidoscope::driver::mcu::ATmega32U4Props { + struct MCUProps : kaleidoscope::driver::mcu::ATmega32U4Props { static constexpr bool disable_jtag = true; }; typedef kaleidoscope::driver::mcu::ATmega32U4 MCU; struct KeyScannerProps : public kaleidoscope::driver::keyscanner::ATmegaProps { - static constexpr uint8_t matrix_rows = 4; + static constexpr uint8_t matrix_rows = 4; static constexpr uint8_t matrix_columns = 12; typedef MatrixAddr KeyAddr; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD - static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D1, PIN_D2, PIN_D3}; - static constexpr uint8_t matrix_col_pins[matrix_columns] = { PIN_F0, PIN_F1, PIN_F4, PIN_F5, PIN_F6, PIN_F7, PIN_C7, PIN_C6, PIN_B6, PIN_B5, PIN_B4, PIN_D7 }; -#endif // KALEIDOSCOPE_VIRTUAL_BUILD + static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D1, PIN_D2, PIN_D3}; + static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_F0, PIN_F1, PIN_F4, PIN_F5, PIN_F6, PIN_F7, PIN_C7, PIN_C6, PIN_B6, PIN_B5, PIN_B4, PIN_D7}; +#endif // KALEIDOSCOPE_VIRTUAL_BUILD }; typedef kaleidoscope::driver::keyscanner::ATmega KeyScanner; typedef kaleidoscope::driver::bootloader::avr::FLIP BootLoader; @@ -58,15 +58,17 @@ struct SplitographyProps : kaleidoscope::device::ATmega32U4KeyboardProps { }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -class Splitography: public kaleidoscope::device::ATmega32U4Keyboard {}; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +class Splitography : public kaleidoscope::device::ATmega32U4Keyboard {}; +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD /* Device definition omitted for virtual device builds. * We need to forward declare the device name, though, as there are * some legacy extern references to boards whose definition * depends on this. */ class Splitography; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD + +// clang-format off #define PER_KEY_DATA(dflt, \ r0c0 ,r0c1 ,r0c2 ,r0c3 ,r0c4 ,r0c5 ,r0c6 ,r0c7 ,r0c8 ,r0c9 ,r0c10 ,r0c11 \ @@ -96,6 +98,8 @@ class Splitography; r2c0 ,r2c1 ,r2c2 ,r2c3 ,r2c4 ,r2c5 ,r2c6 ,r2c7 ,r2c8 ,r2c9 ,r2c10 ,r2c11, \ dflt ,dflt ,dflt ,dflt ,r3c4 ,r3c5 ,r3c6 ,r3c7 ,dflt ,dflt ,dflt ,dflt +// clang-format on + } // namespace softhruf } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/Kaleidoscope-Hardware-Technomancy-Atreus.h b/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/Kaleidoscope-Hardware-Technomancy-Atreus.h index 8d236e0d..7fd8ee9d 100644 --- a/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/Kaleidoscope-Hardware-Technomancy-Atreus.h +++ b/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/Kaleidoscope-Hardware-Technomancy-Atreus.h @@ -18,7 +18,7 @@ #pragma once -#if !defined(KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR) && \ +#if !defined(KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR) && \ !defined(KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR_DOWN) && \ !defined(KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_LEGACY_TEENSY2) #define KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR 1 diff --git a/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/kaleidoscope/device/technomancy/Atreus.cpp b/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/kaleidoscope/device/technomancy/Atreus.cpp index e424a18b..b6149019 100644 --- a/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/kaleidoscope/device/technomancy/Atreus.cpp +++ b/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/kaleidoscope/device/technomancy/Atreus.cpp @@ -36,7 +36,7 @@ // in the global namespace within the scope of this file. We'll use these // aliases to simplify some template initialization code below. using KeyScannerProps = typename kaleidoscope::device::technomancy::AtreusProps::KeyScannerProps; -using KeyScanner = typename kaleidoscope::device::technomancy::AtreusProps::KeyScanner; +using KeyScanner = typename kaleidoscope::device::technomancy::AtreusProps::KeyScanner; namespace kaleidoscope { @@ -55,7 +55,8 @@ constexpr uint8_t KeyScannerProps::matrix_col_pins[matrix_columns]; // `KeyScanner` here refers to the alias set up above, just like in the // `KeyScannerProps` case above. -template<> KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; +template<> +KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; // We set up the TIMER1 interrupt vector here. Due to dependency reasons, this // cannot be in a header-only driver, and must be placed here. @@ -69,9 +70,9 @@ ISR(TIMER1_OVF_vect) { Runtime.device().keyScanner().do_scan_ = true; } -} // namespace technomancy -} // namespace device -} // namespace kaleidoscope +} // namespace technomancy +} // namespace device +} // namespace kaleidoscope #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/kaleidoscope/device/technomancy/Atreus.h b/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/kaleidoscope/device/technomancy/Atreus.h index c1c51b76..35a40683 100644 --- a/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/kaleidoscope/device/technomancy/Atreus.h +++ b/plugins/Kaleidoscope-Hardware-Technomancy-Atreus/src/kaleidoscope/device/technomancy/Atreus.h @@ -40,28 +40,28 @@ namespace technomancy { struct AtreusProps : kaleidoscope::device::ATmega32U4KeyboardProps { struct KeyScannerProps : public kaleidoscope::driver::keyscanner::ATmegaProps { - static constexpr uint8_t matrix_rows = 4; + static constexpr uint8_t matrix_rows = 4; static constexpr uint8_t matrix_columns = 12; typedef MatrixAddr KeyAddr; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #ifdef KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR - static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D1, PIN_D3, PIN_D2}; + static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D1, PIN_D3, PIN_D2}; static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_D7, PIN_C6, PIN_B5, PIN_B4, PIN_E6, PIN_D4, PIN_B6, PIN_F6, PIN_F7, PIN_D6, PIN_B7}; #endif #ifdef KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR_DOWN - static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D1, PIN_D3, PIN_D2}; + static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D1, PIN_D3, PIN_D2}; static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_B7, PIN_D6, PIN_F7, PIN_F6, PIN_B6, PIN_D4, PIN_E6, PIN_B4, PIN_B5, PIN_C6, PIN_D7}; #endif #ifdef KALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_LEGACY_TEENSY2 - static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D1, PIN_D2, PIN_D3}; + static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_D0, PIN_D1, PIN_D2, PIN_D3}; static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_F6, PIN_F5, PIN_F4, PIN_B7, PIN_B6, PIN_B5, PIN_B4, PIN_B3, PIN_B2, PIN_B1, PIN_B0}; #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD }; typedef kaleidoscope::driver::keyscanner::ATmega KeyScanner; @@ -75,15 +75,17 @@ struct AtreusProps : kaleidoscope::device::ATmega32U4KeyboardProps { }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -class Atreus: public kaleidoscope::device::ATmega32U4Keyboard {}; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +class Atreus : public kaleidoscope::device::ATmega32U4Keyboard {}; +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD /* Device definition omitted for virtual device builds. * We need to forward declare the device name, though, as there are * some legacy extern references to boards whose definition * depends on this. */ class Atreus; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD + +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C7, R0C8, R0C9, R0C10, R0C11, \ @@ -113,6 +115,8 @@ class Atreus; R2C0, R2C1, R2C2, R2C3, R2C4, R3C5, R2C7, R2C8, R2C9, R2C10, R2C11, \ R3C0, R3C1, R3C2, R3C3, R3C4, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 +// clang-format on + } // namespace technomancy } // namespace device diff --git a/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.cpp b/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.cpp index a2d67ffa..09131d2e 100644 --- a/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.cpp +++ b/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.cpp @@ -27,7 +27,7 @@ // in the global namespace within the scope of this file. We'll use these // aliases to simplify some template initialization code below. using KeyScannerProps = typename kaleidoscope::device::gheavy::ButterStickProps::KeyScannerProps; -using KeyScanner = typename kaleidoscope::device::gheavy::ButterStickProps::KeyScanner; +using KeyScanner = typename kaleidoscope::device::gheavy::ButterStickProps::KeyScanner; namespace kaleidoscope { namespace device { @@ -45,7 +45,8 @@ constexpr uint8_t KeyScannerProps::matrix_col_pins[matrix_columns]; // `KeyScanner` here refers to the alias set up above, just like in the // `KeyScannerProps` case above. -template<> KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; +template<> +KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; // We set up the TIMER1 interrupt vector here. Due to dependency reasons, this // cannot be in a header-only driver, and must be placed here. @@ -59,9 +60,9 @@ ISR(TIMER1_OVF_vect) { Runtime.device().keyScanner().do_scan_ = true; } -} // namespace gheavy -} // namespace device -} // namespace kaleidoscope +} // namespace gheavy +} // namespace device +} // namespace kaleidoscope #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.h b/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.h index 9cc5a0cb..1b804fbe 100644 --- a/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.h +++ b/plugins/Kaleidoscope-Hardware-gHeavy-ButterStick/src/kaleidoscope/device/gheavy/ButterStick.h @@ -33,13 +33,13 @@ namespace gheavy { struct ButterStickProps : kaleidoscope::device::ATmega32U4KeyboardProps { struct KeyScannerProps : public kaleidoscope::driver::keyscanner::ATmegaProps { - static constexpr uint8_t matrix_rows = 2; + static constexpr uint8_t matrix_rows = 2; static constexpr uint8_t matrix_columns = 10; typedef MatrixAddr KeyAddr; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD - static constexpr uint8_t matrix_row_pins[matrix_rows] = { PIN_F4, PIN_F5 }; - static constexpr uint8_t matrix_col_pins[matrix_columns] = { PIN_B0, PIN_B1, PIN_B2, PIN_B3, PIN_B4, PIN_B5, PIN_B6, PIN_B7, PIN_C6, PIN_C7 }; -#endif // KALEIDOSCOPE_VIRTUAL_BUILD + static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_F4, PIN_F5}; + static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_B0, PIN_B1, PIN_B2, PIN_B3, PIN_B4, PIN_B5, PIN_B6, PIN_B7, PIN_C6, PIN_C7}; +#endif // KALEIDOSCOPE_VIRTUAL_BUILD }; typedef kaleidoscope::driver::keyscanner::ATmega KeyScanner; typedef kaleidoscope::driver::bootloader::avr::FLIP Bootloader; @@ -47,8 +47,8 @@ struct ButterStickProps : kaleidoscope::device::ATmega32U4KeyboardProps { }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -class ButterStick: public kaleidoscope::device::ATmega32U4Keyboard {}; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +class ButterStick : public kaleidoscope::device::ATmega32U4Keyboard {}; +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD /* Device definition omitted for virtual device builds. * We need to forward declare the device name, though, as there are * some legacy extern references to boards whose definition @@ -56,19 +56,22 @@ class ButterStick: public kaleidoscope::device::ATmega32U4Keyboard KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; +template<> +KeyScanner::row_state_t KeyScanner::matrix_state_[KeyScannerProps::matrix_rows] = {}; // We set up the TIMER1 interrupt vector here. Due to dependency reasons, this // cannot be in a header-only driver, and must be placed here. @@ -59,9 +60,9 @@ ISR(TIMER1_OVF_vect) { Runtime.device().keyScanner().do_scan_ = true; } -} // namespace gheavy -} // namespace device -} // namespace kaleidoscope +} // namespace gheavy +} // namespace device +} // namespace kaleidoscope #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/plugins/Kaleidoscope-Hardware-gHeavy-FaunchPad/src/kaleidoscope/device/gheavy/FaunchPad.h b/plugins/Kaleidoscope-Hardware-gHeavy-FaunchPad/src/kaleidoscope/device/gheavy/FaunchPad.h index dfb85663..fb5180f0 100644 --- a/plugins/Kaleidoscope-Hardware-gHeavy-FaunchPad/src/kaleidoscope/device/gheavy/FaunchPad.h +++ b/plugins/Kaleidoscope-Hardware-gHeavy-FaunchPad/src/kaleidoscope/device/gheavy/FaunchPad.h @@ -33,13 +33,13 @@ namespace gheavy { struct FaunchPadProps : kaleidoscope::device::ATmega32U4KeyboardProps { struct KeyScannerProps : public kaleidoscope::driver::keyscanner::ATmegaProps { - static constexpr uint8_t matrix_rows = 2; + static constexpr uint8_t matrix_rows = 2; static constexpr uint8_t matrix_columns = 4; typedef MatrixAddr KeyAddr; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD - static constexpr uint8_t matrix_row_pins[matrix_rows] = { PIN_F4, PIN_F5 }; - static constexpr uint8_t matrix_col_pins[matrix_columns] = { PIN_B3, PIN_B2, PIN_B1, PIN_B0 }; -#endif // KALEIDOSCOPE_VIRTUAL_BUILD + static constexpr uint8_t matrix_row_pins[matrix_rows] = {PIN_F4, PIN_F5}; + static constexpr uint8_t matrix_col_pins[matrix_columns] = {PIN_B3, PIN_B2, PIN_B1, PIN_B0}; +#endif // KALEIDOSCOPE_VIRTUAL_BUILD }; typedef kaleidoscope::driver::keyscanner::ATmega KeyScanner; typedef kaleidoscope::driver::bootloader::avr::FLIP Bootloader; @@ -47,8 +47,8 @@ struct FaunchPadProps : kaleidoscope::device::ATmega32U4KeyboardProps { }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -class FaunchPad: public kaleidoscope::device::ATmega32U4Keyboard {}; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +class FaunchPad : public kaleidoscope::device::ATmega32U4Keyboard {}; +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD /* Device definition omitted for virtual device builds. * We need to forward declare the device name, though, as there are * some legacy extern references to boards whose definition @@ -56,18 +56,21 @@ class FaunchPad: public kaleidoscope::device::ATmega32U4Keyboard */ class FaunchPad; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +// clang-format off #define PER_KEY_DATA(dflt, \ R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7 \ ) \ R0C0, R0C1, R0C2, R0C3, \ R0C4, R0C5, R0C6, R0C7 -} // namespace gheavy -} // namespace device +// clang-format on + +} // namespace gheavy +} // namespace device EXPORT_DEVICE(kaleidoscope::device::gheavy::FaunchPad) -} // namespace kaleidoscope +} // namespace kaleidoscope #endif diff --git a/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.cpp b/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.cpp index 313b1e33..6f0d9436 100644 --- a/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.cpp +++ b/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.cpp @@ -16,7 +16,7 @@ #include "kaleidoscope/plugin/HardwareTestMode.h" -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for MatrixAddr #include "kaleidoscope/Runtime.h" // for Runtime @@ -41,7 +41,7 @@ void HardwareTestMode::waitForKeypress() { while (1) { Runtime.device().readMatrix(); if (Runtime.device().isKeyswitchPressed(actionKey) && - ! Runtime.device().wasKeyswitchPressed(actionKey)) { + !Runtime.device().wasKeyswitchPressed(actionKey)) { break; } } @@ -54,9 +54,9 @@ void HardwareTestMode::setLeds(cRGB color) { } void HardwareTestMode::testLeds(void) { - constexpr cRGB red = CRGB(255, 0, 0); - constexpr cRGB blue = CRGB(0, 0, 255); - constexpr cRGB green = CRGB(0, 255, 0); + constexpr cRGB red = CRGB(255, 0, 0); + constexpr cRGB blue = CRGB(0, 0, 255); + constexpr cRGB green = CRGB(0, 255, 0); constexpr cRGB brightWhite = CRGB(160, 160, 160); // rainbow for 10 seconds @@ -75,18 +75,16 @@ void HardwareTestMode::testLeds(void) { setLeds(blue); setLeds(green); setLeds(red); - } - void HardwareTestMode::testMatrix() { // Reset bad keys from previous tests. chatter_data state[Runtime.device().numKeys()] = {{0, 0, 0}}; - constexpr cRGB red = CRGB(201, 0, 0); - constexpr cRGB blue = CRGB(0, 0, 201); - constexpr cRGB green = CRGB(0, 201, 0); + constexpr cRGB red = CRGB(201, 0, 0); + constexpr cRGB blue = CRGB(0, 0, 201); + constexpr cRGB green = CRGB(0, 201, 0); constexpr cRGB yellow = CRGB(201, 100, 0); while (1) { @@ -95,7 +93,7 @@ void HardwareTestMode::testMatrix() { uint8_t keynum = key_addr.toInt(); // If the key is toggled on - if (Runtime.device().isKeyswitchPressed(key_addr) && ! Runtime.device().wasKeyswitchPressed(key_addr)) { + if (Runtime.device().isKeyswitchPressed(key_addr) && !Runtime.device().wasKeyswitchPressed(key_addr)) { // And it's too soon (in terms of cycles between changes) state[keynum].tested = 1; if (state[keynum].cyclesSinceStateChange < CHATTER_CYCLE_LIMIT) { @@ -113,7 +111,7 @@ void HardwareTestMode::testMatrix() { Runtime.device().setCrgbAt(key_addr, red); } else if (state[keynum].tested == 0) { Runtime.device().setCrgbAt(key_addr, yellow); - } else if (! Runtime.device().isKeyswitchPressed(key_addr)) { + } else if (!Runtime.device().isKeyswitchPressed(key_addr)) { // If the key is not currently pressed and was not just released and is not marked bad Runtime.device().setCrgbAt(key_addr, blue); } diff --git a/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.h b/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.h index ba9e1207..a765863e 100644 --- a/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.h +++ b/plugins/Kaleidoscope-HardwareTestMode/src/kaleidoscope/plugin/HardwareTestMode.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/device/device.h" // for cRGB #include "kaleidoscope/plugin.h" // for Plugin @@ -26,11 +26,10 @@ namespace plugin { class HardwareTestMode : public kaleidoscope::Plugin { public: - typedef struct { uint8_t bad : 1, - tested : 1, - cyclesSinceStateChange: 6; + tested : 1, + cyclesSinceStateChange : 6; } chatter_data; static uint8_t actionKey; @@ -38,6 +37,7 @@ class HardwareTestMode : public kaleidoscope::Plugin { static void runTests(); static void setActionKey(uint8_t key); + private: static void testLeds(); static void testMatrix(); diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp index 28e3a4b9..74abad5e 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.cpp @@ -17,8 +17,8 @@ #include "kaleidoscope/plugin/Heatmap.h" -#include // for pgm_read_byte, PROGMEM -#include // for uint16_t, uint8_t +#include // for pgm_read_byte, PROGMEM +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, MatrixAdd... #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -36,19 +36,18 @@ namespace plugin { static const cRGB heat_colors_default_[] PROGMEM = {{0, 0, 0}, {25, 255, 25}, {25, 255, 255}, {25, 25, 255}}; // colors from cold to hot -const cRGB *Heatmap::heat_colors = heat_colors_default_; +const cRGB *Heatmap::heat_colors = heat_colors_default_; uint8_t Heatmap::heat_colors_length = 4; // number of millisecond to wait between each heatmap computation uint16_t Heatmap::update_delay = 1000; Heatmap::TransientLEDMode::TransientLEDMode(const Heatmap *parent) - : // store the number of times each key has been strock + : // store the number of times each key has been strock heatmap_{}, // max of heatmap_ (we divide by it so we start at 1) highest_(1), // last heatmap computation time - last_heatmap_comp_time_(Runtime.millisAtCycleStart()) -{} + last_heatmap_comp_time_(Runtime.millisAtCycleStart()) {} cRGB Heatmap::TransientLEDMode::computeColor(float v) { // compute the color corresponding to a value between 0 and 1 @@ -98,7 +97,7 @@ cRGB Heatmap::TransientLEDMode::computeColor(float v) { // static_cast(5.9) → 5 idx1 = static_cast(val); idx2 = idx1 + 1; - fb = val - static_cast(idx1); + fb = val - static_cast(idx1); } uint8_t r = static_cast((pgm_read_byte(&(heat_colors[idx2].r)) - pgm_read_byte(&(heat_colors[idx1].r))) * fb + pgm_read_byte(&(heat_colors[idx1].r))); diff --git a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h index d818939d..24b92c2d 100644 --- a/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h +++ b/plugins/Kaleidoscope-Heatmap/src/kaleidoscope/plugin/Heatmap.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/Runtime.h" // for Runtime, Run... @@ -31,8 +31,8 @@ namespace kaleidoscope { namespace plugin { class Heatmap : public Plugin, - public LEDModeInterface, - public AccessTransientLEDMode { + public LEDModeInterface, + public AccessTransientLEDMode { public: Heatmap(void) {} @@ -48,7 +48,6 @@ class Heatmap : public Plugin, // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. @@ -60,11 +59,9 @@ class Heatmap : public Plugin, EventHandlerResult beforeEachCycle(); protected: - void update() final; private: - uint16_t heatmap_[Runtime.device().numKeys()]; uint16_t highest_; uint16_t last_heatmap_comp_time_; diff --git a/plugins/Kaleidoscope-HostOS/src/Kaleidoscope-HostOS.h b/plugins/Kaleidoscope-HostOS/src/Kaleidoscope-HostOS.h index d614d8f9..e552024e 100644 --- a/plugins/Kaleidoscope-HostOS/src/Kaleidoscope-HostOS.h +++ b/plugins/Kaleidoscope-HostOS/src/Kaleidoscope-HostOS.h @@ -18,4 +18,4 @@ #pragma once #include "kaleidoscope/plugin/HostOS-Focus.h" // IWYU pragma: export -#include "kaleidoscope/plugin/HostOS.h" // IWYU pragma: export +#include "kaleidoscope/plugin/HostOS.h" // IWYU pragma: export diff --git a/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.cpp b/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.cpp index 2ae95b1d..58d60ba4 100644 --- a/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.cpp +++ b/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS-Focus.cpp @@ -17,9 +17,9 @@ #include "kaleidoscope/plugin/HostOS-Focus.h" -#include // for PSTR, strcmp_P -#include // for Focus, FocusSerial -#include // for uint8_t +#include // for PSTR, strcmp_P +#include // for Focus, FocusSerial +#include // for uint8_t #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/plugin/HostOS.h" // for HostOS, Type @@ -40,7 +40,7 @@ EventHandlerResult FocusHostOSCommand::onFocusEvent(const char *command) { } else { uint8_t new_os; ::Focus.read(new_os); - ::HostOS.os((hostos::Type) new_os); + ::HostOS.os((hostos::Type)new_os); } return EventHandlerResult::EVENT_CONSUMED; diff --git a/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS.cpp b/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS.cpp index bf5f4661..4eb9dc86 100644 --- a/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS.cpp +++ b/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS.cpp @@ -17,7 +17,7 @@ #include "kaleidoscope/plugin/HostOS.h" -#include // for EEPROMSettings +#include // for EEPROMSettings #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for VirtualProps::Storage diff --git a/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS.h b/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS.h index 008270f8..1748941b 100644 --- a/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS.h +++ b/plugins/Kaleidoscope-HostOS/src/kaleidoscope/plugin/HostOS.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/plugin.h" // for Plugin @@ -34,7 +34,7 @@ typedef enum { OTHER, UNKNOWN = 0xff, - AUTO = UNKNOWN + AUTO = UNKNOWN } Type; } diff --git a/plugins/Kaleidoscope-HostPowerManagement/src/kaleidoscope/plugin/HostPowerManagement.cpp b/plugins/Kaleidoscope-HostPowerManagement/src/kaleidoscope/plugin/HostPowerManagement.cpp index 9218fa4e..8a2b8fa8 100644 --- a/plugins/Kaleidoscope-HostPowerManagement/src/kaleidoscope/plugin/HostPowerManagement.cpp +++ b/plugins/Kaleidoscope-HostPowerManagement/src/kaleidoscope/plugin/HostPowerManagement.cpp @@ -18,7 +18,7 @@ #include "kaleidoscope/plugin/HostPowerManagement.h" #include // IWYU pragma: keep -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -29,7 +29,7 @@ extern uint8_t _usbSuspendState; namespace kaleidoscope { namespace plugin { -bool HostPowerManagement::was_suspended_ = false; +bool HostPowerManagement::was_suspended_ = false; bool HostPowerManagement::initial_suspend_ = true; EventHandlerResult HostPowerManagement::beforeEachCycle() { diff --git a/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.cpp b/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.cpp index 2a0decae..9d1d1b36 100644 --- a/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.cpp +++ b/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.cpp @@ -18,10 +18,10 @@ #include "kaleidoscope/plugin/IdleLEDs.h" -#include // for F, PSTR, __FlashStrin... -#include // for EEPROMSettings -#include // for Focus, FocusSerial -#include // for uint32_t, uint16_t +#include // for F, PSTR, __FlashStrin... +#include // for EEPROMSettings +#include // for Focus, FocusSerial +#include // for uint32_t, uint16_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ @@ -32,7 +32,7 @@ namespace kaleidoscope { namespace plugin { -uint32_t IdleLEDs::idle_time_limit = 600000; // 10 minutes +uint32_t IdleLEDs::idle_time_limit = 600000; // 10 minutes uint32_t IdleLEDs::start_time_ = 0; bool IdleLEDs::idle_; diff --git a/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.h b/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.h index 310b895a..a3b7626a 100644 --- a/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.h +++ b/plugins/Kaleidoscope-IdleLEDs/src/kaleidoscope/plugin/IdleLEDs.h @@ -18,7 +18,7 @@ #pragma once -#include // for uint32_t, uint16_t +#include // for uint32_t, uint16_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -27,7 +27,7 @@ namespace kaleidoscope { namespace plugin { -class IdleLEDs: public kaleidoscope::Plugin { +class IdleLEDs : public kaleidoscope::Plugin { public: IdleLEDs(void) {} @@ -51,6 +51,7 @@ class PersistentIdleLEDs : public IdleLEDs { EventHandlerResult onFocusEvent(const char *command); static void setIdleTimeoutSeconds(uint32_t new_limit); + private: static uint16_t settings_base_; }; diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp index d9ec6d91..4e7f8ab7 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.cpp @@ -17,8 +17,8 @@ #include "kaleidoscope/plugin/LED-ActiveLayerColor.h" -#include // for pgm_read_byte -#include // for uint8_t +#include // for pgm_read_byte +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ @@ -34,8 +34,7 @@ const cRGB *LEDActiveLayerColorEffect::colormap_; LEDActiveLayerColorEffect::TransientLEDMode::TransientLEDMode( const LEDActiveLayerColorEffect *parent) : parent_(parent), - active_color_{0, 0, 0} -{} + active_color_{0, 0, 0} {} void LEDActiveLayerColorEffect::setColormap(const cRGB colormap[]) { colormap_ = colormap; diff --git a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h index bb0ae23b..927c6d51 100644 --- a/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h +++ b/plugins/Kaleidoscope-LED-ActiveLayerColor/src/kaleidoscope/plugin/LED-ActiveLayerColor.h @@ -28,8 +28,8 @@ namespace kaleidoscope { namespace plugin { class LEDActiveLayerColorEffect : public Plugin, - public LEDModeInterface, - public AccessTransientLEDMode { + public LEDModeInterface, + public AccessTransientLEDMode { public: LEDActiveLayerColorEffect(void) {} @@ -40,7 +40,6 @@ class LEDActiveLayerColorEffect : public Plugin, // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. @@ -48,12 +47,10 @@ class LEDActiveLayerColorEffect : public Plugin, explicit TransientLEDMode(const LEDActiveLayerColorEffect *parent); protected: - void onActivate(void) final; void refreshAt(KeyAddr key_addr) final; private: - const LEDActiveLayerColorEffect *parent_; cRGB active_color_; @@ -64,7 +61,6 @@ class LEDActiveLayerColorEffect : public Plugin, }; private: - static const cRGB *colormap_; }; diff --git a/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.cpp b/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.cpp index c44d2ff8..3a8bec01 100644 --- a/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.cpp +++ b/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.cpp @@ -17,8 +17,8 @@ #include "kaleidoscope/plugin/LED-ActiveModColor.h" -#include // for OneShot -#include // for OneShot_ActiveStickyKey +#include // for OneShot +#include // for OneShot_ActiveStickyKey #include "kaleidoscope/KeyAddr.h" // for KeyAddr, MatrixAddr #include "kaleidoscope/KeyAddrBitfield.h" // for KeyAddrBitfield, KeyA... @@ -37,14 +37,14 @@ KeyAddrBitfield ActiveModColorEffect::mod_key_bits_; bool ActiveModColorEffect::highlight_normal_modifiers_ = true; cRGB ActiveModColorEffect::highlight_color_ = CRGB(160, 160, 160); -cRGB ActiveModColorEffect::oneshot_color_ = CRGB(160, 160, 0); -cRGB ActiveModColorEffect::sticky_color_ = CRGB(160, 0, 0); +cRGB ActiveModColorEffect::oneshot_color_ = CRGB(160, 160, 0); +cRGB ActiveModColorEffect::sticky_color_ = CRGB(160, 0, 0); // ----------------------------------------------------------------------------- EventHandlerResult ActiveModColorEffect::onKeyEvent(KeyEvent &event) { // If `event.addr` is not a physical key address, ignore it: - if (! event.addr.isValid()) { + if (!event.addr.isValid()) { return EventHandlerResult::OK; } @@ -70,7 +70,7 @@ EventHandlerResult ActiveModColorEffect::onKeyEvent(KeyEvent &event) { mod_key_bits_.set(entry_addr); } } - } else { // if (keyToggledOff(event.state)) + } else { // if (keyToggledOff(event.state)) // Things get a bit ugly here because this plugin might come before OneShot // in the order, so we can't just count on OneShot stopping the suppressed // release event before we see it here. @@ -104,7 +104,7 @@ EventHandlerResult ActiveModColorEffect::beforeSyncingLeds() { return EventHandlerResult::OK; } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::ActiveModColorEffect ActiveModColorEffect; diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/Kaleidoscope-LED-AlphaSquare.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/Kaleidoscope-LED-AlphaSquare.h index 1e019cdf..c976bb6d 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/Kaleidoscope-LED-AlphaSquare.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/Kaleidoscope-LED-AlphaSquare.h @@ -17,6 +17,6 @@ #pragma once -#include "kaleidoscope/plugin/LED-AlphaSquare.h" // IWYU pragma: export -#include "kaleidoscope/plugin/LED-AlphaSquare/Effect.h" // IWYU pragma: export +#include "kaleidoscope/plugin/LED-AlphaSquare.h" // IWYU pragma: export +#include "kaleidoscope/plugin/LED-AlphaSquare/Effect.h" // IWYU pragma: export #include "kaleidoscope/plugin/LED-AlphaSquare/Symbols.h" // IWYU pragma: export diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.cpp b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.cpp index 2cb93e80..05a5b378 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.cpp +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.cpp @@ -17,14 +17,14 @@ #include "kaleidoscope/plugin/LED-AlphaSquare.h" -#include // for bitRead -#include // for uint16_t +#include // for bitRead +#include // for uint16_t -#include "kaleidoscope/KeyAddr.h" // for KeyAddr -#include "kaleidoscope/Runtime.h" // for Runtime -#include "kaleidoscope/device/device.h" // for cRGB -#include "kaleidoscope/key_defs.h" // for Key, Key_A -#include "kaleidoscope/plugin/LEDControl.h" // for LEDControl +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/Runtime.h" // for Runtime +#include "kaleidoscope/device/device.h" // for cRGB +#include "kaleidoscope/key_defs.h" // for Key, Key_A +#include "kaleidoscope/plugin/LEDControl.h" // for LEDControl #include "kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h" // for ALPHASQUAR... @@ -67,8 +67,7 @@ static const uint16_t alphabet[] PROGMEM = { ALPHASQUARE_SYMBOL_7, ALPHASQUARE_SYMBOL_8, ALPHASQUARE_SYMBOL_9, - ALPHASQUARE_SYMBOL_0 -}; + ALPHASQUARE_SYMBOL_0}; cRGB AlphaSquare::color = {0x80, 0x80, 0x80}; @@ -80,7 +79,7 @@ void AlphaSquare::display(Key key, KeyAddr key_addr, cRGB key_color) { if (key < Key_A || key > Key_0) return; - uint8_t index = key.getKeyCode() - Key_A.getKeyCode(); + uint8_t index = key.getKeyCode() - Key_A.getKeyCode(); uint16_t symbol = pgm_read_word(&alphabet[index]); display(symbol, key_addr, key_color); @@ -122,7 +121,7 @@ bool AlphaSquare::isSymbolPart(Key key, if (key < Key_A || key > Key_0) return false; - uint8_t index = key.getKeyCode() - Key_A.getKeyCode(); + uint8_t index = key.getKeyCode() - Key_A.getKeyCode(); uint16_t symbol = pgm_read_word(&alphabet[index]); return isSymbolPart(symbol, displayLedAddr, key_addr); diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.h index 845da0ef..73c7f5ab 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/key_defs.h" // for Key @@ -25,22 +25,23 @@ struct cRGB; +// clang-format off #define SYM4x4( \ p00, p01, p02, p03, \ p10, p11, p12, p13, \ p20, p21, p22, p23, \ - p30, p31, p32, p33) \ + p30, p31, p32, p33) \ (uint16_t) ( \ p00 << 0 | p01 << 1 | p02 << 2 | p03 << 3 | \ p10 << 4 | p11 << 5 | p12 << 6 | p13 << 7 | \ p20 << 8 | p21 << 9 | p22 << 10 | p23 << 11 | \ p30 << 12 | p31 << 13 | p32 << 14 | p33 << 15 ) +// clang-format on namespace kaleidoscope { namespace plugin { class AlphaSquare : public kaleidoscope::Plugin { public: - AlphaSquare(void) {} static void display(Key key, KeyAddr key_addr, cRGB key_color); diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp index 27f4809b..1a328c83 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp @@ -17,16 +17,16 @@ #include "kaleidoscope/plugin/LED-AlphaSquare/Effect.h" -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t -#include "kaleidoscope/KeyAddr.h" // for KeyAddr -#include "kaleidoscope/KeyEvent.h" // for KeyEvent -#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ -#include "kaleidoscope/device/device.h" // for Device, CRGB -#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult -#include "kaleidoscope/key_defs.h" // for Key, Key_NoKey, Key_0 -#include "kaleidoscope/keyswitch_state.h" // for keyIsInjected -#include "kaleidoscope/plugin/LEDControl.h" // for LEDControl +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ +#include "kaleidoscope/device/device.h" // for Device, CRGB +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/key_defs.h" // for Key, Key_NoKey, Key_0 +#include "kaleidoscope/keyswitch_state.h" // for keyIsInjected +#include "kaleidoscope/plugin/LEDControl.h" // for LEDControl #include "kaleidoscope/plugin/LED-AlphaSquare.h" // for AlphaSquare @@ -35,10 +35,9 @@ namespace plugin { uint16_t AlphaSquareEffect::length = 1000; -AlphaSquareEffect::TransientLEDMode::TransientLEDMode(AlphaSquareEffect */*parent*/) // NOLINT(readability/casting) +AlphaSquareEffect::TransientLEDMode::TransientLEDMode(AlphaSquareEffect * /*parent*/) // NOLINT(readability/casting) : last_key_left_(Key_NoKey), - last_key_right_(Key_NoKey) -{} + last_key_right_(Key_NoKey) {} void AlphaSquareEffect::TransientLEDMode::update(void) { if (!Runtime.has_leds) @@ -59,14 +58,14 @@ void AlphaSquareEffect::TransientLEDMode::update(void) { void AlphaSquareEffect::TransientLEDMode::refreshAt(KeyAddr key_addr) { bool timed_out; uint8_t display_col = 2; - Key key = last_key_left_; + Key key = last_key_left_; if (key_addr.col() < Runtime.device().matrix_columns / 2) { timed_out = Runtime.hasTimeExpired(start_time_left_, length); } else { - key = last_key_right_; + key = last_key_right_; display_col = 10; - timed_out = Runtime.hasTimeExpired(start_time_right_, length); + timed_out = Runtime.hasTimeExpired(start_time_right_, length); } if (!::AlphaSquare.isSymbolPart(key, KeyAddr(0, display_col), key_addr) || timed_out) @@ -90,18 +89,18 @@ EventHandlerResult AlphaSquareEffect::onKeyEvent(KeyEvent &event) { // return EventHandlerResult::OK; uint8_t display_col = 2; - auto this_led_mode = ::LEDControl.get_mode(); + auto this_led_mode = ::LEDControl.get_mode(); Key prev_key = this_led_mode->last_key_left_; if (event.addr.col() < Runtime.device().matrix_columns / 2) { - this_led_mode->last_key_left_ = event.key; + this_led_mode->last_key_left_ = event.key; this_led_mode->start_time_left_ = Runtime.millisAtCycleStart(); } else { - prev_key = this_led_mode->last_key_right_; - this_led_mode->last_key_right_ = event.key; + prev_key = this_led_mode->last_key_right_; + this_led_mode->last_key_right_ = event.key; this_led_mode->start_time_right_ = Runtime.millisAtCycleStart(); - display_col = 10; + display_col = 10; } if (prev_key != event.key) diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h index 0a657267..440fcd3f 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -31,8 +31,8 @@ namespace kaleidoscope { namespace plugin { class AlphaSquareEffect : public Plugin, - public LEDModeInterface, - public AccessTransientLEDMode { + public LEDModeInterface, + public AccessTransientLEDMode { public: AlphaSquareEffect(void) {} diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h index 2fae3bf0..74eb9982 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h @@ -14,6 +14,7 @@ * this program. If not, see . */ +// clang-format off #pragma once diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h index f33e3388..7a526a4d 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #ifndef KALEIDOSCOPE_LED_FONT diff --git a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h index 68361699..19851687 100644 --- a/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h +++ b/plugins/Kaleidoscope-LED-AlphaSquare/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/plugin/LED-AlphaSquare.h" // for SYM4x4 @@ -26,11 +26,14 @@ namespace plugin { namespace alpha_square { namespace symbols { +// clang-format off + /* λ */ static constexpr uint16_t Lambda = SYM4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1); +// clang-format on } // namespace symbols } // namespace alpha_square diff --git a/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.cpp b/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.cpp index ca5543d2..fb2cf695 100644 --- a/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.cpp +++ b/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/LED-Palette-Theme.h" -#include // for strcmp_P, PSTR -#include // for EEPROMSettings -#include // for Focus, FocusSerial -#include // for uint8_t, uint16_t +#include // for strcmp_P, PSTR +#include // for EEPROMSettings +#include // for Focus, FocusSerial +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ @@ -58,7 +58,7 @@ void LEDPaletteTheme::refreshAt(uint16_t theme_base, uint8_t theme, KeyAddr key_ return; uint16_t map_base = theme_base + (theme * Runtime.device().led_count / 2); - uint8_t pos = Runtime.device().getLedIndex(key_addr); + uint8_t pos = Runtime.device().getLedIndex(key_addr); cRGB color = lookupColorAtPosition(map_base, pos); ::LEDControl.setCrgbAt(key_addr, color); @@ -100,10 +100,10 @@ void LEDPaletteTheme::updateColorIndexAtPosition(uint16_t map_base, uint16_t pos indexes = Runtime.storage().read(map_base + position / 2); if (position % 2) { uint8_t other = indexes >> 4; - indexes = (other << 4) + color_index; + indexes = (other << 4) + color_index; } else { uint8_t other = indexes & ~0xf0; - indexes = (color_index << 4) + other; + indexes = (color_index << 4) + other; } Runtime.storage().update(map_base + position / 2, indexes); Runtime.storage().commit(); diff --git a/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.h b/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.h index 1558ca6c..1d764066 100644 --- a/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.h +++ b/plugins/Kaleidoscope-LED-Palette-Theme/src/kaleidoscope/plugin/LED-Palette-Theme.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/device/device.h" // for cRGB @@ -44,7 +44,8 @@ class LEDPaletteTheme : public kaleidoscope::Plugin { EventHandlerResult onFocusEvent(const char *command); EventHandlerResult themeFocusEvent(const char *command, const char *expected_command, - uint16_t theme_base, uint8_t max_themes); + uint16_t theme_base, + uint8_t max_themes); private: static uint16_t palette_base_; diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp index 1f1cb309..117745b9 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.cpp @@ -17,8 +17,8 @@ #include "kaleidoscope/plugin/LED-Stalker.h" -#include // for min -#include // for uint8_t, uint16_t +#include // for min +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, Key... #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -33,15 +33,13 @@ namespace plugin { StalkerEffect::ColorComputer *StalkerEffect::variant; uint16_t StalkerEffect::step_length = 50; -cRGB StalkerEffect::inactive_color = (cRGB) { - 0, 0, 0 -}; +cRGB StalkerEffect::inactive_color = (cRGB){ + 0, 0, 0}; StalkerEffect::TransientLEDMode::TransientLEDMode(const StalkerEffect *parent) : parent_(parent), step_start_time_(0), - map_{} -{} + map_{} {} EventHandlerResult StalkerEffect::onKeyEvent(KeyEvent &event) { if (!Runtime.has_leds) @@ -116,7 +114,7 @@ cRGB Haunt::compute(uint8_t *step) { BlazingTrail::BlazingTrail(void) { } constexpr uint8_t hue_start = 50.0 / 360 * 0xff; -constexpr uint8_t hue_end = 0; +constexpr uint8_t hue_end = 0; cRGB BlazingTrail::compute(uint8_t *step) { cRGB color; @@ -129,10 +127,10 @@ cRGB BlazingTrail::compute(uint8_t *step) { // Fade value from full following a 1-x^4 curve uint8_t val = - 0xff // Maximum brightness - - ((uint32_t) pos255 * pos255 * pos255 * pos255 // Animation position to 4th power - >> 24) // ...pulled down to 8-bit range (but this has a maximum of 0xfc rather than 0xff) - - pos255 / (0x100 / 4); // Correction to bring the end result into a full 0 to 0xff range + 0xff // Maximum brightness + - ((uint32_t)pos255 * pos255 * pos255 * pos255 // Animation position to 4th power + >> 24) // ...pulled down to 8-bit range (but this has a maximum of 0xfc rather than 0xff) + - pos255 / (0x100 / 4); // Correction to bring the end result into a full 0 to 0xff range color = hsvToRgb(hue, 0xff, val); diff --git a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h index 029820ae..2d70ed78 100644 --- a/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h +++ b/plugins/Kaleidoscope-LED-Stalker/src/kaleidoscope/plugin/LED-Stalker.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint8_t, uin... +#include // for uint8_t, uin... #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/Runtime.h" // for Runtime, Run... @@ -28,13 +28,13 @@ #include "kaleidoscope/plugin/LEDMode.h" // for LEDMode #include "kaleidoscope/plugin/LEDModeInterface.h" // for LEDModeInter... -#define STALKER(v, ...) ({static kaleidoscope::plugin::stalker::v _effect __VA_ARGS__; &_effect;}) +#define STALKER(v, ...) ({static kaleidoscope::plugin::stalker::v _effect __VA_ARGS__; &_effect; }) namespace kaleidoscope { namespace plugin { class StalkerEffect : public Plugin, - public LEDModeInterface, - public AccessTransientLEDMode { + public LEDModeInterface, + public AccessTransientLEDMode { public: class ColorComputer { public: @@ -53,7 +53,6 @@ class StalkerEffect : public Plugin, // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. @@ -61,11 +60,9 @@ class StalkerEffect : public Plugin, explicit TransientLEDMode(const StalkerEffect *parent); protected: - void update() final; private: - const StalkerEffect *parent_; uint16_t step_start_time_; @@ -80,9 +77,11 @@ namespace stalker { class Haunt : public StalkerEffect::ColorComputer { public: explicit Haunt(const cRGB highlight_color); - Haunt(void) : Haunt(CRGB(0x40, 0x80, 0x80)) {} + Haunt(void) + : Haunt(CRGB(0x40, 0x80, 0x80)) {} cRGB compute(uint8_t *step) final; + private: static cRGB highlight_color_; }; diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp index c5195187..51c14102 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp @@ -20,8 +20,8 @@ #include "kaleidoscope/plugin/LED-Wavepool.h" -#include // for pgm_read_byte -#include // for int8_t, uint8_t +#include // for pgm_read_byte +#include // for int8_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, Key... #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -35,26 +35,27 @@ namespace kaleidoscope { namespace plugin { -#define INTERPOLATE 1 // smoother, slower animation -#define MS_PER_FRAME 40 // 40 = 25 fps +#define INTERPOLATE 1 // smoother, slower animation +#define MS_PER_FRAME 40 // 40 = 25 fps #define FRAMES_PER_DROP 120 // max time between raindrops during idle animation -uint16_t WavepoolEffect::idle_timeout = 5000; // 5 seconds -int16_t WavepoolEffect::ripple_hue = WavepoolEffect::rainbow_hue; // automatic hue +uint16_t WavepoolEffect::idle_timeout = 5000; // 5 seconds +int16_t WavepoolEffect::ripple_hue = WavepoolEffect::rainbow_hue; // automatic hue // map native keyboard coordinates (16x4) into geometric space (14x5) PROGMEM const uint8_t WavepoolEffect::TransientLEDMode::rc2pos[Runtime.device().numKeys()] = { + // clang-format off 0, 1, 2, 3, 4, 5, 6, 59, 66, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 34, 60, 65, 35, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 48, 61, 64, 49, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 58, 62, 63, 67, 50, 51, 52, 53, 54, 55, + // clang-format on }; WavepoolEffect::TransientLEDMode::TransientLEDMode(const WavepoolEffect *parent) : frames_since_event_(0), surface_{}, - page_(0) -{} + page_(0) {} EventHandlerResult WavepoolEffect::onKeyEvent(KeyEvent &event) { if (!event.addr.isValid()) @@ -71,7 +72,7 @@ EventHandlerResult WavepoolEffect::TransientLEDMode::onKeyEvent(KeyEvent &event) // just the former. if (keyIsPressed(event.state)) { surface_[page_][pgm_read_byte(rc2pos + event.addr.toInt())] = 0x7f; - frames_since_event_ = 0; + frames_since_event_ = 0; } return EventHandlerResult::OK; @@ -91,7 +92,7 @@ void WavepoolEffect::TransientLEDMode::raindrop(uint8_t x, uint8_t y, int8_t *pa // and still looks random-ish uint8_t WavepoolEffect::TransientLEDMode::wp_rand() { static intptr_t offset = 0x400; - offset = ((offset + 1) & 0x4fff) | 0x400; + offset = ((offset + 1) & 0x4fff) | 0x400; return (Runtime.millisAtCycleStart() / MS_PER_FRAME) + pgm_read_byte((const uint8_t *)offset); } @@ -99,7 +100,7 @@ void WavepoolEffect::TransientLEDMode::update(void) { // limit the frame rate; one frame every 64 ms static uint8_t prev_time = 0; - uint8_t now = Runtime.millisAtCycleStart() / MS_PER_FRAME; + uint8_t now = Runtime.millisAtCycleStart() / MS_PER_FRAME; if (now != prev_time) { prev_time = now; } else { @@ -110,9 +111,9 @@ void WavepoolEffect::TransientLEDMode::update(void) { // (side note: it's weird that this is a 16-bit int instead of 8-bit, // but that's what the library function wants) static uint8_t current_hue = 0; - current_hue ++; + current_hue++; - frames_since_event_ ++; + frames_since_event_++; // needs two pages of height map to do the calculations int8_t *newpg = &surface_[page_ ^ 1][0]; @@ -120,8 +121,8 @@ void WavepoolEffect::TransientLEDMode::update(void) { // rain a bit while idle static uint8_t frames_till_next_drop = 0; - static int8_t prev_x = -1; - static int8_t prev_y = -1; + static int8_t prev_x = -1; + static int8_t prev_y = -1; #ifdef INTERPOLATE // even frames: water movement and page flipping // odd frames: raindrops and tweening @@ -135,11 +136,9 @@ void WavepoolEffect::TransientLEDMode::update(void) { raindrop(prev_x, prev_y, oldpg); prev_x = prev_y = -1; } - if (frames_since_event_ - >= (frames_till_next_drop - + (idle_timeout / MS_PER_FRAME))) { + if (frames_since_event_ >= (frames_till_next_drop + (idle_timeout / MS_PER_FRAME))) { frames_till_next_drop = 4 + (wp_rand() % FRAMES_PER_DROP); - frames_since_event_ = idle_timeout / MS_PER_FRAME; + frames_since_event_ = idle_timeout / MS_PER_FRAME; uint8_t x = wp_rand() % WP_WID; uint8_t y = wp_rand() % WP_HGT; @@ -162,11 +161,14 @@ void WavepoolEffect::TransientLEDMode::update(void) { uint8_t offset = (y * WP_WID) + x; int16_t value; - int8_t offsets[] = { -WP_WID, WP_WID, - -1, 1, - -WP_WID - 1, -WP_WID + 1, - WP_WID - 1, WP_WID + 1 - }; + int8_t offsets[] = { + // clang-format off + -WP_WID, WP_WID, + -1, 1, + -WP_WID - 1, -WP_WID + 1, + WP_WID - 1, WP_WID + 1 + // clang-format on + }; // don't wrap around edges or go out of bounds if (y == 0) { offsets[0] = 0; @@ -211,10 +213,10 @@ void WavepoolEffect::TransientLEDMode::update(void) { } #endif - uint8_t intensity = abs(height) * 2; + uint8_t intensity = abs(height) * 2; uint8_t saturation = 0xff - intensity; - uint8_t value = (intensity >= 128) ? 255 : intensity << 1; - int16_t hue = ripple_hue; + uint8_t value = (intensity >= 128) ? 255 : intensity << 1; + int16_t hue = ripple_hue; if (ripple_hue == WavepoolEffect::rainbow_hue) { // color starts white but gets dimmer and more saturated as it fades, @@ -234,7 +236,6 @@ void WavepoolEffect::TransientLEDMode::update(void) { // swap pages every frame page_ ^= 1; #endif - } } // namespace plugin diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h index 57bf753e..d640b8d3 100644 --- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h +++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.h @@ -20,8 +20,8 @@ #ifdef ARDUINO_AVR_MODEL01 -#include // for PROGMEM -#include // for uint8_t, int... +#include // for PROGMEM +#include // for uint8_t, int... #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/Runtime.h" // for Runtime, Run... @@ -38,8 +38,8 @@ namespace kaleidoscope { namespace plugin { class WavepoolEffect : public Plugin, - public LEDModeInterface, - public AccessTransientLEDMode { + public LEDModeInterface, + public AccessTransientLEDMode { public: WavepoolEffect(void) {} @@ -55,7 +55,6 @@ class WavepoolEffect : public Plugin, // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. @@ -65,11 +64,9 @@ class WavepoolEffect : public Plugin, EventHandlerResult onKeyEvent(KeyEvent &event); protected: - void update() final; private: - uint8_t frames_since_event_; int8_t surface_[2][WP_WID * WP_HGT]; uint8_t page_; diff --git a/plugins/Kaleidoscope-LEDEffect-BootAnimation/src/kaleidoscope/plugin/LEDEffect-BootAnimation.cpp b/plugins/Kaleidoscope-LEDEffect-BootAnimation/src/kaleidoscope/plugin/LEDEffect-BootAnimation.cpp index 0c3b2032..52525bb0 100644 --- a/plugins/Kaleidoscope-LEDEffect-BootAnimation/src/kaleidoscope/plugin/LEDEffect-BootAnimation.cpp +++ b/plugins/Kaleidoscope-LEDEffect-BootAnimation/src/kaleidoscope/plugin/LEDEffect-BootAnimation.cpp @@ -17,8 +17,8 @@ #include "Kaleidoscope/plugin/LEDEffect-BootAnimation.h" -#include // for PROGMEM, pgm_read_byte -#include // for uint16_t, uint8_t +#include // for PROGMEM, pgm_read_byte +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr, MatrixAddr #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ @@ -31,11 +31,11 @@ namespace kaleidoscope { namespace plugin { -bool BootAnimationEffect::done_ = false; -cRGB BootAnimationEffect::color = CRGB(150, 0, 0); -uint16_t BootAnimationEffect::start_time_ = 0; -uint16_t BootAnimationEffect::timeout = 1000; -uint8_t BootAnimationEffect::current_index_ = 0; +bool BootAnimationEffect::done_ = false; +cRGB BootAnimationEffect::color = CRGB(150, 0, 0); +uint16_t BootAnimationEffect::start_time_ = 0; +uint16_t BootAnimationEffect::timeout = 1000; +uint8_t BootAnimationEffect::current_index_ = 0; const uint8_t BootAnimationEffect::greeting_[11] PROGMEM = { Key_K.getKeyCode(), Key_E.getKeyCode(), @@ -47,8 +47,7 @@ const uint8_t BootAnimationEffect::greeting_[11] PROGMEM = { Key_D.getKeyCode(), Key_Period.getKeyCode(), Key_I.getKeyCode(), - Key_O.getKeyCode() -}; + Key_O.getKeyCode()}; EventHandlerResult BootAnimationEffect::onSetup() { return EventHandlerResult::OK; @@ -67,8 +66,8 @@ EventHandlerResult BootAnimationEffect::afterEachCycle() { for (auto key_addr : KeyAddr::all()) { Key k = Layer.lookupOnActiveLayer(key_addr); - Key g(pgm_read_byte(&greeting_[current_index_]), // key_code - 0); // flags + Key g(pgm_read_byte(&greeting_[current_index_]), // key_code + 0); // flags if (k == g) { key_addr_found = key_addr; diff --git a/plugins/Kaleidoscope-LEDEffect-BootAnimation/src/kaleidoscope/plugin/LEDEffect-BootAnimation.h b/plugins/Kaleidoscope-LEDEffect-BootAnimation/src/kaleidoscope/plugin/LEDEffect-BootAnimation.h index 16c67b59..d5070646 100644 --- a/plugins/Kaleidoscope-LEDEffect-BootAnimation/src/kaleidoscope/plugin/LEDEffect-BootAnimation.h +++ b/plugins/Kaleidoscope-LEDEffect-BootAnimation/src/kaleidoscope/plugin/LEDEffect-BootAnimation.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/plugin.h" // for Plugin diff --git a/plugins/Kaleidoscope-LEDEffect-BootGreeting/src/kaleidoscope/plugin/LEDEffect-BootGreeting.cpp b/plugins/Kaleidoscope-LEDEffect-BootGreeting/src/kaleidoscope/plugin/LEDEffect-BootGreeting.cpp index e414f311..9687a5b7 100644 --- a/plugins/Kaleidoscope-LEDEffect-BootGreeting/src/kaleidoscope/plugin/LEDEffect-BootGreeting.cpp +++ b/plugins/Kaleidoscope-LEDEffect-BootGreeting/src/kaleidoscope/plugin/LEDEffect-BootGreeting.cpp @@ -17,7 +17,7 @@ #include "kaleidoscope/plugin/LEDEffect-BootGreeting.h" -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr, Matrix... #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ @@ -34,10 +34,10 @@ namespace plugin { bool BootGreetingEffect::done_ = false; KeyAddr BootGreetingEffect::key_addr_; KeyAddr BootGreetingEffect::user_key_addr; -Key BootGreetingEffect::search_key = Key_LEDEffectNext; -uint8_t BootGreetingEffect::hue = 170; +Key BootGreetingEffect::search_key = Key_LEDEffectNext; +uint8_t BootGreetingEffect::hue = 170; uint16_t BootGreetingEffect::start_time = 0; -uint16_t BootGreetingEffect::timeout = 9200; +uint16_t BootGreetingEffect::timeout = 9200; BootGreetingEffect::BootGreetingEffect(KeyAddr key_addr) { user_key_addr = key_addr; @@ -46,7 +46,7 @@ BootGreetingEffect::BootGreetingEffect(KeyAddr key_addr) { void BootGreetingEffect::findLed(void) { if (user_key_addr.isValid()) { key_addr_ = user_key_addr; - done_ = true; + done_ = true; return; } diff --git a/plugins/Kaleidoscope-LEDEffect-BootGreeting/src/kaleidoscope/plugin/LEDEffect-BootGreeting.h b/plugins/Kaleidoscope-LEDEffect-BootGreeting/src/kaleidoscope/plugin/LEDEffect-BootGreeting.h index fe276f23..68646f5d 100644 --- a/plugins/Kaleidoscope-LEDEffect-BootGreeting/src/kaleidoscope/plugin/LEDEffect-BootGreeting.h +++ b/plugins/Kaleidoscope-LEDEffect-BootGreeting/src/kaleidoscope/plugin/LEDEffect-BootGreeting.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp index 14a823a3..73f3517f 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.cpp @@ -16,7 +16,7 @@ #include "kaleidoscope/plugin/LEDEffect-Breathe.h" -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for cRGB diff --git a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h index 255d8e2a..000670ae 100644 --- a/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h +++ b/plugins/Kaleidoscope-LEDEffect-Breathe/src/kaleidoscope/plugin/LEDEffect-Breathe.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/plugin.h" // for Plugin #include "kaleidoscope/plugin/LEDMode.h" // for LEDMode @@ -25,18 +25,17 @@ namespace kaleidoscope { namespace plugin { class LEDBreatheEffect : public Plugin, - public LEDModeInterface { + public LEDModeInterface { public: LEDBreatheEffect(void) {} - uint8_t hue = 170; + uint8_t hue = 170; uint8_t saturation = 255; // This class' instance has dynamic lifetime // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. @@ -48,11 +47,10 @@ class LEDBreatheEffect : public Plugin, void update(void) final; private: - const LEDBreatheEffect *parent_; static constexpr uint8_t update_interval_ = 50; - uint8_t last_update_ = 0; + uint8_t last_update_ = 0; }; }; diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp index ca556d46..a43697ab 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.cpp @@ -16,7 +16,7 @@ #include "kaleidoscope/plugin/LEDEffect-Chase.h" -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for CRGB, Device, Base<>::LE... diff --git a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h index f2739514..177367df 100644 --- a/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h +++ b/plugins/Kaleidoscope-LEDEffect-Chase/src/kaleidoscope/plugin/LEDEffect-Chase.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t, int8_t +#include // for uint8_t, int8_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/plugin.h" // for Plugin @@ -26,7 +26,7 @@ namespace kaleidoscope { namespace plugin { class LEDChaseEffect : public Plugin, - public LEDModeInterface { + public LEDModeInterface { public: LEDChaseEffect(void) {} @@ -47,7 +47,6 @@ class LEDChaseEffect : public Plugin, // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. @@ -56,20 +55,18 @@ class LEDChaseEffect : public Plugin, : parent_(parent), last_update_(Runtime.millisAtCycleStart()) {} protected: - void update() final; private: - const LEDChaseEffect *parent_; - uint8_t pos_ = uint8_t(0); + uint8_t pos_ = uint8_t(0); int8_t direction_ = 1; uint16_t last_update_; }; private: - uint8_t distance_ = 5; + uint8_t distance_ = 5; uint8_t update_delay_ = 150; }; diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp index 93780434..f64a3587 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.cpp @@ -16,8 +16,8 @@ #include "kaleidoscope/plugin/LEDEffect-Rainbow.h" -#include // for byte -#include // for uint8_t, uint16_t +#include // for byte +#include // for uint8_t, uint16_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for Base<>::LEDRang... diff --git a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h index 1ca99498..7daa8c6e 100644 --- a/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h +++ b/plugins/Kaleidoscope-LEDEffect-Rainbow/src/kaleidoscope/plugin/LEDEffect-Rainbow.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t, uint16_t +#include // for uint8_t, uint16_t #include "kaleidoscope/plugin.h" // for Plugin #include "kaleidoscope/plugin/LEDMode.h" // for LEDMode @@ -25,7 +25,7 @@ namespace kaleidoscope { namespace plugin { class LEDRainbowEffect : public Plugin, - public LEDModeInterface { + public LEDModeInterface { public: LEDRainbowEffect(void) {} @@ -42,7 +42,6 @@ class LEDRainbowEffect : public Plugin, // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. @@ -53,20 +52,19 @@ class LEDRainbowEffect : public Plugin, void update() final; private: - const LEDRainbowEffect *parent_; - uint16_t rainbow_hue = 0; // stores 0 to 614 + uint16_t rainbow_hue = 0; // stores 0 to 614 - uint8_t rainbow_steps = 1; // number of hues we skip in a 360 range per update + uint8_t rainbow_steps = 1; // number of hues we skip in a 360 range per update uint8_t rainbow_last_update = 0; uint8_t rainbow_saturation = 255; }; private: - uint8_t rainbow_update_delay = 40; // delay between updates (ms) - uint8_t rainbow_value = 50; + uint8_t rainbow_update_delay = 40; // delay between updates (ms) + uint8_t rainbow_value = 50; }; @@ -87,7 +85,6 @@ class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. @@ -98,19 +95,18 @@ class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface { void update() final; private: - const LEDRainbowWaveEffect *parent_; uint16_t rainbow_hue = 0; // stores 0 to 614 - uint8_t rainbow_wave_steps = 1; // number of hues we skip in a 360 range per update + uint8_t rainbow_wave_steps = 1; // number of hues we skip in a 360 range per update uint8_t rainbow_last_update = 0; uint8_t rainbow_saturation = 255; }; - uint8_t rainbow_update_delay = 40; // delay between updates (ms) - uint8_t rainbow_value = 50; + uint8_t rainbow_update_delay = 40; // delay between updates (ms) + uint8_t rainbow_value = 50; }; } // namespace plugin diff --git a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h index 79fcbd01..61bf95dd 100644 --- a/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h +++ b/plugins/Kaleidoscope-LEDEffect-SolidColor/src/kaleidoscope/plugin/LEDEffect-SolidColor.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/plugin.h" // for Plugin @@ -26,18 +26,15 @@ namespace kaleidoscope { namespace plugin { class LEDSolidColor : public Plugin, - public LEDModeInterface { + public LEDModeInterface { public: - LEDSolidColor(uint8_t r, uint8_t g, uint8_t b) - : r_(r), g_(g), b_(b) - {} + : r_(r), g_(g), b_(b) {} // This class' instance has dynamic lifetime // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. @@ -50,12 +47,10 @@ class LEDSolidColor : public Plugin, void refreshAt(KeyAddr key_addr) final; private: - const LEDSolidColor *parent_; }; private: - uint8_t r_, g_, b_; }; diff --git a/plugins/Kaleidoscope-LEDEffects/src/Kaleidoscope-LEDEffects.h b/plugins/Kaleidoscope-LEDEffects/src/Kaleidoscope-LEDEffects.h index fd0e6479..23fd9bbb 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/Kaleidoscope-LEDEffects.h +++ b/plugins/Kaleidoscope-LEDEffects/src/Kaleidoscope-LEDEffects.h @@ -17,6 +17,6 @@ #pragma once -#include "kaleidoscope/plugin/Jukebox.h" // IWYU pragma: export -#include "kaleidoscope/plugin/Miami.h" // IWYU pragma: export +#include "kaleidoscope/plugin/Jukebox.h" // IWYU pragma: export +#include "kaleidoscope/plugin/Miami.h" // IWYU pragma: export #include "kaleidoscope/plugin/TriColor.h" // IWYU pragma: export diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp index 7d6c2664..6ceddecb 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Jukebox.cpp @@ -20,10 +20,10 @@ #include "kaleidoscope/device/device.h" // for CRGB #include "kaleidoscope/plugin/TriColor.h" // for TriColor -kaleidoscope::plugin::TriColor JukeboxEffect(CRGB(0xc8, 0xe8, 0xee), /* TM */ - CRGB(0xc3, 0xee, 0x8c), /* VCO */ - CRGB(0x21, 0x38, 0xd7)); /* RN */ +kaleidoscope::plugin::TriColor JukeboxEffect(CRGB(0xc8, 0xe8, 0xee), /* TM */ + CRGB(0xc3, 0xee, 0x8c), /* VCO */ + CRGB(0x21, 0x38, 0xd7)); /* RN */ -kaleidoscope::plugin::TriColor JukeboxAlternateEffect(CRGB(0xc8, 0xe8, 0xee), /* TM */ - CRGB(0x21, 0x38, 0xd7), /* RN */ - CRGB(0xc3, 0xee, 0x8c)); /* VCO */ +kaleidoscope::plugin::TriColor JukeboxAlternateEffect(CRGB(0xc8, 0xe8, 0xee), /* TM */ + CRGB(0x21, 0x38, 0xd7), /* RN */ + CRGB(0xc3, 0xee, 0x8c)); /* VCO */ diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp index 72d15309..4d3799b1 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/Miami.cpp @@ -20,5 +20,5 @@ #include "kaleidoscope/device/device.h" // for CRGB #include "kaleidoscope/plugin/TriColor.h" // for TriColor -kaleidoscope::plugin::TriColor MiamiEffect(CRGB(0x4e, 0xd6, 0xd6), /* Cyan */ - CRGB(0xaf, 0x67, 0xfa)); /* Magenta */ +kaleidoscope::plugin::TriColor MiamiEffect(CRGB(0x4e, 0xd6, 0xd6), /* Cyan */ + CRGB(0xaf, 0x67, 0xfa)); /* Magenta */ diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp index b63d0b6e..e8ec2ed7 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.cpp @@ -28,8 +28,8 @@ namespace plugin { TriColor::TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) { base_color_ = base_color; - mod_color_ = mod_color; - esc_color_ = esc_color; + mod_color_ = mod_color; + esc_color_ = esc_color; } void TriColor::TransientLEDMode::update(void) { @@ -45,12 +45,12 @@ void TriColor::TransientLEDMode::update(void) { cRGB color = parent_->mod_color_; switch (k.getKeyCode()) { - case Key_A.getKeyCode() ... Key_0.getKeyCode(): + case Key_A.getKeyCode()... Key_0.getKeyCode(): case Key_Spacebar.getKeyCode(): - case Key_KeypadDivide.getKeyCode() ... Key_KeypadSubtract.getKeyCode(): - case Key_Keypad1.getKeyCode() ... Key_KeypadDot.getKeyCode(): - case Key_F1.getKeyCode() ... Key_F4.getKeyCode(): - case Key_F9.getKeyCode() ... Key_F12.getKeyCode(): + case Key_KeypadDivide.getKeyCode()... Key_KeypadSubtract.getKeyCode(): + case Key_Keypad1.getKeyCode()... Key_KeypadDot.getKeyCode(): + case Key_F1.getKeyCode()... Key_F4.getKeyCode(): + case Key_F9.getKeyCode()... Key_F12.getKeyCode(): color = parent_->base_color_; break; case Key_Escape.getKeyCode(): diff --git a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h index 4e4f92a1..02b74318 100644 --- a/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h +++ b/plugins/Kaleidoscope-LEDEffects/src/kaleidoscope/plugin/TriColor.h @@ -25,16 +25,16 @@ namespace kaleidoscope { namespace plugin { class TriColor : public Plugin, - public LEDModeInterface { + public LEDModeInterface { public: TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color); - TriColor(cRGB base_color, cRGB mod_color) : TriColor(base_color, mod_color, mod_color) {} + TriColor(cRGB base_color, cRGB mod_color) + : TriColor(base_color, mod_color, mod_color) {} // This class' instance has dynamic lifetime // class TransientLEDMode : public LEDMode { public: - // Please note that storing the parent ptr is only required // for those LED modes that require access to // members of their parent class. Most LED modes can do without. @@ -43,11 +43,9 @@ class TriColor : public Plugin, : parent_(parent) {} protected: - void update(void) final; private: - const TriColor *parent_; }; diff --git a/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp b/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp index 19667a9d..d86a2ad1 100644 --- a/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp +++ b/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp @@ -18,9 +18,9 @@ #include "kaleidoscope/plugin/LayerFocus.h" -#include // for PSTR, strcmp_P, F -#include // for Focus, FocusSerial -#include // for uint8_t +#include // for PSTR, strcmp_P, F +#include // for Focus, FocusSerial +#include // for uint8_t #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/layers.h" // for Layer, Layer_ diff --git a/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.h b/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.h index 323a0d92..eff6e7b3 100644 --- a/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.h +++ b/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.h @@ -24,7 +24,7 @@ namespace kaleidoscope { namespace plugin { -class LayerFocus: public kaleidoscope::Plugin { +class LayerFocus : public kaleidoscope::Plugin { public: LayerFocus() {} diff --git a/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp b/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp index b21d205a..34b19413 100644 --- a/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp +++ b/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/Leader.h" -#include // for F, __FlashStringHelper -#include // for Focus, FocusSerial -#include // for LEAD_FIRST, LEAD_LAST -#include // for uint16_t, uint8_t +#include // for F, __FlashStringHelper +#include // for Focus, FocusSerial +#include // for LEAD_FIRST, LEAD_LAST +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -47,16 +47,16 @@ const Leader::dictionary_t *Leader::dictionary; // --- helpers --- #define PARTIAL_MATCH -1 -#define NO_MATCH -2 +#define NO_MATCH -2 -#define isLeader(k) (k.getRaw() >= ranges::LEAD_FIRST && k.getRaw() <= ranges::LEAD_LAST) -#define isActive() (sequence_[0] != Key_NoKey) +#define isLeader(k) (k.getRaw() >= ranges::LEAD_FIRST && k.getRaw() <= ranges::LEAD_LAST) +#define isActive() (sequence_[0] != Key_NoKey) // --- actions --- int8_t Leader::lookup(void) { bool match; - for (uint8_t seq_index = 0; ; seq_index++) { + for (uint8_t seq_index = 0;; seq_index++) { match = true; if (dictionary[seq_index].sequence[0].readFromProgmem() == Key_NoKey) @@ -75,8 +75,7 @@ int8_t Leader::lookup(void) { if (!match) continue; - seq_key - = dictionary[seq_index].sequence[sequence_pos_ + 1].readFromProgmem(); + seq_key = dictionary[seq_index].sequence[sequence_pos_ + 1].readFromProgmem(); if (seq_key == Key_NoKey) { return seq_index; } else { @@ -91,7 +90,7 @@ int8_t Leader::lookup(void) { void Leader::reset(void) { sequence_pos_ = 0; - sequence_[0] = Key_NoKey; + sequence_[0] = Key_NoKey; } #ifndef NDEPRECATED @@ -118,8 +117,8 @@ EventHandlerResult Leader::onKeyswitchEvent(KeyEvent &event) { if (!isLeader(event.key)) return EventHandlerResult::OK; - start_time_ = Runtime.millisAtCycleStart(); - sequence_pos_ = 0; + start_time_ = Runtime.millisAtCycleStart(); + sequence_pos_ = 0; sequence_[sequence_pos_] = event.key; return EventHandlerResult::ABORT; @@ -131,9 +130,9 @@ EventHandlerResult Leader::onKeyswitchEvent(KeyEvent &event) { return EventHandlerResult::OK; } - start_time_ = Runtime.millisAtCycleStart(); + start_time_ = Runtime.millisAtCycleStart(); sequence_[sequence_pos_] = event.key; - int8_t action_index = lookup(); + int8_t action_index = lookup(); if (action_index == NO_MATCH) { reset(); @@ -143,7 +142,7 @@ EventHandlerResult Leader::onKeyswitchEvent(KeyEvent &event) { return EventHandlerResult::ABORT; } - action_t leaderAction = (action_t) pgm_read_ptr((void const **) & (dictionary[action_index].action)); + action_t leaderAction = (action_t)pgm_read_ptr((void const **)&(dictionary[action_index].action)); (*leaderAction)(action_index); reset(); diff --git a/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.h b/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.h index d865ebb7..7408118d 100644 --- a/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.h +++ b/plugins/Kaleidoscope-Leader/src/kaleidoscope/plugin/Leader.h @@ -17,37 +17,41 @@ #pragma once -#include // for LEAD_FIRST -#include // for NULL -#include // for uint16_t, uint8_t +#include // for LEAD_FIRST +#include // for NULL +#include // for uint16_t, uint8_t -#include "kaleidoscope/KeyEvent.h" // for KeyEvent -#include "kaleidoscope/KeyEventTracker.h" // for KeyEventTracker -#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult -#include "kaleidoscope/key_defs.h" // for Key, Key_NoKey -#include "kaleidoscope/plugin.h" // for Plugin +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/KeyEventTracker.h" // for KeyEventTracker +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/key_defs.h" // for Key, Key_NoKey +#include "kaleidoscope/plugin.h" // for Plugin // ----------------------------------------------------------------------------- // Deprecation warning messages #include "kaleidoscope_internal/deprecations.h" // for DEPRECATED -#define _DEPRECATED_MESSAGE_LEADER_INJECT \ - "The `Leader.inject()` function is deprecated. Please call\n" \ - "`kaleidoscope::Runtime.handleKeyEvent()` directly instead.\n" \ +#define _DEPRECATED_MESSAGE_LEADER_INJECT \ + "The `Leader.inject()` function is deprecated. Please call\n" \ + "`kaleidoscope::Runtime.handleKeyEvent()` directly instead.\n" \ "This function will be removed after 2022-09-01." -#define _DEPRECATED_MESSAGE_LEADER_TIME_OUT \ - "The `Leader.time_out` variable is deprecated. Please use the\n" \ - "`Leader.setTimeout()` function instead.\n" \ +#define _DEPRECATED_MESSAGE_LEADER_TIME_OUT \ + "The `Leader.time_out` variable is deprecated. Please use the\n" \ + "`Leader.setTimeout()` function instead.\n" \ "This variable will be removed after 2022-09-01." // ----------------------------------------------------------------------------- #define LEADER_MAX_SEQUENCE_LENGTH 4 -#define LEAD(n) kaleidoscope::plugin::LeaderKey(n) +#define LEAD(n) kaleidoscope::plugin::LeaderKey(n) -#define LEADER_SEQ(...) { __VA_ARGS__, Key_NoKey } -#define LEADER_DICT(...) { __VA_ARGS__, {{Key_NoKey}, NULL} } +#define LEADER_SEQ(...) \ + { __VA_ARGS__, Key_NoKey } +#define LEADER_DICT(...) \ + { \ + __VA_ARGS__, { {Key_NoKey}, NULL } \ + } namespace kaleidoscope { namespace plugin { diff --git a/plugins/Kaleidoscope-Macros/src/Kaleidoscope-Macros.h b/plugins/Kaleidoscope-Macros/src/Kaleidoscope-Macros.h index 8c134ace..b53ff62c 100644 --- a/plugins/Kaleidoscope-Macros/src/Kaleidoscope-Macros.h +++ b/plugins/Kaleidoscope-Macros/src/Kaleidoscope-Macros.h @@ -16,5 +16,5 @@ #pragma once -#include "kaleidoscope/plugin/Macros.h" // IWYU pragma: export +#include "kaleidoscope/plugin/Macros.h" // IWYU pragma: export #include "kaleidoscope/plugin/Macros/MacroKeyDefs.h" // IWYU pragma: export diff --git a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.cpp b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.cpp index 0be3b85a..5d5622f3 100644 --- a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.cpp +++ b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.cpp @@ -16,10 +16,10 @@ #include "kaleidoscope/plugin/Macros.h" -#include // for pgm_read_byte, delay -#include // for Focus, FocusSerial -#include // for MACRO_FIRST -#include // for uint8_t +#include // for pgm_read_byte, delay +#include // for Focus, FocusSerial +#include // for MACRO_FIRST +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -32,7 +32,8 @@ // ============================================================================= // Default `macroAction()` function definitions __attribute__((weak)) -const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { +const macro_t * +macroAction(uint8_t macro_id, KeyEvent &event) { return MACRO_NONE; } @@ -41,7 +42,7 @@ const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) { namespace kaleidoscope { namespace plugin { -constexpr uint8_t press_state = IS_PRESSED | INJECTED; +constexpr uint8_t press_state = IS_PRESSED | INJECTED; constexpr uint8_t release_state = WAS_PRESSED | INJECTED; // Initialized to zeroes (i.e. `Key_NoKey`) @@ -92,7 +93,7 @@ void Macros::tap(Key key) const { } void Macros::play(const macro_t *macro_p) { - macro_t macro = MACRO_ACTION_END; + macro_t macro = MACRO_ACTION_END; uint8_t interval = 0; Key key; @@ -300,7 +301,7 @@ EventHandlerResult Macros::onKeyEvent(KeyEvent &event) { uint8_t macro_id = event.key.getRaw() - ranges::MACRO_FIRST; // Call the new `macroAction(event)` function. - const macro_t* macro_ptr = macroAction(macro_id, event); + const macro_t *macro_ptr = macroAction(macro_id, event); // Play back the macro pointed to by `macroAction()` play(macro_ptr); @@ -346,7 +347,7 @@ EventHandlerResult Macros::onNameQuery() { return ::Focus.sendName(F("Macros")); } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::Macros Macros; diff --git a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.h b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.h index 755a1d7d..a5cfeaf7 100644 --- a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.h +++ b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "Kaleidoscope-Ranges.h" // for MACRO_FIRST, MACR... #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -27,7 +27,7 @@ // ============================================================================= // Define this function in a Kaleidoscope sketch in order to trigger Macros. -const macro_t* macroAction(uint8_t macro_id, KeyEvent &event); +const macro_t *macroAction(uint8_t macro_id, KeyEvent &event); // The number of simultaneously-active `Key` values that a macro can have // running during a call to `Macros.play()`. I don't know if it's actually @@ -42,7 +42,6 @@ namespace plugin { class Macros : public kaleidoscope::Plugin { public: - /// Send a key press event from a Macro /// /// Generates a new `KeyEvent` and calls `Runtime.handleKeyEvent()` with the @@ -71,17 +70,17 @@ class Macros : public kaleidoscope::Plugin { void tap(Key key) const; /// Play a macro sequence of key events - void play(const macro_t* macro_ptr); + void play(const macro_t *macro_ptr); // Templates provide a `type()` function that takes a variable number of // `char*` (string) arguments, in the form of a list of strings stored in // PROGMEM, of the form `Macros.type(PSTR("Hello "), PSTR("world!"))`. - inline const macro_t* type() const { + inline const macro_t *type() const { return MACRO_NONE; } - const macro_t* type(const char* string) const; - template - const macro_t* type(const char* first, Strings&&... strings) const { + const macro_t *type(const char *string) const; + template + const macro_t *type(const char *first, Strings &&...strings) const { type(first); return type(strings...); } @@ -105,7 +104,6 @@ class Macros : public kaleidoscope::Plugin { return true; return false; } - }; } // namespace plugin diff --git a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros/MacroKeyDefs.h b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros/MacroKeyDefs.h index a7c9d5cb..d55e5112 100644 --- a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros/MacroKeyDefs.h +++ b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros/MacroKeyDefs.h @@ -17,8 +17,8 @@ #pragma once -#include // for MACRO_FIRST -#include // for uint8_t +#include // for MACRO_FIRST +#include // for uint8_t #include "kaleidoscope/key_defs.h" // for Key diff --git a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros/MacroSteps.h b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros/MacroSteps.h index 81e7a05a..5c921ff3 100644 --- a/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros/MacroSteps.h +++ b/plugins/Kaleidoscope-Macros/src/kaleidoscope/plugin/Macros/MacroSteps.h @@ -45,38 +45,37 @@ typedef uint8_t macro_t; #define MACRO_NONE 0 -#define MACRO(...) ( \ - { \ - static const macro_t __m[] PROGMEM = { \ - __VA_ARGS__, \ - MACRO_ACTION_END \ - }; \ - &__m[0]; \ - }) - -#define I(n) MACRO_ACTION_STEP_INTERVAL, n -#define W(n) MACRO_ACTION_STEP_WAIT, n - -#define Kr(k) (k).getFlags(), (k).getKeyCode() -#define Kc(k) (Key_ ## k).getKeyCode() -#define K(k) Kr(Key_ ## k) - -#define Dr(k) MACRO_ACTION_STEP_KEYDOWN, Kr(k) -#define D(k) Dr(Key_ ## k) -#define Ur(k) MACRO_ACTION_STEP_KEYUP, Kr(k) -#define U(k) Ur(Key_ ## k) -#define Tr(k) MACRO_ACTION_STEP_TAP, Kr(k) -#define T(k) Tr(Key_ ## k) - -#define Dc(k) MACRO_ACTION_STEP_KEYCODEDOWN, Kc(k) -#define Uc(k) MACRO_ACTION_STEP_KEYCODEUP, Kc(k) -#define Tc(k) MACRO_ACTION_STEP_TAPCODE, Kc(k) - -#define SEQ(...) MACRO_ACTION_STEP_TAP_SEQUENCE, __VA_ARGS__, MACRO_ACTION_END, MACRO_ACTION_END -#define SEQc(...) MACRO_ACTION_STEP_TAP_CODE_SEQUENCE, __VA_ARGS__, MACRO_ACTION_END +#define MACRO(...) ( \ + { \ + static const macro_t __m[] PROGMEM = { \ + __VA_ARGS__, \ + MACRO_ACTION_END}; \ + &__m[0]; \ + }) + +#define I(n) MACRO_ACTION_STEP_INTERVAL, n +#define W(n) MACRO_ACTION_STEP_WAIT, n + +#define Kr(k) (k).getFlags(), (k).getKeyCode() +#define Kc(k) (Key_##k).getKeyCode() +#define K(k) Kr(Key_##k) + +#define Dr(k) MACRO_ACTION_STEP_KEYDOWN, Kr(k) +#define D(k) Dr(Key_##k) +#define Ur(k) MACRO_ACTION_STEP_KEYUP, Kr(k) +#define U(k) Ur(Key_##k) +#define Tr(k) MACRO_ACTION_STEP_TAP, Kr(k) +#define T(k) Tr(Key_##k) + +#define Dc(k) MACRO_ACTION_STEP_KEYCODEDOWN, Kc(k) +#define Uc(k) MACRO_ACTION_STEP_KEYCODEUP, Kc(k) +#define Tc(k) MACRO_ACTION_STEP_TAPCODE, Kc(k) + +#define SEQ(...) MACRO_ACTION_STEP_TAP_SEQUENCE, __VA_ARGS__, MACRO_ACTION_END, MACRO_ACTION_END +#define SEQc(...) MACRO_ACTION_STEP_TAP_CODE_SEQUENCE, __VA_ARGS__, MACRO_ACTION_END #define WITH_EXPLICIT_REPORT MACRO_ACTION_STEP_EXPLICIT_REPORT #define WITH_IMPLICIT_REPORT MACRO_ACTION_STEP_IMPLICIT_REPORT -#define SEND_REPORT MACRO_ACTION_STEP_SEND_REPORT +#define SEND_REPORT MACRO_ACTION_STEP_SEND_REPORT __attribute__((deprecated("END is no longer required to end macros"))) const MacroActionStepType END = MACRO_ACTION_END; diff --git a/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.cpp b/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.cpp index da46216c..f48b590d 100644 --- a/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.cpp +++ b/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.cpp @@ -17,9 +17,9 @@ #include "kaleidoscope/plugin/MagicCombo.h" -#include // for F, __FlashStringHelper -#include // for Focus, FocusSerial -#include // for uint16_t, int8_t, uin... +#include // for F, __FlashStringHelper +#include // for Focus, FocusSerial +#include // for uint16_t, int8_t, uin... #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for Device @@ -29,7 +29,7 @@ namespace kaleidoscope { namespace plugin { uint16_t MagicCombo::min_interval = 500; -uint16_t MagicCombo::start_time_ = 0; +uint16_t MagicCombo::start_time_ = 0; EventHandlerResult MagicCombo::onNameQuery() { return ::Focus.sendName(F("MagicCombo")); @@ -55,7 +55,7 @@ EventHandlerResult MagicCombo::afterEachCycle() { match = false; if (match && Runtime.hasTimeExpired(start_time_, min_interval)) { - ComboAction action = (ComboAction) pgm_read_ptr((void const **) & (magiccombo::combos[i].action)); + ComboAction action = (ComboAction)pgm_read_ptr((void const **)&(magiccombo::combos[i].action)); (*action)(i); start_time_ = Runtime.millisAtCycleStart(); diff --git a/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.h b/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.h index 79b1e5bd..258671dc 100644 --- a/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.h +++ b/plugins/Kaleidoscope-MagicCombo/src/kaleidoscope/plugin/MagicCombo.h @@ -17,24 +17,24 @@ #pragma once -#include // for PROGMEM -#include // for uint16_t, uint8_t +#include // for PROGMEM +#include // for uint16_t, uint8_t #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/plugin.h" // for Plugin #define MAX_COMBO_LENGTH 5 -#define USE_MAGIC_COMBOS(...) \ - namespace kaleidoscope { \ - namespace plugin { \ - namespace magiccombo { \ - const kaleidoscope::plugin::MagicCombo::Combo combos[] PROGMEM = \ - {__VA_ARGS__}; \ - \ - const uint8_t combos_length = sizeof(combos) / sizeof(*combos); \ - } \ - } \ +#define USE_MAGIC_COMBOS(...) \ + namespace kaleidoscope { \ + namespace plugin { \ + namespace magiccombo { \ + const kaleidoscope::plugin::MagicCombo::Combo combos[] PROGMEM = \ + {__VA_ARGS__}; \ + \ + const uint8_t combos_length = sizeof(combos) / sizeof(*combos); \ + } \ + } \ } namespace kaleidoscope { diff --git a/plugins/Kaleidoscope-MouseKeys/src/Kaleidoscope-MouseKeys.h b/plugins/Kaleidoscope-MouseKeys/src/Kaleidoscope-MouseKeys.h index d6f1c6ac..9df9bfa1 100644 --- a/plugins/Kaleidoscope-MouseKeys/src/Kaleidoscope-MouseKeys.h +++ b/plugins/Kaleidoscope-MouseKeys/src/Kaleidoscope-MouseKeys.h @@ -16,5 +16,5 @@ #pragma once -#include "kaleidoscope/plugin/MouseKeys.h" // IWYU pragma: export +#include "kaleidoscope/plugin/MouseKeys.h" // IWYU pragma: export #include "kaleidoscope/plugin/mousekeys/MouseKeyDefs.h" // IWYU pragma: export diff --git a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.cpp b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.cpp index 35018355..f57b29f5 100644 --- a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.cpp +++ b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.cpp @@ -16,9 +16,9 @@ #include "kaleidoscope/plugin/MouseKeys.h" -#include // for F, __F... -#include // for Focus -#include // for uint8_t +#include // for F, __F... +#include // for Focus +#include // for uint8_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/Runtime.h" // for Runtime @@ -34,13 +34,13 @@ namespace kaleidoscope { namespace plugin { -uint8_t MouseKeys::speed = 1; +uint8_t MouseKeys::speed = 1; uint16_t MouseKeys::speedDelay = 1; -uint8_t MouseKeys::accelSpeed = 1; +uint8_t MouseKeys::accelSpeed = 1; uint16_t MouseKeys::accelDelay = 64; -uint8_t MouseKeys::wheelSpeed = 1; +uint8_t MouseKeys::wheelSpeed = 1; uint16_t MouseKeys::wheelDelay = 50; // ============================================================================= @@ -57,27 +57,27 @@ void MouseKeys::setSpeedLimit(uint8_t speed_limit) { // ============================================================================= // Key variant tests -bool MouseKeys::isMouseKey(const Key& key) const { +bool MouseKeys::isMouseKey(const Key &key) const { return (key.getFlags() == (SYNTHETIC | IS_MOUSE_KEY)); } -bool MouseKeys::isMouseButtonKey(const Key& key) const { +bool MouseKeys::isMouseButtonKey(const Key &key) const { uint8_t variant = key.getKeyCode() & (KEY_MOUSE_BUTTON | KEY_MOUSE_WARP); return variant == KEY_MOUSE_BUTTON; } -bool MouseKeys::isMouseMoveKey(const Key& key) const { - uint8_t mask = (KEY_MOUSE_BUTTON | KEY_MOUSE_WARP | KEY_MOUSE_WHEEL); +bool MouseKeys::isMouseMoveKey(const Key &key) const { + uint8_t mask = (KEY_MOUSE_BUTTON | KEY_MOUSE_WARP | KEY_MOUSE_WHEEL); uint8_t variant = key.getKeyCode() & mask; return variant == 0; } -bool MouseKeys::isMouseWarpKey(const Key& key) const { +bool MouseKeys::isMouseWarpKey(const Key &key) const { return (key.getKeyCode() & KEY_MOUSE_WARP) != 0; } -bool MouseKeys::isMouseWheelKey(const Key& key) const { - uint8_t mask = (KEY_MOUSE_BUTTON | KEY_MOUSE_WARP | KEY_MOUSE_WHEEL); +bool MouseKeys::isMouseWheelKey(const Key &key) const { + uint8_t mask = (KEY_MOUSE_BUTTON | KEY_MOUSE_WARP | KEY_MOUSE_WHEEL); uint8_t variant = key.getKeyCode() & mask; return variant == KEY_MOUSE_WHEEL; } @@ -160,7 +160,7 @@ EventHandlerResult MouseKeys::afterReportingState(const KeyEvent &event) { // A mouse key event has been successfully registered, and we have now // gathered all the information on held mouse movement and wheel keys, so it's // safe to update the direction information. - directions_ = pending_directions_; + directions_ = pending_directions_; pending_directions_ = 0; if (isMouseMoveKey(event.key)) { @@ -212,9 +212,9 @@ void MouseKeys::sendMouseButtonReport() const { void MouseKeys::sendMouseWarpReport(const KeyEvent &event) const { mousekeys::wrapper.warp( ((event.key.getKeyCode() & KEY_MOUSE_WARP_END) ? WARP_END : 0x00) | - ((event.key.getKeyCode() & KEY_MOUSE_UP) ? WARP_UP : 0x00) | - ((event.key.getKeyCode() & KEY_MOUSE_DOWN) ? WARP_DOWN : 0x00) | - ((event.key.getKeyCode() & KEY_MOUSE_LEFT) ? WARP_LEFT : 0x00) | + ((event.key.getKeyCode() & KEY_MOUSE_UP) ? WARP_UP : 0x00) | + ((event.key.getKeyCode() & KEY_MOUSE_DOWN) ? WARP_DOWN : 0x00) | + ((event.key.getKeyCode() & KEY_MOUSE_LEFT) ? WARP_LEFT : 0x00) | ((event.key.getKeyCode() & KEY_MOUSE_RIGHT) ? WARP_RIGHT : 0x00)); } @@ -222,8 +222,8 @@ void MouseKeys::sendMouseWarpReport(const KeyEvent &event) const { void MouseKeys::sendMouseMoveReport() { move_start_time_ = Runtime.millisAtCycleStart(); - int8_t vx = 0; - int8_t vy = 0; + int8_t vx = 0; + int8_t vy = 0; uint8_t direction = directions_ & move_mask_; if (direction == 0) { @@ -251,8 +251,8 @@ void MouseKeys::sendMouseMoveReport() { void MouseKeys::sendMouseWheelReport() { wheel_start_time_ = Runtime.millisAtCycleStart(); - int8_t vx = 0; - int8_t vy = 0; + int8_t vx = 0; + int8_t vy = 0; uint8_t direction = directions_ >> wheel_offset_; if (direction != 0) { @@ -274,7 +274,7 @@ void MouseKeys::sendMouseWheelReport() { } } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::MouseKeys MouseKeys; diff --git a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.h b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.h index fa0d86f2..6483c578 100644 --- a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.h +++ b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/MouseKeys.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t, uint16_t +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -45,7 +45,7 @@ class MouseKeys : public kaleidoscope::Plugin { EventHandlerResult afterReportingState(const KeyEvent &event); private: - uint16_t move_start_time_ = 0; + uint16_t move_start_time_ = 0; uint16_t accel_start_time_ = 0; uint16_t wheel_start_time_ = 0; @@ -53,11 +53,11 @@ class MouseKeys : public kaleidoscope::Plugin { // to save space. The low four bits are for cursor movement, and the high // four are for wheel movement. static constexpr uint8_t wheel_offset_ = 4; - static constexpr uint8_t wheel_mask_ = 0b11110000; - static constexpr uint8_t move_mask_ = 0b00001111; - uint8_t directions_ = 0; - uint8_t pending_directions_ = 0; - uint8_t buttons_ = 0; + static constexpr uint8_t wheel_mask_ = 0b11110000; + static constexpr uint8_t move_mask_ = 0b00001111; + uint8_t directions_ = 0; + uint8_t pending_directions_ = 0; + uint8_t buttons_ = 0; bool isMouseKey(const Key &key) const; bool isMouseButtonKey(const Key &key) const; @@ -69,10 +69,9 @@ class MouseKeys : public kaleidoscope::Plugin { void sendMouseWarpReport(const KeyEvent &event) const; void sendMouseMoveReport(); void sendMouseWheelReport(); - }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope extern kaleidoscope::plugin::MouseKeys MouseKeys; diff --git a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseKeyDefs.h b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseKeyDefs.h index 6cc48de3..9c757625 100644 --- a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseKeyDefs.h +++ b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseKeyDefs.h @@ -16,45 +16,45 @@ #pragma once -#define IS_MOUSE_KEY 0b00010000 +#define IS_MOUSE_KEY 0b00010000 // Synthetic, not internal -#define KEY_MOUSE_UP 0b0000001 -#define KEY_MOUSE_DOWN 0b0000010 -#define KEY_MOUSE_LEFT 0b0000100 -#define KEY_MOUSE_RIGHT 0b0001000 -#define KEY_MOUSE_WHEEL 0b0010000 -#define KEY_MOUSE_WARP 0b0100000 -#define KEY_MOUSE_WARP_END 0b1000000 +#define KEY_MOUSE_UP 0b0000001 +#define KEY_MOUSE_DOWN 0b0000010 +#define KEY_MOUSE_LEFT 0b0000100 +#define KEY_MOUSE_RIGHT 0b0001000 +#define KEY_MOUSE_WHEEL 0b0010000 +#define KEY_MOUSE_WARP 0b0100000 +#define KEY_MOUSE_WARP_END 0b1000000 // all buttons end warp. also, we're out of bits -#define KEY_MOUSE_BUTTON 0b1000000 - - -#define Key_mouseWarpNW Key(KEY_MOUSE_WARP| KEY_MOUSE_UP | KEY_MOUSE_LEFT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseWarpN Key(KEY_MOUSE_WARP| KEY_MOUSE_UP, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseWarpNE Key(KEY_MOUSE_WARP| KEY_MOUSE_UP | KEY_MOUSE_RIGHT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseWarpW Key(KEY_MOUSE_WARP| KEY_MOUSE_LEFT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseWarpIn Key(KEY_MOUSE_WARP| KEY_MOUSE_UP | KEY_MOUSE_DOWN, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseWarpE Key(KEY_MOUSE_WARP| KEY_MOUSE_RIGHT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseWarpSW Key(KEY_MOUSE_WARP| KEY_MOUSE_DOWN | KEY_MOUSE_LEFT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseWarpS Key(KEY_MOUSE_WARP| KEY_MOUSE_DOWN, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseWarpSE Key(KEY_MOUSE_WARP| KEY_MOUSE_DOWN | KEY_MOUSE_RIGHT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseWarpEnd Key(KEY_MOUSE_WARP| KEY_MOUSE_WARP_END, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) - - -#define Key_mouseUpL Key(KEY_MOUSE_UP | KEY_MOUSE_LEFT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseUp Key(KEY_MOUSE_UP, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseUpR Key(KEY_MOUSE_UP | KEY_MOUSE_RIGHT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseL Key(KEY_MOUSE_LEFT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseR Key(KEY_MOUSE_RIGHT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseDnL Key(KEY_MOUSE_DOWN | KEY_MOUSE_LEFT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseDn Key(KEY_MOUSE_DOWN, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseDnR Key(KEY_MOUSE_DOWN | KEY_MOUSE_RIGHT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseScrollUp Key(KEY_MOUSE_WHEEL | KEY_MOUSE_UP, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseScrollDn Key(KEY_MOUSE_WHEEL | KEY_MOUSE_DOWN, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseScrollL Key(KEY_MOUSE_WHEEL | KEY_MOUSE_LEFT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) -#define Key_mouseScrollR Key(KEY_MOUSE_WHEEL | KEY_MOUSE_RIGHT, KEY_FLAGS|SYNTHETIC|IS_MOUSE_KEY) +#define KEY_MOUSE_BUTTON 0b1000000 + + +#define Key_mouseWarpNW Key(KEY_MOUSE_WARP | KEY_MOUSE_UP | KEY_MOUSE_LEFT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseWarpN Key(KEY_MOUSE_WARP | KEY_MOUSE_UP, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseWarpNE Key(KEY_MOUSE_WARP | KEY_MOUSE_UP | KEY_MOUSE_RIGHT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseWarpW Key(KEY_MOUSE_WARP | KEY_MOUSE_LEFT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseWarpIn Key(KEY_MOUSE_WARP | KEY_MOUSE_UP | KEY_MOUSE_DOWN, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseWarpE Key(KEY_MOUSE_WARP | KEY_MOUSE_RIGHT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseWarpSW Key(KEY_MOUSE_WARP | KEY_MOUSE_DOWN | KEY_MOUSE_LEFT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseWarpS Key(KEY_MOUSE_WARP | KEY_MOUSE_DOWN, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseWarpSE Key(KEY_MOUSE_WARP | KEY_MOUSE_DOWN | KEY_MOUSE_RIGHT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseWarpEnd Key(KEY_MOUSE_WARP | KEY_MOUSE_WARP_END, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) + + +#define Key_mouseUpL Key(KEY_MOUSE_UP | KEY_MOUSE_LEFT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseUp Key(KEY_MOUSE_UP, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseUpR Key(KEY_MOUSE_UP | KEY_MOUSE_RIGHT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseL Key(KEY_MOUSE_LEFT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseR Key(KEY_MOUSE_RIGHT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseDnL Key(KEY_MOUSE_DOWN | KEY_MOUSE_LEFT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseDn Key(KEY_MOUSE_DOWN, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseDnR Key(KEY_MOUSE_DOWN | KEY_MOUSE_RIGHT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseScrollUp Key(KEY_MOUSE_WHEEL | KEY_MOUSE_UP, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseScrollDn Key(KEY_MOUSE_WHEEL | KEY_MOUSE_DOWN, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseScrollL Key(KEY_MOUSE_WHEEL | KEY_MOUSE_LEFT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseScrollR Key(KEY_MOUSE_WHEEL | KEY_MOUSE_RIGHT, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) // The MOUSE_xxx button definitions come from our HID driver @@ -62,16 +62,16 @@ #ifdef MOUSE_LEFT -#define KEY_MOUSE_BTN_L MOUSE_LEFT // Synthetic key +#define KEY_MOUSE_BTN_L MOUSE_LEFT // Synthetic key #define KEY_MOUSE_BTN_M MOUSE_MIDDLE // Synthetic key -#define KEY_MOUSE_BTN_R MOUSE_RIGHT // Synthetic key +#define KEY_MOUSE_BTN_R MOUSE_RIGHT // Synthetic key #define KEY_MOUSE_BTN_P MOUSE_PREV #define KEY_MOUSE_BTN_N MOUSE_NEXT -#define Key_mouseBtnL Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_L, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) -#define Key_mouseBtnM Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_M, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) -#define Key_mouseBtnR Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_R, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) -#define Key_mouseBtnP Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_P, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) -#define Key_mouseBtnN Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_N, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseBtnL Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_L, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseBtnM Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_M, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseBtnR Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_R, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseBtnP Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_P, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) +#define Key_mouseBtnN Key(KEY_MOUSE_BUTTON | KEY_MOUSE_BTN_N, KEY_FLAGS | SYNTHETIC | IS_MOUSE_KEY) #else diff --git a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseWrapper.cpp b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseWrapper.cpp index 54bd08cf..0e9cc0aa 100644 --- a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseWrapper.cpp +++ b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseWrapper.cpp @@ -16,7 +16,7 @@ #include "kaleidoscope/plugin/mousekeys/MouseWrapper.h" -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/Runtime.h" // for Runtime #include "kaleidoscope/device/device.h" // for Base<>... @@ -46,10 +46,10 @@ void MouseWrapper::warpJump(uint16_t left, uint16_t top, uint16_t height, uint16 void MouseWrapper::beginWarping() { section_left = WARP_ABS_LEFT; - section_top = WARP_ABS_TOP; - next_width = MAX_WARP_WIDTH; - next_height = MAX_WARP_HEIGHT; - is_warping = true; + section_top = WARP_ABS_TOP; + next_width = MAX_WARP_WIDTH; + next_height = MAX_WARP_HEIGHT; + is_warping = true; } void MouseWrapper::endWarping() { @@ -108,28 +108,32 @@ uint8_t MouseWrapper::acceleration(uint8_t cycles) { return 1 + (c2 >> 7); } else { uint16_t remaining_cycles = 256 - cycles; - uint16_t c2 = remaining_cycles * remaining_cycles; + uint16_t c2 = remaining_cycles * remaining_cycles; return 255 - (c2 >> 7); } } void MouseWrapper::move(int8_t x, int8_t y) { - int16_t moveX = 0; - int16_t moveY = 0; - static int8_t remainderX = 0; - static int8_t remainderY = 0; + int16_t moveX = 0; + int16_t moveY = 0; + static int8_t remainderX = 0; + static int8_t remainderY = 0; int16_t effectiveSpeedLimit = speed_limit; if (x != 0) { moveX = remainderX + (x * acceleration(accel_step)); - if (moveX > effectiveSpeedLimit) moveX = effectiveSpeedLimit; - else if (moveX < -effectiveSpeedLimit) moveX = -effectiveSpeedLimit; + if (moveX > effectiveSpeedLimit) + moveX = effectiveSpeedLimit; + else if (moveX < -effectiveSpeedLimit) + moveX = -effectiveSpeedLimit; } if (y != 0) { moveY = remainderY + (y * acceleration(accel_step)); - if (moveY > effectiveSpeedLimit) moveY = effectiveSpeedLimit; - else if (moveY < -effectiveSpeedLimit) moveY = -effectiveSpeedLimit; + if (moveY > effectiveSpeedLimit) + moveY = effectiveSpeedLimit; + else if (moveY < -effectiveSpeedLimit) + moveY = -effectiveSpeedLimit; } endWarping(); @@ -142,6 +146,6 @@ void MouseWrapper::move(int8_t x, int8_t y) { MouseWrapper wrapper; -} // namespace mousekeys -} // namespace plugin -} // namespace kaleidoscope +} // namespace mousekeys +} // namespace plugin +} // namespace kaleidoscope diff --git a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseWrapper.h b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseWrapper.h index 566016d0..e8807c2e 100644 --- a/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseWrapper.h +++ b/plugins/Kaleidoscope-MouseKeys/src/kaleidoscope/plugin/mousekeys/MouseWrapper.h @@ -20,20 +20,20 @@ // Warping commands -#define WARP_END 1 -#define WARP_UP 2 -#define WARP_DOWN 4 -#define WARP_LEFT 8 +#define WARP_END 1 +#define WARP_UP 2 +#define WARP_DOWN 4 +#define WARP_LEFT 8 #define WARP_RIGHT 16 // apparently, the mac discards 15% of the value space for mouse movement. // need to test this on other platforms -#define MAX_WARP_WIDTH 32767 +#define MAX_WARP_WIDTH 32767 #define MAX_WARP_HEIGHT 32767 -#define WARP_ABS_TOP 0 -#define WARP_ABS_LEFT 0 +#define WARP_ABS_TOP 0 +#define WARP_ABS_LEFT 0 // Mouse acceleration @@ -68,6 +68,6 @@ class MouseWrapper { extern MouseWrapper wrapper; -} // namespace mousekeys -} // namespace plugin -} // namespace kaleidoscope +} // namespace mousekeys +} // namespace plugin +} // namespace kaleidoscope diff --git a/plugins/Kaleidoscope-NumPad/src/kaleidoscope/plugin/NumPad.cpp b/plugins/Kaleidoscope-NumPad/src/kaleidoscope/plugin/NumPad.cpp index 837eabca..ce9b5542 100644 --- a/plugins/Kaleidoscope-NumPad/src/kaleidoscope/plugin/NumPad.cpp +++ b/plugins/Kaleidoscope-NumPad/src/kaleidoscope/plugin/NumPad.cpp @@ -16,7 +16,7 @@ #include "kaleidoscope/plugin/NumPad.h" -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr, Matrix... #include "kaleidoscope/device/device.h" // for cRGB, CRGB @@ -31,7 +31,7 @@ namespace plugin { // public: uint8_t NumPad::numPadLayer; -cRGB NumPad::color = CRGB(160, 0, 0); +cRGB NumPad::color = CRGB(160, 0, 0); uint8_t NumPad::lock_hue = 170; // private: @@ -46,7 +46,7 @@ void NumPad::setKeyboardLEDColors(void) { ::LEDControl.set_mode(::LEDControl.get_mode_index()); for (auto key_addr : KeyAddr::all()) { - Key k = Layer.lookupOnActiveLayer(key_addr); + Key k = Layer.lookupOnActiveLayer(key_addr); Key layer_key = Layer.getKey(numPadLayer, key_addr); if (k == LockLayer(numPadLayer)) { @@ -73,7 +73,7 @@ EventHandlerResult NumPad::afterEachCycle() { numpadActive = false; } } else { - if (!numpadActive) { + if (!numpadActive) { numpadActive = true; } setKeyboardLEDColors(); diff --git a/plugins/Kaleidoscope-NumPad/src/kaleidoscope/plugin/NumPad.h b/plugins/Kaleidoscope-NumPad/src/kaleidoscope/plugin/NumPad.h index 10d82ebc..25a538d8 100644 --- a/plugins/Kaleidoscope-NumPad/src/kaleidoscope/plugin/NumPad.h +++ b/plugins/Kaleidoscope-NumPad/src/kaleidoscope/plugin/NumPad.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -39,7 +39,6 @@ class NumPad : public kaleidoscope::Plugin { EventHandlerResult afterEachCycle(); private: - void setKeyboardLEDColors(void); static KeyAddr numpadLayerToggleKeyAddr; diff --git a/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.cpp b/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.cpp index 59b53af8..86769c00 100644 --- a/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.cpp +++ b/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/OneShot.h" -#include // for bitRead, F, __FlashSt... -#include // for Focus, FocusSerial -#include // for OS_FIRST -#include // for uint8_t, int8_t +#include // for bitRead, F, __FlashSt... +#include // for Focus, FocusSerial +#include // for OS_FIRST +#include // for uint8_t, int8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr, MatrixAddr #include "kaleidoscope/KeyAddrBitfield.h" // for KeyAddrBitfield, KeyA... @@ -80,7 +80,7 @@ bool OneShot::isActive() const { bool OneShot::isSticky() const { for (KeyAddr key_addr : glue_addrs_) { - if (! temp_addrs_.read(key_addr)) { + if (!temp_addrs_.read(key_addr)) { return true; } } @@ -94,8 +94,7 @@ bool OneShot::isSticky() const { // could potentially use three different color values for the three // states (sticky | active && !sticky | pressed && !active). -__attribute__((weak)) -bool OneShot::isStickable(Key key) const { +__attribute__((weak)) bool OneShot::isStickable(Key key) const { return isStickableDefault(key); } @@ -189,7 +188,7 @@ EventHandlerResult OneShot::onNameQuery() { return ::Focus.sendName(F("OneShot")); } -EventHandlerResult OneShot::onKeyEvent(KeyEvent& event) { +EventHandlerResult OneShot::onKeyEvent(KeyEvent &event) { // Ignore injected key events. This prevents re-processing events that the // hook functions generate (by calling `injectNormalKey()` via one of the @@ -210,7 +209,7 @@ EventHandlerResult OneShot::onKeyEvent(KeyEvent& event) { // state. bool is_oneshot = false; if (isOneShotKey(event.key)) { - event.key = decodeOneShotKey(event.key); + event.key = decodeOneShotKey(event.key); is_oneshot = true; } @@ -274,14 +273,13 @@ EventHandlerResult OneShot::onKeyEvent(KeyEvent& event) { // event. This is handled in the `beforeReportingState()` hook below. return EventHandlerResult::ABORT; } - } return EventHandlerResult::OK; } // ---------------------------------------------------------------------------- -EventHandlerResult OneShot::afterReportingState(const KeyEvent& event) { +EventHandlerResult OneShot::afterReportingState(const KeyEvent &event) { return afterEachCycle(); } @@ -289,8 +287,8 @@ EventHandlerResult OneShot::afterReportingState(const KeyEvent& event) { EventHandlerResult OneShot::afterEachCycle() { bool oneshot_expired = hasTimedOut(timeout_); - bool hold_expired = hasTimedOut(hold_timeout_); - bool any_temp_keys = false; + bool hold_expired = hasTimedOut(hold_timeout_); + bool any_temp_keys = false; for (KeyAddr key_addr : temp_addrs_) { any_temp_keys = true; @@ -368,7 +366,7 @@ void OneShot::pressKey(KeyAddr key_addr, Key key) { key = decodeOneShotKey(key); } prev_key_addr_ = key_addr; - start_time_ = Runtime.millisAtCycleStart(); + start_time_ = Runtime.millisAtCycleStart(); temp_addrs_.set(key_addr); KeyEvent event{key_addr, IS_PRESSED | INJECTED, key}; Runtime.handleKeyEvent(event); @@ -379,8 +377,7 @@ void OneShot::holdKey(KeyAddr key_addr) const { Runtime.handleKeyEvent(event); } -__attribute__((always_inline)) inline -void OneShot::releaseKey(KeyAddr key_addr) { +__attribute__((always_inline)) inline void OneShot::releaseKey(KeyAddr key_addr) { glue_addrs_.clear(key_addr); temp_addrs_.clear(key_addr); @@ -388,7 +385,7 @@ void OneShot::releaseKey(KeyAddr key_addr) { Runtime.handleKeyEvent(event); } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::OneShot OneShot; diff --git a/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.h b/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.h index 3899e544..9cdeca5d 100644 --- a/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.h +++ b/plugins/Kaleidoscope-OneShot/src/kaleidoscope/plugin/OneShot.h @@ -17,8 +17,8 @@ #pragma once -#include // for OS_FIRST, OS_LAST -#include // for uint16_t, uint8_t +#include // for OS_FIRST, OS_LAST +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyAddrBitfield.h" // for KeyAddrBitfield @@ -31,7 +31,7 @@ // ---------------------------------------------------------------------------- // Keymap macros -#define OSM(k) ::kaleidoscope::plugin::OneShotModifierKey(Key_ ## k) +#define OSM(k) ::kaleidoscope::plugin::OneShotModifierKey(Key_##k) #define OSL(n) ::kaleidoscope::plugin::OneShotLayerKey(n) namespace kaleidoscope { @@ -56,8 +56,8 @@ class OneShot : public kaleidoscope::Plugin { void enableStickablity() {} void enableStickability(Key key); - template - void enableStickability(Key key, Keys&&... keys) { + template + void enableStickability(Key key, Keys &&...keys) { enableStickability(key); enableStickability(keys...); } @@ -66,8 +66,8 @@ class OneShot : public kaleidoscope::Plugin { void disableStickability() {} void disableStickability(Key key); - template - void disableStickability(Key key, Keys&&... keys) { + template + void disableStickability(Key key, Keys &&...keys) { disableStickability(key); disableStickability(keys...); } @@ -97,10 +97,10 @@ class OneShot : public kaleidoscope::Plugin { } void toggleAutoModifiers() { - auto_modifiers_ = ! auto_modifiers_; + auto_modifiers_ = !auto_modifiers_; } void toggleAutoLayers() { - auto_layers_ = ! auto_layers_; + auto_layers_ = !auto_layers_; } void toggleAutoOneShot() { if (auto_modifiers_ || auto_layers_) { @@ -128,10 +128,10 @@ class OneShot : public kaleidoscope::Plugin { bool isStickableDefault(Key key) const; - bool isTemporary(KeyAddr key_addr) const; // inline? + bool isTemporary(KeyAddr key_addr) const; // inline? bool isPending(KeyAddr key_addr) const; - bool isSticky(KeyAddr key_addr) const; // inline? - bool isActive(KeyAddr key_addr) const; // inline? + bool isSticky(KeyAddr key_addr) const; // inline? + bool isActive(KeyAddr key_addr) const; // inline? // -------------------------------------------------------------------------- // Public OneShot state control @@ -191,32 +191,31 @@ class OneShot : public kaleidoscope::Plugin { EventHandlerResult afterEachCycle(); private: - // -------------------------------------------------------------------------- // Constants - static constexpr uint8_t oneshot_key_count = 16; - static constexpr uint8_t oneshot_mod_count = 8; - static constexpr uint8_t oneshot_layer_count = oneshot_key_count - oneshot_mod_count; + static constexpr uint8_t oneshot_key_count = 16; + static constexpr uint8_t oneshot_mod_count = 8; + static constexpr uint8_t oneshot_layer_count = oneshot_key_count - oneshot_mod_count; static constexpr uint16_t stickable_modifiers_mask = uint16_t(uint16_t(-1) >> oneshot_layer_count); - static constexpr uint16_t stickable_layers_mask = uint16_t(uint16_t(-1) << oneshot_mod_count); - static constexpr KeyAddr invalid_key_addr = KeyAddr(KeyAddr::invalid_state); + static constexpr uint16_t stickable_layers_mask = uint16_t(uint16_t(-1) << oneshot_mod_count); + static constexpr KeyAddr invalid_key_addr = KeyAddr(KeyAddr::invalid_state); // -------------------------------------------------------------------------- // Configuration variables - uint16_t timeout_ = 2500; - uint16_t hold_timeout_ = 250; + uint16_t timeout_ = 2500; + uint16_t hold_timeout_ = 250; int16_t double_tap_timeout_ = -1; uint16_t stickable_keys_ = -1; - bool auto_modifiers_ = false; - bool auto_layers_ = false; + bool auto_modifiers_ = false; + bool auto_layers_ = false; // -------------------------------------------------------------------------- // State variables KeyAddrBitfield temp_addrs_; KeyAddrBitfield glue_addrs_; - uint16_t start_time_ = 0; + uint16_t start_time_ = 0; KeyAddr prev_key_addr_ = invalid_key_addr; // -------------------------------------------------------------------------- @@ -238,7 +237,7 @@ class OneShot : public kaleidoscope::Plugin { void releaseKey(KeyAddr key_addr); }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope extern kaleidoscope::plugin::OneShot OneShot; diff --git a/plugins/Kaleidoscope-OneShotMetaKeys/src/kaleidoscope/plugin/OneShotMetaKeys.cpp b/plugins/Kaleidoscope-OneShotMetaKeys/src/kaleidoscope/plugin/OneShotMetaKeys.cpp index 06770060..5a918a8b 100644 --- a/plugins/Kaleidoscope-OneShotMetaKeys/src/kaleidoscope/plugin/OneShotMetaKeys.cpp +++ b/plugins/Kaleidoscope-OneShotMetaKeys/src/kaleidoscope/plugin/OneShotMetaKeys.cpp @@ -17,9 +17,9 @@ #include "kaleidoscope/plugin/OneShotMetaKeys.h" -#include // for F, __FlashStringHelper -#include // for Focus, FocusSerial -#include // for OneShot +#include // for F, __FlashStringHelper +#include // for Focus, FocusSerial +#include // for OneShot #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, MatrixAdd... #include "kaleidoscope/KeyAddrMap.h" // for KeyAddrMap<>::Iterator @@ -92,7 +92,7 @@ bool OneShotMetaKeys::isMetaStickyActive() { return false; } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::OneShotMetaKeys OneShotMetaKeys; diff --git a/plugins/Kaleidoscope-OneShotMetaKeys/src/kaleidoscope/plugin/OneShotMetaKeys.h b/plugins/Kaleidoscope-OneShotMetaKeys/src/kaleidoscope/plugin/OneShotMetaKeys.h index 8f05b1ae..9cf4f1b9 100644 --- a/plugins/Kaleidoscope-OneShotMetaKeys/src/kaleidoscope/plugin/OneShotMetaKeys.h +++ b/plugins/Kaleidoscope-OneShotMetaKeys/src/kaleidoscope/plugin/OneShotMetaKeys.h @@ -17,7 +17,7 @@ #pragma once -#include // for OS_ACTIVE_STICKY, OS_... +#include // for OS_ACTIVE_STICKY, OS_... #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -26,8 +26,8 @@ // ---------------------------------------------------------------------------- // Key constants -constexpr Key OneShot_MetaStickyKey {kaleidoscope::ranges::OS_META_STICKY}; -constexpr Key OneShot_ActiveStickyKey {kaleidoscope::ranges::OS_ACTIVE_STICKY}; +constexpr Key OneShot_MetaStickyKey{kaleidoscope::ranges::OS_META_STICKY}; +constexpr Key OneShot_ActiveStickyKey{kaleidoscope::ranges::OS_ACTIVE_STICKY}; namespace kaleidoscope { namespace plugin { @@ -42,10 +42,9 @@ class OneShotMetaKeys : public kaleidoscope::Plugin { private: static bool isMetaStickyActive(); - }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope extern kaleidoscope::plugin::OneShotMetaKeys OneShotMetaKeys; diff --git a/plugins/Kaleidoscope-PersistentLEDMode/src/kaleidoscope/plugin/PersistentLEDMode.cpp b/plugins/Kaleidoscope-PersistentLEDMode/src/kaleidoscope/plugin/PersistentLEDMode.cpp index 85412c88..c72e2f15 100644 --- a/plugins/Kaleidoscope-PersistentLEDMode/src/kaleidoscope/plugin/PersistentLEDMode.cpp +++ b/plugins/Kaleidoscope-PersistentLEDMode/src/kaleidoscope/plugin/PersistentLEDMode.cpp @@ -18,8 +18,8 @@ #include "kaleidoscope/plugin/PersistentLEDMode.h" -#include // for EEPROMSettings -#include // for uint8_t, uint16_t +#include // for EEPROMSettings +#include // for uint8_t, uint16_t #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ #include "kaleidoscope/device/device.h" // for VirtualProps::Storage diff --git a/plugins/Kaleidoscope-PersistentLEDMode/src/kaleidoscope/plugin/PersistentLEDMode.h b/plugins/Kaleidoscope-PersistentLEDMode/src/kaleidoscope/plugin/PersistentLEDMode.h index aad9c1c5..2254f6ac 100644 --- a/plugins/Kaleidoscope-PersistentLEDMode/src/kaleidoscope/plugin/PersistentLEDMode.h +++ b/plugins/Kaleidoscope-PersistentLEDMode/src/kaleidoscope/plugin/PersistentLEDMode.h @@ -18,7 +18,7 @@ #pragma once -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult #include "kaleidoscope/plugin.h" // for Plugin @@ -26,12 +26,13 @@ namespace kaleidoscope { namespace plugin { -class PersistentLEDMode: public kaleidoscope::Plugin { +class PersistentLEDMode : public kaleidoscope::Plugin { public: PersistentLEDMode() {} EventHandlerResult onSetup(); EventHandlerResult onLEDModeChange(); + private: static uint16_t settings_base_; static uint8_t cached_mode_index_; diff --git a/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.cpp b/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.cpp index de5406ae..0e33618b 100644 --- a/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.cpp +++ b/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.cpp @@ -18,9 +18,9 @@ #include "kaleidoscope/plugin/Qukeys.h" -#include // for F, __FlashStringHelper -#include // for Focus, FocusSerial -#include // for DUL_FIRST, DUM_FIRST +#include // for F, __FlashStringHelper +#include // for Focus, FocusSerial +#include // for DUL_FIRST, DUM_FIRST #include "kaleidoscope/KeyAddrEventQueue.h" // for KeyAddrEventQueue #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -51,12 +51,12 @@ EventHandlerResult Qukeys::onKeyswitchEvent(KeyEvent &event) { } // If event.addr is not a physical key, ignore it; some other plugin injected it. - if (! event.addr.isValid() || keyIsInjected(event.state)) { + if (!event.addr.isValid() || keyIsInjected(event.state)) { return EventHandlerResult::OK; } // If Qukeys is turned off, continue to next plugin. - if (! active_) { + if (!active_) { if (isDualUseKey(event.key)) { event.key = queue_head_.primary_key; } @@ -66,7 +66,8 @@ EventHandlerResult Qukeys::onKeyswitchEvent(KeyEvent &event) { // If we can't trivially ignore the event, just add it to the queue. event_queue_.append(event); // In order to prevent overflowing the queue, process it now. - while (processQueue()); + while (processQueue()) + ; // Any event that gets added to the queue gets re-processed later, so we // need to abort processing now. return EventHandlerResult::ABORT; @@ -97,13 +98,13 @@ EventHandlerResult Qukeys::afterEachCycle() { if (Runtime.hasTimeExpired(event_queue_.timestamp(0), hold_timeout_)) { // If it's a SpaceCadet-type key, it takes on its primary value, otherwise // it takes on its secondary value. - Key event_key = isModifierKey(queue_head_.primary_key) ? - queue_head_.primary_key : queue_head_.alternate_key; + Key event_key = isModifierKey(queue_head_.primary_key) ? queue_head_.primary_key : queue_head_.alternate_key; flushEvent(event_key); } // Process as many events as we can from the queue. - while (processQueue()); + while (processQueue()) + ; return EventHandlerResult::OK; } @@ -151,7 +152,7 @@ bool Qukeys::processQueue() { // it's only there because the plugin was just turned off, we can flush it // immediately. // Should be able to remove the `active_` check once `deactivate()` gets updated - if (! isQukey(queue_head_addr) || ! active_) { + if (!isQukey(queue_head_addr) || !active_) { flushEvent(queue_head_.primary_key); return true; } @@ -205,14 +206,13 @@ bool Qukeys::processQueue() { // flush it now. Its state depends on whether or not it's a // SpaceCadet-type key. if (next_keypress_index == 0 || overlap_threshold_ == 0) { - Key event_key = qukey_is_spacecadet ? - queue_head_.alternate_key : queue_head_.primary_key; + Key event_key = qukey_is_spacecadet ? queue_head_.alternate_key : queue_head_.primary_key; // A qukey just got released in primary state; this might turn out to be // the beginning of a tap-repeat sequence, so we set the tap-repeat // address and start time to the time of the initial press event before // flushing it from the queue. This will come into play when processing // the corresponding release event later. - tap_repeat_.addr = queue_head_addr; + tap_repeat_.addr = queue_head_addr; tap_repeat_.start_time = event_queue_.timestamp(0); flushEvent(event_key); return true; @@ -223,7 +223,7 @@ bool Qukeys::processQueue() { // will meet the maximum overlap requirement to make the qukey take on its // alternate state. uint16_t overlap_start = event_queue_.timestamp(next_keypress_index); - uint16_t overlap_end = event_queue_.timestamp(i); + uint16_t overlap_end = event_queue_.timestamp(i); if (releaseDelayed(overlap_start, overlap_end)) { continue; } @@ -321,7 +321,7 @@ bool Qukeys::isQukey(KeyAddr k) { if (qukey.addr == k) { if ((qukey.layer == layer_index) || (qukey.layer == layer_wildcard)) { - queue_head_.primary_key = key; + queue_head_.primary_key = key; queue_head_.alternate_key = qukey.alternate_key; return true; } @@ -329,7 +329,7 @@ bool Qukeys::isQukey(KeyAddr k) { } // If no matches were found, clear queue_head_ and return false - queue_head_.primary_key = key; + queue_head_.primary_key = key; queue_head_.alternate_key = Key_Transparent; return false; } @@ -355,7 +355,7 @@ bool Qukeys::isDualUseKey(Key key) { queue_head_.primary_key = key; queue_head_.primary_key.setFlags(0); - int8_t layer = key.getFlags(); + int8_t layer = key.getFlags(); queue_head_.alternate_key = ShiftToLayer(layer); return true; } @@ -377,7 +377,7 @@ bool Qukeys::releaseDelayed(uint16_t overlap_start, // divide by the percentage value (as an integer). We use 32-bit integers // here to make sure it doesn't overflow when we multiply by 100. uint32_t overlap_duration = overlap_end - overlap_start; - uint32_t release_timeout = (overlap_duration * 100) / overlap_threshold_; + uint32_t release_timeout = (overlap_duration * 100) / overlap_threshold_; return !Runtime.hasTimeExpired(overlap_start, uint16_t(release_timeout)); } diff --git a/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h b/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h index a196c64f..e4d674f7 100644 --- a/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h +++ b/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h @@ -18,9 +18,9 @@ #pragma once -#include // for PROGMEM -#include // for DUM_FIRST -#include // for uint8_t, uint16_t +#include // for PROGMEM +#include // for DUM_FIRST +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyAddrEventQueue.h" // for KeyAddrEventQueue @@ -31,14 +31,14 @@ #include "kaleidoscope/plugin.h" // for Plugin // DualUse Key definitions for Qukeys in the keymap -#define MT(mod, key) kaleidoscope::plugin::ModTapKey(Key_ ## mod, Key_ ## key) +#define MT(mod, key) kaleidoscope::plugin::ModTapKey(Key_##mod, Key_##key) -#define SFT_T(key) MT(LeftShift, key) -#define CTL_T(key) MT(LeftControl, key) -#define ALT_T(key) MT(LeftAlt, key) -#define GUI_T(key) MT(LeftGui, key) +#define SFT_T(key) MT(LeftShift, key) +#define CTL_T(key) MT(LeftControl, key) +#define ALT_T(key) MT(LeftAlt, key) +#define GUI_T(key) MT(LeftGui, key) -#define LT(layer, key) kaleidoscope::plugin::LayerTapKey(layer, Key_ ## key) +#define LT(layer, key) kaleidoscope::plugin::LayerTapKey(layer, Key_##key) namespace kaleidoscope { namespace plugin { @@ -66,13 +66,11 @@ struct Qukey { // This is the constructor that should be used when creating a Qukey object in // the PROGMEM array that will be used by Qukeys (i.e. in the `QUKEYS()` // macro). - constexpr - Qukey(int8_t layer, KeyAddr k, Key alternate_key) + constexpr Qukey(int8_t layer, KeyAddr k, Key alternate_key) : layer(layer), addr(k), alternate_key(alternate_key) {} // This constructor is here so that we can create an empty Qukey object in RAM // into which we can copy the values from a PROGMEM Qukey object. Qukey() = default; - }; @@ -143,9 +141,9 @@ class Qukeys : public kaleidoscope::Plugin { // template function that takes as its sole argument an array reference of // size `_qukeys_count`, so there's no need to use `sizeof` to calculate the // correct size, and pass it as a separate parameter. - template - void configureQukeys(Qukey const(&qukeys)[_qukeys_count]) { - qukeys_ = qukeys; + template + void configureQukeys(Qukey const (&qukeys)[_qukeys_count]) { + qukeys_ = qukeys; qukeys_count_ = _qukeys_count; } @@ -160,7 +158,7 @@ class Qukeys : public kaleidoscope::Plugin { private: // An array of Qukey objects in PROGMEM. - Qukey const * qukeys_{nullptr}; + Qukey const *qukeys_{nullptr}; uint8_t qukeys_count_{0}; // The maximum number of events in the queue at a time. @@ -239,9 +237,9 @@ extern kaleidoscope::plugin::Qukeys Qukeys; // guarantee that the count is set correctly. This is considerably less // important than it used to be, with the `configureQukeys()` function taking // care of guaranteeing the correct count setting. -#define QUKEYS(qukey_defs...) { \ - static kaleidoscope::plugin::Qukey const qk_table[] PROGMEM = { \ - qukey_defs \ - }; \ - Qukeys.configureQukeys(qk_table); \ -} +#define QUKEYS(qukey_defs...) \ + { \ + static kaleidoscope::plugin::Qukey const qk_table[] PROGMEM = { \ + qukey_defs}; \ + Qukeys.configureQukeys(qk_table); \ + } diff --git a/plugins/Kaleidoscope-Ranges/src/Kaleidoscope-Ranges.h b/plugins/Kaleidoscope-Ranges/src/Kaleidoscope-Ranges.h index a698cae6..0deb42b0 100644 --- a/plugins/Kaleidoscope-Ranges/src/Kaleidoscope-Ranges.h +++ b/plugins/Kaleidoscope-Ranges/src/Kaleidoscope-Ranges.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t // Included for definition of legacy Macros plugin key range: #include "kaleidoscope/key_defs.h" // for SYNTHETIC @@ -52,30 +52,30 @@ enum : uint16_t { MACRO_FIRST = (SYNTHETIC | 0b00100000) << 8, MACRO_LAST = MACRO_FIRST + 255, - FIRST = 0xc000, + FIRST = 0xc000, KALEIDOSCOPE_FIRST = FIRST, OS_FIRST, - OSM_FIRST = OS_FIRST, - OSM_LAST = OSM_FIRST + 7, + OSM_FIRST = OS_FIRST, + OSM_LAST = OSM_FIRST + 7, OSL_FIRST, - OSL_LAST = OSL_FIRST + 7, - OS_LAST = OSL_LAST, + OSL_LAST = OSL_FIRST + 7, + OS_LAST = OSL_LAST, DU_FIRST, - DUM_FIRST = DU_FIRST, - DUM_LAST = DUM_FIRST + (8 << 8), + DUM_FIRST = DU_FIRST, + DUM_LAST = DUM_FIRST + (8 << 8), DUL_FIRST, - DUL_LAST = DUL_FIRST + (8 << 8), - DU_LAST = DUL_LAST, + DUL_LAST = DUL_FIRST + (8 << 8), + DU_LAST = DUL_LAST, TD_FIRST, - TD_LAST = TD_FIRST + 15, + TD_LAST = TD_FIRST + 15, LEAD_FIRST, - LEAD_LAST = LEAD_FIRST + 7, + LEAD_LAST = LEAD_FIRST + 7, CYCLE, SYSTER, TT_FIRST, - TT_LAST = TT_FIRST + 255, + TT_LAST = TT_FIRST + 255, STENO_FIRST, - STENO_LAST = STENO_FIRST + 42, + STENO_LAST = STENO_FIRST + 42, SC_FIRST, SC_LAST, REDIAL, @@ -86,7 +86,7 @@ enum : uint16_t { OS_ACTIVE_STICKY, OS_CANCEL, CS_FIRST, - CS_LAST = CS_FIRST + MAX_CS_KEYS, + CS_LAST = CS_FIRST + MAX_CS_KEYS, SAFE_START, KALEIDOSCOPE_SAFE_START = SAFE_START diff --git a/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.cpp b/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.cpp index cd86804c..8f94fb79 100644 --- a/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.cpp +++ b/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.cpp @@ -17,8 +17,8 @@ #include "kaleidoscope/plugin/Redial.h" -#include // for F, __FlashStringHelper -#include // for Focus, FocusSerial +#include // for F, __FlashStringHelper +#include // for Focus, FocusSerial #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult diff --git a/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.h b/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.h index 073196f1..ed50b3ea 100644 --- a/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.h +++ b/plugins/Kaleidoscope-Redial/src/kaleidoscope/plugin/Redial.h @@ -17,7 +17,7 @@ #pragma once -#include // for REDIAL +#include // for REDIAL #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult diff --git a/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.cpp b/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.cpp index e4b019b5..1714fd5b 100644 --- a/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.cpp +++ b/plugins/Kaleidoscope-ShapeShifter/src/kaleidoscope/plugin/ShapeShifter.cpp @@ -17,7 +17,7 @@ #include "kaleidoscope/plugin/ShapeShifter.h" -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for MatrixAddr, MatrixAdd... #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -58,7 +58,7 @@ EventHandlerResult ShapeShifter::onKeyEvent(KeyEvent &event) { if (live_keys[k].isKeyboardShift()) shift_detected = true; } - if (! shift_detected) + if (!shift_detected) return EventHandlerResult::OK; repl = dictionary[i].replacement.readFromProgmem(); diff --git a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp index 4c299a4a..c4a9efa0 100644 --- a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp +++ b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.cpp @@ -18,9 +18,9 @@ #include "kaleidoscope/plugin/SpaceCadet.h" -#include // for F, __FlashStringHelper -#include // for Focus, FocusSerial -#include // for uint16_t, int8_t, uin... +#include // for F, __FlashStringHelper +#include // for Focus, FocusSerial +#include // for uint16_t, int8_t, uin... #include "kaleidoscope/KeyAddr.h" // for KeyAddr, MatrixAddr #include "kaleidoscope/KeyAddrEventQueue.h" // for KeyAddrEventQueue @@ -48,7 +48,7 @@ SpaceCadet::KeyBinding::KeyBinding(Key input, Key output, uint16_t timeout) // ----------------------------------------------------------------------------- // Plugin configuration variables -SpaceCadet::KeyBinding * SpaceCadet::map; +SpaceCadet::KeyBinding *SpaceCadet::map; uint16_t SpaceCadet::time_out = 200; // ----------------------------------------------------------------------------- @@ -80,8 +80,7 @@ SpaceCadet::SpaceCadet() { {Key_LeftControl, Key_LeftBracket, 250}, {Key_RightControl, Key_RightBracket, 250}, */ - SPACECADET_MAP_END - }; + SPACECADET_MAP_END}; map = initialmap; } @@ -219,7 +218,7 @@ void SpaceCadet::flushEvent(bool is_tap) { Runtime.handleKeyswitchEvent(event); } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::SpaceCadet SpaceCadet; diff --git a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h index 6c6c7e21..e36ce48f 100644 --- a/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h +++ b/plugins/Kaleidoscope-SpaceCadet/src/kaleidoscope/plugin/SpaceCadet.h @@ -18,8 +18,8 @@ #pragma once -#include // for SC_FIRST, SC_LAST -#include // for uint16_t, uint8_t +#include // for SC_FIRST, SC_LAST +#include // for uint16_t, uint8_t #include "kaleidoscope/KeyAddrEventQueue.h" // for KeyAddrEventQueue #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -29,10 +29,11 @@ #include "kaleidoscope/plugin.h" // for Plugin #ifndef SPACECADET_MAP_END -#define SPACECADET_MAP_END (kaleidoscope::plugin::SpaceCadet::KeyBinding) { Key_NoKey, Key_NoKey, 0 } +#define SPACECADET_MAP_END \ + (kaleidoscope::plugin::SpaceCadet::KeyBinding) { Key_NoKey, Key_NoKey, 0 } #endif -constexpr Key Key_SpaceCadetEnable = Key(kaleidoscope::ranges::SC_FIRST); +constexpr Key Key_SpaceCadetEnable = Key(kaleidoscope::ranges::SC_FIRST); constexpr Key Key_SpaceCadetDisable = Key(kaleidoscope::ranges::SC_LAST); namespace kaleidoscope { @@ -79,8 +80,8 @@ class SpaceCadet : public kaleidoscope::Plugin { } // Publically accessible variables - static uint16_t time_out; // The global timeout in milliseconds - static SpaceCadet::KeyBinding * map; // The map of key bindings + static uint16_t time_out; // The global timeout in milliseconds + static SpaceCadet::KeyBinding *map; // The map of key bindings EventHandlerResult onNameQuery(); EventHandlerResult onKeyswitchEvent(KeyEvent &event); diff --git a/plugins/Kaleidoscope-Steno/src/kaleidoscope/plugin/GeminiPR.cpp b/plugins/Kaleidoscope-Steno/src/kaleidoscope/plugin/GeminiPR.cpp index 2c1f2ce7..c036f80a 100644 --- a/plugins/Kaleidoscope-Steno/src/kaleidoscope/plugin/GeminiPR.cpp +++ b/plugins/Kaleidoscope-Steno/src/kaleidoscope/plugin/GeminiPR.cpp @@ -17,11 +17,11 @@ #include "kaleidoscope/plugin/GeminiPR.h" -#include // for F, __FlashStringHelper -#include // for HardwareSerial -#include // for Focus, FocusSerial -#include // for uint8_t -#include // for memset +#include // for F, __FlashStringHelper +#include // for HardwareSerial +#include // for Focus, FocusSerial +#include // for uint8_t +#include // for memset #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ diff --git a/plugins/Kaleidoscope-Steno/src/kaleidoscope/plugin/GeminiPR.h b/plugins/Kaleidoscope-Steno/src/kaleidoscope/plugin/GeminiPR.h index 805ccaf4..8c08d47a 100644 --- a/plugins/Kaleidoscope-Steno/src/kaleidoscope/plugin/GeminiPR.h +++ b/plugins/Kaleidoscope-Steno/src/kaleidoscope/plugin/GeminiPR.h @@ -17,8 +17,8 @@ #pragma once -#include // for STENO_FIRST -#include // for uint8_t +#include // for STENO_FIRST +#include // for uint8_t #define S(n) Key(kaleidoscope::plugin::steno::geminipr::n) #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -46,14 +46,14 @@ enum { START = kaleidoscope::ranges::STENO_FIRST, FN = START, NUM, - N1 = NUM, + N1 = NUM, N2, N3, N4, N5, N6, SL, - S1 = SL, + S1 = SL, S2, TL, KL, @@ -64,12 +64,12 @@ enum { A, O, STR, - ST1 = STR, + ST1 = STR, ST2, RES1, - RE1 = RES1, + RE1 = RES1, RES2, - RE2 = RES2, + RE2 = RES2, PWR, ST3, ST4, @@ -91,11 +91,11 @@ enum { NB, NC, ZR, - END = ZR, + END = ZR, }; -} // namespace geminipr -} // namespace steno -} // namespace plugin -} // namespace kaleidoscope +} // namespace geminipr +} // namespace steno +} // namespace plugin +} // namespace kaleidoscope extern kaleidoscope::plugin::steno::GeminiPR GeminiPR; diff --git a/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp b/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp index d820be43..9f7b48d2 100644 --- a/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp +++ b/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.cpp @@ -17,9 +17,9 @@ #include "kaleidoscope/plugin/Syster.h" -#include // for F, __FlashStringHelper -#include // for Focus, FocusSerial -#include // for int8_t, uint8_t +#include // for F, __FlashStringHelper +#include // for Focus, FocusSerial +#include // for int8_t, uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -39,8 +39,8 @@ bool Syster::is_active_; // --- api --- void Syster::reset(void) { symbol_pos_ = 0; - symbol_[0] = 0; - is_active_ = false; + symbol_[0] = 0; + is_active_ = false; } bool Syster::is_active(void) { @@ -135,7 +135,7 @@ EventHandlerResult Syster::onKeyEvent(KeyEvent &event) { return EventHandlerResult::OK; } -} // namespace plugin +} // namespace plugin void eraseChars(int8_t n) { // For the `event.addr`, we could track the address of the Syster key, but it @@ -162,7 +162,7 @@ void eraseChars(int8_t n) { Runtime.handleKeyEvent(event); } -} // namespace kaleidoscope +} // namespace kaleidoscope __attribute__((weak)) const char keyToChar(Key key) { @@ -170,9 +170,9 @@ __attribute__((weak)) const char keyToChar(Key key) { return 0; switch (key.getKeyCode()) { - case Key_A.getKeyCode() ... Key_Z.getKeyCode(): + case Key_A.getKeyCode()... Key_Z.getKeyCode(): return 'a' + (key.getKeyCode() - Key_A.getKeyCode()); - case Key_1.getKeyCode() ... Key_9.getKeyCode(): + case Key_1.getKeyCode()... Key_9.getKeyCode(): return '1' + (key.getKeyCode() - Key_1.getKeyCode()); case Key_0.getKeyCode(): return '0'; diff --git a/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.h b/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.h index 8ca21e24..19754e85 100644 --- a/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.h +++ b/plugins/Kaleidoscope-Syster/src/kaleidoscope/plugin/Syster.h @@ -17,8 +17,8 @@ #pragma once -#include // for SYSTER -#include // for int8_t, uint8_t +#include // for SYSTER +#include // for int8_t, uint8_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult @@ -28,7 +28,7 @@ #define SYSTER_MAX_SYMBOL_LENGTH 32 constexpr Key Key_Syster = Key(kaleidoscope::ranges::SYSTER); -constexpr Key SYSTER = Key_Syster; +constexpr Key SYSTER = Key_Syster; namespace kaleidoscope { namespace plugin { @@ -56,11 +56,11 @@ class Syster : public kaleidoscope::Plugin { static bool is_active_; }; -} // namespace plugin +} // namespace plugin void eraseChars(int8_t n); -} // namespace kaleidoscope +} // namespace kaleidoscope const char keyToChar(Key key); diff --git a/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.cpp b/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.cpp index cc4af34b..15e6bf78 100644 --- a/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.cpp +++ b/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/TapDance.h" -#include // for F, __FlashStringHelper -#include // for Focus, FocusSerial -#include // for TD_FIRST -#include // for uint8_t, uint16_t +#include // for F, __FlashStringHelper +#include // for Focus, FocusSerial +#include // for TD_FIRST +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr, MatrixAddr #include "kaleidoscope/KeyAddrEventQueue.h" // for KeyAddrEventQueue @@ -37,7 +37,7 @@ namespace plugin { // --- config --- -uint16_t TapDance::time_out = 200; +uint16_t TapDance::time_out = 200; uint8_t TapDance::tap_count_ = 0; KeyEventTracker TapDance::event_tracker_; @@ -54,7 +54,7 @@ void TapDance::actionKeys(uint8_t tap_count, tap_count = max_keys; KeyEvent event = event_queue_.event(0); - event.key = tap_keys[tap_count - 1].readFromProgmem(); + event.key = tap_keys[tap_count - 1].readFromProgmem(); if (action == Interrupt || action == Timeout || action == Hold) { event_queue_.shift(); @@ -68,7 +68,7 @@ void TapDance::actionKeys(uint8_t tap_count, void TapDance::flushQueue(KeyAddr ignored_addr) { - while (! event_queue_.isEmpty()) { + while (!event_queue_.isEmpty()) { KeyEvent queued_event = event_queue_.event(0); event_queue_.shift(); if (queued_event.addr != ignored_addr) @@ -94,7 +94,7 @@ EventHandlerResult TapDance::onKeyswitchEvent(KeyEvent &event) { } // If event.addr is not a physical key, ignore it; some other plugin injected it. - if (! event.addr.isValid() || keyIsInjected(event.state)) { + if (!event.addr.isValid() || keyIsInjected(event.state)) { return EventHandlerResult::OK; } @@ -109,10 +109,10 @@ EventHandlerResult TapDance::onKeyswitchEvent(KeyEvent &event) { return EventHandlerResult::OK; KeyAddr td_addr = event_queue_.addr(0); - Key td_key = Layer.lookupOnActiveLayer(td_addr); - uint8_t td_id = td_key.getRaw() - ranges::TD_FIRST; + Key td_key = Layer.lookupOnActiveLayer(td_addr); + uint8_t td_id = td_key.getRaw() - ranges::TD_FIRST; - if (! event_queue_.isEmpty() && + if (!event_queue_.isEmpty() && event.addr != event_queue_.addr(0)) { // Interrupt: Call `tapDanceAction()` first, so it will have access to the // TapDance key press event that needs to be sent, then flush the queue. @@ -121,7 +121,7 @@ EventHandlerResult TapDance::onKeyswitchEvent(KeyEvent &event) { tap_count_ = 0; // If the event isn't another TapDance key, let it proceed. If it is, fall // through to the next block, which handles "Tap" actions. - if (! isTapDanceKey(event.key)) + if (!isTapDanceKey(event.key)) return EventHandlerResult::OK; } @@ -141,8 +141,8 @@ EventHandlerResult TapDance::afterEachCycle() { // The first event in the queue is now guaranteed to be a TapDance key. KeyAddr td_addr = event_queue_.addr(0); - Key td_key = Layer.lookupOnActiveLayer(td_addr); - uint8_t td_id = td_key.getRaw() - ranges::TD_FIRST; + Key td_key = Layer.lookupOnActiveLayer(td_addr); + uint8_t td_id = td_key.getRaw() - ranges::TD_FIRST; // Check for timeout uint16_t start_time = event_queue_.timestamp(0); @@ -170,8 +170,7 @@ EventHandlerResult TapDance::afterEachCycle() { } // namespace plugin } // namespace kaleidoscope -__attribute__((weak)) void tapDanceAction(uint8_t tap_dance_index, KeyAddr key_addr, uint8_t tap_count, - kaleidoscope::plugin::TapDance::ActionType tap_dance_action) { +__attribute__((weak)) void tapDanceAction(uint8_t tap_dance_index, KeyAddr key_addr, uint8_t tap_count, kaleidoscope::plugin::TapDance::ActionType tap_dance_action) { } kaleidoscope::plugin::TapDance TapDance; diff --git a/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.h b/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.h index 0754845e..14355ea4 100644 --- a/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.h +++ b/plugins/Kaleidoscope-TapDance/src/kaleidoscope/plugin/TapDance.h @@ -17,9 +17,9 @@ #pragma once -#include // for PROGMEM -#include // for TD_FIRST, TD_LAST -#include // for uint8_t, uint16_t +#include // for PROGMEM +#include // for TD_FIRST, TD_LAST +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyAddrEventQueue.h" // for KeyAddrEventQueue @@ -29,13 +29,12 @@ #include "kaleidoscope/key_defs.h" // for Key #include "kaleidoscope/plugin.h" // for Plugin -#define TD(n) kaleidoscope::plugin::TapDanceKey(n) +#define TD(n) kaleidoscope::plugin::TapDanceKey(n) -#define tapDanceActionKeys(tap_count, tap_dance_action, ...) ({ \ - static const Key __k[] PROGMEM = { __VA_ARGS__ }; \ - TapDance.actionKeys(tap_count, tap_dance_action, \ - sizeof (__k) / sizeof (Key), &__k[0]); \ - }) +#define tapDanceActionKeys(tap_count, tap_dance_action, ...) ({ \ + static const Key __k[] PROGMEM = {__VA_ARGS__}; \ + TapDance.actionKeys(tap_count, tap_dance_action, sizeof(__k) / sizeof(Key), &__k[0]); \ +}) namespace kaleidoscope { namespace plugin { @@ -82,13 +81,11 @@ class TapDance : public kaleidoscope::Plugin { static uint8_t tap_count_; void flushQueue(KeyAddr ignored_addr = KeyAddr::none()); - }; } // namespace plugin } // namespace kaleidoscope -void tapDanceAction(uint8_t tap_dance_index, KeyAddr key_addr, uint8_t tap_count, - kaleidoscope::plugin::TapDance::ActionType tap_dance_action); +void tapDanceAction(uint8_t tap_dance_index, KeyAddr key_addr, uint8_t tap_count, kaleidoscope::plugin::TapDance::ActionType tap_dance_action); extern kaleidoscope::plugin::TapDance TapDance; diff --git a/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.cpp b/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.cpp index d4baf9a0..a31d1cee 100644 --- a/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.cpp +++ b/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.cpp @@ -17,7 +17,7 @@ #include "kaleidoscope/plugin/TopsyTurvy.h" -#include // for TT_FIRST +#include // for TT_FIRST #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -97,7 +97,7 @@ EventHandlerResult TopsyTurvy::beforeReportingState(const KeyEvent &event) { return EventHandlerResult::OK; } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope kaleidoscope::plugin::TopsyTurvy TopsyTurvy; diff --git a/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.h b/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.h index 24e642bb..da504a90 100644 --- a/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.h +++ b/plugins/Kaleidoscope-TopsyTurvy/src/kaleidoscope/plugin/TopsyTurvy.h @@ -17,7 +17,7 @@ #pragma once -#include // for TT_FIRST, TT_LAST +#include // for TT_FIRST, TT_LAST #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -25,7 +25,7 @@ #include "kaleidoscope/key_defs.h" // for Key #include "kaleidoscope/plugin.h" // for Plugin -#define TOPSY(k) ::kaleidoscope::plugin::TopsyTurvyKey(Key_ ## k) +#define TOPSY(k) ::kaleidoscope::plugin::TopsyTurvyKey(Key_##k) namespace kaleidoscope { namespace plugin { @@ -34,7 +34,7 @@ constexpr Key TopsyTurvyKey(Key key) { return Key(kaleidoscope::ranges::TT_FIRST + key.getKeyCode()); } -class TopsyTurvy: public kaleidoscope::Plugin { +class TopsyTurvy : public kaleidoscope::Plugin { public: TopsyTurvy(void) {} diff --git a/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.cpp b/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.cpp index 8adea2f4..fc83e70b 100644 --- a/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.cpp +++ b/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.cpp @@ -17,9 +17,9 @@ #include "kaleidoscope/plugin/Turbo.h" -#include // for F, __FlashS... -#include // for Focus, Focu... -#include // for uint16_t +#include // for F, __FlashS... +#include // for Focus, Focu... +#include // for uint16_t #include "kaleidoscope/KeyAddr.h" // for MatrixAddr #include "kaleidoscope/KeyAddrMap.h" // for KeyAddrMap<... @@ -36,14 +36,14 @@ namespace kaleidoscope { namespace plugin { -uint16_t Turbo::interval_ = 10; +uint16_t Turbo::interval_ = 10; uint16_t Turbo::flash_interval_ = 69; -bool Turbo::sticky_ = false; -bool Turbo::flash_ = true; -cRGB Turbo::active_color_ = CRGB(160, 0, 0); +bool Turbo::sticky_ = false; +bool Turbo::flash_ = true; +cRGB Turbo::active_color_ = CRGB(160, 0, 0); -bool Turbo::active_ = false; -uint32_t Turbo::start_time_ = 0; +bool Turbo::active_ = false; +uint32_t Turbo::start_time_ = 0; uint32_t Turbo::flash_start_time_ = 0; uint16_t Turbo::interval() { @@ -91,7 +91,7 @@ EventHandlerResult Turbo::onKeyEvent(KeyEvent &event) { return EventHandlerResult::OK; if (keyToggledOn(event.state)) { - active_ = true; + active_ = true; start_time_ = Runtime.millisAtCycleStart() - interval_; } else { active_ = false; @@ -138,13 +138,13 @@ EventHandlerResult Turbo::afterEachCycle() { EventHandlerResult Turbo::beforeSyncingLeds() { if (flash_ && active_) { static bool leds_on = false; - cRGB color = CRGB(0, 0, 0); + cRGB color = CRGB(0, 0, 0); if (leds_on) { color = active_color_; } if (Runtime.hasTimeExpired(flash_start_time_, flash_interval_)) { flash_start_time_ = Runtime.millisAtCycleStart(); - leds_on = !leds_on; + leds_on = !leds_on; } for (KeyAddr key_addr : KeyAddr::all()) { Key key = live_keys[key_addr]; diff --git a/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.h b/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.h index b01979e8..af12ea32 100644 --- a/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.h +++ b/plugins/Kaleidoscope-Turbo/src/kaleidoscope/plugin/Turbo.h @@ -17,8 +17,8 @@ #pragma once -#include // for TURBO -#include // for uint16_t, uint32_t +#include // for TURBO +#include // for uint16_t, uint32_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/device/device.h" // for cRGB diff --git a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp index bbf63ae6..ffc106d3 100644 --- a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp +++ b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp @@ -17,10 +17,10 @@ #include "kaleidoscope/plugin/TypingBreaks.h" -#include // for PSTR, strcmp_P, F -#include // for EEPROMSettings -#include // for Focus, FocusSerial -#include // for uint32_t, uint16_t +#include // for PSTR, strcmp_P, F +#include // for EEPROMSettings +#include // for Focus, FocusSerial +#include // for uint32_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -33,12 +33,11 @@ namespace kaleidoscope { namespace plugin { TypingBreaks::settings_t TypingBreaks::settings = { - .idle_time_limit = 300, // 5m - .lock_time_out = 2700, // 45m - .lock_length = 300, // 5m - .left_hand_max_keys = 0, - .right_hand_max_keys = 0 -}; + .idle_time_limit = 300, // 5m + .lock_time_out = 2700, // 45m + .lock_length = 300, // 5m + .left_hand_max_keys = 0, + .right_hand_max_keys = 0}; bool TypingBreaks::keyboard_locked_{false}; uint32_t TypingBreaks::session_start_time_; @@ -49,9 +48,9 @@ uint16_t TypingBreaks::right_hand_keys_; uint16_t TypingBreaks::settings_base_; EventHandlerResult TypingBreaks::onKeyEvent(KeyEvent &event) { - uint32_t lock_length = settings.lock_length * 1000; + uint32_t lock_length = settings.lock_length * 1000; uint32_t idle_time_limit = settings.idle_time_limit * 1000; - uint32_t lock_time_out = settings.lock_time_out * 1000; + uint32_t lock_time_out = settings.lock_time_out * 1000; // Let key release events through regardless, so the last key pressed (and any // other held keys) finish getting processed when they're released. @@ -68,7 +67,7 @@ EventHandlerResult TypingBreaks::onKeyEvent(KeyEvent &event) { // ...otherwise clear the lock keyboard_locked_ = false; left_hand_keys_ = right_hand_keys_ = 0; - session_start_time_ = Runtime.millisAtCycleStart(); + session_start_time_ = Runtime.millisAtCycleStart(); TypingBreak(false); } @@ -79,7 +78,7 @@ EventHandlerResult TypingBreaks::onKeyEvent(KeyEvent &event) { if (Runtime.hasTimeExpired(last_key_time_, idle_time_limit)) { // No, we are not. Clear timers and start over. left_hand_keys_ = right_hand_keys_ = 0; - session_start_time_ = Runtime.millisAtCycleStart(); + session_start_time_ = Runtime.millisAtCycleStart(); } // If we have a limit on the either hand, and we reached it, lock up! @@ -133,11 +132,11 @@ EventHandlerResult TypingBreaks::onSetup() { return EventHandlerResult::OK; } -#define FOCUS_HOOK_TYPINGBREAKS FOCUS_HOOK(TypingBreaks.focusHook, \ +#define FOCUS_HOOK_TYPINGBREAKS FOCUS_HOOK(TypingBreaks.focusHook, \ "typingbreaks.idleTimeLimit\n" \ - "typingbreaks.lockTimeOut\n" \ - "typingbreaks.lockLength\n" \ - "typingbreaks.leftMaxKeys\n" \ + "typingbreaks.lockTimeOut\n" \ + "typingbreaks.lockLength\n" \ + "typingbreaks.leftMaxKeys\n" \ "typingbreaks.rightMaxKeys") EventHandlerResult TypingBreaks::onFocusEvent(const char *command) { diff --git a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.h b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.h index ccb4d52f..daf9d958 100644 --- a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.h +++ b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t, uint32_t +#include // for uint16_t, uint32_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/event_handler_result.h" // for EventHandlerResult diff --git a/plugins/Kaleidoscope-USB-Quirks/src/kaleidoscope/plugin/USB-Quirks.cpp b/plugins/Kaleidoscope-USB-Quirks/src/kaleidoscope/plugin/USB-Quirks.cpp index e0cceed3..42d9f3d8 100644 --- a/plugins/Kaleidoscope-USB-Quirks/src/kaleidoscope/plugin/USB-Quirks.cpp +++ b/plugins/Kaleidoscope-USB-Quirks/src/kaleidoscope/plugin/USB-Quirks.cpp @@ -17,8 +17,8 @@ #include "kaleidoscope/plugin/USB-Quirks.h" -#include // for delay -#include // for uint8_t +#include // for delay +#include // for uint8_t #include "kaleidoscope/Runtime.h" // for Runtime #include "kaleidoscope/device/device.h" // for Base<>::HID diff --git a/plugins/Kaleidoscope-USB-Quirks/src/kaleidoscope/plugin/USB-Quirks.h b/plugins/Kaleidoscope-USB-Quirks/src/kaleidoscope/plugin/USB-Quirks.h index 8d2cca26..0fda0363 100644 --- a/plugins/Kaleidoscope-USB-Quirks/src/kaleidoscope/plugin/USB-Quirks.h +++ b/plugins/Kaleidoscope-USB-Quirks/src/kaleidoscope/plugin/USB-Quirks.h @@ -21,7 +21,7 @@ namespace kaleidoscope { namespace plugin { -class USBQuirks: public kaleidoscope::Plugin { +class USBQuirks : public kaleidoscope::Plugin { public: USBQuirks() {} diff --git a/plugins/Kaleidoscope-Unicode/src/kaleidoscope/plugin/Unicode.cpp b/plugins/Kaleidoscope-Unicode/src/kaleidoscope/plugin/Unicode.cpp index f1a4ee33..476a3ad7 100644 --- a/plugins/Kaleidoscope-Unicode/src/kaleidoscope/plugin/Unicode.cpp +++ b/plugins/Kaleidoscope-Unicode/src/kaleidoscope/plugin/Unicode.cpp @@ -17,9 +17,9 @@ #include "kaleidoscope/plugin/Unicode.h" -#include // for delay -#include // for HostOS, LINUX -#include // for uint8_t +#include // for delay +#include // for HostOS, LINUX +#include // for uint8_t #include "kaleidoscope/Runtime.h" // for Runtime #include "kaleidoscope/device/device.h" // for Base<>::HID @@ -155,7 +155,7 @@ __attribute__((weak)) Key hexToKey(uint8_t hex) { } else { m = Key_A.getKeyCode() + (hex - 0xA); } - return { m, KEY_FLAGS }; + return {m, KEY_FLAGS}; } __attribute__((weak)) Key hexToKeysWithNumpad(uint8_t hex) { @@ -190,7 +190,7 @@ __attribute__((weak)) Key hexToKeysWithNumpad(uint8_t hex) { break; } } - return { m, KEY_FLAGS }; + return {m, KEY_FLAGS}; } __attribute__((weak)) void unicodeCustomStart(void) { diff --git a/plugins/Kaleidoscope-Unicode/src/kaleidoscope/plugin/Unicode.h b/plugins/Kaleidoscope-Unicode/src/kaleidoscope/plugin/Unicode.h index ce2cc39e..0eaffc9b 100644 --- a/plugins/Kaleidoscope-Unicode/src/kaleidoscope/plugin/Unicode.h +++ b/plugins/Kaleidoscope-Unicode/src/kaleidoscope/plugin/Unicode.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint8_t, uint32_t +#include // for uint8_t, uint32_t #include "kaleidoscope/key_defs.h" // for Key #include "kaleidoscope/plugin.h" // for Plugin @@ -48,6 +48,7 @@ class Unicode : public kaleidoscope::Plugin { static Key getLinuxKey() { return linux_key_; } + private: static Key linux_key_; static uint8_t input_delay_; diff --git a/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.h b/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.h index b8405650..80926b39 100644 --- a/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.h +++ b/plugins/Kaleidoscope-WinKeyToggle/src/kaleidoscope/plugin/WinKeyToggle.h @@ -23,7 +23,7 @@ namespace kaleidoscope { namespace plugin { -class WinKeyToggle: public kaleidoscope::Plugin { +class WinKeyToggle : public kaleidoscope::Plugin { public: WinKeyToggle() {} @@ -31,6 +31,7 @@ class WinKeyToggle: public kaleidoscope::Plugin { void toggle() { enabled_ = !enabled_; } + private: static bool enabled_; }; diff --git a/src/Kaleidoscope.h b/src/Kaleidoscope.h index 62ccee7c..ddc1a773 100644 --- a/src/Kaleidoscope.h +++ b/src/Kaleidoscope.h @@ -25,12 +25,12 @@ extern "C" { void loop(); void setup(); #ifdef __cplusplus -} // extern "C" +} // extern "C" #endif //add your function definitions for the project KeyboardIO here -#define TS(X) //Serial.print(micros() );Serial.print("\t");Serial.println(X); +#define TS(X) //Serial.print(micros() );Serial.print("\t");Serial.println(X); #include #include @@ -47,36 +47,32 @@ void setup(); // host_keymap-keymaps on different layers (see key_defs.h for its // default definition. -#define CONVERT_AND_CHECK_KEY(KEY) \ - ( \ - ( \ - struct { \ - static_assert(CONVERT_TO_KEY(KEY) != kaleidoscope::bad_keymap_key, \ - "Bad key definition: \'" #KEY "\'"); \ - } \ - ){}, \ - CONVERT_TO_KEY(KEY) \ - ) +#define CONVERT_AND_CHECK_KEY(KEY) \ + ( \ + ( \ + struct { \ + static_assert(CONVERT_TO_KEY(KEY) != kaleidoscope::bad_keymap_key, \ + "Bad key definition: \'" #KEY "\'"); \ + }){}, \ + CONVERT_TO_KEY(KEY)) #ifdef PER_KEY_DATA_STACKED -#define KEYMAP_STACKED(...) \ - { \ - MAP_LIST( \ - CONVERT_AND_CHECK_KEY, \ - PER_KEY_DATA_STACKED(XXX, __VA_ARGS__) \ - ) \ - } +#define KEYMAP_STACKED(...) \ + { \ + MAP_LIST( \ + CONVERT_AND_CHECK_KEY, \ + PER_KEY_DATA_STACKED(XXX, __VA_ARGS__)) \ + } #endif #ifdef PER_KEY_DATA -#define KEYMAP(...) \ - { \ - MAP_LIST( \ - CONVERT_AND_CHECK_KEY, \ - PER_KEY_DATA(XXX, __VA_ARGS__) \ - ) \ - } +#define KEYMAP(...) \ + { \ + MAP_LIST( \ + CONVERT_AND_CHECK_KEY, \ + PER_KEY_DATA(XXX, __VA_ARGS__)) \ + } #endif #include "kaleidoscope/KeyAddr.h" @@ -122,10 +118,9 @@ void setup(); */ #if defined(KALEIDOSCOPE_REQUIRED_API_VERSION) && (KALEIDOSCOPE_REQUIRED_API_VERSION != KALEIDOSCOPE_API_VERSION) #define xstr(a) str(a) -#define str(a) #a +#define str(a) #a static_assert(KALEIDOSCOPE_REQUIRED_API_VERSION == KALEIDOSCOPE_API_VERSION, - "Kaleidoscope API version mismatch! We have version " xstr(KALEIDOSCOPE_API_VERSION) - " available, but version " xstr(KALEIDOSCOPE_REQUIRED_API_VERSION) " is required."); + "Kaleidoscope API version mismatch! We have version " xstr(KALEIDOSCOPE_API_VERSION) " available, but version " xstr(KALEIDOSCOPE_REQUIRED_API_VERSION) " is required."); #endif // Use this function macro to register plugins with Kaleidoscope's diff --git a/src/kaleidoscope/HIDTables.h b/src/kaleidoscope/HIDTables.h index 59784338..7e309df5 100644 --- a/src/kaleidoscope/HIDTables.h +++ b/src/kaleidoscope/HIDTables.h @@ -16,6 +16,7 @@ #pragma once +// clang-format off // These mappings were extracted and transcribed from // https://www.usb.org/sites/default/files/hut1_2.pdf diff --git a/src/kaleidoscope/KeyAddrBitfield.h b/src/kaleidoscope/KeyAddrBitfield.h index ef85e07c..22219a68 100644 --- a/src/kaleidoscope/KeyAddrBitfield.h +++ b/src/kaleidoscope/KeyAddrBitfield.h @@ -16,9 +16,9 @@ #pragma once -#include // for bitClear, bitRead, bitSet, bitWrite -#include // for uint8_t -#include // for memset +#include // for bitClear, bitRead, bitSet, bitWrite +#include // for uint8_t +#include // for memset #include "kaleidoscope/KeyAddr.h" // for KeyAddr @@ -30,7 +30,7 @@ namespace kaleidoscope { // when calling this function (e.g. `bitfieldSize(n)`). The default `UnitType` // is `byte` (i.e. `uint8_t`, which is almost always what we want, so most of the time we // can also drop that template parameter (e.g. `bitfieldSize(n)`). -template +template constexpr _WidthType bitfieldSize(_WidthType n) { return ((n - 1) / (8 * sizeof(_UnitType))) + 1; } @@ -40,9 +40,8 @@ constexpr _WidthType bitfieldSize(_WidthType n) { class KeyAddrBitfield { public: - - static constexpr uint8_t size = KeyAddr::upper_limit; - static constexpr uint8_t block_size = 8 * sizeof(uint8_t); + static constexpr uint8_t size = KeyAddr::upper_limit; + static constexpr uint8_t block_size = 8 * sizeof(uint8_t); static constexpr uint8_t total_blocks = bitfieldSize(size); static constexpr uint8_t blockIndex(KeyAddr k) { @@ -100,7 +99,6 @@ class KeyAddrBitfield { } private: - uint8_t data_[total_blocks] = {}; @@ -139,7 +137,7 @@ class KeyAddrBitfield { // When we're done checking a block, move on to the next one: block_index_ += 1; - bit_index_ = 0; + bit_index_ = 0; } return false; } @@ -155,12 +153,12 @@ class KeyAddrBitfield { private: const KeyAddrBitfield &bitfield_; - uint8_t block_index_; // index of the block - uint8_t bit_index_{0}; // bit index in the block + uint8_t block_index_; // index of the block + uint8_t bit_index_{0}; // bit index in the block uint8_t block_; KeyAddr index_; - }; // class Iterator { + }; // class Iterator { friend class Iterator; @@ -171,9 +169,9 @@ class KeyAddrBitfield { return Iterator{*this, total_blocks}; } -} __attribute__((packed)); // class KeyAddrBitfield { +} __attribute__((packed)); // class KeyAddrBitfield { -} // namespace kaleidoscope { +} // namespace kaleidoscope // ================================================================================ diff --git a/src/kaleidoscope/KeyAddrEventQueue.h b/src/kaleidoscope/KeyAddrEventQueue.h index 6a60c18a..f343a111 100644 --- a/src/kaleidoscope/KeyAddrEventQueue.h +++ b/src/kaleidoscope/KeyAddrEventQueue.h @@ -17,8 +17,8 @@ #pragma once -#include // for bitRead, bitWrite -#include // for uint8_t, uint16_t +#include // for bitRead, bitWrite +#include // for uint8_t, uint16_t //#include #include "kaleidoscope/KeyAddr.h" // for KeyAddr @@ -36,20 +36,20 @@ namespace kaleidoscope { // other data, in order to best serve the specific needs of the Qukeys // plugin. Its performance is better for a queue that needs to be searched much // more frequently than entries are added or removed. -template +template class KeyAddrEventQueue { static_assert(_capacity <= (sizeof(_Bitfield) * 8), "EventQueue error: _Bitfield type too small for _capacity!"); private: - uint8_t length_{0}; - KeyEventId event_ids_[_capacity]; // NOLINT(runtime/arrays) - KeyAddr addrs_[_capacity]; // NOLINT(runtime/arrays) - _Timestamp timestamps_[_capacity]; // NOLINT(runtime/arrays) - _Bitfield release_event_bits_; + uint8_t length_{0}; + KeyEventId event_ids_[_capacity]; // NOLINT(runtime/arrays) + KeyAddr addrs_[_capacity]; // NOLINT(runtime/arrays) + _Timestamp timestamps_[_capacity]; // NOLINT(runtime/arrays) + _Bitfield release_event_bits_; public: uint8_t length() const { @@ -91,7 +91,7 @@ class KeyAddrEventQueue { // Append a new event on the end of the queue. Note: the caller is responsible // for bounds checking; we don't guard against it here. - void append(const KeyEvent& event) { + void append(const KeyEvent &event) { // assert(length_ < _capacity); event_ids_[length_] = event.id(); addrs_[length_] = event.addr; @@ -155,7 +155,7 @@ class KeyAddrEventQueue { } // Only call this after `EventTracker::shouldIgnore()` returns `true`. - bool shouldAbort(const KeyEvent& event) const { + bool shouldAbort(const KeyEvent &event) const { return (length_ != 0) && (event.id() - event_ids_[0] >= 0); } }; diff --git a/src/kaleidoscope/KeyAddrMap.h b/src/kaleidoscope/KeyAddrMap.h index 3026de6f..fdcc7815 100644 --- a/src/kaleidoscope/KeyAddrMap.h +++ b/src/kaleidoscope/KeyAddrMap.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr @@ -41,13 +41,13 @@ class KeyAddrMap { // To set the value of an entry: // key_array[key_addr] = Key_X; - _ContentType& operator[](KeyAddr key_addr) { + _ContentType &operator[](KeyAddr key_addr) { return values_[key_addr.toInt()]; } // To get the value of an entry: // Key key = key_array[key_addr]; - const _ContentType& operator[](KeyAddr key_addr) const { + const _ContentType &operator[](KeyAddr key_addr) const { return values_[key_addr.toInt()]; } @@ -82,17 +82,18 @@ class KeyAddrMap { bool operator!=(const Iterator &other) const { return key_addr_ != other.key_addr_; } - _ContentType& operator*() const { + _ContentType &operator*() const { return map_[key_addr_]; } - Iterator& operator++() { + Iterator &operator++() { ++key_addr_; return *this; } + private: ThisType &map_; KeyAddr key_addr_; }; }; -} // namespace kaleidoscope +} // namespace kaleidoscope diff --git a/src/kaleidoscope/KeyEvent.h b/src/kaleidoscope/KeyEvent.h index d96dad32..2d099108 100644 --- a/src/kaleidoscope/KeyEvent.h +++ b/src/kaleidoscope/KeyEvent.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t, int8_t +#include // for uint8_t, int8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/key_defs.h" // for Key_Undefined, Key @@ -30,11 +30,11 @@ struct KeyEvent { public: // Constructor for plugin use when regenerating an event with specific ID: - KeyEvent(KeyAddr addr, uint8_t state, - Key key = Key_Undefined, KeyEventId id = last_id_) + KeyEvent(KeyAddr addr, uint8_t state, Key key = Key_Undefined, KeyEventId id = last_id_) : addr(addr), state(state), key(key), id_(id) {} - KeyEvent() : id_(last_id_) {} + KeyEvent() + : id_(last_id_) {} // For use by keyscanner creating a new event from a physical keyswitch toggle // on or off. @@ -47,13 +47,13 @@ struct KeyEvent { } void swapId(KeyEvent &other) { KeyEventId tmp_id = id_; - id_ = other.id_; - other.id_ = tmp_id; + id_ = other.id_; + other.id_ = tmp_id; } - KeyAddr addr = KeyAddr::none(); + KeyAddr addr = KeyAddr::none(); uint8_t state = 0; - Key key = Key_Undefined; + Key key = Key_Undefined; private: // serial number of the event: diff --git a/src/kaleidoscope/KeyEventTracker.h b/src/kaleidoscope/KeyEventTracker.h index cd91f1ab..5b37e543 100644 --- a/src/kaleidoscope/KeyEventTracker.h +++ b/src/kaleidoscope/KeyEventTracker.h @@ -97,7 +97,6 @@ class KeyEventTracker { } return false; } - }; } // namespace kaleidoscope diff --git a/src/kaleidoscope/KeyMap.h b/src/kaleidoscope/KeyMap.h index 9d8e93e0..8094bc99 100644 --- a/src/kaleidoscope/KeyMap.h +++ b/src/kaleidoscope/KeyMap.h @@ -24,4 +24,4 @@ namespace kaleidoscope { typedef KeyAddrMap KeyMap; -} // namespace kaleidoscope +} // namespace kaleidoscope diff --git a/src/kaleidoscope/LiveKeys.cpp b/src/kaleidoscope/LiveKeys.cpp index 1c66d1b9..44f84f41 100644 --- a/src/kaleidoscope/LiveKeys.cpp +++ b/src/kaleidoscope/LiveKeys.cpp @@ -20,4 +20,4 @@ namespace kaleidoscope { LiveKeys live_keys; -} // namespace kaleidoscope +} // namespace kaleidoscope diff --git a/src/kaleidoscope/LiveKeys.h b/src/kaleidoscope/LiveKeys.h index 53e51e66..63218bd1 100644 --- a/src/kaleidoscope/LiveKeys.h +++ b/src/kaleidoscope/LiveKeys.h @@ -45,7 +45,7 @@ namespace kaleidoscope { class LiveKeys { public: // For array-style subscript addressing of entries in a read-only context: - const Key& operator[](KeyAddr key_addr) const { + const Key &operator[](KeyAddr key_addr) const { if (key_addr.isValid()) { return key_map_[key_addr]; } @@ -55,7 +55,7 @@ class LiveKeys { // For array-style subscript addressing of entries by reference. The client // code can alter values in the array this way. - Key& operator[](KeyAddr key_addr) { + Key &operator[](KeyAddr key_addr) { if (key_addr.isValid()) { return key_map_[key_addr]; } @@ -92,7 +92,7 @@ class LiveKeys { /// Returns an iterator for use in range-based for loops: /// /// for (Key key : live_keys.all()) {...} - KeyMap& all() { + KeyMap &all() { return key_map_; } @@ -103,4 +103,4 @@ class LiveKeys { extern LiveKeys live_keys; -} // namespace kaleidoscope +} // namespace kaleidoscope diff --git a/src/kaleidoscope/MatrixAddr.h b/src/kaleidoscope/MatrixAddr.h index c150747d..9a2a7c4c 100644 --- a/src/kaleidoscope/MatrixAddr.h +++ b/src/kaleidoscope/MatrixAddr.h @@ -25,15 +25,13 @@ namespace kaleidoscope { template class MatrixAddr { private: - uint8_t offset_; public: - typedef MatrixAddr ThisType; - static constexpr uint8_t rows = rows__; - static constexpr uint8_t cols = cols__; + static constexpr uint8_t rows = rows__; + static constexpr uint8_t cols = cols__; static constexpr uint8_t upper_limit = rows__ * cols__; static constexpr uint8_t invalid_state = 255; @@ -43,7 +41,8 @@ class MatrixAddr { "MatrixAddr exceeds the supported total number \n" "of 255 keys"); - constexpr MatrixAddr() : offset_(invalid_state) {} + constexpr MatrixAddr() + : offset_(invalid_state) {} constexpr MatrixAddr(uint8_t row, uint8_t col) : offset_(row * cols + col) {} @@ -58,8 +57,8 @@ class MatrixAddr { // ridiculously bad assembler code for each copy construction, // that would bloat the default firmware by 1K of PROGMEM! // - constexpr MatrixAddr(const ThisType &other) = default; // NOLINT(runtime/explicit) - constexpr MatrixAddr(ThisType &&other) = default; // NOLINT(runtime/explicit) + constexpr MatrixAddr(const ThisType &other) = default; // NOLINT(runtime/explicit) + constexpr MatrixAddr(ThisType &&other) = default; // NOLINT(runtime/explicit) //constexpr MatrixAddr(const ThisType &other) : offset_(other.offset_) {} //constexpr MatrixAddr(ThisType &&other) : offset_(other.offset_) {} @@ -140,9 +139,9 @@ class MatrixAddr { return *this; } - ThisType operator++(int) { // postfix ++ + ThisType operator++(int) { // postfix ++ ThisType copy(*this); - ++*this; // call the prefix increment + ++*this; // call the prefix increment return copy; } @@ -151,34 +150,34 @@ class MatrixAddr { return *this; } - ThisType operator--(int) { // postfix ++ + ThisType operator--(int) { // postfix ++ ThisType copy(*this); - --*this; // call the prefix increment + --*this; // call the prefix increment return copy; } template - ThisType &operator+(const MatrixAddr__ & other) { + ThisType &operator+(const MatrixAddr__ &other) { *this = ThisType(this->row() + other.row(), this->col() + other.col()); return *this; } template - ThisType &operator-(const MatrixAddr__ & other) { + ThisType &operator-(const MatrixAddr__ &other) { *this = ThisType(this->row() - other.row(), this->col() - other.col()); return *this; } template - ThisType &operator+=(const MatrixAddr__ & other) { + ThisType &operator+=(const MatrixAddr__ &other) { *this = *this + other; return *this; } template - ThisType &operator-=(const MatrixAddr__ & other) { + ThisType &operator-=(const MatrixAddr__ &other) { *this = *this - other; return *this; } @@ -230,37 +229,36 @@ class MatrixAddr { #ifdef MATRIX_ADDR_TESTING template -bool operator==(const MatrixAddr1__ & a1, const MatrixAddr2__ & a2) { +bool operator==(const MatrixAddr1__ &a1, const MatrixAddr2__ &a2) { return (a1.row() == a2.row()) && (a1.col() == a2.col()); } template -bool operator!=(const MatrixAddr1__ & a1, const MatrixAddr2__ & a2) { +bool operator!=(const MatrixAddr1__ &a1, const MatrixAddr2__ &a2) { return !operator==(a1, a2); } template -bool operator>(const MatrixAddr1__ & a1, const MatrixAddr2__ & a2) { - return (a1.row() > a2.row()) - || ((a1.row() == a2.row()) && (a1.col() > a2.col())); +bool operator>(const MatrixAddr1__ &a1, const MatrixAddr2__ &a2) { + return (a1.row() > a2.row()) || ((a1.row() == a2.row()) && (a1.col() > a2.col())); } template -bool operator<(const MatrixAddr1__ & a1, const MatrixAddr2__ & a2) { +bool operator<(const MatrixAddr1__ &a1, const MatrixAddr2__ &a2) { // This could be optimized if necessary return !operator>(a1, a2) && !operator==(a1, a2); } template -bool operator>=(const MatrixAddr1__ & a1, const MatrixAddr2__ & a2) { +bool operator>=(const MatrixAddr1__ &a1, const MatrixAddr2__ &a2) { // This could be optimized if necessary return operator>(a1, a2) || operator==(a1, a2); } template -bool operator<=(const MatrixAddr1__ & a1, const MatrixAddr2__ & a2) { +bool operator<=(const MatrixAddr1__ &a1, const MatrixAddr2__ &a2) { return !operator>(a1, a2); } #endif -} // namespace kaleidoscope +} // namespace kaleidoscope diff --git a/src/kaleidoscope/Runtime.cpp b/src/kaleidoscope/Runtime.cpp index eb22393e..2a958cb4 100644 --- a/src/kaleidoscope/Runtime.cpp +++ b/src/kaleidoscope/Runtime.cpp @@ -16,8 +16,8 @@ #include "kaleidoscope/Runtime.h" -#include // for millis -#include // for HardwareSerial +#include // for millis +#include // for HardwareSerial #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -36,8 +36,7 @@ Runtime_::Runtime_(void) { } // ---------------------------------------------------------------------------- -void -Runtime_::setup(void) { +void Runtime_::setup(void) { // We are explicitly initializing the Serial port as early as possible to // (temporarily, hopefully) work around an issue on OSX. If we initialize // Serial too late, no matter what we do, we'll end up reading garbage from @@ -60,8 +59,7 @@ Runtime_::setup(void) { } // ---------------------------------------------------------------------------- -void -Runtime_::loop(void) { +void Runtime_::loop(void) { millis_at_cycle_start_ = millis(); kaleidoscope::Hooks::beforeEachCycle(); @@ -79,8 +77,7 @@ Runtime_::loop(void) { } // ---------------------------------------------------------------------------- -void -Runtime_::handleKeyswitchEvent(KeyEvent event) { +void Runtime_::handleKeyswitchEvent(KeyEvent event) { // This function strictly handles physical key events. Any event without a // valid `KeyAddr` gets ignored. @@ -123,8 +120,7 @@ Runtime_::handleKeyswitchEvent(KeyEvent event) { } // ---------------------------------------------------------------------------- -void -Runtime_::handleKeyEvent(KeyEvent event) { +void Runtime_::handleKeyEvent(KeyEvent event) { // For events that didn't begin with `handleKeyswitchEvent()`, we need to look // up the `Key` value from the keymap (maybe overridden by `live_keys`). @@ -191,8 +187,7 @@ Runtime_::handleKeyEvent(KeyEvent event) { } // ---------------------------------------------------------------------------- -void -Runtime_::prepareKeyboardReport(const KeyEvent &event) { +void Runtime_::prepareKeyboardReport(const KeyEvent &event) { // before building the new report, start clean device().hid().keyboard().releaseAllKeys(); @@ -220,8 +215,7 @@ Runtime_::prepareKeyboardReport(const KeyEvent &event) { } // ---------------------------------------------------------------------------- -void -Runtime_::addToReport(Key key) { +void Runtime_::addToReport(Key key) { // First, call any relevant plugin handlers, to give them a chance to add // other values to the HID report directly and/or to abort the automatic // adding of keycodes below. @@ -252,8 +246,7 @@ Runtime_::addToReport(Key key) { } // ---------------------------------------------------------------------------- -void -Runtime_::sendKeyboardReport(const KeyEvent &event) { +void Runtime_::sendKeyboardReport(const KeyEvent &event) { // If the keycode for this key is already in the report, we need to send an // extra report without that keycode in order to correctly process the // rollover. It might be better to exempt modifiers from this rule, but it's @@ -294,6 +287,6 @@ Runtime_::sendKeyboardReport(const KeyEvent &event) { Runtime_ Runtime; -} // namespace kaleidoscope +} // namespace kaleidoscope kaleidoscope::Runtime_ &Kaleidoscope = kaleidoscope::Runtime; diff --git a/src/kaleidoscope/Runtime.h b/src/kaleidoscope/Runtime.h index b84c7846..9777c3de 100644 --- a/src/kaleidoscope/Runtime.h +++ b/src/kaleidoscope/Runtime.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint32_t +#include // for uint32_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -125,7 +125,7 @@ class Runtime_ { * of x ms, the value of ttl must not be larger than * std::numeric_limits::max() - x. */ - template + template static bool hasTimeExpired(_Timestamp start_time, _Timeout ttl) { _Timestamp current_time = millis_at_cycle_start_; _Timestamp elapsed_time = current_time - start_time; @@ -216,4 +216,4 @@ class Runtime_ { extern kaleidoscope::Runtime_ Runtime; -} // namespace kaleidoscope +} // namespace kaleidoscope diff --git a/src/kaleidoscope/bitfields.cpp b/src/kaleidoscope/bitfields.cpp index 807c4007..01ddd5fd 100644 --- a/src/kaleidoscope/bitfields.cpp +++ b/src/kaleidoscope/bitfields.cpp @@ -24,8 +24,8 @@ namespace bitfields { namespace internal { bool _BaseBitfield::isBitSetP(const void *bit_field, uint8_t raw_pos) { - uint8_t byte_id = raw_pos >> 3; - uint8_t bit_pos = raw_pos & 0x7; + uint8_t byte_id = raw_pos >> 3; + uint8_t bit_pos = raw_pos & 0x7; const uint8_t *bytes = reinterpret_cast(bit_field); return bytes[byte_id] & (0x1 << bit_pos); } @@ -33,7 +33,7 @@ bool _BaseBitfield::isBitSetP(const void *bit_field, uint8_t raw_pos) { void _BaseBitfield::setBitP(void *bit_field, uint8_t raw_pos, uint8_t val) { uint8_t byte_id = raw_pos >> 3; uint8_t bit_pos = raw_pos & 0x7; - uint8_t *bytes = reinterpret_cast(bit_field); + uint8_t *bytes = reinterpret_cast(bit_field); if (val) { bytes[byte_id] |= (0x1 << bit_pos); } else { @@ -42,13 +42,13 @@ void _BaseBitfield::setBitP(void *bit_field, uint8_t raw_pos, uint8_t val) { } bool _BaseBitfield::isBitSetPROGMEM_P(const void *bit_field, uint8_t raw_pos) { - uint8_t byte_id = raw_pos >> 3; - uint8_t bit_pos = raw_pos & 0x7; + uint8_t byte_id = raw_pos >> 3; + uint8_t bit_pos = raw_pos & 0x7; const uint8_t *bytes = reinterpret_cast(bit_field); - uint8_t the_byte = pgm_read_byte(&(bytes[byte_id])); + uint8_t the_byte = pgm_read_byte(&(bytes[byte_id])); return the_byte & (0x1 << bit_pos); } -} // namespace internal -} // namespace bitfields -} // namespace kaleidoscope +} // namespace internal +} // namespace bitfields +} // namespace kaleidoscope diff --git a/src/kaleidoscope/bitfields.h b/src/kaleidoscope/bitfields.h index c7cb6d9a..d530021c 100644 --- a/src/kaleidoscope/bitfields.h +++ b/src/kaleidoscope/bitfields.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include // for PROGMEM diff --git a/src/kaleidoscope/device/ATmega32U4Keyboard.h b/src/kaleidoscope/device/ATmega32U4Keyboard.h index a40a289b..f3ec42fb 100644 --- a/src/kaleidoscope/device/ATmega32U4Keyboard.h +++ b/src/kaleidoscope/device/ATmega32U4Keyboard.h @@ -40,17 +40,17 @@ struct ATmega32U4KeyboardProps : kaleidoscope::device::BaseProps { }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -template +template class ATmega32U4Keyboard : public kaleidoscope::device::Base<_DeviceProps> { public: auto serialPort() -> decltype(Serial) & { return Serial; } }; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD -template +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +template class ATmega32U4Keyboard; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD } // namespace device } // namespace kaleidoscope diff --git a/src/kaleidoscope/device/Base.h b/src/kaleidoscope/device/Base.h index aae4c3d8..756198ae 100644 --- a/src/kaleidoscope/device/Base.h +++ b/src/kaleidoscope/device/Base.h @@ -23,8 +23,8 @@ #pragma once -#include // for uint8_t, int8_t -#include // for size_t, strlen, memcpy +#include // for uint8_t, int8_t +#include // for size_t, strlen, memcpy #include "kaleidoscope/driver/bootloader/None.h" // for None #include "kaleidoscope/driver/hid/Base.h" // for Base, BaseProps @@ -87,7 +87,7 @@ class Base { int peek() { return 0; } - long parseInt() { // NOLINT(runtime/int) + long parseInt() { // NOLINT(runtime/int) return 0; } int available() { @@ -118,9 +118,9 @@ class Base { typedef typename _DeviceProps::StorageProps StorageProps; typedef typename _DeviceProps::Storage Storage; - static constexpr uint8_t matrix_rows = KeyScannerProps::matrix_rows; + static constexpr uint8_t matrix_rows = KeyScannerProps::matrix_rows; static constexpr uint8_t matrix_columns = KeyScannerProps::matrix_columns; - static constexpr uint8_t led_count = LEDDriverProps::led_count; + static constexpr uint8_t led_count = LEDDriverProps::led_count; static constexpr auto LEDs() -> decltype(LEDDriver::LEDs()) & { return LEDDriver::LEDs(); } @@ -439,10 +439,10 @@ class Base { // e.g. Model01 as device and Model01Props as properties class. // #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -#define EXPORT_DEVICE(DEVICE) \ - typedef DEVICE##Props DeviceProps; \ +#define EXPORT_DEVICE(DEVICE) \ + typedef DEVICE##Props DeviceProps; \ typedef DEVICE Device; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD -#define EXPORT_DEVICE(DEVICE) \ +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#define EXPORT_DEVICE(DEVICE) \ typedef DEVICE##Props DeviceProps; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/device/avr/pins_and_ports.h b/src/kaleidoscope/device/avr/pins_and_ports.h index d2d566cc..0643e6b5 100644 --- a/src/kaleidoscope/device/avr/pins_and_ports.h +++ b/src/kaleidoscope/device/avr/pins_and_ports.h @@ -24,7 +24,7 @@ #if !defined(__ASSEMBLER__) && !defined(KALEIDOSCOPE_VIRTUAL_BUILD) #include #endif -#define PORT_SHIFTER 4 // this may be 4 for all AVR chips +#define PORT_SHIFTER 4 // this may be 4 for all AVR chips // If you want to add more to this list, reference the PINx definitions in these header // files: https://github.com/vancegroup-mirrors/avr-libc/tree/master/avr-libc/include/avr @@ -62,7 +62,7 @@ /* I/O pins */ #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #define PINDEF(port, pin) ((PIN##port##_ADDRESS << PORT_SHIFTER) | pin) -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #define PINDEF(port, pin) 0 #define PORTA #define PORTB @@ -70,7 +70,7 @@ #define PORTD #define PORTE #define PORTF -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #ifdef PORTA #define PIN_A0 PINDEF(A, 0) @@ -134,28 +134,29 @@ #endif /* converting pins to ports */ -enum { PIN_OFFSET, DDR_OFFSET, PORT_OFFSET}; +enum { PIN_OFFSET, + DDR_OFFSET, + PORT_OFFSET }; -#define PIN_ADDRESS_MASK 0xF +#define PIN_ADDRESS_MASK 0xF #define PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset) -#define PIN_REG_FOR_PIN(pin) PIN_ADDRESS(pin, PIN_OFFSET ) -#define DDR_REG_FOR_PIN(pin) PIN_ADDRESS(pin, DDR_OFFSET ) -#define PORT_REG_FOR_PIN(pin) PIN_ADDRESS(pin, PORT_OFFSET ) -#define PIN_NUM_FOR_PIN(pin) ( pin & PIN_ADDRESS_MASK ) -#define PIN_MASK_FOR_PIN(pin) _BV(PIN_NUM_FOR_PIN(pin)) +#define PIN_REG_FOR_PIN(pin) PIN_ADDRESS(pin, PIN_OFFSET) +#define DDR_REG_FOR_PIN(pin) PIN_ADDRESS(pin, DDR_OFFSET) +#define PORT_REG_FOR_PIN(pin) PIN_ADDRESS(pin, PORT_OFFSET) +#define PIN_NUM_FOR_PIN(pin) (pin & PIN_ADDRESS_MASK) +#define PIN_MASK_FOR_PIN(pin) _BV(PIN_NUM_FOR_PIN(pin)) -#define DDR_INPUT(pin) (DDR_REG_FOR_PIN(pin) &= ~(PIN_MASK_FOR_PIN(pin))) -#define DDR_OUTPUT(pin) (DDR_REG_FOR_PIN(pin) |= (PIN_MASK_FOR_PIN(pin))) +#define DDR_INPUT(pin) (DDR_REG_FOR_PIN(pin) &= ~(PIN_MASK_FOR_PIN(pin))) +#define DDR_OUTPUT(pin) (DDR_REG_FOR_PIN(pin) |= (PIN_MASK_FOR_PIN(pin))) -#define ENABLE_PULLUP(pin) (PORT_REG_FOR_PIN(pin) |= (PIN_MASK_FOR_PIN(pin))) -#define DISABLE_PULLUP(pin) (PORT_REG_FOR_PIN(pin) &= ~(PIN_MASK_FOR_PIN(pin))) +#define ENABLE_PULLUP(pin) (PORT_REG_FOR_PIN(pin) |= (PIN_MASK_FOR_PIN(pin))) +#define DISABLE_PULLUP(pin) (PORT_REG_FOR_PIN(pin) &= ~(PIN_MASK_FOR_PIN(pin))) -#define OUTPUT_HIGH(pin) (PORT_REG_FOR_PIN(pin) |= (PIN_MASK_FOR_PIN(pin))) -#define OUTPUT_LOW(pin) (PORT_REG_FOR_PIN(pin) &= ~(PIN_MASK_FOR_PIN(pin))) -#define OUTPUT_TOGGLE(pin) (PORT_REG_FOR_PIN(pin) ^= (PIN_MASK_FOR_PIN(pin))) - -#define READ_PIN(pin) (!!(PIN_REG_FOR_PIN(pin) & PIN_MASK_FOR_PIN(pin))) +#define OUTPUT_HIGH(pin) (PORT_REG_FOR_PIN(pin) |= (PIN_MASK_FOR_PIN(pin))) +#define OUTPUT_LOW(pin) (PORT_REG_FOR_PIN(pin) &= ~(PIN_MASK_FOR_PIN(pin))) +#define OUTPUT_TOGGLE(pin) (PORT_REG_FOR_PIN(pin) ^= (PIN_MASK_FOR_PIN(pin))) +#define READ_PIN(pin) (!!(PIN_REG_FOR_PIN(pin) & PIN_MASK_FOR_PIN(pin))) diff --git a/src/kaleidoscope/device/key_indexes.h b/src/kaleidoscope/device/key_indexes.h index b983c7d6..98365e87 100644 --- a/src/kaleidoscope/device/key_indexes.h +++ b/src/kaleidoscope/device/key_indexes.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr @@ -32,316 +32,316 @@ constexpr uint8_t keyIndex(uint8_t row, uint8_t col) { return KeyAddr(row, col).toInt() + 1; } -constexpr uint8_t R0C0 = keyIndex(0, 0); -constexpr uint8_t R0C1 = keyIndex(0, 1); -constexpr uint8_t R0C2 = keyIndex(0, 2); -constexpr uint8_t R0C3 = keyIndex(0, 3); -constexpr uint8_t R0C4 = keyIndex(0, 4); -constexpr uint8_t R0C5 = keyIndex(0, 5); -constexpr uint8_t R0C6 = keyIndex(0, 6); -constexpr uint8_t R0C7 = keyIndex(0, 7); -constexpr uint8_t R0C8 = keyIndex(0, 8); -constexpr uint8_t R0C9 = keyIndex(0, 9); -constexpr uint8_t R0C10 = keyIndex(0, 10); -constexpr uint8_t R0C11 = keyIndex(0, 11); -constexpr uint8_t R0C12 = keyIndex(0, 12); -constexpr uint8_t R0C13 = keyIndex(0, 13); -constexpr uint8_t R0C14 = keyIndex(0, 14); -constexpr uint8_t R0C15 = keyIndex(0, 15); -constexpr uint8_t R0C16 = keyIndex(0, 16); -constexpr uint8_t R0C17 = keyIndex(0, 17); -constexpr uint8_t R0C18 = keyIndex(0, 18); -constexpr uint8_t R0C19 = keyIndex(0, 19); -constexpr uint8_t R0C20 = keyIndex(0, 20); -constexpr uint8_t R0C21 = keyIndex(0, 21); -constexpr uint8_t R0C22 = keyIndex(0, 22); -constexpr uint8_t R0C23 = keyIndex(0, 23); -constexpr uint8_t R0C24 = keyIndex(0, 24); -constexpr uint8_t R0C25 = keyIndex(0, 25); -constexpr uint8_t R0C26 = keyIndex(0, 26); -constexpr uint8_t R0C27 = keyIndex(0, 27); -constexpr uint8_t R0C28 = keyIndex(0, 28); -constexpr uint8_t R0C29 = keyIndex(0, 29); -constexpr uint8_t R1C0 = keyIndex(1, 0); -constexpr uint8_t R1C1 = keyIndex(1, 1); -constexpr uint8_t R1C2 = keyIndex(1, 2); -constexpr uint8_t R1C3 = keyIndex(1, 3); -constexpr uint8_t R1C4 = keyIndex(1, 4); -constexpr uint8_t R1C5 = keyIndex(1, 5); -constexpr uint8_t R1C6 = keyIndex(1, 6); -constexpr uint8_t R1C7 = keyIndex(1, 7); -constexpr uint8_t R1C8 = keyIndex(1, 8); -constexpr uint8_t R1C9 = keyIndex(1, 9); -constexpr uint8_t R1C10 = keyIndex(1, 10); -constexpr uint8_t R1C11 = keyIndex(1, 11); -constexpr uint8_t R1C12 = keyIndex(1, 12); -constexpr uint8_t R1C13 = keyIndex(1, 13); -constexpr uint8_t R1C14 = keyIndex(1, 14); -constexpr uint8_t R1C15 = keyIndex(1, 15); -constexpr uint8_t R1C16 = keyIndex(1, 16); -constexpr uint8_t R1C17 = keyIndex(1, 17); -constexpr uint8_t R1C18 = keyIndex(1, 18); -constexpr uint8_t R1C19 = keyIndex(1, 19); -constexpr uint8_t R1C20 = keyIndex(1, 20); -constexpr uint8_t R1C21 = keyIndex(1, 21); -constexpr uint8_t R1C22 = keyIndex(1, 22); -constexpr uint8_t R1C23 = keyIndex(1, 23); -constexpr uint8_t R1C24 = keyIndex(1, 24); -constexpr uint8_t R1C25 = keyIndex(1, 25); -constexpr uint8_t R1C26 = keyIndex(1, 26); -constexpr uint8_t R1C27 = keyIndex(1, 27); -constexpr uint8_t R1C28 = keyIndex(1, 28); -constexpr uint8_t R1C29 = keyIndex(1, 29); -constexpr uint8_t R2C0 = keyIndex(2, 0); -constexpr uint8_t R2C1 = keyIndex(2, 1); -constexpr uint8_t R2C2 = keyIndex(2, 2); -constexpr uint8_t R2C3 = keyIndex(2, 3); -constexpr uint8_t R2C4 = keyIndex(2, 4); -constexpr uint8_t R2C5 = keyIndex(2, 5); -constexpr uint8_t R2C6 = keyIndex(2, 6); -constexpr uint8_t R2C7 = keyIndex(2, 7); -constexpr uint8_t R2C8 = keyIndex(2, 8); -constexpr uint8_t R2C9 = keyIndex(2, 9); -constexpr uint8_t R2C10 = keyIndex(2, 10); -constexpr uint8_t R2C11 = keyIndex(2, 11); -constexpr uint8_t R2C12 = keyIndex(2, 12); -constexpr uint8_t R2C13 = keyIndex(2, 13); -constexpr uint8_t R2C14 = keyIndex(2, 14); -constexpr uint8_t R2C15 = keyIndex(2, 15); -constexpr uint8_t R2C16 = keyIndex(2, 16); -constexpr uint8_t R2C17 = keyIndex(2, 17); -constexpr uint8_t R2C18 = keyIndex(2, 18); -constexpr uint8_t R2C19 = keyIndex(2, 19); -constexpr uint8_t R2C20 = keyIndex(2, 20); -constexpr uint8_t R2C21 = keyIndex(2, 21); -constexpr uint8_t R2C22 = keyIndex(2, 22); -constexpr uint8_t R2C23 = keyIndex(2, 23); -constexpr uint8_t R2C24 = keyIndex(2, 24); -constexpr uint8_t R2C25 = keyIndex(2, 25); -constexpr uint8_t R2C26 = keyIndex(2, 26); -constexpr uint8_t R2C27 = keyIndex(2, 27); -constexpr uint8_t R2C28 = keyIndex(2, 28); -constexpr uint8_t R2C29 = keyIndex(2, 29); -constexpr uint8_t R3C0 = keyIndex(3, 0); -constexpr uint8_t R3C1 = keyIndex(3, 1); -constexpr uint8_t R3C2 = keyIndex(3, 2); -constexpr uint8_t R3C3 = keyIndex(3, 3); -constexpr uint8_t R3C4 = keyIndex(3, 4); -constexpr uint8_t R3C5 = keyIndex(3, 5); -constexpr uint8_t R3C6 = keyIndex(3, 6); -constexpr uint8_t R3C7 = keyIndex(3, 7); -constexpr uint8_t R3C8 = keyIndex(3, 8); -constexpr uint8_t R3C9 = keyIndex(3, 9); -constexpr uint8_t R3C10 = keyIndex(3, 10); -constexpr uint8_t R3C11 = keyIndex(3, 11); -constexpr uint8_t R3C12 = keyIndex(3, 12); -constexpr uint8_t R3C13 = keyIndex(3, 13); -constexpr uint8_t R3C14 = keyIndex(3, 14); -constexpr uint8_t R3C15 = keyIndex(3, 15); -constexpr uint8_t R3C16 = keyIndex(3, 16); -constexpr uint8_t R3C17 = keyIndex(3, 17); -constexpr uint8_t R3C18 = keyIndex(3, 18); -constexpr uint8_t R3C19 = keyIndex(3, 19); -constexpr uint8_t R3C20 = keyIndex(3, 20); -constexpr uint8_t R3C21 = keyIndex(3, 21); -constexpr uint8_t R3C22 = keyIndex(3, 22); -constexpr uint8_t R3C23 = keyIndex(3, 23); -constexpr uint8_t R3C24 = keyIndex(3, 24); -constexpr uint8_t R3C25 = keyIndex(3, 25); -constexpr uint8_t R3C26 = keyIndex(3, 26); -constexpr uint8_t R3C27 = keyIndex(3, 27); -constexpr uint8_t R3C28 = keyIndex(3, 28); -constexpr uint8_t R3C29 = keyIndex(3, 29); -constexpr uint8_t R4C0 = keyIndex(4, 0); -constexpr uint8_t R4C1 = keyIndex(4, 1); -constexpr uint8_t R4C2 = keyIndex(4, 2); -constexpr uint8_t R4C3 = keyIndex(4, 3); -constexpr uint8_t R4C4 = keyIndex(4, 4); -constexpr uint8_t R4C5 = keyIndex(4, 5); -constexpr uint8_t R4C6 = keyIndex(4, 6); -constexpr uint8_t R4C7 = keyIndex(4, 7); -constexpr uint8_t R4C8 = keyIndex(4, 8); -constexpr uint8_t R4C9 = keyIndex(4, 9); -constexpr uint8_t R4C10 = keyIndex(4, 10); -constexpr uint8_t R4C11 = keyIndex(4, 11); -constexpr uint8_t R4C12 = keyIndex(4, 12); -constexpr uint8_t R4C13 = keyIndex(4, 13); -constexpr uint8_t R4C14 = keyIndex(4, 14); -constexpr uint8_t R4C15 = keyIndex(4, 15); -constexpr uint8_t R4C16 = keyIndex(4, 16); -constexpr uint8_t R4C17 = keyIndex(4, 17); -constexpr uint8_t R4C18 = keyIndex(4, 18); -constexpr uint8_t R4C19 = keyIndex(4, 19); -constexpr uint8_t R4C20 = keyIndex(4, 20); -constexpr uint8_t R4C21 = keyIndex(4, 21); -constexpr uint8_t R4C22 = keyIndex(4, 22); -constexpr uint8_t R4C23 = keyIndex(4, 23); -constexpr uint8_t R4C24 = keyIndex(4, 24); -constexpr uint8_t R4C25 = keyIndex(4, 25); -constexpr uint8_t R4C26 = keyIndex(4, 26); -constexpr uint8_t R4C27 = keyIndex(4, 27); -constexpr uint8_t R4C28 = keyIndex(4, 28); -constexpr uint8_t R4C29 = keyIndex(4, 29); -constexpr uint8_t R5C0 = keyIndex(5, 0); -constexpr uint8_t R5C1 = keyIndex(5, 1); -constexpr uint8_t R5C2 = keyIndex(5, 2); -constexpr uint8_t R5C3 = keyIndex(5, 3); -constexpr uint8_t R5C4 = keyIndex(5, 4); -constexpr uint8_t R5C5 = keyIndex(5, 5); -constexpr uint8_t R5C6 = keyIndex(5, 6); -constexpr uint8_t R5C7 = keyIndex(5, 7); -constexpr uint8_t R5C8 = keyIndex(5, 8); -constexpr uint8_t R5C9 = keyIndex(5, 9); -constexpr uint8_t R5C10 = keyIndex(5, 10); -constexpr uint8_t R5C11 = keyIndex(5, 11); -constexpr uint8_t R5C12 = keyIndex(5, 12); -constexpr uint8_t R5C13 = keyIndex(5, 13); -constexpr uint8_t R5C14 = keyIndex(5, 14); -constexpr uint8_t R5C15 = keyIndex(5, 15); -constexpr uint8_t R5C16 = keyIndex(5, 16); -constexpr uint8_t R5C17 = keyIndex(5, 17); -constexpr uint8_t R5C18 = keyIndex(5, 18); -constexpr uint8_t R5C19 = keyIndex(5, 19); -constexpr uint8_t R5C20 = keyIndex(5, 20); -constexpr uint8_t R5C21 = keyIndex(5, 21); -constexpr uint8_t R5C22 = keyIndex(5, 22); -constexpr uint8_t R5C23 = keyIndex(5, 23); -constexpr uint8_t R5C24 = keyIndex(5, 24); -constexpr uint8_t R5C25 = keyIndex(5, 25); -constexpr uint8_t R5C26 = keyIndex(5, 26); -constexpr uint8_t R5C27 = keyIndex(5, 27); -constexpr uint8_t R5C28 = keyIndex(5, 28); -constexpr uint8_t R5C29 = keyIndex(5, 29); -constexpr uint8_t R6C0 = keyIndex(6, 0); -constexpr uint8_t R6C1 = keyIndex(6, 1); -constexpr uint8_t R6C2 = keyIndex(6, 2); -constexpr uint8_t R6C3 = keyIndex(6, 3); -constexpr uint8_t R6C4 = keyIndex(6, 4); -constexpr uint8_t R6C5 = keyIndex(6, 5); -constexpr uint8_t R6C6 = keyIndex(6, 6); -constexpr uint8_t R6C7 = keyIndex(6, 7); -constexpr uint8_t R6C8 = keyIndex(6, 8); -constexpr uint8_t R6C9 = keyIndex(6, 9); -constexpr uint8_t R6C10 = keyIndex(6, 10); -constexpr uint8_t R6C11 = keyIndex(6, 11); -constexpr uint8_t R6C12 = keyIndex(6, 12); -constexpr uint8_t R6C13 = keyIndex(6, 13); -constexpr uint8_t R6C14 = keyIndex(6, 14); -constexpr uint8_t R6C15 = keyIndex(6, 15); -constexpr uint8_t R6C16 = keyIndex(6, 16); -constexpr uint8_t R6C17 = keyIndex(6, 17); -constexpr uint8_t R6C18 = keyIndex(6, 18); -constexpr uint8_t R6C19 = keyIndex(6, 19); -constexpr uint8_t R6C20 = keyIndex(6, 20); -constexpr uint8_t R6C21 = keyIndex(6, 21); -constexpr uint8_t R6C22 = keyIndex(6, 22); -constexpr uint8_t R6C23 = keyIndex(6, 23); -constexpr uint8_t R6C24 = keyIndex(6, 24); -constexpr uint8_t R6C25 = keyIndex(6, 25); -constexpr uint8_t R6C26 = keyIndex(6, 26); -constexpr uint8_t R6C27 = keyIndex(6, 27); -constexpr uint8_t R6C28 = keyIndex(6, 28); -constexpr uint8_t R6C29 = keyIndex(6, 29); -constexpr uint8_t R7C0 = keyIndex(7, 0); -constexpr uint8_t R7C1 = keyIndex(7, 1); -constexpr uint8_t R7C2 = keyIndex(7, 2); -constexpr uint8_t R7C3 = keyIndex(7, 3); -constexpr uint8_t R7C4 = keyIndex(7, 4); -constexpr uint8_t R7C5 = keyIndex(7, 5); -constexpr uint8_t R7C6 = keyIndex(7, 6); -constexpr uint8_t R7C7 = keyIndex(7, 7); -constexpr uint8_t R7C8 = keyIndex(7, 8); -constexpr uint8_t R7C9 = keyIndex(7, 9); -constexpr uint8_t R7C10 = keyIndex(7, 10); -constexpr uint8_t R7C11 = keyIndex(7, 11); -constexpr uint8_t R7C12 = keyIndex(7, 12); -constexpr uint8_t R7C13 = keyIndex(7, 13); -constexpr uint8_t R7C14 = keyIndex(7, 14); -constexpr uint8_t R7C15 = keyIndex(7, 15); -constexpr uint8_t R7C16 = keyIndex(7, 16); -constexpr uint8_t R7C17 = keyIndex(7, 17); -constexpr uint8_t R7C18 = keyIndex(7, 18); -constexpr uint8_t R7C19 = keyIndex(7, 19); -constexpr uint8_t R7C20 = keyIndex(7, 20); -constexpr uint8_t R7C21 = keyIndex(7, 21); -constexpr uint8_t R7C22 = keyIndex(7, 22); -constexpr uint8_t R7C23 = keyIndex(7, 23); -constexpr uint8_t R7C24 = keyIndex(7, 24); -constexpr uint8_t R7C25 = keyIndex(7, 25); -constexpr uint8_t R7C26 = keyIndex(7, 26); -constexpr uint8_t R7C27 = keyIndex(7, 27); -constexpr uint8_t R7C28 = keyIndex(7, 28); -constexpr uint8_t R7C29 = keyIndex(7, 29); -constexpr uint8_t R8C0 = keyIndex(8, 0); -constexpr uint8_t R8C1 = keyIndex(8, 1); -constexpr uint8_t R8C2 = keyIndex(8, 2); -constexpr uint8_t R8C3 = keyIndex(8, 3); -constexpr uint8_t R8C4 = keyIndex(8, 4); -constexpr uint8_t R8C5 = keyIndex(8, 5); -constexpr uint8_t R8C6 = keyIndex(8, 6); -constexpr uint8_t R8C7 = keyIndex(8, 7); -constexpr uint8_t R8C8 = keyIndex(8, 8); -constexpr uint8_t R8C9 = keyIndex(8, 9); -constexpr uint8_t R8C10 = keyIndex(8, 10); -constexpr uint8_t R8C11 = keyIndex(8, 11); -constexpr uint8_t R8C12 = keyIndex(8, 12); -constexpr uint8_t R8C13 = keyIndex(8, 13); -constexpr uint8_t R8C14 = keyIndex(8, 14); -constexpr uint8_t R8C15 = keyIndex(8, 15); -constexpr uint8_t R8C16 = keyIndex(8, 16); -constexpr uint8_t R8C17 = keyIndex(8, 17); -constexpr uint8_t R8C18 = keyIndex(8, 18); -constexpr uint8_t R8C19 = keyIndex(8, 19); -constexpr uint8_t R8C20 = keyIndex(8, 20); -constexpr uint8_t R8C21 = keyIndex(8, 21); -constexpr uint8_t R8C22 = keyIndex(8, 22); -constexpr uint8_t R8C23 = keyIndex(8, 23); -constexpr uint8_t R8C24 = keyIndex(8, 24); -constexpr uint8_t R8C25 = keyIndex(8, 25); -constexpr uint8_t R8C26 = keyIndex(8, 26); -constexpr uint8_t R8C27 = keyIndex(8, 27); -constexpr uint8_t R8C28 = keyIndex(8, 28); -constexpr uint8_t R8C29 = keyIndex(8, 29); -constexpr uint8_t R9C0 = keyIndex(9, 0); -constexpr uint8_t R9C1 = keyIndex(9, 1); -constexpr uint8_t R9C2 = keyIndex(9, 2); -constexpr uint8_t R9C3 = keyIndex(9, 3); -constexpr uint8_t R9C4 = keyIndex(9, 4); -constexpr uint8_t R9C5 = keyIndex(9, 5); -constexpr uint8_t R9C6 = keyIndex(9, 6); -constexpr uint8_t R9C7 = keyIndex(9, 7); -constexpr uint8_t R9C8 = keyIndex(9, 8); -constexpr uint8_t R9C9 = keyIndex(9, 9); -constexpr uint8_t R9C10 = keyIndex(9, 10); -constexpr uint8_t R9C11 = keyIndex(9, 11); -constexpr uint8_t R9C12 = keyIndex(9, 12); -constexpr uint8_t R9C13 = keyIndex(9, 13); -constexpr uint8_t R9C14 = keyIndex(9, 14); -constexpr uint8_t R9C15 = keyIndex(9, 15); -constexpr uint8_t R9C16 = keyIndex(9, 16); -constexpr uint8_t R9C17 = keyIndex(9, 17); -constexpr uint8_t R9C18 = keyIndex(9, 18); -constexpr uint8_t R9C19 = keyIndex(9, 19); -constexpr uint8_t R9C20 = keyIndex(9, 20); -constexpr uint8_t R9C21 = keyIndex(9, 21); -constexpr uint8_t R9C22 = keyIndex(9, 22); -constexpr uint8_t R9C23 = keyIndex(9, 23); -constexpr uint8_t R9C24 = keyIndex(9, 24); -constexpr uint8_t R9C25 = keyIndex(9, 25); -constexpr uint8_t R9C26 = keyIndex(9, 26); -constexpr uint8_t R9C27 = keyIndex(9, 27); -constexpr uint8_t R9C28 = keyIndex(9, 28); -constexpr uint8_t R9C29 = keyIndex(9, 29); -constexpr uint8_t R10C0 = keyIndex(10, 0); -constexpr uint8_t R10C1 = keyIndex(10, 1); -constexpr uint8_t R10C2 = keyIndex(10, 2); -constexpr uint8_t R10C3 = keyIndex(10, 3); -constexpr uint8_t R10C4 = keyIndex(10, 4); -constexpr uint8_t R10C5 = keyIndex(10, 5); -constexpr uint8_t R10C6 = keyIndex(10, 6); -constexpr uint8_t R10C7 = keyIndex(10, 7); -constexpr uint8_t R10C8 = keyIndex(10, 8); -constexpr uint8_t R10C9 = keyIndex(10, 9); +constexpr uint8_t R0C0 = keyIndex(0, 0); +constexpr uint8_t R0C1 = keyIndex(0, 1); +constexpr uint8_t R0C2 = keyIndex(0, 2); +constexpr uint8_t R0C3 = keyIndex(0, 3); +constexpr uint8_t R0C4 = keyIndex(0, 4); +constexpr uint8_t R0C5 = keyIndex(0, 5); +constexpr uint8_t R0C6 = keyIndex(0, 6); +constexpr uint8_t R0C7 = keyIndex(0, 7); +constexpr uint8_t R0C8 = keyIndex(0, 8); +constexpr uint8_t R0C9 = keyIndex(0, 9); +constexpr uint8_t R0C10 = keyIndex(0, 10); +constexpr uint8_t R0C11 = keyIndex(0, 11); +constexpr uint8_t R0C12 = keyIndex(0, 12); +constexpr uint8_t R0C13 = keyIndex(0, 13); +constexpr uint8_t R0C14 = keyIndex(0, 14); +constexpr uint8_t R0C15 = keyIndex(0, 15); +constexpr uint8_t R0C16 = keyIndex(0, 16); +constexpr uint8_t R0C17 = keyIndex(0, 17); +constexpr uint8_t R0C18 = keyIndex(0, 18); +constexpr uint8_t R0C19 = keyIndex(0, 19); +constexpr uint8_t R0C20 = keyIndex(0, 20); +constexpr uint8_t R0C21 = keyIndex(0, 21); +constexpr uint8_t R0C22 = keyIndex(0, 22); +constexpr uint8_t R0C23 = keyIndex(0, 23); +constexpr uint8_t R0C24 = keyIndex(0, 24); +constexpr uint8_t R0C25 = keyIndex(0, 25); +constexpr uint8_t R0C26 = keyIndex(0, 26); +constexpr uint8_t R0C27 = keyIndex(0, 27); +constexpr uint8_t R0C28 = keyIndex(0, 28); +constexpr uint8_t R0C29 = keyIndex(0, 29); +constexpr uint8_t R1C0 = keyIndex(1, 0); +constexpr uint8_t R1C1 = keyIndex(1, 1); +constexpr uint8_t R1C2 = keyIndex(1, 2); +constexpr uint8_t R1C3 = keyIndex(1, 3); +constexpr uint8_t R1C4 = keyIndex(1, 4); +constexpr uint8_t R1C5 = keyIndex(1, 5); +constexpr uint8_t R1C6 = keyIndex(1, 6); +constexpr uint8_t R1C7 = keyIndex(1, 7); +constexpr uint8_t R1C8 = keyIndex(1, 8); +constexpr uint8_t R1C9 = keyIndex(1, 9); +constexpr uint8_t R1C10 = keyIndex(1, 10); +constexpr uint8_t R1C11 = keyIndex(1, 11); +constexpr uint8_t R1C12 = keyIndex(1, 12); +constexpr uint8_t R1C13 = keyIndex(1, 13); +constexpr uint8_t R1C14 = keyIndex(1, 14); +constexpr uint8_t R1C15 = keyIndex(1, 15); +constexpr uint8_t R1C16 = keyIndex(1, 16); +constexpr uint8_t R1C17 = keyIndex(1, 17); +constexpr uint8_t R1C18 = keyIndex(1, 18); +constexpr uint8_t R1C19 = keyIndex(1, 19); +constexpr uint8_t R1C20 = keyIndex(1, 20); +constexpr uint8_t R1C21 = keyIndex(1, 21); +constexpr uint8_t R1C22 = keyIndex(1, 22); +constexpr uint8_t R1C23 = keyIndex(1, 23); +constexpr uint8_t R1C24 = keyIndex(1, 24); +constexpr uint8_t R1C25 = keyIndex(1, 25); +constexpr uint8_t R1C26 = keyIndex(1, 26); +constexpr uint8_t R1C27 = keyIndex(1, 27); +constexpr uint8_t R1C28 = keyIndex(1, 28); +constexpr uint8_t R1C29 = keyIndex(1, 29); +constexpr uint8_t R2C0 = keyIndex(2, 0); +constexpr uint8_t R2C1 = keyIndex(2, 1); +constexpr uint8_t R2C2 = keyIndex(2, 2); +constexpr uint8_t R2C3 = keyIndex(2, 3); +constexpr uint8_t R2C4 = keyIndex(2, 4); +constexpr uint8_t R2C5 = keyIndex(2, 5); +constexpr uint8_t R2C6 = keyIndex(2, 6); +constexpr uint8_t R2C7 = keyIndex(2, 7); +constexpr uint8_t R2C8 = keyIndex(2, 8); +constexpr uint8_t R2C9 = keyIndex(2, 9); +constexpr uint8_t R2C10 = keyIndex(2, 10); +constexpr uint8_t R2C11 = keyIndex(2, 11); +constexpr uint8_t R2C12 = keyIndex(2, 12); +constexpr uint8_t R2C13 = keyIndex(2, 13); +constexpr uint8_t R2C14 = keyIndex(2, 14); +constexpr uint8_t R2C15 = keyIndex(2, 15); +constexpr uint8_t R2C16 = keyIndex(2, 16); +constexpr uint8_t R2C17 = keyIndex(2, 17); +constexpr uint8_t R2C18 = keyIndex(2, 18); +constexpr uint8_t R2C19 = keyIndex(2, 19); +constexpr uint8_t R2C20 = keyIndex(2, 20); +constexpr uint8_t R2C21 = keyIndex(2, 21); +constexpr uint8_t R2C22 = keyIndex(2, 22); +constexpr uint8_t R2C23 = keyIndex(2, 23); +constexpr uint8_t R2C24 = keyIndex(2, 24); +constexpr uint8_t R2C25 = keyIndex(2, 25); +constexpr uint8_t R2C26 = keyIndex(2, 26); +constexpr uint8_t R2C27 = keyIndex(2, 27); +constexpr uint8_t R2C28 = keyIndex(2, 28); +constexpr uint8_t R2C29 = keyIndex(2, 29); +constexpr uint8_t R3C0 = keyIndex(3, 0); +constexpr uint8_t R3C1 = keyIndex(3, 1); +constexpr uint8_t R3C2 = keyIndex(3, 2); +constexpr uint8_t R3C3 = keyIndex(3, 3); +constexpr uint8_t R3C4 = keyIndex(3, 4); +constexpr uint8_t R3C5 = keyIndex(3, 5); +constexpr uint8_t R3C6 = keyIndex(3, 6); +constexpr uint8_t R3C7 = keyIndex(3, 7); +constexpr uint8_t R3C8 = keyIndex(3, 8); +constexpr uint8_t R3C9 = keyIndex(3, 9); +constexpr uint8_t R3C10 = keyIndex(3, 10); +constexpr uint8_t R3C11 = keyIndex(3, 11); +constexpr uint8_t R3C12 = keyIndex(3, 12); +constexpr uint8_t R3C13 = keyIndex(3, 13); +constexpr uint8_t R3C14 = keyIndex(3, 14); +constexpr uint8_t R3C15 = keyIndex(3, 15); +constexpr uint8_t R3C16 = keyIndex(3, 16); +constexpr uint8_t R3C17 = keyIndex(3, 17); +constexpr uint8_t R3C18 = keyIndex(3, 18); +constexpr uint8_t R3C19 = keyIndex(3, 19); +constexpr uint8_t R3C20 = keyIndex(3, 20); +constexpr uint8_t R3C21 = keyIndex(3, 21); +constexpr uint8_t R3C22 = keyIndex(3, 22); +constexpr uint8_t R3C23 = keyIndex(3, 23); +constexpr uint8_t R3C24 = keyIndex(3, 24); +constexpr uint8_t R3C25 = keyIndex(3, 25); +constexpr uint8_t R3C26 = keyIndex(3, 26); +constexpr uint8_t R3C27 = keyIndex(3, 27); +constexpr uint8_t R3C28 = keyIndex(3, 28); +constexpr uint8_t R3C29 = keyIndex(3, 29); +constexpr uint8_t R4C0 = keyIndex(4, 0); +constexpr uint8_t R4C1 = keyIndex(4, 1); +constexpr uint8_t R4C2 = keyIndex(4, 2); +constexpr uint8_t R4C3 = keyIndex(4, 3); +constexpr uint8_t R4C4 = keyIndex(4, 4); +constexpr uint8_t R4C5 = keyIndex(4, 5); +constexpr uint8_t R4C6 = keyIndex(4, 6); +constexpr uint8_t R4C7 = keyIndex(4, 7); +constexpr uint8_t R4C8 = keyIndex(4, 8); +constexpr uint8_t R4C9 = keyIndex(4, 9); +constexpr uint8_t R4C10 = keyIndex(4, 10); +constexpr uint8_t R4C11 = keyIndex(4, 11); +constexpr uint8_t R4C12 = keyIndex(4, 12); +constexpr uint8_t R4C13 = keyIndex(4, 13); +constexpr uint8_t R4C14 = keyIndex(4, 14); +constexpr uint8_t R4C15 = keyIndex(4, 15); +constexpr uint8_t R4C16 = keyIndex(4, 16); +constexpr uint8_t R4C17 = keyIndex(4, 17); +constexpr uint8_t R4C18 = keyIndex(4, 18); +constexpr uint8_t R4C19 = keyIndex(4, 19); +constexpr uint8_t R4C20 = keyIndex(4, 20); +constexpr uint8_t R4C21 = keyIndex(4, 21); +constexpr uint8_t R4C22 = keyIndex(4, 22); +constexpr uint8_t R4C23 = keyIndex(4, 23); +constexpr uint8_t R4C24 = keyIndex(4, 24); +constexpr uint8_t R4C25 = keyIndex(4, 25); +constexpr uint8_t R4C26 = keyIndex(4, 26); +constexpr uint8_t R4C27 = keyIndex(4, 27); +constexpr uint8_t R4C28 = keyIndex(4, 28); +constexpr uint8_t R4C29 = keyIndex(4, 29); +constexpr uint8_t R5C0 = keyIndex(5, 0); +constexpr uint8_t R5C1 = keyIndex(5, 1); +constexpr uint8_t R5C2 = keyIndex(5, 2); +constexpr uint8_t R5C3 = keyIndex(5, 3); +constexpr uint8_t R5C4 = keyIndex(5, 4); +constexpr uint8_t R5C5 = keyIndex(5, 5); +constexpr uint8_t R5C6 = keyIndex(5, 6); +constexpr uint8_t R5C7 = keyIndex(5, 7); +constexpr uint8_t R5C8 = keyIndex(5, 8); +constexpr uint8_t R5C9 = keyIndex(5, 9); +constexpr uint8_t R5C10 = keyIndex(5, 10); +constexpr uint8_t R5C11 = keyIndex(5, 11); +constexpr uint8_t R5C12 = keyIndex(5, 12); +constexpr uint8_t R5C13 = keyIndex(5, 13); +constexpr uint8_t R5C14 = keyIndex(5, 14); +constexpr uint8_t R5C15 = keyIndex(5, 15); +constexpr uint8_t R5C16 = keyIndex(5, 16); +constexpr uint8_t R5C17 = keyIndex(5, 17); +constexpr uint8_t R5C18 = keyIndex(5, 18); +constexpr uint8_t R5C19 = keyIndex(5, 19); +constexpr uint8_t R5C20 = keyIndex(5, 20); +constexpr uint8_t R5C21 = keyIndex(5, 21); +constexpr uint8_t R5C22 = keyIndex(5, 22); +constexpr uint8_t R5C23 = keyIndex(5, 23); +constexpr uint8_t R5C24 = keyIndex(5, 24); +constexpr uint8_t R5C25 = keyIndex(5, 25); +constexpr uint8_t R5C26 = keyIndex(5, 26); +constexpr uint8_t R5C27 = keyIndex(5, 27); +constexpr uint8_t R5C28 = keyIndex(5, 28); +constexpr uint8_t R5C29 = keyIndex(5, 29); +constexpr uint8_t R6C0 = keyIndex(6, 0); +constexpr uint8_t R6C1 = keyIndex(6, 1); +constexpr uint8_t R6C2 = keyIndex(6, 2); +constexpr uint8_t R6C3 = keyIndex(6, 3); +constexpr uint8_t R6C4 = keyIndex(6, 4); +constexpr uint8_t R6C5 = keyIndex(6, 5); +constexpr uint8_t R6C6 = keyIndex(6, 6); +constexpr uint8_t R6C7 = keyIndex(6, 7); +constexpr uint8_t R6C8 = keyIndex(6, 8); +constexpr uint8_t R6C9 = keyIndex(6, 9); +constexpr uint8_t R6C10 = keyIndex(6, 10); +constexpr uint8_t R6C11 = keyIndex(6, 11); +constexpr uint8_t R6C12 = keyIndex(6, 12); +constexpr uint8_t R6C13 = keyIndex(6, 13); +constexpr uint8_t R6C14 = keyIndex(6, 14); +constexpr uint8_t R6C15 = keyIndex(6, 15); +constexpr uint8_t R6C16 = keyIndex(6, 16); +constexpr uint8_t R6C17 = keyIndex(6, 17); +constexpr uint8_t R6C18 = keyIndex(6, 18); +constexpr uint8_t R6C19 = keyIndex(6, 19); +constexpr uint8_t R6C20 = keyIndex(6, 20); +constexpr uint8_t R6C21 = keyIndex(6, 21); +constexpr uint8_t R6C22 = keyIndex(6, 22); +constexpr uint8_t R6C23 = keyIndex(6, 23); +constexpr uint8_t R6C24 = keyIndex(6, 24); +constexpr uint8_t R6C25 = keyIndex(6, 25); +constexpr uint8_t R6C26 = keyIndex(6, 26); +constexpr uint8_t R6C27 = keyIndex(6, 27); +constexpr uint8_t R6C28 = keyIndex(6, 28); +constexpr uint8_t R6C29 = keyIndex(6, 29); +constexpr uint8_t R7C0 = keyIndex(7, 0); +constexpr uint8_t R7C1 = keyIndex(7, 1); +constexpr uint8_t R7C2 = keyIndex(7, 2); +constexpr uint8_t R7C3 = keyIndex(7, 3); +constexpr uint8_t R7C4 = keyIndex(7, 4); +constexpr uint8_t R7C5 = keyIndex(7, 5); +constexpr uint8_t R7C6 = keyIndex(7, 6); +constexpr uint8_t R7C7 = keyIndex(7, 7); +constexpr uint8_t R7C8 = keyIndex(7, 8); +constexpr uint8_t R7C9 = keyIndex(7, 9); +constexpr uint8_t R7C10 = keyIndex(7, 10); +constexpr uint8_t R7C11 = keyIndex(7, 11); +constexpr uint8_t R7C12 = keyIndex(7, 12); +constexpr uint8_t R7C13 = keyIndex(7, 13); +constexpr uint8_t R7C14 = keyIndex(7, 14); +constexpr uint8_t R7C15 = keyIndex(7, 15); +constexpr uint8_t R7C16 = keyIndex(7, 16); +constexpr uint8_t R7C17 = keyIndex(7, 17); +constexpr uint8_t R7C18 = keyIndex(7, 18); +constexpr uint8_t R7C19 = keyIndex(7, 19); +constexpr uint8_t R7C20 = keyIndex(7, 20); +constexpr uint8_t R7C21 = keyIndex(7, 21); +constexpr uint8_t R7C22 = keyIndex(7, 22); +constexpr uint8_t R7C23 = keyIndex(7, 23); +constexpr uint8_t R7C24 = keyIndex(7, 24); +constexpr uint8_t R7C25 = keyIndex(7, 25); +constexpr uint8_t R7C26 = keyIndex(7, 26); +constexpr uint8_t R7C27 = keyIndex(7, 27); +constexpr uint8_t R7C28 = keyIndex(7, 28); +constexpr uint8_t R7C29 = keyIndex(7, 29); +constexpr uint8_t R8C0 = keyIndex(8, 0); +constexpr uint8_t R8C1 = keyIndex(8, 1); +constexpr uint8_t R8C2 = keyIndex(8, 2); +constexpr uint8_t R8C3 = keyIndex(8, 3); +constexpr uint8_t R8C4 = keyIndex(8, 4); +constexpr uint8_t R8C5 = keyIndex(8, 5); +constexpr uint8_t R8C6 = keyIndex(8, 6); +constexpr uint8_t R8C7 = keyIndex(8, 7); +constexpr uint8_t R8C8 = keyIndex(8, 8); +constexpr uint8_t R8C9 = keyIndex(8, 9); +constexpr uint8_t R8C10 = keyIndex(8, 10); +constexpr uint8_t R8C11 = keyIndex(8, 11); +constexpr uint8_t R8C12 = keyIndex(8, 12); +constexpr uint8_t R8C13 = keyIndex(8, 13); +constexpr uint8_t R8C14 = keyIndex(8, 14); +constexpr uint8_t R8C15 = keyIndex(8, 15); +constexpr uint8_t R8C16 = keyIndex(8, 16); +constexpr uint8_t R8C17 = keyIndex(8, 17); +constexpr uint8_t R8C18 = keyIndex(8, 18); +constexpr uint8_t R8C19 = keyIndex(8, 19); +constexpr uint8_t R8C20 = keyIndex(8, 20); +constexpr uint8_t R8C21 = keyIndex(8, 21); +constexpr uint8_t R8C22 = keyIndex(8, 22); +constexpr uint8_t R8C23 = keyIndex(8, 23); +constexpr uint8_t R8C24 = keyIndex(8, 24); +constexpr uint8_t R8C25 = keyIndex(8, 25); +constexpr uint8_t R8C26 = keyIndex(8, 26); +constexpr uint8_t R8C27 = keyIndex(8, 27); +constexpr uint8_t R8C28 = keyIndex(8, 28); +constexpr uint8_t R8C29 = keyIndex(8, 29); +constexpr uint8_t R9C0 = keyIndex(9, 0); +constexpr uint8_t R9C1 = keyIndex(9, 1); +constexpr uint8_t R9C2 = keyIndex(9, 2); +constexpr uint8_t R9C3 = keyIndex(9, 3); +constexpr uint8_t R9C4 = keyIndex(9, 4); +constexpr uint8_t R9C5 = keyIndex(9, 5); +constexpr uint8_t R9C6 = keyIndex(9, 6); +constexpr uint8_t R9C7 = keyIndex(9, 7); +constexpr uint8_t R9C8 = keyIndex(9, 8); +constexpr uint8_t R9C9 = keyIndex(9, 9); +constexpr uint8_t R9C10 = keyIndex(9, 10); +constexpr uint8_t R9C11 = keyIndex(9, 11); +constexpr uint8_t R9C12 = keyIndex(9, 12); +constexpr uint8_t R9C13 = keyIndex(9, 13); +constexpr uint8_t R9C14 = keyIndex(9, 14); +constexpr uint8_t R9C15 = keyIndex(9, 15); +constexpr uint8_t R9C16 = keyIndex(9, 16); +constexpr uint8_t R9C17 = keyIndex(9, 17); +constexpr uint8_t R9C18 = keyIndex(9, 18); +constexpr uint8_t R9C19 = keyIndex(9, 19); +constexpr uint8_t R9C20 = keyIndex(9, 20); +constexpr uint8_t R9C21 = keyIndex(9, 21); +constexpr uint8_t R9C22 = keyIndex(9, 22); +constexpr uint8_t R9C23 = keyIndex(9, 23); +constexpr uint8_t R9C24 = keyIndex(9, 24); +constexpr uint8_t R9C25 = keyIndex(9, 25); +constexpr uint8_t R9C26 = keyIndex(9, 26); +constexpr uint8_t R9C27 = keyIndex(9, 27); +constexpr uint8_t R9C28 = keyIndex(9, 28); +constexpr uint8_t R9C29 = keyIndex(9, 29); +constexpr uint8_t R10C0 = keyIndex(10, 0); +constexpr uint8_t R10C1 = keyIndex(10, 1); +constexpr uint8_t R10C2 = keyIndex(10, 2); +constexpr uint8_t R10C3 = keyIndex(10, 3); +constexpr uint8_t R10C4 = keyIndex(10, 4); +constexpr uint8_t R10C5 = keyIndex(10, 5); +constexpr uint8_t R10C6 = keyIndex(10, 6); +constexpr uint8_t R10C7 = keyIndex(10, 7); +constexpr uint8_t R10C8 = keyIndex(10, 8); +constexpr uint8_t R10C9 = keyIndex(10, 9); constexpr uint8_t R10C10 = keyIndex(10, 10); constexpr uint8_t R10C11 = keyIndex(10, 11); constexpr uint8_t R10C12 = keyIndex(10, 12); @@ -362,16 +362,16 @@ constexpr uint8_t R10C26 = keyIndex(10, 26); constexpr uint8_t R10C27 = keyIndex(10, 27); constexpr uint8_t R10C28 = keyIndex(10, 28); constexpr uint8_t R10C29 = keyIndex(10, 29); -constexpr uint8_t R11C0 = keyIndex(11, 0); -constexpr uint8_t R11C1 = keyIndex(11, 1); -constexpr uint8_t R11C2 = keyIndex(11, 2); -constexpr uint8_t R11C3 = keyIndex(11, 3); -constexpr uint8_t R11C4 = keyIndex(11, 4); -constexpr uint8_t R11C5 = keyIndex(11, 5); -constexpr uint8_t R11C6 = keyIndex(11, 6); -constexpr uint8_t R11C7 = keyIndex(11, 7); -constexpr uint8_t R11C8 = keyIndex(11, 8); -constexpr uint8_t R11C9 = keyIndex(11, 9); +constexpr uint8_t R11C0 = keyIndex(11, 0); +constexpr uint8_t R11C1 = keyIndex(11, 1); +constexpr uint8_t R11C2 = keyIndex(11, 2); +constexpr uint8_t R11C3 = keyIndex(11, 3); +constexpr uint8_t R11C4 = keyIndex(11, 4); +constexpr uint8_t R11C5 = keyIndex(11, 5); +constexpr uint8_t R11C6 = keyIndex(11, 6); +constexpr uint8_t R11C7 = keyIndex(11, 7); +constexpr uint8_t R11C8 = keyIndex(11, 8); +constexpr uint8_t R11C9 = keyIndex(11, 9); constexpr uint8_t R11C10 = keyIndex(11, 10); constexpr uint8_t R11C11 = keyIndex(11, 11); constexpr uint8_t R11C12 = keyIndex(11, 12); @@ -392,16 +392,16 @@ constexpr uint8_t R11C26 = keyIndex(11, 26); constexpr uint8_t R11C27 = keyIndex(11, 27); constexpr uint8_t R11C28 = keyIndex(11, 28); constexpr uint8_t R11C29 = keyIndex(11, 29); -constexpr uint8_t R12C0 = keyIndex(12, 0); -constexpr uint8_t R12C1 = keyIndex(12, 1); -constexpr uint8_t R12C2 = keyIndex(12, 2); -constexpr uint8_t R12C3 = keyIndex(12, 3); -constexpr uint8_t R12C4 = keyIndex(12, 4); -constexpr uint8_t R12C5 = keyIndex(12, 5); -constexpr uint8_t R12C6 = keyIndex(12, 6); -constexpr uint8_t R12C7 = keyIndex(12, 7); -constexpr uint8_t R12C8 = keyIndex(12, 8); -constexpr uint8_t R12C9 = keyIndex(12, 9); +constexpr uint8_t R12C0 = keyIndex(12, 0); +constexpr uint8_t R12C1 = keyIndex(12, 1); +constexpr uint8_t R12C2 = keyIndex(12, 2); +constexpr uint8_t R12C3 = keyIndex(12, 3); +constexpr uint8_t R12C4 = keyIndex(12, 4); +constexpr uint8_t R12C5 = keyIndex(12, 5); +constexpr uint8_t R12C6 = keyIndex(12, 6); +constexpr uint8_t R12C7 = keyIndex(12, 7); +constexpr uint8_t R12C8 = keyIndex(12, 8); +constexpr uint8_t R12C9 = keyIndex(12, 9); constexpr uint8_t R12C10 = keyIndex(12, 10); constexpr uint8_t R12C11 = keyIndex(12, 11); constexpr uint8_t R12C12 = keyIndex(12, 12); @@ -422,16 +422,16 @@ constexpr uint8_t R12C26 = keyIndex(12, 26); constexpr uint8_t R12C27 = keyIndex(12, 27); constexpr uint8_t R12C28 = keyIndex(12, 28); constexpr uint8_t R12C29 = keyIndex(12, 29); -constexpr uint8_t R13C0 = keyIndex(13, 0); -constexpr uint8_t R13C1 = keyIndex(13, 1); -constexpr uint8_t R13C2 = keyIndex(13, 2); -constexpr uint8_t R13C3 = keyIndex(13, 3); -constexpr uint8_t R13C4 = keyIndex(13, 4); -constexpr uint8_t R13C5 = keyIndex(13, 5); -constexpr uint8_t R13C6 = keyIndex(13, 6); -constexpr uint8_t R13C7 = keyIndex(13, 7); -constexpr uint8_t R13C8 = keyIndex(13, 8); -constexpr uint8_t R13C9 = keyIndex(13, 9); +constexpr uint8_t R13C0 = keyIndex(13, 0); +constexpr uint8_t R13C1 = keyIndex(13, 1); +constexpr uint8_t R13C2 = keyIndex(13, 2); +constexpr uint8_t R13C3 = keyIndex(13, 3); +constexpr uint8_t R13C4 = keyIndex(13, 4); +constexpr uint8_t R13C5 = keyIndex(13, 5); +constexpr uint8_t R13C6 = keyIndex(13, 6); +constexpr uint8_t R13C7 = keyIndex(13, 7); +constexpr uint8_t R13C8 = keyIndex(13, 8); +constexpr uint8_t R13C9 = keyIndex(13, 9); constexpr uint8_t R13C10 = keyIndex(13, 10); constexpr uint8_t R13C11 = keyIndex(13, 11); constexpr uint8_t R13C12 = keyIndex(13, 12); @@ -452,16 +452,16 @@ constexpr uint8_t R13C26 = keyIndex(13, 26); constexpr uint8_t R13C27 = keyIndex(13, 27); constexpr uint8_t R13C28 = keyIndex(13, 28); constexpr uint8_t R13C29 = keyIndex(13, 29); -constexpr uint8_t R14C0 = keyIndex(14, 0); -constexpr uint8_t R14C1 = keyIndex(14, 1); -constexpr uint8_t R14C2 = keyIndex(14, 2); -constexpr uint8_t R14C3 = keyIndex(14, 3); -constexpr uint8_t R14C4 = keyIndex(14, 4); -constexpr uint8_t R14C5 = keyIndex(14, 5); -constexpr uint8_t R14C6 = keyIndex(14, 6); -constexpr uint8_t R14C7 = keyIndex(14, 7); -constexpr uint8_t R14C8 = keyIndex(14, 8); -constexpr uint8_t R14C9 = keyIndex(14, 9); +constexpr uint8_t R14C0 = keyIndex(14, 0); +constexpr uint8_t R14C1 = keyIndex(14, 1); +constexpr uint8_t R14C2 = keyIndex(14, 2); +constexpr uint8_t R14C3 = keyIndex(14, 3); +constexpr uint8_t R14C4 = keyIndex(14, 4); +constexpr uint8_t R14C5 = keyIndex(14, 5); +constexpr uint8_t R14C6 = keyIndex(14, 6); +constexpr uint8_t R14C7 = keyIndex(14, 7); +constexpr uint8_t R14C8 = keyIndex(14, 8); +constexpr uint8_t R14C9 = keyIndex(14, 9); constexpr uint8_t R14C10 = keyIndex(14, 10); constexpr uint8_t R14C11 = keyIndex(14, 11); constexpr uint8_t R14C12 = keyIndex(14, 12); @@ -482,16 +482,16 @@ constexpr uint8_t R14C26 = keyIndex(14, 26); constexpr uint8_t R14C27 = keyIndex(14, 27); constexpr uint8_t R14C28 = keyIndex(14, 28); constexpr uint8_t R14C29 = keyIndex(14, 29); -constexpr uint8_t R15C0 = keyIndex(15, 0); -constexpr uint8_t R15C1 = keyIndex(15, 1); -constexpr uint8_t R15C2 = keyIndex(15, 2); -constexpr uint8_t R15C3 = keyIndex(15, 3); -constexpr uint8_t R15C4 = keyIndex(15, 4); -constexpr uint8_t R15C5 = keyIndex(15, 5); -constexpr uint8_t R15C6 = keyIndex(15, 6); -constexpr uint8_t R15C7 = keyIndex(15, 7); -constexpr uint8_t R15C8 = keyIndex(15, 8); -constexpr uint8_t R15C9 = keyIndex(15, 9); +constexpr uint8_t R15C0 = keyIndex(15, 0); +constexpr uint8_t R15C1 = keyIndex(15, 1); +constexpr uint8_t R15C2 = keyIndex(15, 2); +constexpr uint8_t R15C3 = keyIndex(15, 3); +constexpr uint8_t R15C4 = keyIndex(15, 4); +constexpr uint8_t R15C5 = keyIndex(15, 5); +constexpr uint8_t R15C6 = keyIndex(15, 6); +constexpr uint8_t R15C7 = keyIndex(15, 7); +constexpr uint8_t R15C8 = keyIndex(15, 8); +constexpr uint8_t R15C9 = keyIndex(15, 9); constexpr uint8_t R15C10 = keyIndex(15, 10); constexpr uint8_t R15C11 = keyIndex(15, 11); constexpr uint8_t R15C12 = keyIndex(15, 12); @@ -512,16 +512,16 @@ constexpr uint8_t R15C26 = keyIndex(15, 26); constexpr uint8_t R15C27 = keyIndex(15, 27); constexpr uint8_t R15C28 = keyIndex(15, 28); constexpr uint8_t R15C29 = keyIndex(15, 29); -constexpr uint8_t R16C0 = keyIndex(16, 0); -constexpr uint8_t R16C1 = keyIndex(16, 1); -constexpr uint8_t R16C2 = keyIndex(16, 2); -constexpr uint8_t R16C3 = keyIndex(16, 3); -constexpr uint8_t R16C4 = keyIndex(16, 4); -constexpr uint8_t R16C5 = keyIndex(16, 5); -constexpr uint8_t R16C6 = keyIndex(16, 6); -constexpr uint8_t R16C7 = keyIndex(16, 7); -constexpr uint8_t R16C8 = keyIndex(16, 8); -constexpr uint8_t R16C9 = keyIndex(16, 9); +constexpr uint8_t R16C0 = keyIndex(16, 0); +constexpr uint8_t R16C1 = keyIndex(16, 1); +constexpr uint8_t R16C2 = keyIndex(16, 2); +constexpr uint8_t R16C3 = keyIndex(16, 3); +constexpr uint8_t R16C4 = keyIndex(16, 4); +constexpr uint8_t R16C5 = keyIndex(16, 5); +constexpr uint8_t R16C6 = keyIndex(16, 6); +constexpr uint8_t R16C7 = keyIndex(16, 7); +constexpr uint8_t R16C8 = keyIndex(16, 8); +constexpr uint8_t R16C9 = keyIndex(16, 9); constexpr uint8_t R16C10 = keyIndex(16, 10); constexpr uint8_t R16C11 = keyIndex(16, 11); constexpr uint8_t R16C12 = keyIndex(16, 12); @@ -542,16 +542,16 @@ constexpr uint8_t R16C26 = keyIndex(16, 26); constexpr uint8_t R16C27 = keyIndex(16, 27); constexpr uint8_t R16C28 = keyIndex(16, 28); constexpr uint8_t R16C29 = keyIndex(16, 29); -constexpr uint8_t R17C0 = keyIndex(17, 0); -constexpr uint8_t R17C1 = keyIndex(17, 1); -constexpr uint8_t R17C2 = keyIndex(17, 2); -constexpr uint8_t R17C3 = keyIndex(17, 3); -constexpr uint8_t R17C4 = keyIndex(17, 4); -constexpr uint8_t R17C5 = keyIndex(17, 5); -constexpr uint8_t R17C6 = keyIndex(17, 6); -constexpr uint8_t R17C7 = keyIndex(17, 7); -constexpr uint8_t R17C8 = keyIndex(17, 8); -constexpr uint8_t R17C9 = keyIndex(17, 9); +constexpr uint8_t R17C0 = keyIndex(17, 0); +constexpr uint8_t R17C1 = keyIndex(17, 1); +constexpr uint8_t R17C2 = keyIndex(17, 2); +constexpr uint8_t R17C3 = keyIndex(17, 3); +constexpr uint8_t R17C4 = keyIndex(17, 4); +constexpr uint8_t R17C5 = keyIndex(17, 5); +constexpr uint8_t R17C6 = keyIndex(17, 6); +constexpr uint8_t R17C7 = keyIndex(17, 7); +constexpr uint8_t R17C8 = keyIndex(17, 8); +constexpr uint8_t R17C9 = keyIndex(17, 9); constexpr uint8_t R17C10 = keyIndex(17, 10); constexpr uint8_t R17C11 = keyIndex(17, 11); constexpr uint8_t R17C12 = keyIndex(17, 12); @@ -572,16 +572,16 @@ constexpr uint8_t R17C26 = keyIndex(17, 26); constexpr uint8_t R17C27 = keyIndex(17, 27); constexpr uint8_t R17C28 = keyIndex(17, 28); constexpr uint8_t R17C29 = keyIndex(17, 29); -constexpr uint8_t R18C0 = keyIndex(18, 0); -constexpr uint8_t R18C1 = keyIndex(18, 1); -constexpr uint8_t R18C2 = keyIndex(18, 2); -constexpr uint8_t R18C3 = keyIndex(18, 3); -constexpr uint8_t R18C4 = keyIndex(18, 4); -constexpr uint8_t R18C5 = keyIndex(18, 5); -constexpr uint8_t R18C6 = keyIndex(18, 6); -constexpr uint8_t R18C7 = keyIndex(18, 7); -constexpr uint8_t R18C8 = keyIndex(18, 8); -constexpr uint8_t R18C9 = keyIndex(18, 9); +constexpr uint8_t R18C0 = keyIndex(18, 0); +constexpr uint8_t R18C1 = keyIndex(18, 1); +constexpr uint8_t R18C2 = keyIndex(18, 2); +constexpr uint8_t R18C3 = keyIndex(18, 3); +constexpr uint8_t R18C4 = keyIndex(18, 4); +constexpr uint8_t R18C5 = keyIndex(18, 5); +constexpr uint8_t R18C6 = keyIndex(18, 6); +constexpr uint8_t R18C7 = keyIndex(18, 7); +constexpr uint8_t R18C8 = keyIndex(18, 8); +constexpr uint8_t R18C9 = keyIndex(18, 9); constexpr uint8_t R18C10 = keyIndex(18, 10); constexpr uint8_t R18C11 = keyIndex(18, 11); constexpr uint8_t R18C12 = keyIndex(18, 12); @@ -602,16 +602,16 @@ constexpr uint8_t R18C26 = keyIndex(18, 26); constexpr uint8_t R18C27 = keyIndex(18, 27); constexpr uint8_t R18C28 = keyIndex(18, 28); constexpr uint8_t R18C29 = keyIndex(18, 29); -constexpr uint8_t R19C0 = keyIndex(19, 0); -constexpr uint8_t R19C1 = keyIndex(19, 1); -constexpr uint8_t R19C2 = keyIndex(19, 2); -constexpr uint8_t R19C3 = keyIndex(19, 3); -constexpr uint8_t R19C4 = keyIndex(19, 4); -constexpr uint8_t R19C5 = keyIndex(19, 5); -constexpr uint8_t R19C6 = keyIndex(19, 6); -constexpr uint8_t R19C7 = keyIndex(19, 7); -constexpr uint8_t R19C8 = keyIndex(19, 8); -constexpr uint8_t R19C9 = keyIndex(19, 9); +constexpr uint8_t R19C0 = keyIndex(19, 0); +constexpr uint8_t R19C1 = keyIndex(19, 1); +constexpr uint8_t R19C2 = keyIndex(19, 2); +constexpr uint8_t R19C3 = keyIndex(19, 3); +constexpr uint8_t R19C4 = keyIndex(19, 4); +constexpr uint8_t R19C5 = keyIndex(19, 5); +constexpr uint8_t R19C6 = keyIndex(19, 6); +constexpr uint8_t R19C7 = keyIndex(19, 7); +constexpr uint8_t R19C8 = keyIndex(19, 8); +constexpr uint8_t R19C9 = keyIndex(19, 9); constexpr uint8_t R19C10 = keyIndex(19, 10); constexpr uint8_t R19C11 = keyIndex(19, 11); constexpr uint8_t R19C12 = keyIndex(19, 12); @@ -632,16 +632,16 @@ constexpr uint8_t R19C26 = keyIndex(19, 26); constexpr uint8_t R19C27 = keyIndex(19, 27); constexpr uint8_t R19C28 = keyIndex(19, 28); constexpr uint8_t R19C29 = keyIndex(19, 29); -constexpr uint8_t R20C0 = keyIndex(20, 0); -constexpr uint8_t R20C1 = keyIndex(20, 1); -constexpr uint8_t R20C2 = keyIndex(20, 2); -constexpr uint8_t R20C3 = keyIndex(20, 3); -constexpr uint8_t R20C4 = keyIndex(20, 4); -constexpr uint8_t R20C5 = keyIndex(20, 5); -constexpr uint8_t R20C6 = keyIndex(20, 6); -constexpr uint8_t R20C7 = keyIndex(20, 7); -constexpr uint8_t R20C8 = keyIndex(20, 8); -constexpr uint8_t R20C9 = keyIndex(20, 9); +constexpr uint8_t R20C0 = keyIndex(20, 0); +constexpr uint8_t R20C1 = keyIndex(20, 1); +constexpr uint8_t R20C2 = keyIndex(20, 2); +constexpr uint8_t R20C3 = keyIndex(20, 3); +constexpr uint8_t R20C4 = keyIndex(20, 4); +constexpr uint8_t R20C5 = keyIndex(20, 5); +constexpr uint8_t R20C6 = keyIndex(20, 6); +constexpr uint8_t R20C7 = keyIndex(20, 7); +constexpr uint8_t R20C8 = keyIndex(20, 8); +constexpr uint8_t R20C9 = keyIndex(20, 9); constexpr uint8_t R20C10 = keyIndex(20, 10); constexpr uint8_t R20C11 = keyIndex(20, 11); constexpr uint8_t R20C12 = keyIndex(20, 12); @@ -662,16 +662,16 @@ constexpr uint8_t R20C26 = keyIndex(20, 26); constexpr uint8_t R20C27 = keyIndex(20, 27); constexpr uint8_t R20C28 = keyIndex(20, 28); constexpr uint8_t R20C29 = keyIndex(20, 29); -constexpr uint8_t R21C0 = keyIndex(21, 0); -constexpr uint8_t R21C1 = keyIndex(21, 1); -constexpr uint8_t R21C2 = keyIndex(21, 2); -constexpr uint8_t R21C3 = keyIndex(21, 3); -constexpr uint8_t R21C4 = keyIndex(21, 4); -constexpr uint8_t R21C5 = keyIndex(21, 5); -constexpr uint8_t R21C6 = keyIndex(21, 6); -constexpr uint8_t R21C7 = keyIndex(21, 7); -constexpr uint8_t R21C8 = keyIndex(21, 8); -constexpr uint8_t R21C9 = keyIndex(21, 9); +constexpr uint8_t R21C0 = keyIndex(21, 0); +constexpr uint8_t R21C1 = keyIndex(21, 1); +constexpr uint8_t R21C2 = keyIndex(21, 2); +constexpr uint8_t R21C3 = keyIndex(21, 3); +constexpr uint8_t R21C4 = keyIndex(21, 4); +constexpr uint8_t R21C5 = keyIndex(21, 5); +constexpr uint8_t R21C6 = keyIndex(21, 6); +constexpr uint8_t R21C7 = keyIndex(21, 7); +constexpr uint8_t R21C8 = keyIndex(21, 8); +constexpr uint8_t R21C9 = keyIndex(21, 9); constexpr uint8_t R21C10 = keyIndex(21, 10); constexpr uint8_t R21C11 = keyIndex(21, 11); constexpr uint8_t R21C12 = keyIndex(21, 12); @@ -692,16 +692,16 @@ constexpr uint8_t R21C26 = keyIndex(21, 26); constexpr uint8_t R21C27 = keyIndex(21, 27); constexpr uint8_t R21C28 = keyIndex(21, 28); constexpr uint8_t R21C29 = keyIndex(21, 29); -constexpr uint8_t R22C0 = keyIndex(22, 0); -constexpr uint8_t R22C1 = keyIndex(22, 1); -constexpr uint8_t R22C2 = keyIndex(22, 2); -constexpr uint8_t R22C3 = keyIndex(22, 3); -constexpr uint8_t R22C4 = keyIndex(22, 4); -constexpr uint8_t R22C5 = keyIndex(22, 5); -constexpr uint8_t R22C6 = keyIndex(22, 6); -constexpr uint8_t R22C7 = keyIndex(22, 7); -constexpr uint8_t R22C8 = keyIndex(22, 8); -constexpr uint8_t R22C9 = keyIndex(22, 9); +constexpr uint8_t R22C0 = keyIndex(22, 0); +constexpr uint8_t R22C1 = keyIndex(22, 1); +constexpr uint8_t R22C2 = keyIndex(22, 2); +constexpr uint8_t R22C3 = keyIndex(22, 3); +constexpr uint8_t R22C4 = keyIndex(22, 4); +constexpr uint8_t R22C5 = keyIndex(22, 5); +constexpr uint8_t R22C6 = keyIndex(22, 6); +constexpr uint8_t R22C7 = keyIndex(22, 7); +constexpr uint8_t R22C8 = keyIndex(22, 8); +constexpr uint8_t R22C9 = keyIndex(22, 9); constexpr uint8_t R22C10 = keyIndex(22, 10); constexpr uint8_t R22C11 = keyIndex(22, 11); constexpr uint8_t R22C12 = keyIndex(22, 12); @@ -722,16 +722,16 @@ constexpr uint8_t R22C26 = keyIndex(22, 26); constexpr uint8_t R22C27 = keyIndex(22, 27); constexpr uint8_t R22C28 = keyIndex(22, 28); constexpr uint8_t R22C29 = keyIndex(22, 29); -constexpr uint8_t R23C0 = keyIndex(23, 0); -constexpr uint8_t R23C1 = keyIndex(23, 1); -constexpr uint8_t R23C2 = keyIndex(23, 2); -constexpr uint8_t R23C3 = keyIndex(23, 3); -constexpr uint8_t R23C4 = keyIndex(23, 4); -constexpr uint8_t R23C5 = keyIndex(23, 5); -constexpr uint8_t R23C6 = keyIndex(23, 6); -constexpr uint8_t R23C7 = keyIndex(23, 7); -constexpr uint8_t R23C8 = keyIndex(23, 8); -constexpr uint8_t R23C9 = keyIndex(23, 9); +constexpr uint8_t R23C0 = keyIndex(23, 0); +constexpr uint8_t R23C1 = keyIndex(23, 1); +constexpr uint8_t R23C2 = keyIndex(23, 2); +constexpr uint8_t R23C3 = keyIndex(23, 3); +constexpr uint8_t R23C4 = keyIndex(23, 4); +constexpr uint8_t R23C5 = keyIndex(23, 5); +constexpr uint8_t R23C6 = keyIndex(23, 6); +constexpr uint8_t R23C7 = keyIndex(23, 7); +constexpr uint8_t R23C8 = keyIndex(23, 8); +constexpr uint8_t R23C9 = keyIndex(23, 9); constexpr uint8_t R23C10 = keyIndex(23, 10); constexpr uint8_t R23C11 = keyIndex(23, 11); constexpr uint8_t R23C12 = keyIndex(23, 12); @@ -752,16 +752,16 @@ constexpr uint8_t R23C26 = keyIndex(23, 26); constexpr uint8_t R23C27 = keyIndex(23, 27); constexpr uint8_t R23C28 = keyIndex(23, 28); constexpr uint8_t R23C29 = keyIndex(23, 29); -constexpr uint8_t R24C0 = keyIndex(24, 0); -constexpr uint8_t R24C1 = keyIndex(24, 1); -constexpr uint8_t R24C2 = keyIndex(24, 2); -constexpr uint8_t R24C3 = keyIndex(24, 3); -constexpr uint8_t R24C4 = keyIndex(24, 4); -constexpr uint8_t R24C5 = keyIndex(24, 5); -constexpr uint8_t R24C6 = keyIndex(24, 6); -constexpr uint8_t R24C7 = keyIndex(24, 7); -constexpr uint8_t R24C8 = keyIndex(24, 8); -constexpr uint8_t R24C9 = keyIndex(24, 9); +constexpr uint8_t R24C0 = keyIndex(24, 0); +constexpr uint8_t R24C1 = keyIndex(24, 1); +constexpr uint8_t R24C2 = keyIndex(24, 2); +constexpr uint8_t R24C3 = keyIndex(24, 3); +constexpr uint8_t R24C4 = keyIndex(24, 4); +constexpr uint8_t R24C5 = keyIndex(24, 5); +constexpr uint8_t R24C6 = keyIndex(24, 6); +constexpr uint8_t R24C7 = keyIndex(24, 7); +constexpr uint8_t R24C8 = keyIndex(24, 8); +constexpr uint8_t R24C9 = keyIndex(24, 9); constexpr uint8_t R24C10 = keyIndex(24, 10); constexpr uint8_t R24C11 = keyIndex(24, 11); constexpr uint8_t R24C12 = keyIndex(24, 12); @@ -782,16 +782,16 @@ constexpr uint8_t R24C26 = keyIndex(24, 26); constexpr uint8_t R24C27 = keyIndex(24, 27); constexpr uint8_t R24C28 = keyIndex(24, 28); constexpr uint8_t R24C29 = keyIndex(24, 29); -constexpr uint8_t R25C0 = keyIndex(25, 0); -constexpr uint8_t R25C1 = keyIndex(25, 1); -constexpr uint8_t R25C2 = keyIndex(25, 2); -constexpr uint8_t R25C3 = keyIndex(25, 3); -constexpr uint8_t R25C4 = keyIndex(25, 4); -constexpr uint8_t R25C5 = keyIndex(25, 5); -constexpr uint8_t R25C6 = keyIndex(25, 6); -constexpr uint8_t R25C7 = keyIndex(25, 7); -constexpr uint8_t R25C8 = keyIndex(25, 8); -constexpr uint8_t R25C9 = keyIndex(25, 9); +constexpr uint8_t R25C0 = keyIndex(25, 0); +constexpr uint8_t R25C1 = keyIndex(25, 1); +constexpr uint8_t R25C2 = keyIndex(25, 2); +constexpr uint8_t R25C3 = keyIndex(25, 3); +constexpr uint8_t R25C4 = keyIndex(25, 4); +constexpr uint8_t R25C5 = keyIndex(25, 5); +constexpr uint8_t R25C6 = keyIndex(25, 6); +constexpr uint8_t R25C7 = keyIndex(25, 7); +constexpr uint8_t R25C8 = keyIndex(25, 8); +constexpr uint8_t R25C9 = keyIndex(25, 9); constexpr uint8_t R25C10 = keyIndex(25, 10); constexpr uint8_t R25C11 = keyIndex(25, 11); constexpr uint8_t R25C12 = keyIndex(25, 12); @@ -812,16 +812,16 @@ constexpr uint8_t R25C26 = keyIndex(25, 26); constexpr uint8_t R25C27 = keyIndex(25, 27); constexpr uint8_t R25C28 = keyIndex(25, 28); constexpr uint8_t R25C29 = keyIndex(25, 29); -constexpr uint8_t R26C0 = keyIndex(26, 0); -constexpr uint8_t R26C1 = keyIndex(26, 1); -constexpr uint8_t R26C2 = keyIndex(26, 2); -constexpr uint8_t R26C3 = keyIndex(26, 3); -constexpr uint8_t R26C4 = keyIndex(26, 4); -constexpr uint8_t R26C5 = keyIndex(26, 5); -constexpr uint8_t R26C6 = keyIndex(26, 6); -constexpr uint8_t R26C7 = keyIndex(26, 7); -constexpr uint8_t R26C8 = keyIndex(26, 8); -constexpr uint8_t R26C9 = keyIndex(26, 9); +constexpr uint8_t R26C0 = keyIndex(26, 0); +constexpr uint8_t R26C1 = keyIndex(26, 1); +constexpr uint8_t R26C2 = keyIndex(26, 2); +constexpr uint8_t R26C3 = keyIndex(26, 3); +constexpr uint8_t R26C4 = keyIndex(26, 4); +constexpr uint8_t R26C5 = keyIndex(26, 5); +constexpr uint8_t R26C6 = keyIndex(26, 6); +constexpr uint8_t R26C7 = keyIndex(26, 7); +constexpr uint8_t R26C8 = keyIndex(26, 8); +constexpr uint8_t R26C9 = keyIndex(26, 9); constexpr uint8_t R26C10 = keyIndex(26, 10); constexpr uint8_t R26C11 = keyIndex(26, 11); constexpr uint8_t R26C12 = keyIndex(26, 12); @@ -842,16 +842,16 @@ constexpr uint8_t R26C26 = keyIndex(26, 26); constexpr uint8_t R26C27 = keyIndex(26, 27); constexpr uint8_t R26C28 = keyIndex(26, 28); constexpr uint8_t R26C29 = keyIndex(26, 29); -constexpr uint8_t R27C0 = keyIndex(27, 0); -constexpr uint8_t R27C1 = keyIndex(27, 1); -constexpr uint8_t R27C2 = keyIndex(27, 2); -constexpr uint8_t R27C3 = keyIndex(27, 3); -constexpr uint8_t R27C4 = keyIndex(27, 4); -constexpr uint8_t R27C5 = keyIndex(27, 5); -constexpr uint8_t R27C6 = keyIndex(27, 6); -constexpr uint8_t R27C7 = keyIndex(27, 7); -constexpr uint8_t R27C8 = keyIndex(27, 8); -constexpr uint8_t R27C9 = keyIndex(27, 9); +constexpr uint8_t R27C0 = keyIndex(27, 0); +constexpr uint8_t R27C1 = keyIndex(27, 1); +constexpr uint8_t R27C2 = keyIndex(27, 2); +constexpr uint8_t R27C3 = keyIndex(27, 3); +constexpr uint8_t R27C4 = keyIndex(27, 4); +constexpr uint8_t R27C5 = keyIndex(27, 5); +constexpr uint8_t R27C6 = keyIndex(27, 6); +constexpr uint8_t R27C7 = keyIndex(27, 7); +constexpr uint8_t R27C8 = keyIndex(27, 8); +constexpr uint8_t R27C9 = keyIndex(27, 9); constexpr uint8_t R27C10 = keyIndex(27, 10); constexpr uint8_t R27C11 = keyIndex(27, 11); constexpr uint8_t R27C12 = keyIndex(27, 12); @@ -872,16 +872,16 @@ constexpr uint8_t R27C26 = keyIndex(27, 26); constexpr uint8_t R27C27 = keyIndex(27, 27); constexpr uint8_t R27C28 = keyIndex(27, 28); constexpr uint8_t R27C29 = keyIndex(27, 29); -constexpr uint8_t R28C0 = keyIndex(28, 0); -constexpr uint8_t R28C1 = keyIndex(28, 1); -constexpr uint8_t R28C2 = keyIndex(28, 2); -constexpr uint8_t R28C3 = keyIndex(28, 3); -constexpr uint8_t R28C4 = keyIndex(28, 4); -constexpr uint8_t R28C5 = keyIndex(28, 5); -constexpr uint8_t R28C6 = keyIndex(28, 6); -constexpr uint8_t R28C7 = keyIndex(28, 7); -constexpr uint8_t R28C8 = keyIndex(28, 8); -constexpr uint8_t R28C9 = keyIndex(28, 9); +constexpr uint8_t R28C0 = keyIndex(28, 0); +constexpr uint8_t R28C1 = keyIndex(28, 1); +constexpr uint8_t R28C2 = keyIndex(28, 2); +constexpr uint8_t R28C3 = keyIndex(28, 3); +constexpr uint8_t R28C4 = keyIndex(28, 4); +constexpr uint8_t R28C5 = keyIndex(28, 5); +constexpr uint8_t R28C6 = keyIndex(28, 6); +constexpr uint8_t R28C7 = keyIndex(28, 7); +constexpr uint8_t R28C8 = keyIndex(28, 8); +constexpr uint8_t R28C9 = keyIndex(28, 9); constexpr uint8_t R28C10 = keyIndex(28, 10); constexpr uint8_t R28C11 = keyIndex(28, 11); constexpr uint8_t R28C12 = keyIndex(28, 12); @@ -902,16 +902,16 @@ constexpr uint8_t R28C26 = keyIndex(28, 26); constexpr uint8_t R28C27 = keyIndex(28, 27); constexpr uint8_t R28C28 = keyIndex(28, 28); constexpr uint8_t R28C29 = keyIndex(28, 29); -constexpr uint8_t R29C0 = keyIndex(29, 0); -constexpr uint8_t R29C1 = keyIndex(29, 1); -constexpr uint8_t R29C2 = keyIndex(29, 2); -constexpr uint8_t R29C3 = keyIndex(29, 3); -constexpr uint8_t R29C4 = keyIndex(29, 4); -constexpr uint8_t R29C5 = keyIndex(29, 5); -constexpr uint8_t R29C6 = keyIndex(29, 6); -constexpr uint8_t R29C7 = keyIndex(29, 7); -constexpr uint8_t R29C8 = keyIndex(29, 8); -constexpr uint8_t R29C9 = keyIndex(29, 9); +constexpr uint8_t R29C0 = keyIndex(29, 0); +constexpr uint8_t R29C1 = keyIndex(29, 1); +constexpr uint8_t R29C2 = keyIndex(29, 2); +constexpr uint8_t R29C3 = keyIndex(29, 3); +constexpr uint8_t R29C4 = keyIndex(29, 4); +constexpr uint8_t R29C5 = keyIndex(29, 5); +constexpr uint8_t R29C6 = keyIndex(29, 6); +constexpr uint8_t R29C7 = keyIndex(29, 7); +constexpr uint8_t R29C8 = keyIndex(29, 8); +constexpr uint8_t R29C9 = keyIndex(29, 9); constexpr uint8_t R29C10 = keyIndex(29, 10); constexpr uint8_t R29C11 = keyIndex(29, 11); constexpr uint8_t R29C12 = keyIndex(29, 12); diff --git a/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp b/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp index 3e54e268..e82c28fa 100644 --- a/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp +++ b/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp @@ -19,12 +19,12 @@ #include "kaleidoscope/device/virtual/DefaultHIDReportConsumer.h" // From KeyboardioHID: -#include // for HID_REPORTID_NKRO_K... -#include // for HID_KeyboardReport_... +#include // for HID_REPORTID_NKRO_K... +#include // for HID_KeyboardReport_... // From system: -#include // for uint8_t +#include // for uint8_t // From Arduino core: -#include // for logUSBEvent_keyboard +#include // for logUSBEvent_keyboard // From Kaleidoscope: #include "kaleidoscope/device/virtual/Logging.h" // for log_info, logging @@ -32,23 +32,23 @@ #undef min #undef max -#include // for operator<<, strings... -#include // for char_traits, operator+ +#include // for operator<<, strings... +#include // for char_traits, operator+ namespace kaleidoscope { -using namespace logging; // NOLINT(build/namespaces) +using namespace logging; // NOLINT(build/namespaces) // For each bit set in 'bitfield', output the corresponding string to 'stream' #define FOREACHBIT(bitfield, stream, str0, str1, str2, str3, str4, str5, str6, str7) \ - if((bitfield) & 1<<0) stream << str0; \ - if((bitfield) & 1<<1) stream << str1; \ - if((bitfield) & 1<<2) stream << str2; \ - if((bitfield) & 1<<3) stream << str3; \ - if((bitfield) & 1<<4) stream << str4; \ - if((bitfield) & 1<<5) stream << str5; \ - if((bitfield) & 1<<6) stream << str6; \ - if((bitfield) & 1<<7) stream << str7; + if ((bitfield)&1 << 0) stream << str0; \ + if ((bitfield)&1 << 1) stream << str1; \ + if ((bitfield)&1 << 2) stream << str2; \ + if ((bitfield)&1 << 3) stream << str3; \ + if ((bitfield)&1 << 4) stream << str4; \ + if ((bitfield)&1 << 5) stream << str5; \ + if ((bitfield)&1 << 6) stream << str6; \ + if ((bitfield)&1 << 7) stream << str7; void DefaultHIDReportConsumer::processHIDReport( uint8_t id, const void *data, int len, int result) { @@ -57,21 +57,26 @@ void DefaultHIDReportConsumer::processHIDReport( return; } - const HID_KeyboardReport_Data_t &report_data - = *static_cast(data); + const HID_KeyboardReport_Data_t &report_data = *static_cast(data); std::stringstream keypresses; bool anything = false; - if (report_data.modifiers) anything = true; - else for (int i = 0; i < KEY_BYTES; i++) if (report_data.keys[i]) { + if (report_data.modifiers) { + anything = true; + } else { + for (int i = 0; i < KEY_BYTES; i++) { + if (report_data.keys[i]) { anything = true; break; } + } + } if (!anything) { keypresses << "none"; } else { + // clang-format off FOREACHBIT(report_data.modifiers, keypresses, "lctrl ", "lshift ", "lalt ", "lgui ", "rctrl ", "rshift ", "ralt ", "rgui ") @@ -114,6 +119,7 @@ void DefaultHIDReportConsumer::processHIDReport( FOREACHBIT(report_data.keys[16], keypresses, "volup ", "voldn ", "capslock_l ", "numlock_l ", "scrolllock_l ", "num, ", "num= ", "(other) ") + // clang-format on for (int i = 17; i < KEY_BYTES; i++) { // A little imprecise, in two ways: @@ -128,6 +134,6 @@ void DefaultHIDReportConsumer::processHIDReport( logUSBEvent_keyboard("Keyboard HID report; pressed keys: " + keypresses.str()); } -} // namespace kaleidoscope +} // namespace kaleidoscope -#endif // ifdef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifdef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.h b/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.h index cb2eaba3..d1e8c2f6 100644 --- a/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.h +++ b/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.h @@ -24,11 +24,9 @@ namespace kaleidoscope { class DefaultHIDReportConsumer { public: - - static void processHIDReport(uint8_t id, const void *data, - int len, int result); + static void processHIDReport(uint8_t id, const void *data, int len, int result); }; -} // namespace kaleidoscope +} // namespace kaleidoscope -#endif // ifdef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifdef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/device/virtual/HID.cpp b/src/kaleidoscope/device/virtual/HID.cpp index a3b6ff03..2ddd7b92 100644 --- a/src/kaleidoscope/device/virtual/HID.cpp +++ b/src/kaleidoscope/device/virtual/HID.cpp @@ -34,7 +34,7 @@ HID_ &HID() { } int HID_::getInterface(uint8_t *interfaceCount) { - *interfaceCount += 1; // uses 1 + *interfaceCount += 1; // uses 1 return 0; } @@ -67,12 +67,15 @@ bool HID_::setup(USBSetup &setup) { return true; } -HID_::HID_(void) : PluggableUSBModule(1, 1, epType), - rootNode(NULL), descriptorSize(0), - protocol(HID_REPORT_PROTOCOL), idle(1) { +HID_::HID_(void) + : PluggableUSBModule(1, 1, epType), + rootNode(NULL), + descriptorSize(0), + protocol(HID_REPORT_PROTOCOL), + idle(1) { setReportData.reportId = 0; - setReportData.leds = 0; - epType[0] = EP_TYPE_INTERRUPT_IN; + setReportData.leds = 0; + epType[0] = EP_TYPE_INTERRUPT_IN; //PluggableUSB().plug(this); } @@ -82,4 +85,4 @@ int HID_::begin(void) { #endif /* if defined(USBCON) */ -#endif // #ifdef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // #ifdef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/device/virtual/Logging.cpp b/src/kaleidoscope/device/virtual/Logging.cpp index d4a87839..cd88e533 100644 --- a/src/kaleidoscope/device/virtual/Logging.cpp +++ b/src/kaleidoscope/device/virtual/Logging.cpp @@ -31,7 +31,7 @@ bool verboseOutputEnabled() { return __verboseOutputEnabled; } -} // namespace logging -} // namespace kaleidoscope +} // namespace logging +} // namespace kaleidoscope -#endif // #ifdef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // #ifdef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/device/virtual/Logging.h b/src/kaleidoscope/device/virtual/Logging.h index 7bdf45ca..5e32cbfc 100644 --- a/src/kaleidoscope/device/virtual/Logging.h +++ b/src/kaleidoscope/device/virtual/Logging.h @@ -48,50 +48,44 @@ extern bool verboseOutputEnabled(); #ifdef KALEIDOSCOPE_HARDWARE_VIRTUAL_NO_LOGGING template -inline -void log_debug(Args__&&... args) {} +inline void log_debug(Args__ &&...args) {} template -inline -void log_info(Args__&&... args) {} +inline void log_info(Args__ &&...args) {} -#else // #ifdef KALEIDOSCOPE_HARDWARE_VIRTUAL_NO_LOGGING +#else // #ifdef KALEIDOSCOPE_HARDWARE_VIRTUAL_NO_LOGGING template -inline -void log_debug(Args__&&... args) { +inline void log_debug(Args__ &&...args) { if (verboseOutputEnabled()) { fprintf(stdout, std::forward(args)...); } } template -inline -void log_info(Args__&&... args) { +inline void log_info(Args__ &&...args) { if (verboseOutputEnabled()) { fprintf(stdout, std::forward(args)...); } } -#endif // #ifdef KALEIDOSCOPE_HARDWARE_VIRTUAL_NO_LOGGING +#endif // #ifdef KALEIDOSCOPE_HARDWARE_VIRTUAL_NO_LOGGING template -inline -void log_error(Args__&&... args) { +inline void log_error(Args__ &&...args) { fprintf(stderr, std::forward(args)...); } template -inline -void log_critical(Args__&&... args) { +inline void log_critical(Args__ &&...args) { fprintf(stderr, std::forward(args)...); } -} // namespace logging -} // namespace kaleidoscope +} // namespace logging +} // namespace kaleidoscope // Re-enable diagnostic for literal format strings. // #pragma GCC diagnostic pop -#endif // ifdef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifdef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/device/virtual/Virtual.cpp b/src/kaleidoscope/device/virtual/Virtual.cpp index 2d44f595..70545eee 100644 --- a/src/kaleidoscope/device/virtual/Virtual.cpp +++ b/src/kaleidoscope/device/virtual/Virtual.cpp @@ -20,26 +20,26 @@ #include "kaleidoscope/device/virtual/Virtual.h" // From system: -#include // for uint8_t, uint16_t -#include // for exit, size_t +#include // for uint8_t, uint16_t +#include // for exit, size_t // From Arduino: -#include // for EEPROMClass, EERef -#include // for getLineOfInput, isI... +#include // for EEPROMClass, EERef +#include // for getLineOfInput, isI... // From KeyboardioHID: -#include // for HIDReportObserver +#include // for HIDReportObserver // From Kaleidoscope: -#include "kaleidoscope/KeyAddr.h" // for MatrixAddr, MatrixA... +#include "kaleidoscope/KeyAddr.h" // for MatrixAddr, MatrixA... #include "kaleidoscope/device/virtual/DefaultHIDReportConsumer.h" // for DefaultHIDReportCon... -#include "kaleidoscope/device/virtual/Logging.h" // for log_error, logging -#include "kaleidoscope/key_defs.h" // for Key_NoKey -#include "kaleidoscope/keyswitch_state.h" // for IS_PRESSED, WAS_PRE... +#include "kaleidoscope/device/virtual/Logging.h" // for log_error, logging +#include "kaleidoscope/key_defs.h" // for Key_NoKey +#include "kaleidoscope/keyswitch_state.h" // for IS_PRESSED, WAS_PRE... // These must come after other headers: -#include // for operator<<, string -#include // for operator==, char_tr... +#include // for operator<<, string +#include // for operator==, char_tr... // FIXME: This relates to virtual/cores/arduino/EEPROM.h. // EEPROM static data must be defined here as only @@ -60,16 +60,16 @@ namespace kaleidoscope { namespace device { namespace virt { -using namespace kaleidoscope::logging; // NOLINT(build/namespaces) +using namespace kaleidoscope::logging; // NOLINT(build/namespaces) //############################################################################## // VirtualKeyScanner //############################################################################## VirtualKeyScanner::VirtualKeyScanner() - : n_pressed_switches_{0}, - n_previously_pressed_switches_{0}, - read_matrix_enabled_{true} { + : n_pressed_switches_{0}, + n_previously_pressed_switches_{0}, + read_matrix_enabled_{true} { } void VirtualKeyScanner::setup() { @@ -77,7 +77,7 @@ void VirtualKeyScanner::setup() { HIDReportObserver::resetHook(&DefaultHIDReportConsumer::processHIDReport); for (auto key_addr : KeyAddr::all()) { - keystates_[key_addr.toInt()] = KeyState::NotPressed; + keystates_[key_addr.toInt()] = KeyState::NotPressed; keystates_prev_[key_addr.toInt()] = KeyState::NotPressed; } } @@ -174,9 +174,9 @@ void VirtualKeyScanner::readMatrix() { std::getline(sline, token, ' '); if (token == "") { - break; // end of line + break; // end of line } else if (token == "#") { - break; // skip the rest of the line + break; // skip the rest of the line } else if ((token == "?" || token == "help") && isInteractive()) { printHelp(); } else if (token == "Q") { @@ -202,9 +202,8 @@ void VirtualKeyScanner::readMatrix() { continue; } else { key_addr = KeyAddr( - (uint8_t)std::stoi(token.substr(1, commapos - 1)), - (uint8_t)std::stoi(token.substr(commapos + 1, token.length() - commapos - 1)) - ); + (uint8_t)std::stoi(token.substr(1, commapos - 1)), + (uint8_t)std::stoi(token.substr(commapos + 1, token.length() - commapos - 1))); if (!key_addr.isValid()) { log_error("Bad coordinates: %s\n", token.c_str()); @@ -214,24 +213,23 @@ void VirtualKeyScanner::readMatrix() { } else { // TODO(anyone): Is there a device independent // way to determine KeyAddr from key names? -// key_addr = getRCfromPhysicalKey(token); -// -// if (!key_addr.isValid()) { -// log_error("Unrecognized command: %s\n", token.c_str()); -// continue; -// } + // key_addr = getRCfromPhysicalKey(token); + // + // if (!key_addr.isValid()) { + // log_error("Unrecognized command: %s\n", token.c_str()); + // continue; + // } } keystates_[key_addr.toInt()] = - (mode == M_DOWN) ? KeyState::Pressed : - (mode == M_UP) ? KeyState::NotPressed : - KeyState::Tap; + (mode == M_DOWN) ? KeyState::Pressed : (mode == M_UP) ? KeyState::NotPressed + : KeyState::Tap; } } } void VirtualKeyScanner::actOnMatrixScan() { - n_pressed_switches_ = 0; + n_pressed_switches_ = 0; n_previously_pressed_switches_ = 0; for (auto key_addr : KeyAddr::all()) { @@ -273,7 +271,7 @@ void VirtualKeyScanner::actOnMatrixScan() { if (keystates_[key_addr.toInt()] == KeyState::Tap) { key_state = WAS_PRESSED & ~IS_PRESSED; handleKeyswitchEvent(Key_NoKey, key_addr, key_state); - keystates_[key_addr.toInt()] = KeyState::NotPressed; + keystates_[key_addr.toInt()] = KeyState::NotPressed; keystates_prev_[key_addr.toInt()] = KeyState::NotPressed; } } @@ -285,7 +283,6 @@ uint8_t VirtualKeyScanner::pressedKeyswitchCount() const { bool VirtualKeyScanner::isKeyswitchPressed(KeyAddr key_addr) const { if (keystates_[key_addr.toInt()] == KeyState::NotPressed) { return false; - } return true; } @@ -296,7 +293,6 @@ uint8_t VirtualKeyScanner::previousPressedKeyswitchCount() const { bool VirtualKeyScanner::wasKeyswitchPressed(KeyAddr key_addr) const { if (keystates_prev_[key_addr.toInt()] == KeyState::NotPressed) { return false; - } return true; @@ -335,7 +331,7 @@ void VirtualLEDDriver::syncLeds() { for (int i = 0; i < led_count; i++) { const cRGB state = led_states_[i]; - ss << (unsigned int) state.r << "." << (unsigned int) state.g << "." << (unsigned int) state.b << " "; + ss << (unsigned int)state.r << "." << (unsigned int)state.g << "." << (unsigned int)state.b << " "; } ss << std::endl; @@ -358,11 +354,10 @@ cRGB VirtualLEDDriver::getCrgbAt(uint8_t i) const { return led_states_[i]; } -} // namespace virt -} // namespace device - -} // namespace kaleidoscope +} // namespace virt +} // namespace device +} // namespace kaleidoscope -#endif // ifdef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifdef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/device/virtual/Virtual.h b/src/kaleidoscope/device/virtual/Virtual.h index a0ff389d..f974abf1 100644 --- a/src/kaleidoscope/device/virtual/Virtual.h +++ b/src/kaleidoscope/device/virtual/Virtual.h @@ -25,15 +25,15 @@ #include KALEIDOSCOPE_HARDWARE_H // From system: -#include // for uint8_t +#include // for uint8_t // From Arduino libraries: -#include // for Serial +#include // for Serial // From Kaleidoscope: -#include "kaleidoscope/device/Base.h" // for Base -#include "kaleidoscope/driver/bootloader/None.h" // for None -#include "kaleidoscope/driver/hid/Keyboardio.h" // for Keyboardio -#include "kaleidoscope/driver/keyscanner/Base.h" // for Base -#include "kaleidoscope/driver/mcu/None.h" // for None +#include "kaleidoscope/device/Base.h" // for Base +#include "kaleidoscope/driver/bootloader/None.h" // for None +#include "kaleidoscope/driver/hid/Keyboardio.h" // for Keyboardio +#include "kaleidoscope/driver/keyscanner/Base.h" // for Base +#include "kaleidoscope/driver/mcu/None.h" // for None namespace kaleidoscope { namespace device { @@ -42,12 +42,10 @@ namespace virt { class VirtualKeyScanner : public kaleidoscope::driver::keyscanner::Base { private: - typedef VirtualKeyScanner ThisType; typedef kaleidoscope::driver::keyscanner::Base ParentType; public: - typedef typename ParentType::KeyAddr KeyAddr; enum class KeyState { @@ -56,7 +54,7 @@ class VirtualKeyScanner Tap }; - static constexpr uint8_t matrix_rows = kaleidoscope::DeviceProps::KeyScannerProps::matrix_rows; + static constexpr uint8_t matrix_rows = kaleidoscope::DeviceProps::KeyScannerProps::matrix_rows; static constexpr uint8_t matrix_columns = kaleidoscope::DeviceProps::KeyScannerProps::matrix_columns; VirtualKeyScanner(); @@ -83,27 +81,23 @@ class VirtualKeyScanner KeyState getKeystate(KeyAddr keyAddr) const; private: - bool anythingHeld(); private: - - uint8_t n_pressed_switches_, - n_previously_pressed_switches_; + uint8_t n_pressed_switches_, + n_previously_pressed_switches_; bool read_matrix_enabled_; - KeyState keystates_[matrix_rows * matrix_columns]; // NOLINT(runtime/arrays) - KeyState keystates_prev_[matrix_rows * matrix_columns]; // NOLINT(runtime/arrays) - + KeyState keystates_[matrix_rows * matrix_columns]; // NOLINT(runtime/arrays) + KeyState keystates_prev_[matrix_rows * matrix_columns]; // NOLINT(runtime/arrays) }; class VirtualLEDDriver : public driver::led::Base { public: - typedef driver::led::Base - ParentType; + ParentType; static constexpr uint8_t led_count = kaleidoscope::DeviceProps::LEDDriverProps::led_count; @@ -113,8 +107,7 @@ class VirtualLEDDriver cRGB getCrgbAt(uint8_t i) const; private: - - cRGB led_states_[led_count]; // NOLINT(runtime/arrays) + cRGB led_states_[led_count]; // NOLINT(runtime/arrays) }; // This overrides only the drivers and keeps the driver props of @@ -124,42 +117,41 @@ struct VirtualProps : public kaleidoscope::DeviceProps { typedef kaleidoscope::driver::hid::KeyboardioProps HIDProps; typedef kaleidoscope::driver::hid::Keyboardio HID; typedef typename kaleidoscope::DeviceProps::KeyScannerProps - KeyScannerProps; + KeyScannerProps; typedef VirtualKeyScanner - KeyScanner; + KeyScanner; typedef KeyScannerProps::KeyAddr - KeyAddr; + KeyAddr; typedef typename kaleidoscope::DeviceProps::LEDDriverProps - LEDDriverProps; + LEDDriverProps; typedef VirtualLEDDriver - LEDDriver; + LEDDriver; typedef kaleidoscope::driver::mcu::None MCU; typedef kaleidoscope::driver::bootloader::None - BootLoader; + BootLoader; typedef typename kaleidoscope::DeviceProps::StorageProps - StorageProps; + StorageProps; typedef typename kaleidoscope::DeviceProps::Storage - Storage; + Storage; }; class VirtualDevice : public kaleidoscope::device::Base { public: - auto serialPort() -> decltype(Serial) & { return Serial; } }; -} // namespace virt -} // namespace device +} // namespace virt +} // namespace device typedef device::virt::VirtualDevice Device; -} // namespace kaleidoscope +} // namespace kaleidoscope -#endif // ifdef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifdef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/driver/bootloader/avr/Caterina.h b/src/kaleidoscope/driver/bootloader/avr/Caterina.h index 4c3beb79..480bf28c 100644 --- a/src/kaleidoscope/driver/bootloader/avr/Caterina.h +++ b/src/kaleidoscope/driver/bootloader/avr/Caterina.h @@ -19,7 +19,7 @@ #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include "kaleidoscope/driver/bootloader/Base.h" // IWYU pragma: keep #include "kaleidoscope/driver/bootloader/None.h" // for None @@ -40,7 +40,7 @@ class Caterina : public kaleidoscope::driver::bootloader::Base { // Caterina.c: // https://github.com/arduino/ArduinoCore-avr/blob/5755ddea49fa69d6c505c772ebee5af5078e2ebf/bootloaders/caterina/Caterina.c#L130-L133 - uint16_t bootKey = 0x7777; + uint16_t bootKey = 0x7777; uint16_t *const bootKeyPtr = reinterpret_cast(0x0800); // Stash the magic key @@ -49,13 +49,13 @@ class Caterina : public kaleidoscope::driver::bootloader::Base { // Set a watchdog timer wdt_enable(WDTO_120MS); - while (true) {} // This infinite loop ensures nothing else + while (true) {} // This infinite loop ensures nothing else // happens before the watchdog reboots us } }; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD typedef bootloader::None Caterina; -#endif // #ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // #ifndef KALEIDOSCOPE_VIRTUAL_BUILD } // namespace avr } // namespace bootloader diff --git a/src/kaleidoscope/driver/bootloader/avr/FLIP.cpp b/src/kaleidoscope/driver/bootloader/avr/FLIP.cpp index f4a90933..79fc6da1 100644 --- a/src/kaleidoscope/driver/bootloader/avr/FLIP.cpp +++ b/src/kaleidoscope/driver/bootloader/avr/FLIP.cpp @@ -46,14 +46,14 @@ namespace avr { // http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__software_bootloader_start.html #define BOOTLOADER_RESET_KEY 0xB007B007 -static uint32_t reset_key __attribute__((section(".noinit"))); +static uint32_t reset_key __attribute__((section(".noinit"))); /* * This function runs before main(), and jumps to the bootloader after a reset * initiated by .resetDevice(). */ static void _bootloader_jump_after_watchdog_reset() -__attribute__((used, naked, section(".init3"))); + __attribute__((used, naked, section(".init3"))); static void _bootloader_jump_after_watchdog_reset() { if ((MCUSR & (1 << WDRF)) && reset_key == BOOTLOADER_RESET_KEY) { reset_key = 0; @@ -65,7 +65,7 @@ static void _bootloader_jump_after_watchdog_reset() { void FLIP::rebootBootloader() { reset_key = BOOTLOADER_RESET_KEY; wdt_enable(WDTO_250MS); - while (true) {} // This infinite loop ensures nothing else + while (true) {} // This infinite loop ensures nothing else // happens before the watchdog reboots us } @@ -75,4 +75,4 @@ void FLIP::rebootBootloader() { } // namespace kaleidoscope #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/driver/bootloader/avr/FLIP.h b/src/kaleidoscope/driver/bootloader/avr/FLIP.h index 69ea8ad4..83a9a071 100644 --- a/src/kaleidoscope/driver/bootloader/avr/FLIP.h +++ b/src/kaleidoscope/driver/bootloader/avr/FLIP.h @@ -23,7 +23,7 @@ #ifndef KALEIDOSCOPE_BOOTLOADER_FLIP_WORKAROUND #error To use the FLIP bootloader driver, KALEIDOSCOPE_BOOTLOADER_FLIP_WORKAROUND *must* be defined prior to including this header! #endif -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include "kaleidoscope/driver/bootloader/Base.h" // IWYU pragma: keep #include "kaleidoscope/driver/bootloader/None.h" // for None @@ -38,9 +38,9 @@ class FLIP : public kaleidoscope::driver::bootloader::Base { public: static void rebootBootloader(); }; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD typedef bootloader::None FLIP; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD } // namespace avr } // namespace bootloader diff --git a/src/kaleidoscope/driver/bootloader/avr/HalfKay.h b/src/kaleidoscope/driver/bootloader/avr/HalfKay.h index 510cd67f..46fc705d 100644 --- a/src/kaleidoscope/driver/bootloader/avr/HalfKay.h +++ b/src/kaleidoscope/driver/bootloader/avr/HalfKay.h @@ -19,7 +19,7 @@ #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include "kaleidoscope/driver/bootloader/Base.h" // IWYU pragma: keep #include "kaleidoscope/driver/bootloader/None.h" // for None @@ -38,40 +38,40 @@ class HalfKay : public kaleidoscope::driver::bootloader::Base { // Documentation: https://www.pjrc.com/teensy/jump_to_bootloader.html static void rebootBootloader() { cli(); - UDCON = 1; + UDCON = 1; USBCON = (1 << FRZCLK); UCSR1B = 0; _delay_ms(5); - EIMSK = 0; - PCICR = 0; - SPCR = 0; - ACSR = 0; - EECR = 0; + EIMSK = 0; + PCICR = 0; + SPCR = 0; + ACSR = 0; + EECR = 0; ADCSRA = 0; TIMSK0 = 0; TIMSK1 = 0; TIMSK3 = 0; TIMSK4 = 0; UCSR1B = 0; - TWCR = 0; - DDRB = 0; - DDRC = 0; - DDRD = 0; - DDRE = 0; - DDRF = 0; - TWCR = 0; - PORTB = 0; - PORTC = 0; - PORTD = 0; - PORTE = 0; - PORTF = 0; + TWCR = 0; + DDRB = 0; + DDRC = 0; + DDRD = 0; + DDRE = 0; + DDRF = 0; + TWCR = 0; + PORTB = 0; + PORTC = 0; + PORTD = 0; + PORTE = 0; + PORTF = 0; asm volatile("jmp 0x7E00"); } }; #else typedef bootloader::None HalfKay; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD } // namespace avr } // namespace bootloader diff --git a/src/kaleidoscope/driver/bootloader/gd32/Base.h b/src/kaleidoscope/driver/bootloader/gd32/Base.h index 7391c1b3..28bfae23 100644 --- a/src/kaleidoscope/driver/bootloader/gd32/Base.h +++ b/src/kaleidoscope/driver/bootloader/gd32/Base.h @@ -26,14 +26,14 @@ namespace driver { namespace bootloader { namespace gd32 { -class Base: public kaleidoscope::driver::bootloader::Base { +class Base : public kaleidoscope::driver::bootloader::Base { public: static void rebootBootloader() { NVIC_SystemReset(); } }; -} // namespace gd32 -} // namespace bootloader -} // namespace driver -} // namespace kaleidoscope +} // namespace gd32 +} // namespace bootloader +} // namespace driver +} // namespace kaleidoscope diff --git a/src/kaleidoscope/driver/bootloader/samd/Bossac.h b/src/kaleidoscope/driver/bootloader/samd/Bossac.h index a7ed4aab..766559f4 100644 --- a/src/kaleidoscope/driver/bootloader/samd/Bossac.h +++ b/src/kaleidoscope/driver/bootloader/samd/Bossac.h @@ -32,7 +32,7 @@ namespace samd { class Bossac : public kaleidoscope::driver::bootloader::Base { public: static void rebootBootloader() { - __attribute__((__aligned__(4))) UsbDeviceDescriptor EP[USB_EPT_NUM]; + __attribute__((__aligned__(4))) UsbDeviceDescriptor EP[USB_EPT_NUM]; USB->DEVICE.CTRLA.bit.SWRST = 1; memset(EP, 0, sizeof(EP)); diff --git a/src/kaleidoscope/driver/color/GammaCorrection.h b/src/kaleidoscope/driver/color/GammaCorrection.h index ef4e7880..37719c00 100644 --- a/src/kaleidoscope/driver/color/GammaCorrection.h +++ b/src/kaleidoscope/driver/color/GammaCorrection.h @@ -25,23 +25,7 @@ namespace driver { namespace color { const uint8_t PROGMEM gamma_correction[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, - 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, - 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, - 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25, - 25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36, - 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50, - 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, - 69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89, - 90, 92, 93, 95, 96, 98, 99, 101, 102, 104, 105, 107, 109, 110, 112, 114, - 115, 117, 119, 120, 122, 124, 126, 127, 129, 131, 133, 135, 137, 138, 140, 142, - 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 167, 169, 171, 173, 175, - 177, 180, 182, 184, 186, 189, 191, 193, 196, 198, 200, 203, 205, 208, 210, 213, - 215, 218, 220, 223, 225, 228, 231, 233, 236, 239, 241, 244, 247, 249, 252, 255 -}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89, 90, 92, 93, 95, 96, 98, 99, 101, 102, 104, 105, 107, 109, 110, 112, 114, 115, 117, 119, 120, 122, 124, 126, 127, 129, 131, 133, 135, 137, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 167, 169, 171, 173, 175, 177, 180, 182, 184, 186, 189, 191, 193, 196, 198, 200, 203, 205, 208, 210, 213, 215, 218, 220, 223, 225, 228, 231, 233, 236, 239, 241, 244, 247, 249, 252, 255}; } } // namespace driver diff --git a/src/kaleidoscope/driver/hid/Base.h b/src/kaleidoscope/driver/hid/Base.h index 04a73594..0535e621 100644 --- a/src/kaleidoscope/driver/hid/Base.h +++ b/src/kaleidoscope/driver/hid/Base.h @@ -34,7 +34,7 @@ struct BaseProps { typedef base::AbsoluteMouse AbsoluteMouse; }; -template +template class Base { private: typename _Props::Keyboard keyboard_; diff --git a/src/kaleidoscope/driver/hid/Keyboardio.h b/src/kaleidoscope/driver/hid/Keyboardio.h index 4f7ac3d4..17c54abe 100644 --- a/src/kaleidoscope/driver/hid/Keyboardio.h +++ b/src/kaleidoscope/driver/hid/Keyboardio.h @@ -26,7 +26,7 @@ namespace kaleidoscope { namespace driver { namespace hid { -struct KeyboardioProps: public BaseProps { +struct KeyboardioProps : public BaseProps { typedef keyboardio::KeyboardProps KeyboardProps; typedef keyboardio::Keyboard Keyboard; typedef keyboardio::MouseProps MouseProps; @@ -35,8 +35,8 @@ struct KeyboardioProps: public BaseProps { typedef keyboardio::AbsoluteMouse AbsoluteMouse; }; -template -class Keyboardio: public Base<_Props> {}; +template +class Keyboardio : public Base<_Props> {}; } // namespace hid } // namespace driver diff --git a/src/kaleidoscope/driver/hid/base/AbsoluteMouse.h b/src/kaleidoscope/driver/hid/base/AbsoluteMouse.h index 07007f5d..8e9bf819 100644 --- a/src/kaleidoscope/driver/hid/base/AbsoluteMouse.h +++ b/src/kaleidoscope/driver/hid/base/AbsoluteMouse.h @@ -41,10 +41,11 @@ struct AbsoluteMouseProps { typedef NoAbsoluteMouse AbsoluteMouse; }; -template +template class AbsoluteMouse { private: typename _Props::AbsoluteMouse absolute_mouse_; + public: AbsoluteMouse() {} diff --git a/src/kaleidoscope/driver/hid/base/Keyboard.h b/src/kaleidoscope/driver/hid/base/Keyboard.h index a3c8d55a..0e0d500f 100644 --- a/src/kaleidoscope/driver/hid/base/Keyboard.h +++ b/src/kaleidoscope/driver/hid/base/Keyboard.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/key_defs.h" // for Key, Key_LeftAlt, Key_LeftControl @@ -128,13 +128,14 @@ struct KeyboardProps { typedef NoSystemControl SystemControl; }; -template +template class Keyboard { private: typename _Props::BootKeyboard boot_keyboard_; typename _Props::NKROKeyboard nkro_keyboard_; typename _Props::ConsumerControl consumer_control_; typename _Props::SystemControl system_control_; + public: Keyboard() {} @@ -330,7 +331,6 @@ class Keyboard { releaseRawKey(Key_LeftGui); } } - }; } // namespace base diff --git a/src/kaleidoscope/driver/hid/base/Mouse.h b/src/kaleidoscope/driver/hid/base/Mouse.h index 4fa0d668..5ed13d44 100644 --- a/src/kaleidoscope/driver/hid/base/Mouse.h +++ b/src/kaleidoscope/driver/hid/base/Mouse.h @@ -42,10 +42,11 @@ struct MouseProps { typedef NoMouse Mouse; }; -template +template class Mouse { private: typename _Props::Mouse mouse_; + public: Mouse() {} diff --git a/src/kaleidoscope/driver/hid/keyboardio/AbsoluteMouse.h b/src/kaleidoscope/driver/hid/keyboardio/AbsoluteMouse.h index 8133d02c..257e7b2d 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/AbsoluteMouse.h +++ b/src/kaleidoscope/driver/hid/keyboardio/AbsoluteMouse.h @@ -17,12 +17,12 @@ #pragma once -#include // for uint8_t, int8_t +#include // for uint8_t, int8_t #include // From KeyboardioHID: -#include "DeviceAPIs/AbsoluteMouseAPI.hpp" // for AbsoluteMous... -#include "SingleReport/SingleAbsoluteMouse.h" // for SingleAbsolu... +#include "DeviceAPIs/AbsoluteMouseAPI.hpp" // for AbsoluteMous... +#include "SingleReport/SingleAbsoluteMouse.h" // for SingleAbsolu... // From Kaleidoscope: #include "kaleidoscope/driver/hid/base/AbsoluteMouse.h" // for AbsoluteMouse @@ -66,12 +66,12 @@ class AbsoluteMouseWrapper { } }; -struct AbsoluteMouseProps: public base::AbsoluteMouseProps { +struct AbsoluteMouseProps : public base::AbsoluteMouseProps { typedef AbsoluteMouseWrapper AbsoluteMouse; }; -template -class AbsoluteMouse: public base::AbsoluteMouse<_Props> {}; +template +class AbsoluteMouse : public base::AbsoluteMouse<_Props> {}; } // namespace keyboardio } // namespace hid diff --git a/src/kaleidoscope/driver/hid/keyboardio/Keyboard.h b/src/kaleidoscope/driver/hid/keyboardio/Keyboard.h index edf63815..fb3fb350 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/Keyboard.h +++ b/src/kaleidoscope/driver/hid/keyboardio/Keyboard.h @@ -17,14 +17,14 @@ #pragma once -#include // for uint8_t, uint16_t +#include // for uint8_t, uint16_t #include // From KeyboardioHID: -#include "BootKeyboard/BootKeyboard.h" // for BootKeyboard, Boo... -#include "MultiReport/ConsumerControl.h" // for ConsumerControl -#include "MultiReport/Keyboard.h" // for Keyboard, Keyboard_ -#include "MultiReport/SystemControl.h" // for SystemControl +#include "BootKeyboard/BootKeyboard.h" // for BootKeyboard, Boo... +#include "MultiReport/ConsumerControl.h" // for ConsumerControl +#include "MultiReport/Keyboard.h" // for Keyboard, Keyboard_ +#include "MultiReport/SystemControl.h" // for SystemControl // From Kaleidoscope: #include "kaleidoscope/driver/hid/base/Keyboard.h" // for Keyboard, Keyboar... @@ -176,15 +176,15 @@ class SystemControlWrapper { } }; -struct KeyboardProps: public base::KeyboardProps { +struct KeyboardProps : public base::KeyboardProps { typedef BootKeyboardWrapper BootKeyboard; typedef NKROKeyboardWrapper NKROKeyboard; typedef ConsumerControlWrapper ConsumerControl; typedef SystemControlWrapper SystemControl; }; -template -class Keyboard: public base::Keyboard<_Props> {}; +template +class Keyboard : public base::Keyboard<_Props> {}; } // namespace keyboardio } // namespace hid diff --git a/src/kaleidoscope/driver/hid/keyboardio/Mouse.h b/src/kaleidoscope/driver/hid/keyboardio/Mouse.h index 8fe80bfd..e1ec3ddf 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/Mouse.h +++ b/src/kaleidoscope/driver/hid/keyboardio/Mouse.h @@ -17,11 +17,11 @@ #pragma once -#include // for int8_t, uint8_t +#include // for int8_t, uint8_t #include // From KeyboardioHID: -#include "MultiReport/Mouse.h" // for HID_MouseReport_Data_t +#include "MultiReport/Mouse.h" // for HID_MouseReport_Data_t // From Kaleidoscope: #include "kaleidoscope/driver/hid/base/Mouse.h" // for Mouse, MouseProps @@ -82,12 +82,12 @@ class MouseWrapper { } }; -struct MouseProps: public base::MouseProps { +struct MouseProps : public base::MouseProps { typedef MouseWrapper Mouse; }; -template -class Mouse: public base::Mouse<_Props> {}; +template +class Mouse : public base::Mouse<_Props> {}; } // namespace keyboardio } // namespace hid diff --git a/src/kaleidoscope/driver/keyscanner/ATmega.h b/src/kaleidoscope/driver/keyscanner/ATmega.h index b8e5d457..7f6b3e41 100644 --- a/src/kaleidoscope/driver/keyscanner/ATmega.h +++ b/src/kaleidoscope/driver/keyscanner/ATmega.h @@ -17,21 +17,21 @@ #pragma once -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/device/avr/pins_and_ports.h" // IWYU pragma: keep -#include "kaleidoscope/driver/keyscanner/Base.h" // for BaseProps -#include "kaleidoscope/driver/keyscanner/None.h" // for None +#include "kaleidoscope/driver/keyscanner/Base.h" // for BaseProps +#include "kaleidoscope/driver/keyscanner/None.h" // for None #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD namespace kaleidoscope { namespace driver { namespace keyscanner { -struct ATmegaProps: kaleidoscope::driver::keyscanner::BaseProps { +struct ATmegaProps : kaleidoscope::driver::keyscanner::BaseProps { static const uint16_t keyscan_interval = 1500; typedef uint16_t RowState; @@ -45,8 +45,8 @@ struct ATmegaProps: kaleidoscope::driver::keyscanner::BaseProps { #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -template -class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> { +template +class ATmega : public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> { private: typedef ATmega<_KeyScannerProps> ThisType; @@ -54,12 +54,10 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> { void setup() { static_assert( sizeof(_KeyScannerProps::matrix_row_pins) > 0, - "The key scanner description has an empty array of matrix row pins." - ); + "The key scanner description has an empty array of matrix row pins."); static_assert( sizeof(_KeyScannerProps::matrix_col_pins) > 0, - "The key scanner description has an empty array of matrix column pins." - ); + "The key scanner description has an empty array of matrix column pins."); wdt_disable(); @@ -88,13 +86,12 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> { const uint32_t cycles = (F_CPU / 2000000) * c; - ICR1 = cycles; + ICR1 = cycles; TCCR1B = _BV(WGM13) | _BV(CS10); TIMSK1 = _BV(TOIE1); } - __attribute__((optimize(3))) - void readMatrix(void) { + __attribute__((optimize(3))) void readMatrix(void) { typename _KeyScannerProps::RowState any_debounced_changes = 0; for (uint8_t current_row = 0; current_row < _KeyScannerProps::matrix_rows; current_row++) { @@ -168,8 +165,8 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> { and the state in debounced_state[0]. */ struct debounce_t { - typename _KeyScannerProps::RowState db0; // counter bit 0 - typename _KeyScannerProps::RowState db1; // counter bit 1 + typename _KeyScannerProps::RowState db0; // counter bit 0 + typename _KeyScannerProps::RowState db1; // counter bit 1 typename _KeyScannerProps::RowState debounced_state; // debounced state }; @@ -197,10 +194,11 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> { * Do not remove the attribute! */ __attribute__((optimize("no-unroll-loops"))) - typename _KeyScannerProps::RowState readCols() { + typename _KeyScannerProps::RowState + readCols() { typename _KeyScannerProps::RowState hot_pins = 0; for (uint8_t i = 0; i < _KeyScannerProps::matrix_columns; i++) { - asm("NOP"); // We need to pause a beat before reading or we may read before the pin is hot + asm("NOP"); // We need to pause a beat before reading or we may read before the pin is hot hot_pins |= (!READ_PIN(_KeyScannerProps::matrix_col_pins[i]) << i); } @@ -208,8 +206,7 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> { } static inline typename _KeyScannerProps::RowState debounce( - typename _KeyScannerProps::RowState sample, debounce_t *debouncer - ) { + typename _KeyScannerProps::RowState sample, debounce_t *debouncer) { typename _KeyScannerProps::RowState delta, changes; // Use xor to detect changes from last stable state: @@ -232,10 +229,10 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> { return changes; } }; -#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD -template +#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +template class ATmega : public keyscanner::None {}; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD } // namespace keyscanner } // namespace driver diff --git a/src/kaleidoscope/driver/keyscanner/Base.h b/src/kaleidoscope/driver/keyscanner/Base.h index ebd62f25..58953c8e 100644 --- a/src/kaleidoscope/driver/keyscanner/Base.h +++ b/src/kaleidoscope/driver/keyscanner/Base.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/MatrixAddr.h" // for MatrixAddr #include "kaleidoscope/key_defs.h" // for Key @@ -27,12 +27,12 @@ namespace driver { namespace keyscanner { struct BaseProps { - static constexpr uint8_t matrix_rows = 0; + static constexpr uint8_t matrix_rows = 0; static constexpr uint8_t matrix_columns = 0; typedef MatrixAddr KeyAddr; }; -template +template class Base { public: Base() {} @@ -59,7 +59,6 @@ class Base { bool wasKeyswitchPressed(KeyAddr key_addr) { return false; } - }; } // namespace keyscanner diff --git a/src/kaleidoscope/driver/keyscanner/Base_Impl.h b/src/kaleidoscope/driver/keyscanner/Base_Impl.h index 4a41dca5..17ae3b43 100644 --- a/src/kaleidoscope/driver/keyscanner/Base_Impl.h +++ b/src/kaleidoscope/driver/keyscanner/Base_Impl.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/KeyEvent.h" // for KeyEvent #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ @@ -46,6 +46,6 @@ void Base::handleKeyswitchEvent( } } -} // namespace keyscanner -} // namespace driver -} // namespace kaleidoscope +} // namespace keyscanner +} // namespace driver +} // namespace kaleidoscope diff --git a/src/kaleidoscope/driver/led/Base.h b/src/kaleidoscope/driver/led/Base.h index c464cb64..64a76cbe 100644 --- a/src/kaleidoscope/driver/led/Base.h +++ b/src/kaleidoscope/driver/led/Base.h @@ -35,10 +35,10 @@ struct BaseProps { // C++ does not allow empty constexpr arrays // - static constexpr uint8_t key_led_map[] PROGMEM = { no_led }; + static constexpr uint8_t key_led_map[] PROGMEM = {no_led}; }; -template +template class Base { public: Base() {} @@ -48,8 +48,7 @@ class Base { void setCrgbAt(uint8_t i, cRGB color) {} cRGB getCrgbAt(uint8_t i) { cRGB c = { - 0, 0, 0 - }; + 0, 0, 0}; return c; } void setBrightness(uint8_t brightness) {} @@ -76,9 +75,12 @@ class Base { class LEDRangeIterator { private: uint8_t offset_; + public: - LEDRangeIterator() : offset_(0) {} - explicit LEDRangeIterator(uint8_t offset) : offset_(offset) {} + LEDRangeIterator() + : offset_(0) {} + explicit LEDRangeIterator(uint8_t offset) + : offset_(offset) {} typedef LEDRangeIterator ThisType; @@ -91,9 +93,9 @@ class Base { return *this; } - ThisType operator++(int) { // postfix ++ + ThisType operator++(int) { // postfix ++ ThisType copy(*this); - ++*this; // call the prefix increment + ++*this; // call the prefix increment return copy; } @@ -102,9 +104,9 @@ class Base { return *this; } - ThisType operator--(int) { // postfix ++ + ThisType operator--(int) { // postfix ++ ThisType copy(*this); - --*this; // call the prefix increment + --*this; // call the prefix increment return copy; } diff --git a/src/kaleidoscope/driver/led/Color.h b/src/kaleidoscope/driver/led/Color.h index 4080d926..e8639ab2 100644 --- a/src/kaleidoscope/driver/led/Color.h +++ b/src/kaleidoscope/driver/led/Color.h @@ -25,7 +25,8 @@ namespace led { namespace color { struct RGB { - RGB(uint8_t r_, uint8_t g_, uint8_t b_) : r(r_), g(g_), b(b_) {} + RGB(uint8_t r_, uint8_t g_, uint8_t b_) + : r(r_), g(g_), b(b_) {} RGB() {} uint8_t r; @@ -34,7 +35,8 @@ struct RGB { }; struct GRB { - GRB(uint8_t r_, uint8_t g_, uint8_t b_) : g(g_), r(r_), b(b_) {} + GRB(uint8_t r_, uint8_t g_, uint8_t b_) + : g(g_), r(r_), b(b_) {} GRB() {} uint8_t g; @@ -43,7 +45,8 @@ struct GRB { }; struct BGR { - BGR(uint8_t r_, uint8_t g_, uint8_t b_) : b(b_), g(g_), r(r_) {} + BGR(uint8_t r_, uint8_t g_, uint8_t b_) + : b(b_), g(g_), r(r_) {} BGR() {} uint8_t b; diff --git a/src/kaleidoscope/driver/led/None.h b/src/kaleidoscope/driver/led/None.h index 47702d4b..df5d8502 100644 --- a/src/kaleidoscope/driver/led/None.h +++ b/src/kaleidoscope/driver/led/None.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #ifndef CRGB @@ -25,7 +25,8 @@ struct cRGB { uint8_t r, g, b; }; -#define CRGB(r,g,b) (cRGB){b, g, r} +#define CRGB(r, g, b) \ + (cRGB) { b, g, r } #endif diff --git a/src/kaleidoscope/driver/led/WS2812.h b/src/kaleidoscope/driver/led/WS2812.h index d6331c74..296326c5 100644 --- a/src/kaleidoscope/driver/led/WS2812.h +++ b/src/kaleidoscope/driver/led/WS2812.h @@ -41,10 +41,11 @@ namespace kaleidoscope { namespace driver { namespace led { -template +template class WS2812 { public: - WS2812() : pinmask_(_BV(pin & 0xF)) {} + WS2812() + : pinmask_(_BV(pin & 0xF)) {} int8_t led_count() { return ledCount; @@ -64,13 +65,13 @@ class WS2812 { void setColorAt(int8_t index, Color color) { if (index >= ledCount) return; - modified_ = true; + modified_ = true; leds_[index] = color; } void setColorAt(int8_t index, uint8_t r, uint8_t g, uint8_t b) { if (index >= ledCount) return; - modified_ = true; + modified_ = true; leds_[index] = Color(r, g, b); } Color getColorAt(int8_t index) { @@ -80,17 +81,17 @@ class WS2812 { } private: - Color leds_[ledCount]; // NOLINT(runtime/arrays) + Color leds_[ledCount]; // NOLINT(runtime/arrays) uint8_t pinmask_; bool modified_ = false; void sendArrayWithMask(uint8_t maskhi) { - uint8_t *data = reinterpret_cast(leds_); + uint8_t *data = reinterpret_cast(leds_); uint16_t datalen = ledCount * sizeof(Color); uint8_t curbyte, ctr, masklo; uint8_t sreg_prev; - masklo = ~ maskhi & PORT_REG_FOR_PIN(pin); + masklo = ~maskhi & PORT_REG_FOR_PIN(pin); maskhi |= PORT_REG_FOR_PIN(pin); sreg_prev = SREG; @@ -102,67 +103,65 @@ class WS2812 { asm volatile( " ldi %0,8 \n\t" "loop%=: \n\t" - " out %2,%3 \n\t" // '1' [01] '0' [01] - re -#if (w1_nops&1) + " out %2,%3 \n\t" // '1' [01] '0' [01] - re +#if (w1_nops & 1) w_nop1 #endif -#if (w1_nops&2) - w_nop2 +#if (w1_nops & 2) + w_nop2 #endif -#if (w1_nops&4) - w_nop4 +#if (w1_nops & 4) + w_nop4 #endif -#if (w1_nops&8) - w_nop8 +#if (w1_nops & 8) + w_nop8 #endif -#if (w1_nops&16) - w_nop16 +#if (w1_nops & 16) + w_nop16 #endif - " sbrs %1,7 \n\t" // '1' [03] '0' [02] - " out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low - " lsl %1 \n\t" // '1' [04] '0' [04] -#if (w2_nops&1) + " sbrs %1,7 \n\t" // '1' [03] '0' [02] + " out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low + " lsl %1 \n\t" // '1' [04] '0' [04] +#if (w2_nops & 1) w_nop1 #endif -#if (w2_nops&2) - w_nop2 +#if (w2_nops & 2) + w_nop2 #endif -#if (w2_nops&4) - w_nop4 +#if (w2_nops & 4) + w_nop4 #endif -#if (w2_nops&8) - w_nop8 +#if (w2_nops & 8) + w_nop8 #endif -#if (w2_nops&16) - w_nop16 +#if (w2_nops & 16) + w_nop16 #endif - " out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high -#if (w3_nops&1) + " out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high +#if (w3_nops & 1) w_nop1 #endif -#if (w3_nops&2) - w_nop2 +#if (w3_nops & 2) + w_nop2 #endif -#if (w3_nops&4) - w_nop4 +#if (w3_nops & 4) + w_nop4 #endif -#if (w3_nops&8) - w_nop8 +#if (w3_nops & 8) + w_nop8 #endif -#if (w3_nops&16) - w_nop16 +#if (w3_nops & 16) + w_nop16 #endif - " dec %0 \n\t" // '1' [+2] '0' [+2] - " brne loop%=\n\t" // '1' [+3] '0' [+4] - : "=&d"(ctr) - : "r"(curbyte), "I"(_SFR_IO_ADDR(PORT_REG_FOR_PIN(pin))), "r"(maskhi), "r"(masklo) - ); + " dec %0 \n\t" // '1' [+2] '0' [+2] + " brne loop%=\n\t" // '1' [+3] '0' [+4] + : "=&d"(ctr) + : "r"(curbyte), "I"(_SFR_IO_ADDR(PORT_REG_FOR_PIN(pin))), "r"(maskhi), "r"(masklo)); } SREG = sreg_prev; } - }; } // namespace led } // namespace driver diff --git a/src/kaleidoscope/driver/led/ws2812/config.h b/src/kaleidoscope/driver/led/ws2812/config.h index 0dbd8fec..b0b8a850 100644 --- a/src/kaleidoscope/driver/led/ws2812/config.h +++ b/src/kaleidoscope/driver/led/ws2812/config.h @@ -39,48 +39,48 @@ #define w_totalperiod 1250 // Fixed cycles used by the inner loop -#define w_fixedlow 2 -#define w_fixedhigh 4 -#define w_fixedtotal 8 +#define w_fixedlow 2 +#define w_fixedhigh 4 +#define w_fixedtotal 8 // Insert NOPs to match the timing, if possible -#define w_zerocycles (((F_CPU/1000)*w_zeropulse )/1000000) -#define w_onecycles (((F_CPU/1000)*w_onepulse +500000)/1000000) -#define w_totalcycles (((F_CPU/1000)*w_totalperiod +500000)/1000000) +#define w_zerocycles (((F_CPU / 1000) * w_zeropulse) / 1000000) +#define w_onecycles (((F_CPU / 1000) * w_onepulse + 500000) / 1000000) +#define w_totalcycles (((F_CPU / 1000) * w_totalperiod + 500000) / 1000000) // w1 - nops between rising edge and falling edge - low -#define w1 (w_zerocycles-w_fixedlow) +#define w1 (w_zerocycles - w_fixedlow) // w2 nops between fe low and fe high -#define w2 (w_onecycles-w_fixedhigh-w1) +#define w2 (w_onecycles - w_fixedhigh - w1) // w3 nops to complete loop -#define w3 (w_totalcycles-w_fixedtotal-w1-w2) +#define w3 (w_totalcycles - w_fixedtotal - w1 - w2) -#if w1>0 +#if w1 > 0 #define w1_nops w1 #else -#define w1_nops 0 +#define w1_nops 0 #endif // The only critical timing parameter is the minimum pulse length of the "0" // Warn or throw error if this timing can not be met with current F_CPU settings. -#define w_lowtime ((w1_nops+w_fixedlow)*1000000)/(F_CPU/1000) -#if w_lowtime>550 +#define w_lowtime ((w1_nops + w_fixedlow) * 1000000) / (F_CPU / 1000) +#if w_lowtime > 550 #error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?" -#elif w_lowtime>450 +#elif w_lowtime > 450 #warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)." #warning "Please consider a higher clockspeed, if possible" #endif -#if w2>0 +#if w2 > 0 #define w2_nops w2 #else -#define w2_nops 0 +#define w2_nops 0 #endif -#if w3>0 +#if w3 > 0 #define w3_nops w3 #else -#define w3_nops 0 +#define w3_nops 0 #endif #define w_nop1 "nop \n\t" diff --git a/src/kaleidoscope/driver/mcu/ATmega32U4.h b/src/kaleidoscope/driver/mcu/ATmega32U4.h index 6b0d589b..cbf4bd1e 100644 --- a/src/kaleidoscope/driver/mcu/ATmega32U4.h +++ b/src/kaleidoscope/driver/mcu/ATmega32U4.h @@ -23,13 +23,13 @@ namespace kaleidoscope { namespace driver { namespace mcu { -struct ATmega32U4Props: public kaleidoscope::driver::mcu::BaseProps { - static constexpr bool disable_jtag = false; +struct ATmega32U4Props : public kaleidoscope::driver::mcu::BaseProps { + static constexpr bool disable_jtag = false; static constexpr bool disable_clock_division = false; }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD -template +template class ATmega32U4 : public kaleidoscope::driver::mcu::Base<_Props> { public: void detachFromHost() { @@ -75,9 +75,9 @@ class ATmega32U4 : public kaleidoscope::driver::mcu::Base<_Props> { } }; #else -template +template class ATmega32U4 : public kaleidoscope::driver::mcu::Base<_Props> {}; -#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD +#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD } // namespace mcu } // namespace driver diff --git a/src/kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h b/src/kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h index 5f11022e..097aab9c 100644 --- a/src/kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h +++ b/src/kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h @@ -17,7 +17,7 @@ #pragma once -#include // for uint16_t +#include // for uint16_t #include "kaleidoscope/driver/storage/AVREEPROM.h" // for AVREEPROMProps diff --git a/src/kaleidoscope/driver/storage/AVREEPROM.h b/src/kaleidoscope/driver/storage/AVREEPROM.h index 24129809..88585ef8 100644 --- a/src/kaleidoscope/driver/storage/AVREEPROM.h +++ b/src/kaleidoscope/driver/storage/AVREEPROM.h @@ -17,10 +17,10 @@ #pragma once -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #if defined(__AVR__) || defined(KALEIDOSCOPE_VIRTUAL_BUILD) -#include // for EEPROM, EEPROMClass +#include // for EEPROM, EEPROMClass #include "kaleidoscope/driver/storage/Base.h" // for Base, BaseProps @@ -32,16 +32,16 @@ struct AVREEPROMProps : kaleidoscope::driver::storage::BaseProps { static constexpr uint16_t length = 0; }; -template +template class AVREEPROM : public kaleidoscope::driver::storage::Base<_StorageProps> { public: template - static T& get(uint16_t offset, T& t) { + static T &get(uint16_t offset, T &t) { return EEPROM.get(offset, t); } template - static const T& put(uint16_t offset, T& t) { + static const T &put(uint16_t offset, T &t) { return EEPROM.put(offset, t); } diff --git a/src/kaleidoscope/driver/storage/Base.h b/src/kaleidoscope/driver/storage/Base.h index 00cc481a..ccf99a33 100644 --- a/src/kaleidoscope/driver/storage/Base.h +++ b/src/kaleidoscope/driver/storage/Base.h @@ -24,20 +24,20 @@ namespace driver { namespace storage { struct BaseProps { - static constexpr uint16_t length = 0; + static constexpr uint16_t length = 0; static constexpr uint8_t uninitialized_byte = 0xff; }; -template +template class Base { public: template - static T& get(uint16_t offset, T& t) { + static T &get(uint16_t offset, T &t) { return t; } template - static const T& put(uint16_t offset, T& t) { + static const T &put(uint16_t offset, T &t) { return t; } diff --git a/src/kaleidoscope/driver/storage/Flash.h b/src/kaleidoscope/driver/storage/Flash.h index d7e96b32..002bbaec 100644 --- a/src/kaleidoscope/driver/storage/Flash.h +++ b/src/kaleidoscope/driver/storage/Flash.h @@ -44,16 +44,16 @@ struct FlashProps : kaleidoscope::driver::storage::BaseProps { static constexpr uint16_t length = EEPROM_EMULATION_SIZE; }; -template -class Flash: public kaleidoscope::driver::storage::Base<_StorageProps> { +template +class Flash : public kaleidoscope::driver::storage::Base<_StorageProps> { public: template - T& get(uint16_t offset, T& t) { + T &get(uint16_t offset, T &t) { return EEPROM.get(offset, t); } template - const T& put(uint16_t offset, T& t) { + const T &put(uint16_t offset, T &t) { EEPROM.put(offset, t); } diff --git a/src/kaleidoscope/driver/storage/GD32Flash.h b/src/kaleidoscope/driver/storage/GD32Flash.h index e0d09d69..3d63c763 100644 --- a/src/kaleidoscope/driver/storage/GD32Flash.h +++ b/src/kaleidoscope/driver/storage/GD32Flash.h @@ -32,8 +32,8 @@ struct GD32FlashProps : kaleidoscope::driver::storage::BaseProps { static constexpr uint16_t length = 16384; }; -template -class GD32Flash: public EEPROMClass<_StorageProps::length> { +template +class GD32Flash : public EEPROMClass<_StorageProps::length> { public: void setup() { EEPROMClass<_StorageProps::length>::begin(); @@ -43,8 +43,8 @@ class GD32Flash: public EEPROMClass<_StorageProps::length> { } }; -} // namespace storage -} // namespace driver -} // namespace kaleidoscope +} // namespace storage +} // namespace driver +} // namespace kaleidoscope #endif diff --git a/src/kaleidoscope/event_handlers.h b/src/kaleidoscope/event_handlers.h index 806f89d2..0c99f1a8 100644 --- a/src/kaleidoscope/event_handlers.h +++ b/src/kaleidoscope/event_handlers.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once // This file defines the names and argument signatures for all event handlers diff --git a/src/kaleidoscope/hooks.cpp b/src/kaleidoscope/hooks.cpp index cdecf296..33408398 100644 --- a/src/kaleidoscope/hooks.cpp +++ b/src/kaleidoscope/hooks.cpp @@ -30,6 +30,7 @@ namespace kaleidoscope { // that we can compile sketches that use no plugins, without them having to use // KALEIDOSCOPE_INIT_PLUGINS() with a dummy plugin. +// clang-format off #define INSTANTIATE_WEAK_HOOK_FUNCTION( \ HOOK_NAME, HOOK_VERSION, DEPRECATION_TAG, \ SHOULD_EXIT_IF_RESULT_NOT_OK, \ @@ -43,6 +44,7 @@ namespace kaleidoscope { } _FOR_EACH_EVENT_HANDLER(INSTANTIATE_WEAK_HOOK_FUNCTION) +// clang-format on #undef INSTANTIATE_WEAK_HOOK_FUNCTION @@ -55,9 +57,9 @@ class Sketch; // template<> __attribute__((weak)) -EventHandlerResult Hooks::exploreSketch -() { +EventHandlerResult +Hooks::exploreSketch() { return EventHandlerResult::OK; } -} // namespace kaleidoscope +} // namespace kaleidoscope diff --git a/src/kaleidoscope/hooks.h b/src/kaleidoscope/hooks.h index 4481bc9d..a0f3c49d 100644 --- a/src/kaleidoscope/hooks.h +++ b/src/kaleidoscope/hooks.h @@ -16,10 +16,10 @@ #pragma once -#include "kaleidoscope/KeyEvent.h" // IWYU pragma: keep -#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult -#include "kaleidoscope/event_handlers.h" // for _FOR_EACH_EVENT_HANDLER -#include "kaleidoscope/macro_helpers.h" // for __NL__, MAKE_TEMPLATE... +#include "kaleidoscope/KeyEvent.h" // IWYU pragma: keep +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/event_handlers.h" // for _FOR_EACH_EVENT_HANDLER +#include "kaleidoscope/macro_helpers.h" // for __NL__, MAKE_TEMPLATE... #include "kaleidoscope_internal/event_dispatch.h" // IWYU pragma: keep namespace kaleidoscope { @@ -31,11 +31,11 @@ namespace plugin { // Forward declarations to enable friend declarations. class FocusSerial; class LEDControl; -} // namespace plugin +} // namespace plugin namespace sketch_exploration { void pluginsExploreSketch(); -} // namespace sketch_exploration +} // namespace sketch_exploration // The reason why the hook routing entry point functions live within // class Hooks and not directly within a namespace is, that we want @@ -60,10 +60,10 @@ class Hooks { friend void sketch_exploration::pluginsExploreSketch(); private: - // The following private functions are just to be called by classes // and functions that are declared as friends above. + // clang-format off #define DEFINE_WEAK_HOOK_FUNCTION( \ HOOK_NAME, HOOK_VERSION, DEPRECATION_TAG, \ SHOULD_EXIT_IF_RESULT_NOT_OK, \ @@ -76,6 +76,7 @@ class Hooks { _FOR_EACH_EVENT_HANDLER(DEFINE_WEAK_HOOK_FUNCTION) #undef DEFINE_WEAK_HOOK_FUNCTION + // clang-format on }; } // namespace kaleidoscope diff --git a/src/kaleidoscope/key_defs.h b/src/kaleidoscope/key_defs.h index 1aa92e70..80e54874 100644 --- a/src/kaleidoscope/key_defs.h +++ b/src/kaleidoscope/key_defs.h @@ -16,10 +16,10 @@ #pragma once -#include // for pgm_read_byte, INPUT -#include // for uint8_t, uint16_t +#include // for pgm_read_byte, INPUT +#include // for uint8_t, uint16_t -#include "kaleidoscope/HIDTables.h" // for HID_KEYBOARD_LEFT_CONTROL +#include "kaleidoscope/HIDTables.h" // for HID_KEYBOARD_LEFT_CONTROL // IWYU pragma: begin_exports #include "kaleidoscope/key_defs/aliases.h" @@ -31,28 +31,28 @@ // ----------------------------------------------------------------------------- // Constant keycode values -#define HID_FIRST_KEY HID_KEYBOARD_NO_EVENT -#define HID_LAST_KEY HID_KEYPAD_HEXADECIMAL +#define HID_FIRST_KEY HID_KEYBOARD_NO_EVENT +#define HID_LAST_KEY HID_KEYPAD_HEXADECIMAL #define HID_KEYBOARD_FIRST_MODIFIER HID_KEYBOARD_LEFT_CONTROL -#define HID_KEYBOARD_LAST_MODIFIER HID_KEYBOARD_RIGHT_GUI +#define HID_KEYBOARD_LAST_MODIFIER HID_KEYBOARD_RIGHT_GUI // ----------------------------------------------------------------------------- // Constant flags values -#define KEY_FLAGS 0b00000000 -#define CTRL_HELD 0b00000001 -#define LALT_HELD 0b00000010 -#define RALT_HELD 0b00000100 -#define SHIFT_HELD 0b00001000 -#define GUI_HELD 0b00010000 +#define KEY_FLAGS 0b00000000 +#define CTRL_HELD 0b00000001 +#define LALT_HELD 0b00000010 +#define RALT_HELD 0b00000100 +#define SHIFT_HELD 0b00001000 +#define GUI_HELD 0b00010000 -#define SYNTHETIC 0b01000000 -#define RESERVED 0b10000000 +#define SYNTHETIC 0b01000000 +#define RESERVED 0b10000000 // we assert that synthetic keys can never have keys held, so we reuse the _HELD bits -#define IS_SYSCTL 0b00000001 -#define IS_INTERNAL 0b00000010 -#define SWITCH_TO_KEYMAP 0b00000100 -#define IS_CONSUMER 0b00001000 +#define IS_SYSCTL 0b00000001 +#define IS_INTERNAL 0b00000010 +#define SWITCH_TO_KEYMAP 0b00000100 +#define IS_CONSUMER 0b00001000 // HID Usage Types: Because these constants, like the ones above, are // used in the flags byte of the Key class, they can't overlap any of @@ -60,18 +60,18 @@ // the HID usage type of a keycode, which leaves us with only two // bits. Since we don't currently do anything different based on HID // usage type, these are currently all set to zeroes. -#define HID_TYPE_CA 0b00000000 -#define HID_TYPE_CL 0b00000000 -#define HID_TYPE_LC 0b00000000 -#define HID_TYPE_MC 0b00000000 -#define HID_TYPE_NARY 0b00000000 -#define HID_TYPE_OOC 0b00000000 -#define HID_TYPE_OSC 0b00000000 -#define HID_TYPE_RTC 0b00000000 -#define HID_TYPE_SEL 0b00000000 -#define HID_TYPE_SV 0b00000000 +#define HID_TYPE_CA 0b00000000 +#define HID_TYPE_CL 0b00000000 +#define HID_TYPE_LC 0b00000000 +#define HID_TYPE_MC 0b00000000 +#define HID_TYPE_NARY 0b00000000 +#define HID_TYPE_OOC 0b00000000 +#define HID_TYPE_OSC 0b00000000 +#define HID_TYPE_RTC 0b00000000 +#define HID_TYPE_SEL 0b00000000 +#define HID_TYPE_SV 0b00000000 // Mask defining the allowed usage type flag bits: -#define HID_TYPE_MASK 0b00110000 +#define HID_TYPE_MASK 0b00110000 // ============================================================================= @@ -80,19 +80,16 @@ namespace kaleidoscope { class Key { public: - typedef uint16_t StorageType; Key() = default; - constexpr Key(uint16_t raw) // NOLINT(runtime/explicit) - : Key{(uint8_t)(raw & 0x00FF), (uint8_t)(raw >> 8)} - {} + constexpr Key(uint16_t raw) // NOLINT(runtime/explicit) + : Key{(uint8_t)(raw & 0x00FF), (uint8_t)(raw >> 8)} {} constexpr Key(uint8_t key_code, uint8_t flags) : keyCode_{key_code}, - flags_{flags} - {} + flags_{flags} {} void setFlags(uint8_t new_flags) { flags_ = new_flags; @@ -116,28 +113,24 @@ class Key { #pragma GCC diagnostic pop void setRaw(uint16_t raw) { - flags_ = (uint8_t)(raw >> 8); + flags_ = (uint8_t)(raw >> 8); keyCode_ = (uint8_t)(raw & 0x00FF); } constexpr uint16_t getRaw() const { - return (uint16_t)( - ((uint16_t)flags_ << 8) - + (uint16_t)keyCode_ - ); + return (uint16_t)(((uint16_t)flags_ << 8) + (uint16_t)keyCode_); } constexpr bool operator==(const StorageType rhs) const { return this->getRaw() == rhs; } - constexpr bool operator==(const Key& rhs) const { - return (this->keyCode_ == rhs.keyCode_) - && (this->flags_ == rhs.flags_); + constexpr bool operator==(const Key &rhs) const { + return (this->keyCode_ == rhs.keyCode_) && (this->flags_ == rhs.flags_); } - Key& operator=(const StorageType raw) { + Key &operator=(const StorageType raw) { this->setRaw(raw); return *this; } - constexpr bool operator!=(const Key& rhs) const { + constexpr bool operator!=(const Key &rhs) const { return !(*this == rhs); } constexpr bool operator>=(const StorageType raw) const { @@ -152,16 +145,16 @@ class Key { constexpr bool operator<(const StorageType raw) const { return this->getRaw() < raw; } - constexpr bool operator>=(const Key& other) const { + constexpr bool operator>=(const Key &other) const { return this->getRaw() >= other.getRaw(); } - constexpr bool operator<=(const Key& other) const { + constexpr bool operator<=(const Key &other) const { return this->getRaw() <= other.getRaw(); } - constexpr bool operator>(const Key& other) const { + constexpr bool operator>(const Key &other) const { return this->getRaw() > other.getRaw(); } - constexpr bool operator<(const Key& other) const { + constexpr bool operator<(const Key &other) const { return this->getRaw() < other.getRaw(); } @@ -248,7 +241,6 @@ class Key { // The bits that must match exactly when checking if a `Key` value corresponds // to a Consumer Control keycode. static constexpr uint8_t consumer_control_mask_ = (RESERVED | SYNTHETIC | IS_CONSUMER); - }; static_assert(sizeof(Key) == 2, "sizeof(Key) changed"); @@ -263,7 +255,7 @@ constexpr Key addFlags(Key k, uint8_t add_flags) { return Key(k.getKeyCode(), k.getFlags() | add_flags); } -} // namespace kaleidoscope +} // namespace kaleidoscope // Redefine this macro to enable using alternative char-string to Key // conversions per layer. This is, howerver, only necessary in rare cases @@ -278,35 +270,35 @@ constexpr Key addFlags(Key k, uint8_t add_flags) { typedef kaleidoscope::Key Key; typedef kaleidoscope::Key Key_; -#define LCTRL(k) kaleidoscope::addFlags(CONVERT_TO_KEY(k), CTRL_HELD) -#define LALT(k) kaleidoscope::addFlags(CONVERT_TO_KEY(k), LALT_HELD) -#define RALT(k) kaleidoscope::addFlags(CONVERT_TO_KEY(k), RALT_HELD) -#define LSHIFT(k) kaleidoscope::addFlags(CONVERT_TO_KEY(k), SHIFT_HELD) -#define LGUI(k) kaleidoscope::addFlags(CONVERT_TO_KEY(k), GUI_HELD) +#define LCTRL(k) kaleidoscope::addFlags(CONVERT_TO_KEY(k), CTRL_HELD) +#define LALT(k) kaleidoscope::addFlags(CONVERT_TO_KEY(k), LALT_HELD) +#define RALT(k) kaleidoscope::addFlags(CONVERT_TO_KEY(k), RALT_HELD) +#define LSHIFT(k) kaleidoscope::addFlags(CONVERT_TO_KEY(k), SHIFT_HELD) +#define LGUI(k) kaleidoscope::addFlags(CONVERT_TO_KEY(k), GUI_HELD) -#define Key_NoKey Key(0, KEY_FLAGS) -#define Key_skip Key(0, KEY_FLAGS) +#define Key_NoKey Key(0, KEY_FLAGS) +#define Key_skip Key(0, KEY_FLAGS) #define Key_Transparent Key(0xffff) -#define ___ Key_Transparent -#define XXX Key_NoKey +#define ___ Key_Transparent +#define XXX Key_NoKey // For entries in the `live_keys[]` array for inactive keys and masked keys, // respectively: #define Key_Inactive Key_Transparent -#define Key_Masked Key_NoKey +#define Key_Masked Key_NoKey // The default value for new events. Used to signal that a keymap lookup should // be done. -#define Key_Undefined Key_Transparent +#define Key_Undefined Key_Transparent #define KEY_BACKLIGHT_DOWN 0xf1 -#define KEY_BACKLIGHT_UP 0xf2 -#define Key_BacklightDown Key(KEY_BACKLIGHT_DOWN, KEY_FLAGS) -#define Key_BacklightUp Key(KEY_BACKLIGHT_UP, KEY_FLAGS) -#define KEY_RIGHT_FN2 0xfe -#define Key_RFN2 Key(KEY_RIGHT_FN2, KEY_FLAGS) -#define KEY_LEFT_FN2 0xff -#define Key_LFN2 Key(KEY_LEFT_FN2, KEY_FLAGS) +#define KEY_BACKLIGHT_UP 0xf2 +#define Key_BacklightDown Key(KEY_BACKLIGHT_DOWN, KEY_FLAGS) +#define Key_BacklightUp Key(KEY_BACKLIGHT_UP, KEY_FLAGS) +#define KEY_RIGHT_FN2 0xfe +#define Key_RFN2 Key(KEY_RIGHT_FN2, KEY_FLAGS) +#define KEY_LEFT_FN2 0xff +#define Key_LFN2 Key(KEY_LEFT_FN2, KEY_FLAGS) #define SYSTEM_KEY(code, hid_type) \ Key(code, SYNTHETIC | IS_SYSCTL | (hid_type & HID_TYPE_MASK)) @@ -318,7 +310,7 @@ typedef kaleidoscope::Key Key_; */ constexpr uint16_t CONSUMER_KEYCODE_MASK = 0x03FF; #define CONSUMER(key) (key.getRaw() & CONSUMER_KEYCODE_MASK) -#define CONSUMER_KEY(code, hid_type) \ +#define CONSUMER_KEY(code, hid_type) \ Key((code & CONSUMER_KEYCODE_MASK) | \ ((SYNTHETIC | IS_CONSUMER | (hid_type & HID_TYPE_MASK)) << 8)) diff --git a/src/kaleidoscope/key_defs/aliases.h b/src/kaleidoscope/key_defs/aliases.h index 0450a809..8b6789d0 100644 --- a/src/kaleidoscope/key_defs/aliases.h +++ b/src/kaleidoscope/key_defs/aliases.h @@ -25,34 +25,34 @@ // The first group defined here provide short alternate names for a variety // of keys. -#define Key_Space Key_Spacebar -#define Key_LBracket Key_LeftBracket -#define Key_LArrow Key_LeftArrow -#define Key_LCtrl Key_LeftControl -#define Key_LShift Key_LeftShift -#define Key_LAlt Key_LeftAlt -#define Key_LGui Key_LeftGui -#define Key_RBracket Key_RightBracket -#define Key_RArrow Key_RightArrow -#define Key_RCtrl Key_RightControl -#define Key_RShift Key_RightShift -#define Key_RAlt Key_RightAlt -#define Key_RGui Key_RightGui -#define Key_Esc Key_Escape +#define Key_Space Key_Spacebar +#define Key_LBracket Key_LeftBracket +#define Key_LArrow Key_LeftArrow +#define Key_LCtrl Key_LeftControl +#define Key_LShift Key_LeftShift +#define Key_LAlt Key_LeftAlt +#define Key_LGui Key_LeftGui +#define Key_RBracket Key_RightBracket +#define Key_RArrow Key_RightArrow +#define Key_RCtrl Key_RightControl +#define Key_RShift Key_RightShift +#define Key_RAlt Key_RightAlt +#define Key_RGui Key_RightGui +#define Key_Esc Key_Escape #define Key_LSquareBracket Key_LeftBracket #define Key_RSquareBracket Key_RightBracket // To match Key_UpArrow -#define Key_DnArrow Key_DownArrow +#define Key_DnArrow Key_DownArrow -#define Key_LeftParen LSHIFT(Key_9) -#define Key_RightParen LSHIFT(Key_0) -#define Key_LeftCurlyBracket LSHIFT(Key_LeftBracket) +#define Key_LeftParen LSHIFT(Key_9) +#define Key_RightParen LSHIFT(Key_0) +#define Key_LeftCurlyBracket LSHIFT(Key_LeftBracket) #define Key_RightCurlyBracket LSHIFT(Key_RightBracket) -#define Key_Pipe LSHIFT(Key_Backslash) +#define Key_Pipe LSHIFT(Key_Backslash) // To make it easier to create custom shortcuts, that do not interfere with // system ones, an old trick is to use many modifiers. To make this easier, @@ -63,5 +63,5 @@ #define Key_Meh LCTRL(LSHIFT(Key_LeftAlt)) #define Key_Hyper MEH(Key_LeftGui) -#define MEH(k) LCTRL(LSHIFT(LALT((k)))) -#define HYPER(k) LGUI(MEH((k))) +#define MEH(k) LCTRL(LSHIFT(LALT((k)))) +#define HYPER(k) LGUI(MEH((k))) diff --git a/src/kaleidoscope/key_defs/consumerctl.h b/src/kaleidoscope/key_defs/consumerctl.h index b5025a27..4dd067e3 100644 --- a/src/kaleidoscope/key_defs/consumerctl.h +++ b/src/kaleidoscope/key_defs/consumerctl.h @@ -16,456 +16,455 @@ #pragma once -#define Consumer_NumericKeyPad CONSUMER_KEY(HID_CONSUMER_NUMERIC_KEY_PAD, HID_TYPE_NARY) -#define Consumer_ProgrammableButtons CONSUMER_KEY(HID_CONSUMER_PROGRAMMABLE_BUTTONS, HID_TYPE_NARY) -#define Consumer_MicrophoneCa CONSUMER_KEY(HID_CONSUMER_MICROPHONE_CA, HID_TYPE_CA) -#define Consumer_HeadphoneCa CONSUMER_KEY(HID_CONSUMER_HEADPHONE_CA, HID_TYPE_CA) -#define Consumer_GraphicEqualizerCa CONSUMER_KEY(HID_CONSUMER_GRAPHIC_EQUALIZER_CA, HID_TYPE_CA) +#define Consumer_NumericKeyPad CONSUMER_KEY(HID_CONSUMER_NUMERIC_KEY_PAD, HID_TYPE_NARY) +#define Consumer_ProgrammableButtons CONSUMER_KEY(HID_CONSUMER_PROGRAMMABLE_BUTTONS, HID_TYPE_NARY) +#define Consumer_MicrophoneCa CONSUMER_KEY(HID_CONSUMER_MICROPHONE_CA, HID_TYPE_CA) +#define Consumer_HeadphoneCa CONSUMER_KEY(HID_CONSUMER_HEADPHONE_CA, HID_TYPE_CA) +#define Consumer_GraphicEqualizerCa CONSUMER_KEY(HID_CONSUMER_GRAPHIC_EQUALIZER_CA, HID_TYPE_CA) -#define Consumer_Plus10 CONSUMER_KEY(HID_CONSUMER_PLUS_10, HID_TYPE_OSC) -#define Consumer_Plus100 CONSUMER_KEY(HID_CONSUMER_PLUS_100, HID_TYPE_OSC) -#define Consumer_AMSlashPM CONSUMER_KEY(HID_CONSUMER_AM_SLASH_PM, HID_TYPE_OSC) +#define Consumer_Plus10 CONSUMER_KEY(HID_CONSUMER_PLUS_10, HID_TYPE_OSC) +#define Consumer_Plus100 CONSUMER_KEY(HID_CONSUMER_PLUS_100, HID_TYPE_OSC) +#define Consumer_AMSlashPM CONSUMER_KEY(HID_CONSUMER_AM_SLASH_PM, HID_TYPE_OSC) -#define Consumer_Power CONSUMER_KEY(HID_CONSUMER_POWER, HID_TYPE_OOC) -#define Consumer_Reset CONSUMER_KEY(HID_CONSUMER_RESET, HID_TYPE_OSC) -#define Consumer_Sleep CONSUMER_KEY(HID_CONSUMER_SLEEP, HID_TYPE_OSC) -#define Consumer_Sleep_After CONSUMER_KEY(HID_CONSUMER_SLEEP_AFTER, HID_TYPE_OSC) -#define Consumer_Sleep_Mode CONSUMER_KEY(HID_CONSUMER_SLEEP_MODE, HID_TYPE_RTC) -#define Consumer_Illumination CONSUMER_KEY(HID_CONSUMER_ILLUMINATION, HID_TYPE_OOC) -#define Consumer_Function_Buttons CONSUMER_KEY(HID_CONSUMER_FUNCTION_BUTTONS, HID_TYPE_NARY) +#define Consumer_Power CONSUMER_KEY(HID_CONSUMER_POWER, HID_TYPE_OOC) +#define Consumer_Reset CONSUMER_KEY(HID_CONSUMER_RESET, HID_TYPE_OSC) +#define Consumer_Sleep CONSUMER_KEY(HID_CONSUMER_SLEEP, HID_TYPE_OSC) +#define Consumer_Sleep_After CONSUMER_KEY(HID_CONSUMER_SLEEP_AFTER, HID_TYPE_OSC) +#define Consumer_Sleep_Mode CONSUMER_KEY(HID_CONSUMER_SLEEP_MODE, HID_TYPE_RTC) +#define Consumer_Illumination CONSUMER_KEY(HID_CONSUMER_ILLUMINATION, HID_TYPE_OOC) +#define Consumer_Function_Buttons CONSUMER_KEY(HID_CONSUMER_FUNCTION_BUTTONS, HID_TYPE_NARY) -#define Consumer_Menu CONSUMER_KEY(HID_CONSUMER_MENU, HID_TYPE_OOC) -#define Consumer_MenuPick CONSUMER_KEY(HID_CONSUMER_MENU_PICK, HID_TYPE_OSC) -#define Consumer_MenuUp CONSUMER_KEY(HID_CONSUMER_MENU_UP, HID_TYPE_OSC) -#define Consumer_MenuDown CONSUMER_KEY(HID_CONSUMER_MENU_DOWN, HID_TYPE_OSC) -#define Consumer_MenuLeft CONSUMER_KEY(HID_CONSUMER_MENU_LEFT, HID_TYPE_OSC) -#define Consumer_MenuRight CONSUMER_KEY(HID_CONSUMER_MENU_RIGHT, HID_TYPE_OSC) -#define Consumer_MenuEscape CONSUMER_KEY(HID_CONSUMER_MENU_ESCAPE, HID_TYPE_OSC) -#define Consumer_MenuValueIncrease CONSUMER_KEY(HID_CONSUMER_MENU_VALUE_INCREASE, HID_TYPE_OSC) -#define Consumer_MenuValueDecrease CONSUMER_KEY(HID_CONSUMER_MENU_VALUE_DECREASE, HID_TYPE_OSC) +#define Consumer_Menu CONSUMER_KEY(HID_CONSUMER_MENU, HID_TYPE_OOC) +#define Consumer_MenuPick CONSUMER_KEY(HID_CONSUMER_MENU_PICK, HID_TYPE_OSC) +#define Consumer_MenuUp CONSUMER_KEY(HID_CONSUMER_MENU_UP, HID_TYPE_OSC) +#define Consumer_MenuDown CONSUMER_KEY(HID_CONSUMER_MENU_DOWN, HID_TYPE_OSC) +#define Consumer_MenuLeft CONSUMER_KEY(HID_CONSUMER_MENU_LEFT, HID_TYPE_OSC) +#define Consumer_MenuRight CONSUMER_KEY(HID_CONSUMER_MENU_RIGHT, HID_TYPE_OSC) +#define Consumer_MenuEscape CONSUMER_KEY(HID_CONSUMER_MENU_ESCAPE, HID_TYPE_OSC) +#define Consumer_MenuValueIncrease CONSUMER_KEY(HID_CONSUMER_MENU_VALUE_INCREASE, HID_TYPE_OSC) +#define Consumer_MenuValueDecrease CONSUMER_KEY(HID_CONSUMER_MENU_VALUE_DECREASE, HID_TYPE_OSC) -#define Consumer_DataOnScreen CONSUMER_KEY(HID_CONSUMER_DATA_ON_SCREEN, HID_TYPE_OOC) -#define Consumer_ClosedCaption CONSUMER_KEY(HID_CONSUMER_CLOSED_CAPTION, HID_TYPE_OOC) -#define Consumer_ClosedCaptionSelect CONSUMER_KEY(HID_CONSUMER_CLOSED_CAPTION_SELECT, HID_TYPE_OSC) -#define Consumer_VCRSlashTV CONSUMER_KEY(HID_CONSUMER_VCR_SLASH_TV, HID_TYPE_OOC) -#define Consumer_BroadcastMode CONSUMER_KEY(HID_CONSUMER_BROADCAST_MODE, HID_TYPE_OSC) -#define Consumer_Snapshot CONSUMER_KEY(HID_CONSUMER_SNAPSHOT, HID_TYPE_OSC) -#define Consumer_Still CONSUMER_KEY(HID_CONSUMER_STILL, HID_TYPE_OSC) +#define Consumer_DataOnScreen CONSUMER_KEY(HID_CONSUMER_DATA_ON_SCREEN, HID_TYPE_OOC) +#define Consumer_ClosedCaption CONSUMER_KEY(HID_CONSUMER_CLOSED_CAPTION, HID_TYPE_OOC) +#define Consumer_ClosedCaptionSelect CONSUMER_KEY(HID_CONSUMER_CLOSED_CAPTION_SELECT, HID_TYPE_OSC) +#define Consumer_VCRSlashTV CONSUMER_KEY(HID_CONSUMER_VCR_SLASH_TV, HID_TYPE_OOC) +#define Consumer_BroadcastMode CONSUMER_KEY(HID_CONSUMER_BROADCAST_MODE, HID_TYPE_OSC) +#define Consumer_Snapshot CONSUMER_KEY(HID_CONSUMER_SNAPSHOT, HID_TYPE_OSC) +#define Consumer_Still CONSUMER_KEY(HID_CONSUMER_STILL, HID_TYPE_OSC) -#define Consumer_PictureInPictureToggle CONSUMER_KEY(HID_CONSUMER_PICTURE_IN_PICTURE_TOGGLE, HID_TYPE_OSC) -#define Consumer_PictureInPictureSwap CONSUMER_KEY(HID_CONSUMER_PICTURE_IN_PICTURE_SWAP, HID_TYPE_OSC) -#define Consumer_RedMenuButton CONSUMER_KEY(HID_CONSUMER_RED_MENU_BUTTON, HID_TYPE_MC) -#define Consumer_GreenMenuButton CONSUMER_KEY(HID_CONSUMER_GREEN_MENU_BUTTON, HID_TYPE_MC) -#define Consumer_BlueMenuButton CONSUMER_KEY(HID_CONSUMER_BLUE_MENU_BUTTON, HID_TYPE_MC) -#define Consumer_YellowMenuButton CONSUMER_KEY(HID_CONSUMER_YELLOW_MENU_BUTTON, HID_TYPE_MC) -#define Consumer_Aspect CONSUMER_KEY(HID_CONSUMER_ASPECT, HID_TYPE_OSC) -#define Consumer_3dModeSelect CONSUMER_KEY(HID_CONSUMER_3D_MODE_SELECT, HID_TYPE_OSC) -#define Consumer_DisplayBrightnessIncrement CONSUMER_KEY(HID_CONSUMER_DISPLAY_BRIGHTNESS_INCREMENT, HID_TYPE_RTC) -#define Consumer_DisplayBrightnessDecrement CONSUMER_KEY(HID_CONSUMER_DISPLAY_BRIGHTNESS_DECREMENT, HID_TYPE_RTC) -#define Consumer_DisplayBrightness CONSUMER_KEY(HID_CONSUMER_DISPLAY_BRIGHTNESS, HID_TYPE_LC) -#define Consumer_DisplayBacklightToggle CONSUMER_KEY(HID_CONSUMER_DISPLAY_BACKLIGHT_TOGGLE, HID_TYPE_OOC) -#define Consumer_DisplaySetBrightnessToMinimum CONSUMER_KEY(HID_CONSUMER_DISPLAY_SET_BRIGHTNESS_TO_MINIMUM, HID_TYPE_OSC) -#define Consumer_DisplaySetBrightnessToMaximum CONSUMER_KEY(HID_CONSUMER_DISPLAY_SET_BRIGHTNESS_TO_MAXIMUM, HID_TYPE_OSC) -#define Consumer_DisplaySetAutoBrightness CONSUMER_KEY(HID_CONSUMER_DISPLAY_SET_AUTO_BRIGHTNESS, HID_TYPE_OOC) -#define Consumer_CameraAccessEnabled CONSUMER_KEY(HID_CONSUMER_CAMERA_ACCESS_ENABLED, HID_TYPE_OOC) -#define Consumer_CameraAccessDisabled CONSUMER_KEY(HID_CONSUMER_CAMERA_ACCESS_DISABLED, HID_TYPE_OOC) -#define Consumer_CameraAccessToggle CONSUMER_KEY(HID_CONSUMER_CAMERA_ACCESS_TOGGLE, HID_TYPE_OOC) -#define Consumer_KeyboardBrightnessIncrement CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BRIGHTNESS_INCREMENT, HID_TYPE_OSC) -#define Consumer_KeyboardBrightnessDecrement CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BRIGHTNESS_DECREMENT, HID_TYPE_OSC) -#define Consumer_KeyboardBacklightSetLevel CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BACKLIGHT_SET_LEVEL, HID_TYPE_LC) -#define Consumer_KeyboardBacklightOoc CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BACKLIGHT_OOC, HID_TYPE_OOC) -#define Consumer_KeyboardBacklightSetMinimum CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BACKLIGHT_SET_MINIMUM, HID_TYPE_OSC) -#define Consumer_KeyboardBacklightSetMaximum CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BACKLIGHT_SET_MAXIMUM, HID_TYPE_OSC) -#define Consumer_KeyboardBacklightAuto CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BACKLIGHT_AUTO, HID_TYPE_OOC) -#define Consumer_Selection CONSUMER_KEY(HID_CONSUMER_SELECTION, HID_TYPE_NARY) -#define Consumer_AssignSelection CONSUMER_KEY(HID_CONSUMER_ASSIGN_SELECTION, HID_TYPE_OSC) -#define Consumer_ModeStep CONSUMER_KEY(HID_CONSUMER_MODE_STEP, HID_TYPE_OSC) +#define Consumer_PictureInPictureToggle CONSUMER_KEY(HID_CONSUMER_PICTURE_IN_PICTURE_TOGGLE, HID_TYPE_OSC) +#define Consumer_PictureInPictureSwap CONSUMER_KEY(HID_CONSUMER_PICTURE_IN_PICTURE_SWAP, HID_TYPE_OSC) +#define Consumer_RedMenuButton CONSUMER_KEY(HID_CONSUMER_RED_MENU_BUTTON, HID_TYPE_MC) +#define Consumer_GreenMenuButton CONSUMER_KEY(HID_CONSUMER_GREEN_MENU_BUTTON, HID_TYPE_MC) +#define Consumer_BlueMenuButton CONSUMER_KEY(HID_CONSUMER_BLUE_MENU_BUTTON, HID_TYPE_MC) +#define Consumer_YellowMenuButton CONSUMER_KEY(HID_CONSUMER_YELLOW_MENU_BUTTON, HID_TYPE_MC) +#define Consumer_Aspect CONSUMER_KEY(HID_CONSUMER_ASPECT, HID_TYPE_OSC) +#define Consumer_3dModeSelect CONSUMER_KEY(HID_CONSUMER_3D_MODE_SELECT, HID_TYPE_OSC) +#define Consumer_DisplayBrightnessIncrement CONSUMER_KEY(HID_CONSUMER_DISPLAY_BRIGHTNESS_INCREMENT, HID_TYPE_RTC) +#define Consumer_DisplayBrightnessDecrement CONSUMER_KEY(HID_CONSUMER_DISPLAY_BRIGHTNESS_DECREMENT, HID_TYPE_RTC) +#define Consumer_DisplayBrightness CONSUMER_KEY(HID_CONSUMER_DISPLAY_BRIGHTNESS, HID_TYPE_LC) +#define Consumer_DisplayBacklightToggle CONSUMER_KEY(HID_CONSUMER_DISPLAY_BACKLIGHT_TOGGLE, HID_TYPE_OOC) +#define Consumer_DisplaySetBrightnessToMinimum CONSUMER_KEY(HID_CONSUMER_DISPLAY_SET_BRIGHTNESS_TO_MINIMUM, HID_TYPE_OSC) +#define Consumer_DisplaySetBrightnessToMaximum CONSUMER_KEY(HID_CONSUMER_DISPLAY_SET_BRIGHTNESS_TO_MAXIMUM, HID_TYPE_OSC) +#define Consumer_DisplaySetAutoBrightness CONSUMER_KEY(HID_CONSUMER_DISPLAY_SET_AUTO_BRIGHTNESS, HID_TYPE_OOC) +#define Consumer_CameraAccessEnabled CONSUMER_KEY(HID_CONSUMER_CAMERA_ACCESS_ENABLED, HID_TYPE_OOC) +#define Consumer_CameraAccessDisabled CONSUMER_KEY(HID_CONSUMER_CAMERA_ACCESS_DISABLED, HID_TYPE_OOC) +#define Consumer_CameraAccessToggle CONSUMER_KEY(HID_CONSUMER_CAMERA_ACCESS_TOGGLE, HID_TYPE_OOC) +#define Consumer_KeyboardBrightnessIncrement CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BRIGHTNESS_INCREMENT, HID_TYPE_OSC) +#define Consumer_KeyboardBrightnessDecrement CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BRIGHTNESS_DECREMENT, HID_TYPE_OSC) +#define Consumer_KeyboardBacklightSetLevel CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BACKLIGHT_SET_LEVEL, HID_TYPE_LC) +#define Consumer_KeyboardBacklightOoc CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BACKLIGHT_OOC, HID_TYPE_OOC) +#define Consumer_KeyboardBacklightSetMinimum CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BACKLIGHT_SET_MINIMUM, HID_TYPE_OSC) +#define Consumer_KeyboardBacklightSetMaximum CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BACKLIGHT_SET_MAXIMUM, HID_TYPE_OSC) +#define Consumer_KeyboardBacklightAuto CONSUMER_KEY(HID_CONSUMER_KEYBOARD_BACKLIGHT_AUTO, HID_TYPE_OOC) +#define Consumer_Selection CONSUMER_KEY(HID_CONSUMER_SELECTION, HID_TYPE_NARY) +#define Consumer_AssignSelection CONSUMER_KEY(HID_CONSUMER_ASSIGN_SELECTION, HID_TYPE_OSC) +#define Consumer_ModeStep CONSUMER_KEY(HID_CONSUMER_MODE_STEP, HID_TYPE_OSC) -#define Consumer_Selection CONSUMER_KEY(HID_CONSUMER_SELECTION, HID_TYPE_NARY) -#define Consumer_AssignSelection CONSUMER_KEY(HID_CONSUMER_ASSIGN_SELECTION, HID_TYPE_OSC) -#define Consumer_ModeStep CONSUMER_KEY(HID_CONSUMER_MODE_STEP, HID_TYPE_OSC) -#define Consumer_RecallLast CONSUMER_KEY(HID_CONSUMER_RECALL_LAST, HID_TYPE_OSC) -#define Consumer_EnterChannel CONSUMER_KEY(HID_CONSUMER_ENTER_CHANNEL, HID_TYPE_OSC) -#define Consumer_OrderMovie CONSUMER_KEY(HID_CONSUMER_ORDER_MOVIE, HID_TYPE_OSC) -#define Consumer_Channel CONSUMER_KEY(HID_CONSUMER_CHANNEL, HID_TYPE_LC) -#define Consumer_MediaSelection CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECTION, HID_TYPE_NARY) -#define Consumer_MediaSelectComputer CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_COMPUTER, HID_TYPE_SEL) -#define Consumer_MediaSelectTV CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_TV, HID_TYPE_SEL) -#define Consumer_MediaSelectWww CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_WWW, HID_TYPE_SEL) -#define Consumer_MediaSelectDvd CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_DVD, HID_TYPE_SEL) -#define Consumer_MediaSelectTelephone CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_TELEPHONE, HID_TYPE_SEL) -#define Consumer_MediaSelectProgramGuide CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_PROGRAM_GUIDE, HID_TYPE_SEL) -#define Consumer_MediaSelectVideoPhone CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_VIDEO_PHONE, HID_TYPE_SEL) -#define Consumer_MediaSelectGames CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_GAMES, HID_TYPE_SEL) -#define Consumer_MediaSelectMessages CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_MESSAGES, HID_TYPE_SEL) -#define Consumer_MediaSelectCd CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_CD, HID_TYPE_SEL) -#define Consumer_MediaSelectVcr CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_VCR, HID_TYPE_SEL) -#define Consumer_MediaSelectTuner CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_TUNER, HID_TYPE_SEL) -#define Consumer_Quit CONSUMER_KEY(HID_CONSUMER_QUIT, HID_TYPE_OSC) -#define Consumer_Help CONSUMER_KEY(HID_CONSUMER_HELP, HID_TYPE_OOC) -#define Consumer_MediaSelectTape CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_TAPE, HID_TYPE_SEL) -#define Consumer_MediaSelectCable CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_CABLE, HID_TYPE_SEL) -#define Consumer_MediaSelectSatellite CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_SATELLITE, HID_TYPE_SEL) -#define Consumer_MediaSelectSecurity CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_SECURITY, HID_TYPE_SEL) -#define Consumer_MediaSelectHome CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_HOME, HID_TYPE_SEL) -#define Consumer_MediaSelectCall CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_CALL, HID_TYPE_SEL) -#define Consumer_ChannelIncrement CONSUMER_KEY(HID_CONSUMER_CHANNEL_INCREMENT, HID_TYPE_OSC) -#define Consumer_ChannelDecrement CONSUMER_KEY(HID_CONSUMER_CHANNEL_DECREMENT, HID_TYPE_OSC) -#define Consumer_MediaSelectSap CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_SAP, HID_TYPE_SEL) +#define Consumer_Selection CONSUMER_KEY(HID_CONSUMER_SELECTION, HID_TYPE_NARY) +#define Consumer_AssignSelection CONSUMER_KEY(HID_CONSUMER_ASSIGN_SELECTION, HID_TYPE_OSC) +#define Consumer_ModeStep CONSUMER_KEY(HID_CONSUMER_MODE_STEP, HID_TYPE_OSC) +#define Consumer_RecallLast CONSUMER_KEY(HID_CONSUMER_RECALL_LAST, HID_TYPE_OSC) +#define Consumer_EnterChannel CONSUMER_KEY(HID_CONSUMER_ENTER_CHANNEL, HID_TYPE_OSC) +#define Consumer_OrderMovie CONSUMER_KEY(HID_CONSUMER_ORDER_MOVIE, HID_TYPE_OSC) +#define Consumer_Channel CONSUMER_KEY(HID_CONSUMER_CHANNEL, HID_TYPE_LC) +#define Consumer_MediaSelection CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECTION, HID_TYPE_NARY) +#define Consumer_MediaSelectComputer CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_COMPUTER, HID_TYPE_SEL) +#define Consumer_MediaSelectTV CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_TV, HID_TYPE_SEL) +#define Consumer_MediaSelectWww CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_WWW, HID_TYPE_SEL) +#define Consumer_MediaSelectDvd CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_DVD, HID_TYPE_SEL) +#define Consumer_MediaSelectTelephone CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_TELEPHONE, HID_TYPE_SEL) +#define Consumer_MediaSelectProgramGuide CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_PROGRAM_GUIDE, HID_TYPE_SEL) +#define Consumer_MediaSelectVideoPhone CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_VIDEO_PHONE, HID_TYPE_SEL) +#define Consumer_MediaSelectGames CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_GAMES, HID_TYPE_SEL) +#define Consumer_MediaSelectMessages CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_MESSAGES, HID_TYPE_SEL) +#define Consumer_MediaSelectCd CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_CD, HID_TYPE_SEL) +#define Consumer_MediaSelectVcr CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_VCR, HID_TYPE_SEL) +#define Consumer_MediaSelectTuner CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_TUNER, HID_TYPE_SEL) +#define Consumer_Quit CONSUMER_KEY(HID_CONSUMER_QUIT, HID_TYPE_OSC) +#define Consumer_Help CONSUMER_KEY(HID_CONSUMER_HELP, HID_TYPE_OOC) +#define Consumer_MediaSelectTape CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_TAPE, HID_TYPE_SEL) +#define Consumer_MediaSelectCable CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_CABLE, HID_TYPE_SEL) +#define Consumer_MediaSelectSatellite CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_SATELLITE, HID_TYPE_SEL) +#define Consumer_MediaSelectSecurity CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_SECURITY, HID_TYPE_SEL) +#define Consumer_MediaSelectHome CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_HOME, HID_TYPE_SEL) +#define Consumer_MediaSelectCall CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_CALL, HID_TYPE_SEL) +#define Consumer_ChannelIncrement CONSUMER_KEY(HID_CONSUMER_CHANNEL_INCREMENT, HID_TYPE_OSC) +#define Consumer_ChannelDecrement CONSUMER_KEY(HID_CONSUMER_CHANNEL_DECREMENT, HID_TYPE_OSC) +#define Consumer_MediaSelectSap CONSUMER_KEY(HID_CONSUMER_MEDIA_SELECT_SAP, HID_TYPE_SEL) -#define Consumer_VcrPlus CONSUMER_KEY(HID_CONSUMER_VCR_PLUS, HID_TYPE_OSC) -#define Consumer_Once CONSUMER_KEY(HID_CONSUMER_ONCE, HID_TYPE_OSC) -#define Consumer_Daily CONSUMER_KEY(HID_CONSUMER_DAILY, HID_TYPE_OSC) -#define Consumer_Weekly CONSUMER_KEY(HID_CONSUMER_WEEKLY, HID_TYPE_OSC) -#define Consumer_Monthly CONSUMER_KEY(HID_CONSUMER_MONTHLY, HID_TYPE_OSC) +#define Consumer_VcrPlus CONSUMER_KEY(HID_CONSUMER_VCR_PLUS, HID_TYPE_OSC) +#define Consumer_Once CONSUMER_KEY(HID_CONSUMER_ONCE, HID_TYPE_OSC) +#define Consumer_Daily CONSUMER_KEY(HID_CONSUMER_DAILY, HID_TYPE_OSC) +#define Consumer_Weekly CONSUMER_KEY(HID_CONSUMER_WEEKLY, HID_TYPE_OSC) +#define Consumer_Monthly CONSUMER_KEY(HID_CONSUMER_MONTHLY, HID_TYPE_OSC) -#define Consumer_Play CONSUMER_KEY(HID_CONSUMER_PLAY, HID_TYPE_OOC) -#define Consumer_Pause CONSUMER_KEY(HID_CONSUMER_PAUSE, HID_TYPE_OOC) -#define Consumer_Record CONSUMER_KEY(HID_CONSUMER_RECORD, HID_TYPE_OOC) -#define Consumer_FastForward CONSUMER_KEY(HID_CONSUMER_FAST_FORWARD, HID_TYPE_OOC) -#define Consumer_Rewind CONSUMER_KEY(HID_CONSUMER_REWIND, HID_TYPE_OOC) -#define Consumer_ScanNextTrack CONSUMER_KEY(HID_CONSUMER_SCAN_NEXT_TRACK, HID_TYPE_OSC) -#define Consumer_ScanPreviousTrack CONSUMER_KEY(HID_CONSUMER_SCAN_PREVIOUS_TRACK, HID_TYPE_OSC) -#define Consumer_Stop CONSUMER_KEY(HID_CONSUMER_STOP, HID_TYPE_OSC) -#define Consumer_Eject CONSUMER_KEY(HID_CONSUMER_EJECT, HID_TYPE_OSC) -#define Consumer_RandomPlay CONSUMER_KEY(HID_CONSUMER_RANDOM_PLAY, HID_TYPE_OOC) -#define Consumer_SelectDisc CONSUMER_KEY(HID_CONSUMER_SELECT_DISC, HID_TYPE_NARY) -#define Consumer_EnterDiscMc CONSUMER_KEY(HID_CONSUMER_ENTER_DISC_MC, HID_TYPE_MC) -#define Consumer_Repeat CONSUMER_KEY(HID_CONSUMER_REPEAT, HID_TYPE_OSC) -#define Consumer_Tracking CONSUMER_KEY(HID_CONSUMER_TRACKING, HID_TYPE_LC) -#define Consumer_Track_Normal CONSUMER_KEY(HID_CONSUMER_TRACK_NORMAL, HID_TYPE_OSC) -#define Consumer_SlowTracking CONSUMER_KEY(HID_CONSUMER_SLOW_TRACKING, HID_TYPE_LC) -#define Consumer_FrameForward CONSUMER_KEY(HID_CONSUMER_FRAME_FORWARD, HID_TYPE_RTC) -#define Consumer_FrameBack CONSUMER_KEY(HID_CONSUMER_FRAME_BACK, HID_TYPE_RTC) -#define Consumer_Mark CONSUMER_KEY(HID_CONSUMER_MARK, HID_TYPE_OSC) -#define Consumer_ClearMark CONSUMER_KEY(HID_CONSUMER_CLEAR_MARK, HID_TYPE_OSC) -#define Consumer_RepeatFromMark CONSUMER_KEY(HID_CONSUMER_REPEAT_FROM_MARK, HID_TYPE_OOC) -#define Consumer_ReturnTo_Mark CONSUMER_KEY(HID_CONSUMER_RETURN_TO_MARK, HID_TYPE_OSC) -#define Consumer_SearchMarkForward CONSUMER_KEY(HID_CONSUMER_SEARCH_MARK_FORWARD, HID_TYPE_OSC) -#define Consumer_SearchMarkBackwards CONSUMER_KEY(HID_CONSUMER_SEARCH_MARK_BACKWARDS, HID_TYPE_OSC) -#define Consumer_CounterReset CONSUMER_KEY(HID_CONSUMER_COUNTER_RESET, HID_TYPE_OSC) -#define Consumer_ShowCounter CONSUMER_KEY(HID_CONSUMER_SHOW_COUNTER, HID_TYPE_OSC) -#define Consumer_TrackingIncrement CONSUMER_KEY(HID_CONSUMER_TRACKING_INCREMENT, HID_TYPE_RTC) -#define Consumer_TrackingDecrement CONSUMER_KEY(HID_CONSUMER_TRACKING_DECREMENT, HID_TYPE_RTC) -#define Consumer_StopSlashEject CONSUMER_KEY(HID_CONSUMER_STOP_SLASH_EJECT, HID_TYPE_OSC) -#define Consumer_PlaySlashPause CONSUMER_KEY(HID_CONSUMER_PLAY_SLASH_PAUSE, HID_TYPE_OSC) -#define Consumer_PlaySlashSkip CONSUMER_KEY(HID_CONSUMER_PLAY_SLASH_SKIP, HID_TYPE_OSC) +#define Consumer_Play CONSUMER_KEY(HID_CONSUMER_PLAY, HID_TYPE_OOC) +#define Consumer_Pause CONSUMER_KEY(HID_CONSUMER_PAUSE, HID_TYPE_OOC) +#define Consumer_Record CONSUMER_KEY(HID_CONSUMER_RECORD, HID_TYPE_OOC) +#define Consumer_FastForward CONSUMER_KEY(HID_CONSUMER_FAST_FORWARD, HID_TYPE_OOC) +#define Consumer_Rewind CONSUMER_KEY(HID_CONSUMER_REWIND, HID_TYPE_OOC) +#define Consumer_ScanNextTrack CONSUMER_KEY(HID_CONSUMER_SCAN_NEXT_TRACK, HID_TYPE_OSC) +#define Consumer_ScanPreviousTrack CONSUMER_KEY(HID_CONSUMER_SCAN_PREVIOUS_TRACK, HID_TYPE_OSC) +#define Consumer_Stop CONSUMER_KEY(HID_CONSUMER_STOP, HID_TYPE_OSC) +#define Consumer_Eject CONSUMER_KEY(HID_CONSUMER_EJECT, HID_TYPE_OSC) +#define Consumer_RandomPlay CONSUMER_KEY(HID_CONSUMER_RANDOM_PLAY, HID_TYPE_OOC) +#define Consumer_SelectDisc CONSUMER_KEY(HID_CONSUMER_SELECT_DISC, HID_TYPE_NARY) +#define Consumer_EnterDiscMc CONSUMER_KEY(HID_CONSUMER_ENTER_DISC_MC, HID_TYPE_MC) +#define Consumer_Repeat CONSUMER_KEY(HID_CONSUMER_REPEAT, HID_TYPE_OSC) +#define Consumer_Tracking CONSUMER_KEY(HID_CONSUMER_TRACKING, HID_TYPE_LC) +#define Consumer_Track_Normal CONSUMER_KEY(HID_CONSUMER_TRACK_NORMAL, HID_TYPE_OSC) +#define Consumer_SlowTracking CONSUMER_KEY(HID_CONSUMER_SLOW_TRACKING, HID_TYPE_LC) +#define Consumer_FrameForward CONSUMER_KEY(HID_CONSUMER_FRAME_FORWARD, HID_TYPE_RTC) +#define Consumer_FrameBack CONSUMER_KEY(HID_CONSUMER_FRAME_BACK, HID_TYPE_RTC) +#define Consumer_Mark CONSUMER_KEY(HID_CONSUMER_MARK, HID_TYPE_OSC) +#define Consumer_ClearMark CONSUMER_KEY(HID_CONSUMER_CLEAR_MARK, HID_TYPE_OSC) +#define Consumer_RepeatFromMark CONSUMER_KEY(HID_CONSUMER_REPEAT_FROM_MARK, HID_TYPE_OOC) +#define Consumer_ReturnTo_Mark CONSUMER_KEY(HID_CONSUMER_RETURN_TO_MARK, HID_TYPE_OSC) +#define Consumer_SearchMarkForward CONSUMER_KEY(HID_CONSUMER_SEARCH_MARK_FORWARD, HID_TYPE_OSC) +#define Consumer_SearchMarkBackwards CONSUMER_KEY(HID_CONSUMER_SEARCH_MARK_BACKWARDS, HID_TYPE_OSC) +#define Consumer_CounterReset CONSUMER_KEY(HID_CONSUMER_COUNTER_RESET, HID_TYPE_OSC) +#define Consumer_ShowCounter CONSUMER_KEY(HID_CONSUMER_SHOW_COUNTER, HID_TYPE_OSC) +#define Consumer_TrackingIncrement CONSUMER_KEY(HID_CONSUMER_TRACKING_INCREMENT, HID_TYPE_RTC) +#define Consumer_TrackingDecrement CONSUMER_KEY(HID_CONSUMER_TRACKING_DECREMENT, HID_TYPE_RTC) +#define Consumer_StopSlashEject CONSUMER_KEY(HID_CONSUMER_STOP_SLASH_EJECT, HID_TYPE_OSC) +#define Consumer_PlaySlashPause CONSUMER_KEY(HID_CONSUMER_PLAY_SLASH_PAUSE, HID_TYPE_OSC) +#define Consumer_PlaySlashSkip CONSUMER_KEY(HID_CONSUMER_PLAY_SLASH_SKIP, HID_TYPE_OSC) -#define Consumer_VoiceCommand CONSUMER_KEY(HID_CONSUMER_VOICE_COMMAND, HID_TYPE_SEL) -#define Consumer_InvokeCaptureInterface CONSUMER_KEY(HID_CONSUMER_INVOKE_CAPTURE_INTERFACE, HID_TYPE_SEL) -#define Consumer_StartOrStopGameRecording CONSUMER_KEY(HID_CONSUMER_START_OR_STOP_GAME_RECORDING, HID_TYPE_SEL) -#define Consumer_HistoricalGameCapture CONSUMER_KEY(HID_CONSUMER_HISTORICAL_GAME_CAPTURE, HID_TYPE_SEL) -#define Consumer_CaptureGameScreenshot CONSUMER_KEY(HID_CONSUMER_CAPTURE_GAME_SCREENSHOT, HID_TYPE_SEL) -#define Consumer_ShowOrHideRecordingIndicator CONSUMER_KEY(HID_CONSUMER_SHOW_OR_HIDE_RECORDING_INDICATOR, HID_TYPE_SEL) -#define Consumer_StartOrStopMicrophoneCapture CONSUMER_KEY(HID_CONSUMER_START_OR_STOP_MICROPHONE_CAPTURE, HID_TYPE_SEL) -#define Consumer_StartOrStopCameraCapture CONSUMER_KEY(HID_CONSUMER_START_OR_STOP_CAMERA_CAPTURE, HID_TYPE_SEL) +#define Consumer_VoiceCommand CONSUMER_KEY(HID_CONSUMER_VOICE_COMMAND, HID_TYPE_SEL) +#define Consumer_InvokeCaptureInterface CONSUMER_KEY(HID_CONSUMER_INVOKE_CAPTURE_INTERFACE, HID_TYPE_SEL) +#define Consumer_StartOrStopGameRecording CONSUMER_KEY(HID_CONSUMER_START_OR_STOP_GAME_RECORDING, HID_TYPE_SEL) +#define Consumer_HistoricalGameCapture CONSUMER_KEY(HID_CONSUMER_HISTORICAL_GAME_CAPTURE, HID_TYPE_SEL) +#define Consumer_CaptureGameScreenshot CONSUMER_KEY(HID_CONSUMER_CAPTURE_GAME_SCREENSHOT, HID_TYPE_SEL) +#define Consumer_ShowOrHideRecordingIndicator CONSUMER_KEY(HID_CONSUMER_SHOW_OR_HIDE_RECORDING_INDICATOR, HID_TYPE_SEL) +#define Consumer_StartOrStopMicrophoneCapture CONSUMER_KEY(HID_CONSUMER_START_OR_STOP_MICROPHONE_CAPTURE, HID_TYPE_SEL) +#define Consumer_StartOrStopCameraCapture CONSUMER_KEY(HID_CONSUMER_START_OR_STOP_CAMERA_CAPTURE, HID_TYPE_SEL) -#define Consumer_Volume CONSUMER_KEY(HID_CONSUMER_VOLUME, HID_TYPE_LC) -#define Consumer_Balance CONSUMER_KEY(HID_CONSUMER_BALANCE, HID_TYPE_LC) -#define Consumer_Mute CONSUMER_KEY(HID_CONSUMER_MUTE, HID_TYPE_OOC) -#define Consumer_Bass CONSUMER_KEY(HID_CONSUMER_BASS, HID_TYPE_LC) -#define Consumer_Treble CONSUMER_KEY(HID_CONSUMER_TREBLE, HID_TYPE_LC) -#define Consumer_BassBoost CONSUMER_KEY(HID_CONSUMER_BASS_BOOST, HID_TYPE_OOC) -#define Consumer_SurroundMode CONSUMER_KEY(HID_CONSUMER_SURROUND_MODE, HID_TYPE_OSC) -#define Consumer_Loudness CONSUMER_KEY(HID_CONSUMER_LOUDNESS, HID_TYPE_OOC) -#define Consumer_Mpx CONSUMER_KEY(HID_CONSUMER_MPX, HID_TYPE_OOC) -#define Consumer_VolumeIncrement CONSUMER_KEY(HID_CONSUMER_VOLUME_INCREMENT, HID_TYPE_RTC) +#define Consumer_Volume CONSUMER_KEY(HID_CONSUMER_VOLUME, HID_TYPE_LC) +#define Consumer_Balance CONSUMER_KEY(HID_CONSUMER_BALANCE, HID_TYPE_LC) +#define Consumer_Mute CONSUMER_KEY(HID_CONSUMER_MUTE, HID_TYPE_OOC) +#define Consumer_Bass CONSUMER_KEY(HID_CONSUMER_BASS, HID_TYPE_LC) +#define Consumer_Treble CONSUMER_KEY(HID_CONSUMER_TREBLE, HID_TYPE_LC) +#define Consumer_BassBoost CONSUMER_KEY(HID_CONSUMER_BASS_BOOST, HID_TYPE_OOC) +#define Consumer_SurroundMode CONSUMER_KEY(HID_CONSUMER_SURROUND_MODE, HID_TYPE_OSC) +#define Consumer_Loudness CONSUMER_KEY(HID_CONSUMER_LOUDNESS, HID_TYPE_OOC) +#define Consumer_Mpx CONSUMER_KEY(HID_CONSUMER_MPX, HID_TYPE_OOC) +#define Consumer_VolumeIncrement CONSUMER_KEY(HID_CONSUMER_VOLUME_INCREMENT, HID_TYPE_RTC) -#define Consumer_VolumeDecrement CONSUMER_KEY(HID_CONSUMER_VOLUME_DECREMENT, HID_TYPE_RTC) +#define Consumer_VolumeDecrement CONSUMER_KEY(HID_CONSUMER_VOLUME_DECREMENT, HID_TYPE_RTC) -#define Consumer_SpeedSelect CONSUMER_KEY(HID_CONSUMER_SPEED_SELECT, HID_TYPE_OSC) -#define Consumer_PlaybackSpeed CONSUMER_KEY(HID_CONSUMER_PLAYBACK_SPEED, HID_TYPE_NARY) -#define Consumer_StandardPlay CONSUMER_KEY(HID_CONSUMER_STANDARD_PLAY, HID_TYPE_SEL) -#define Consumer_LongPlay CONSUMER_KEY(HID_CONSUMER_LONG_PLAY, HID_TYPE_SEL) -#define Consumer_ExtendedPlay CONSUMER_KEY(HID_CONSUMER_EXTENDED_PLAY, HID_TYPE_SEL) -#define Consumer_Slow CONSUMER_KEY(HID_CONSUMER_SLOW, HID_TYPE_OSC) +#define Consumer_SpeedSelect CONSUMER_KEY(HID_CONSUMER_SPEED_SELECT, HID_TYPE_OSC) +#define Consumer_PlaybackSpeed CONSUMER_KEY(HID_CONSUMER_PLAYBACK_SPEED, HID_TYPE_NARY) +#define Consumer_StandardPlay CONSUMER_KEY(HID_CONSUMER_STANDARD_PLAY, HID_TYPE_SEL) +#define Consumer_LongPlay CONSUMER_KEY(HID_CONSUMER_LONG_PLAY, HID_TYPE_SEL) +#define Consumer_ExtendedPlay CONSUMER_KEY(HID_CONSUMER_EXTENDED_PLAY, HID_TYPE_SEL) +#define Consumer_Slow CONSUMER_KEY(HID_CONSUMER_SLOW, HID_TYPE_OSC) -#define Consumer_FanEnable CONSUMER_KEY(HID_CONSUMER_FAN_ENABLE, HID_TYPE_OOC) -#define Consumer_FanSpeed CONSUMER_KEY(HID_CONSUMER_FAN_SPEED, HID_TYPE_LC) -#define Consumer_LightEnable CONSUMER_KEY(HID_CONSUMER_LIGHT_ENABLE, HID_TYPE_OOC) -#define Consumer_LightIlluminationLevel CONSUMER_KEY(HID_CONSUMER_LIGHT_ILLUMINATION_LEVEL, HID_TYPE_LC) -#define Consumer_ClimateControlEnable CONSUMER_KEY(HID_CONSUMER_CLIMATE_CONTROL_ENABLE, HID_TYPE_OOC) -#define Consumer_RoomTemperature CONSUMER_KEY(HID_CONSUMER_ROOM_TEMPERATURE, HID_TYPE_LC) -#define Consumer_SecurityEnable CONSUMER_KEY(HID_CONSUMER_SECURITY_ENABLE, HID_TYPE_OOC) -#define Consumer_FireAlarm CONSUMER_KEY(HID_CONSUMER_FIRE_ALARM, HID_TYPE_OSC) -#define Consumer_PoliceAlarm CONSUMER_KEY(HID_CONSUMER_POLICE_ALARM, HID_TYPE_OSC) -#define Consumer_Proximity CONSUMER_KEY(HID_CONSUMER_PROXIMITY, HID_TYPE_LC) -#define Consumer_Motion CONSUMER_KEY(HID_CONSUMER_MOTION, HID_TYPE_OSC) -#define Consumer_DuressAlarm CONSUMER_KEY(HID_CONSUMER_DURESS_ALARM, HID_TYPE_OSC) -#define Consumer_HoldupAlarm CONSUMER_KEY(HID_CONSUMER_HOLDUP_ALARM, HID_TYPE_OSC) -#define Consumer_MedicalAlarm CONSUMER_KEY(HID_CONSUMER_MEDICAL_ALARM, HID_TYPE_OSC) +#define Consumer_FanEnable CONSUMER_KEY(HID_CONSUMER_FAN_ENABLE, HID_TYPE_OOC) +#define Consumer_FanSpeed CONSUMER_KEY(HID_CONSUMER_FAN_SPEED, HID_TYPE_LC) +#define Consumer_LightEnable CONSUMER_KEY(HID_CONSUMER_LIGHT_ENABLE, HID_TYPE_OOC) +#define Consumer_LightIlluminationLevel CONSUMER_KEY(HID_CONSUMER_LIGHT_ILLUMINATION_LEVEL, HID_TYPE_LC) +#define Consumer_ClimateControlEnable CONSUMER_KEY(HID_CONSUMER_CLIMATE_CONTROL_ENABLE, HID_TYPE_OOC) +#define Consumer_RoomTemperature CONSUMER_KEY(HID_CONSUMER_ROOM_TEMPERATURE, HID_TYPE_LC) +#define Consumer_SecurityEnable CONSUMER_KEY(HID_CONSUMER_SECURITY_ENABLE, HID_TYPE_OOC) +#define Consumer_FireAlarm CONSUMER_KEY(HID_CONSUMER_FIRE_ALARM, HID_TYPE_OSC) +#define Consumer_PoliceAlarm CONSUMER_KEY(HID_CONSUMER_POLICE_ALARM, HID_TYPE_OSC) +#define Consumer_Proximity CONSUMER_KEY(HID_CONSUMER_PROXIMITY, HID_TYPE_LC) +#define Consumer_Motion CONSUMER_KEY(HID_CONSUMER_MOTION, HID_TYPE_OSC) +#define Consumer_DuressAlarm CONSUMER_KEY(HID_CONSUMER_DURESS_ALARM, HID_TYPE_OSC) +#define Consumer_HoldupAlarm CONSUMER_KEY(HID_CONSUMER_HOLDUP_ALARM, HID_TYPE_OSC) +#define Consumer_MedicalAlarm CONSUMER_KEY(HID_CONSUMER_MEDICAL_ALARM, HID_TYPE_OSC) -#define Consumer_BalanceRight CONSUMER_KEY(HID_CONSUMER_BALANCE_RIGHT, HID_TYPE_RTC) -#define Consumer_BalanceLeft CONSUMER_KEY(HID_CONSUMER_BALANCE_LEFT, HID_TYPE_RTC) -#define Consumer_BassIncrement CONSUMER_KEY(HID_CONSUMER_BASS_INCREMENT, HID_TYPE_RTC) -#define Consumer_BassDecrement CONSUMER_KEY(HID_CONSUMER_BASS_DECREMENT, HID_TYPE_RTC) -#define Consumer_TrebleIncrement CONSUMER_KEY(HID_CONSUMER_TREBLE_INCREMENT, HID_TYPE_RTC) -#define Consumer_TrebleDecrement CONSUMER_KEY(HID_CONSUMER_TREBLE_DECREMENT, HID_TYPE_RTC) +#define Consumer_BalanceRight CONSUMER_KEY(HID_CONSUMER_BALANCE_RIGHT, HID_TYPE_RTC) +#define Consumer_BalanceLeft CONSUMER_KEY(HID_CONSUMER_BALANCE_LEFT, HID_TYPE_RTC) +#define Consumer_BassIncrement CONSUMER_KEY(HID_CONSUMER_BASS_INCREMENT, HID_TYPE_RTC) +#define Consumer_BassDecrement CONSUMER_KEY(HID_CONSUMER_BASS_DECREMENT, HID_TYPE_RTC) +#define Consumer_TrebleIncrement CONSUMER_KEY(HID_CONSUMER_TREBLE_INCREMENT, HID_TYPE_RTC) +#define Consumer_TrebleDecrement CONSUMER_KEY(HID_CONSUMER_TREBLE_DECREMENT, HID_TYPE_RTC) -#define Consumer_SpeakerSystem CONSUMER_KEY(HID_CONSUMER_SPEAKER_SYSTEM, HID_TYPE_CL) -#define Consumer_ChannelLeft CONSUMER_KEY(HID_CONSUMER_CHANNEL_LEFT, HID_TYPE_CL) -#define Consumer_ChannelRight CONSUMER_KEY(HID_CONSUMER_CHANNEL_RIGHT, HID_TYPE_CL) -#define Consumer_ChannelCenter CONSUMER_KEY(HID_CONSUMER_CHANNEL_CENTER, HID_TYPE_CL) -#define Consumer_ChannelFront CONSUMER_KEY(HID_CONSUMER_CHANNEL_FRONT, HID_TYPE_CL) -#define Consumer_ChannelCenterFront CONSUMER_KEY(HID_CONSUMER_CHANNEL_CENTER_FRONT, HID_TYPE_CL) -#define Consumer_ChannelSide CONSUMER_KEY(HID_CONSUMER_CHANNEL_SIDE, HID_TYPE_CL) -#define Consumer_ChannelSurround CONSUMER_KEY(HID_CONSUMER_CHANNEL_SURROUND, HID_TYPE_CL) -#define Consumer_ChannelLowFrequencyEnhancement CONSUMER_KEY(HID_CONSUMER_CHANNEL_LOW_FREQUENCY_ENHANCEMENT, HID_TYPE_CL) -#define Consumer_ChannelTop CONSUMER_KEY(HID_CONSUMER_CHANNEL_TOP, HID_TYPE_CL) -#define Consumer_ChannelUnknown CONSUMER_KEY(HID_CONSUMER_CHANNEL_UNKNOWN, HID_TYPE_CL) +#define Consumer_SpeakerSystem CONSUMER_KEY(HID_CONSUMER_SPEAKER_SYSTEM, HID_TYPE_CL) +#define Consumer_ChannelLeft CONSUMER_KEY(HID_CONSUMER_CHANNEL_LEFT, HID_TYPE_CL) +#define Consumer_ChannelRight CONSUMER_KEY(HID_CONSUMER_CHANNEL_RIGHT, HID_TYPE_CL) +#define Consumer_ChannelCenter CONSUMER_KEY(HID_CONSUMER_CHANNEL_CENTER, HID_TYPE_CL) +#define Consumer_ChannelFront CONSUMER_KEY(HID_CONSUMER_CHANNEL_FRONT, HID_TYPE_CL) +#define Consumer_ChannelCenterFront CONSUMER_KEY(HID_CONSUMER_CHANNEL_CENTER_FRONT, HID_TYPE_CL) +#define Consumer_ChannelSide CONSUMER_KEY(HID_CONSUMER_CHANNEL_SIDE, HID_TYPE_CL) +#define Consumer_ChannelSurround CONSUMER_KEY(HID_CONSUMER_CHANNEL_SURROUND, HID_TYPE_CL) +#define Consumer_ChannelLowFrequencyEnhancement CONSUMER_KEY(HID_CONSUMER_CHANNEL_LOW_FREQUENCY_ENHANCEMENT, HID_TYPE_CL) +#define Consumer_ChannelTop CONSUMER_KEY(HID_CONSUMER_CHANNEL_TOP, HID_TYPE_CL) +#define Consumer_ChannelUnknown CONSUMER_KEY(HID_CONSUMER_CHANNEL_UNKNOWN, HID_TYPE_CL) -#define Consumer_SubChannel CONSUMER_KEY(HID_CONSUMER_SUB_CHANNEL, HID_TYPE_LC) -#define Consumer_SubChannelIncrement CONSUMER_KEY(HID_CONSUMER_SUB_CHANNEL_INCREMENT, HID_TYPE_OSC) -#define Consumer_SubChannelDecrement CONSUMER_KEY(HID_CONSUMER_SUB_CHANNEL_DECREMENT, HID_TYPE_OSC) -#define Consumer_AlternateAudioIncrement CONSUMER_KEY(HID_CONSUMER_ALTERNATE_AUDIO_INCREMENT, HID_TYPE_OSC) -#define Consumer_AlternateAudioDecrement CONSUMER_KEY(HID_CONSUMER_ALTERNATE_AUDIO_DECREMENT, HID_TYPE_OSC) +#define Consumer_SubChannel CONSUMER_KEY(HID_CONSUMER_SUB_CHANNEL, HID_TYPE_LC) +#define Consumer_SubChannelIncrement CONSUMER_KEY(HID_CONSUMER_SUB_CHANNEL_INCREMENT, HID_TYPE_OSC) +#define Consumer_SubChannelDecrement CONSUMER_KEY(HID_CONSUMER_SUB_CHANNEL_DECREMENT, HID_TYPE_OSC) +#define Consumer_AlternateAudioIncrement CONSUMER_KEY(HID_CONSUMER_ALTERNATE_AUDIO_INCREMENT, HID_TYPE_OSC) +#define Consumer_AlternateAudioDecrement CONSUMER_KEY(HID_CONSUMER_ALTERNATE_AUDIO_DECREMENT, HID_TYPE_OSC) -#define Consumer_Application_Launch_Buttons CONSUMER_KEY(HID_CONSUMER_APPLICATION_LAUNCH_BUTTONS, HID_TYPE_NARY) -#define Consumer_AL_Launch_Button_Configuration_Tool CONSUMER_KEY(HID_CONSUMER_AL_LAUNCH_BUTTON_CONFIGURATION_TOOL, HID_TYPE_SEL) -#define Consumer_AL_Programmable_Button_Configuration CONSUMER_KEY(HID_CONSUMER_AL_PROGRAMMABLE_BUTTON_CONFIGURATION, HID_TYPE_SEL) -#define Consumer_AL_Consumer_Control_Configuration CONSUMER_KEY(HID_CONSUMER_AL_CONSUMER_CONTROL_CONFIGURATION, HID_TYPE_SEL) -#define Consumer_AL_Word_Processor CONSUMER_KEY(HID_CONSUMER_AL_WORD_PROCESSOR, HID_TYPE_SEL) -#define Consumer_AL_Text_Editor CONSUMER_KEY(HID_CONSUMER_AL_TEXT_EDITOR, HID_TYPE_SEL) -#define Consumer_AL_Spreadsheet CONSUMER_KEY(HID_CONSUMER_AL_SPREADSHEET, HID_TYPE_SEL) -#define Consumer_AL_Graphics_Editor CONSUMER_KEY(HID_CONSUMER_AL_GRAPHICS_EDITOR, HID_TYPE_SEL) -#define Consumer_AL_Presentation_App CONSUMER_KEY(HID_CONSUMER_AL_PRESENTATION_APP, HID_TYPE_SEL) -#define Consumer_AL_Database_App CONSUMER_KEY(HID_CONSUMER_AL_DATABASE_APP, HID_TYPE_SEL) -#define Consumer_AL_Email_Reader CONSUMER_KEY(HID_CONSUMER_AL_EMAIL_READER, HID_TYPE_SEL) -#define Consumer_AL_Newsreader CONSUMER_KEY(HID_CONSUMER_AL_NEWSREADER, HID_TYPE_SEL) -#define Consumer_AL_Voicemail CONSUMER_KEY(HID_CONSUMER_AL_VOICEMAIL, HID_TYPE_SEL) -#define Consumer_AL_Contacts_Slash_Address_Book CONSUMER_KEY(HID_CONSUMER_AL_CONTACTS_SLASH_ADDRESS_BOOK, HID_TYPE_SEL) -#define Consumer_AL_Calendar_Slash_Schedule CONSUMER_KEY(HID_CONSUMER_AL_CALENDAR_SLASH_SCHEDULE, HID_TYPE_SEL) -#define Consumer_AL_Task_Slash_Project_Manager CONSUMER_KEY(HID_CONSUMER_AL_TASK_SLASH_PROJECT_MANAGER, HID_TYPE_SEL) -#define Consumer_AL_Log_Slash_Journal_Slash_Timecard CONSUMER_KEY(HID_CONSUMER_AL_LOG_SLASH_JOURNAL_SLASH_TIMECARD, HID_TYPE_SEL) -#define Consumer_AL_Checkbook_Slash_Finance CONSUMER_KEY(HID_CONSUMER_AL_CHECKBOOK_SLASH_FINANCE, HID_TYPE_SEL) -#define Consumer_AL_Calculator CONSUMER_KEY(HID_CONSUMER_AL_CALCULATOR, HID_TYPE_SEL) -#define Consumer_AL_AVCaptureSlashPlayback CONSUMER_KEY(HID_CONSUMER_AL_A_SLASH_V_CAPTURE_SLASH_PLAYBACK, HID_TYPE_SEL) -#define Consumer_AL_Local_MachineBrowser CONSUMER_KEY(HID_CONSUMER_AL_LOCAL_MACHINE_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_Lan_SlashWanBrowser CONSUMER_KEY(HID_CONSUMER_AL_LAN_SLASH_WAN_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_InternetBrowser CONSUMER_KEY(HID_CONSUMER_AL_INTERNET_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_RemoteNetworkingSlashIspConnect CONSUMER_KEY(HID_CONSUMER_AL_REMOTE_NETWORKING_SLASH_ISP_CONNECT, HID_TYPE_SEL) -#define Consumer_AL_NetworkConference CONSUMER_KEY(HID_CONSUMER_AL_NETWORK_CONFERENCE, HID_TYPE_SEL) -#define Consumer_AL_NetworkChat CONSUMER_KEY(HID_CONSUMER_AL_NETWORK_CHAT, HID_TYPE_SEL) -#define Consumer_AL_TelephonySlashDialer CONSUMER_KEY(HID_CONSUMER_AL_TELEPHONY_SLASH_DIALER, HID_TYPE_SEL) -#define Consumer_AL_Logon CONSUMER_KEY(HID_CONSUMER_AL_LOGON, HID_TYPE_SEL) -#define Consumer_AL_Logoff CONSUMER_KEY(HID_CONSUMER_AL_LOGOFF, HID_TYPE_SEL) -#define Consumer_AL_LogonSlashLogoff CONSUMER_KEY(HID_CONSUMER_AL_LOGON_SLASH_LOGOFF, HID_TYPE_SEL) -#define Consumer_AL_TerminalLockSlashScreensaver CONSUMER_KEY(HID_CONSUMER_AL_TERMINAL_LOCK_SLASH_SCREENSAVER, HID_TYPE_SEL) -#define Consumer_AL_ControlPanel CONSUMER_KEY(HID_CONSUMER_AL_CONTROL_PANEL, HID_TYPE_SEL) -#define Consumer_AL_CommandLineProcessorSlashRun CONSUMER_KEY(HID_CONSUMER_AL_COMMAND_LINE_PROCESSOR_SLASH_RUN, HID_TYPE_SEL) -#define Consumer_AL_ProcessSlashTask_Manager CONSUMER_KEY(HID_CONSUMER_AL_PROCESS_SLASH_TASK_MANAGER, HID_TYPE_SEL) -#define Consumer_AL_SelectTaskSlashApplication CONSUMER_KEY(HID_CONSUMER_AL_SELECT_TASK_SLASH_APPLICATION, HID_TYPE_SEL) -#define Consumer_AL_NextTaskSlashApplication CONSUMER_KEY(HID_CONSUMER_AL_NEXT_TASK_SLASH_APPLICATION, HID_TYPE_SEL) -#define Consumer_AL_PreviousTaskSlashApplication CONSUMER_KEY(HID_CONSUMER_AL_PREVIOUS_TASK_SLASH_APPLICATION, HID_TYPE_SEL) -#define Consumer_AL_PreemptiveHaltTaskSlashApplication CONSUMER_KEY(HID_CONSUMER_AL_PREEMPTIVE_HALT_TASK_SLASH_APPLICATION, HID_TYPE_SEL) -#define Consumer_AL_IntegratedHelpCenter CONSUMER_KEY(HID_CONSUMER_AL_INTEGRATED_HELP_CENTER, HID_TYPE_SEL) -#define Consumer_AL_Documents CONSUMER_KEY(HID_CONSUMER_AL_DOCUMENTS, HID_TYPE_SEL) -#define Consumer_AL_Thesaurus CONSUMER_KEY(HID_CONSUMER_AL_THESAURUS, HID_TYPE_SEL) -#define Consumer_AL_Dictionary CONSUMER_KEY(HID_CONSUMER_AL_DICTIONARY, HID_TYPE_SEL) -#define Consumer_AL_Desktop CONSUMER_KEY(HID_CONSUMER_AL_DESKTOP, HID_TYPE_SEL) -#define Consumer_AL_SpellCheck CONSUMER_KEY(HID_CONSUMER_AL_SPELL_CHECK, HID_TYPE_SEL) -#define Consumer_AL_GrammarCheck CONSUMER_KEY(HID_CONSUMER_AL_GRAMMAR_CHECK, HID_TYPE_SEL) -#define Consumer_AL_WirelessStatus CONSUMER_KEY(HID_CONSUMER_AL_WIRELESS_STATUS, HID_TYPE_SEL) -#define Consumer_AL_KeyboardLayout CONSUMER_KEY(HID_CONSUMER_AL_KEYBOARD_LAYOUT, HID_TYPE_SEL) -#define Consumer_AL_VirusProtection CONSUMER_KEY(HID_CONSUMER_AL_VIRUS_PROTECTION, HID_TYPE_SEL) -#define Consumer_AL_Encryption CONSUMER_KEY(HID_CONSUMER_AL_ENCRYPTION, HID_TYPE_SEL) -#define Consumer_AL_ScreenSaver CONSUMER_KEY(HID_CONSUMER_AL_SCREEN_SAVER, HID_TYPE_SEL) -#define Consumer_AL_Alarms CONSUMER_KEY(HID_CONSUMER_AL_ALARMS, HID_TYPE_SEL) -#define Consumer_AL_Clock CONSUMER_KEY(HID_CONSUMER_AL_CLOCK, HID_TYPE_SEL) -#define Consumer_AL_FileBrowser CONSUMER_KEY(HID_CONSUMER_AL_FILE_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_PowerStatus CONSUMER_KEY(HID_CONSUMER_AL_POWER_STATUS, HID_TYPE_SEL) -#define Consumer_AL_ImageBrowser CONSUMER_KEY(HID_CONSUMER_AL_IMAGE_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_AudioBrowser CONSUMER_KEY(HID_CONSUMER_AL_AUDIO_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_MovieBrowser CONSUMER_KEY(HID_CONSUMER_AL_MOVIE_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_DigitalRightsManager CONSUMER_KEY(HID_CONSUMER_AL_DIGITAL_RIGHTS_MANAGER, HID_TYPE_SEL) -#define Consumer_AL_DigitalWallet CONSUMER_KEY(HID_CONSUMER_AL_DIGITAL_WALLET, HID_TYPE_SEL) +#define Consumer_Application_Launch_Buttons CONSUMER_KEY(HID_CONSUMER_APPLICATION_LAUNCH_BUTTONS, HID_TYPE_NARY) +#define Consumer_AL_Launch_Button_Configuration_Tool CONSUMER_KEY(HID_CONSUMER_AL_LAUNCH_BUTTON_CONFIGURATION_TOOL, HID_TYPE_SEL) +#define Consumer_AL_Programmable_Button_Configuration CONSUMER_KEY(HID_CONSUMER_AL_PROGRAMMABLE_BUTTON_CONFIGURATION, HID_TYPE_SEL) +#define Consumer_AL_Consumer_Control_Configuration CONSUMER_KEY(HID_CONSUMER_AL_CONSUMER_CONTROL_CONFIGURATION, HID_TYPE_SEL) +#define Consumer_AL_Word_Processor CONSUMER_KEY(HID_CONSUMER_AL_WORD_PROCESSOR, HID_TYPE_SEL) +#define Consumer_AL_Text_Editor CONSUMER_KEY(HID_CONSUMER_AL_TEXT_EDITOR, HID_TYPE_SEL) +#define Consumer_AL_Spreadsheet CONSUMER_KEY(HID_CONSUMER_AL_SPREADSHEET, HID_TYPE_SEL) +#define Consumer_AL_Graphics_Editor CONSUMER_KEY(HID_CONSUMER_AL_GRAPHICS_EDITOR, HID_TYPE_SEL) +#define Consumer_AL_Presentation_App CONSUMER_KEY(HID_CONSUMER_AL_PRESENTATION_APP, HID_TYPE_SEL) +#define Consumer_AL_Database_App CONSUMER_KEY(HID_CONSUMER_AL_DATABASE_APP, HID_TYPE_SEL) +#define Consumer_AL_Email_Reader CONSUMER_KEY(HID_CONSUMER_AL_EMAIL_READER, HID_TYPE_SEL) +#define Consumer_AL_Newsreader CONSUMER_KEY(HID_CONSUMER_AL_NEWSREADER, HID_TYPE_SEL) +#define Consumer_AL_Voicemail CONSUMER_KEY(HID_CONSUMER_AL_VOICEMAIL, HID_TYPE_SEL) +#define Consumer_AL_Contacts_Slash_Address_Book CONSUMER_KEY(HID_CONSUMER_AL_CONTACTS_SLASH_ADDRESS_BOOK, HID_TYPE_SEL) +#define Consumer_AL_Calendar_Slash_Schedule CONSUMER_KEY(HID_CONSUMER_AL_CALENDAR_SLASH_SCHEDULE, HID_TYPE_SEL) +#define Consumer_AL_Task_Slash_Project_Manager CONSUMER_KEY(HID_CONSUMER_AL_TASK_SLASH_PROJECT_MANAGER, HID_TYPE_SEL) +#define Consumer_AL_Log_Slash_Journal_Slash_Timecard CONSUMER_KEY(HID_CONSUMER_AL_LOG_SLASH_JOURNAL_SLASH_TIMECARD, HID_TYPE_SEL) +#define Consumer_AL_Checkbook_Slash_Finance CONSUMER_KEY(HID_CONSUMER_AL_CHECKBOOK_SLASH_FINANCE, HID_TYPE_SEL) +#define Consumer_AL_Calculator CONSUMER_KEY(HID_CONSUMER_AL_CALCULATOR, HID_TYPE_SEL) +#define Consumer_AL_AVCaptureSlashPlayback CONSUMER_KEY(HID_CONSUMER_AL_A_SLASH_V_CAPTURE_SLASH_PLAYBACK, HID_TYPE_SEL) +#define Consumer_AL_Local_MachineBrowser CONSUMER_KEY(HID_CONSUMER_AL_LOCAL_MACHINE_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_Lan_SlashWanBrowser CONSUMER_KEY(HID_CONSUMER_AL_LAN_SLASH_WAN_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_InternetBrowser CONSUMER_KEY(HID_CONSUMER_AL_INTERNET_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_RemoteNetworkingSlashIspConnect CONSUMER_KEY(HID_CONSUMER_AL_REMOTE_NETWORKING_SLASH_ISP_CONNECT, HID_TYPE_SEL) +#define Consumer_AL_NetworkConference CONSUMER_KEY(HID_CONSUMER_AL_NETWORK_CONFERENCE, HID_TYPE_SEL) +#define Consumer_AL_NetworkChat CONSUMER_KEY(HID_CONSUMER_AL_NETWORK_CHAT, HID_TYPE_SEL) +#define Consumer_AL_TelephonySlashDialer CONSUMER_KEY(HID_CONSUMER_AL_TELEPHONY_SLASH_DIALER, HID_TYPE_SEL) +#define Consumer_AL_Logon CONSUMER_KEY(HID_CONSUMER_AL_LOGON, HID_TYPE_SEL) +#define Consumer_AL_Logoff CONSUMER_KEY(HID_CONSUMER_AL_LOGOFF, HID_TYPE_SEL) +#define Consumer_AL_LogonSlashLogoff CONSUMER_KEY(HID_CONSUMER_AL_LOGON_SLASH_LOGOFF, HID_TYPE_SEL) +#define Consumer_AL_TerminalLockSlashScreensaver CONSUMER_KEY(HID_CONSUMER_AL_TERMINAL_LOCK_SLASH_SCREENSAVER, HID_TYPE_SEL) +#define Consumer_AL_ControlPanel CONSUMER_KEY(HID_CONSUMER_AL_CONTROL_PANEL, HID_TYPE_SEL) +#define Consumer_AL_CommandLineProcessorSlashRun CONSUMER_KEY(HID_CONSUMER_AL_COMMAND_LINE_PROCESSOR_SLASH_RUN, HID_TYPE_SEL) +#define Consumer_AL_ProcessSlashTask_Manager CONSUMER_KEY(HID_CONSUMER_AL_PROCESS_SLASH_TASK_MANAGER, HID_TYPE_SEL) +#define Consumer_AL_SelectTaskSlashApplication CONSUMER_KEY(HID_CONSUMER_AL_SELECT_TASK_SLASH_APPLICATION, HID_TYPE_SEL) +#define Consumer_AL_NextTaskSlashApplication CONSUMER_KEY(HID_CONSUMER_AL_NEXT_TASK_SLASH_APPLICATION, HID_TYPE_SEL) +#define Consumer_AL_PreviousTaskSlashApplication CONSUMER_KEY(HID_CONSUMER_AL_PREVIOUS_TASK_SLASH_APPLICATION, HID_TYPE_SEL) +#define Consumer_AL_PreemptiveHaltTaskSlashApplication CONSUMER_KEY(HID_CONSUMER_AL_PREEMPTIVE_HALT_TASK_SLASH_APPLICATION, HID_TYPE_SEL) +#define Consumer_AL_IntegratedHelpCenter CONSUMER_KEY(HID_CONSUMER_AL_INTEGRATED_HELP_CENTER, HID_TYPE_SEL) +#define Consumer_AL_Documents CONSUMER_KEY(HID_CONSUMER_AL_DOCUMENTS, HID_TYPE_SEL) +#define Consumer_AL_Thesaurus CONSUMER_KEY(HID_CONSUMER_AL_THESAURUS, HID_TYPE_SEL) +#define Consumer_AL_Dictionary CONSUMER_KEY(HID_CONSUMER_AL_DICTIONARY, HID_TYPE_SEL) +#define Consumer_AL_Desktop CONSUMER_KEY(HID_CONSUMER_AL_DESKTOP, HID_TYPE_SEL) +#define Consumer_AL_SpellCheck CONSUMER_KEY(HID_CONSUMER_AL_SPELL_CHECK, HID_TYPE_SEL) +#define Consumer_AL_GrammarCheck CONSUMER_KEY(HID_CONSUMER_AL_GRAMMAR_CHECK, HID_TYPE_SEL) +#define Consumer_AL_WirelessStatus CONSUMER_KEY(HID_CONSUMER_AL_WIRELESS_STATUS, HID_TYPE_SEL) +#define Consumer_AL_KeyboardLayout CONSUMER_KEY(HID_CONSUMER_AL_KEYBOARD_LAYOUT, HID_TYPE_SEL) +#define Consumer_AL_VirusProtection CONSUMER_KEY(HID_CONSUMER_AL_VIRUS_PROTECTION, HID_TYPE_SEL) +#define Consumer_AL_Encryption CONSUMER_KEY(HID_CONSUMER_AL_ENCRYPTION, HID_TYPE_SEL) +#define Consumer_AL_ScreenSaver CONSUMER_KEY(HID_CONSUMER_AL_SCREEN_SAVER, HID_TYPE_SEL) +#define Consumer_AL_Alarms CONSUMER_KEY(HID_CONSUMER_AL_ALARMS, HID_TYPE_SEL) +#define Consumer_AL_Clock CONSUMER_KEY(HID_CONSUMER_AL_CLOCK, HID_TYPE_SEL) +#define Consumer_AL_FileBrowser CONSUMER_KEY(HID_CONSUMER_AL_FILE_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_PowerStatus CONSUMER_KEY(HID_CONSUMER_AL_POWER_STATUS, HID_TYPE_SEL) +#define Consumer_AL_ImageBrowser CONSUMER_KEY(HID_CONSUMER_AL_IMAGE_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_AudioBrowser CONSUMER_KEY(HID_CONSUMER_AL_AUDIO_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_MovieBrowser CONSUMER_KEY(HID_CONSUMER_AL_MOVIE_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_DigitalRightsManager CONSUMER_KEY(HID_CONSUMER_AL_DIGITAL_RIGHTS_MANAGER, HID_TYPE_SEL) +#define Consumer_AL_DigitalWallet CONSUMER_KEY(HID_CONSUMER_AL_DIGITAL_WALLET, HID_TYPE_SEL) -#define Consumer_AL_InstantMessaging CONSUMER_KEY(HID_CONSUMER_AL_INSTANT_MESSAGING, HID_TYPE_SEL) +#define Consumer_AL_InstantMessaging CONSUMER_KEY(HID_CONSUMER_AL_INSTANT_MESSAGING, HID_TYPE_SEL) #define Consumer_AL_OemFeaturesSlashTipsSlashTutorialBrowser CONSUMER_KEY(HID_CONSUMER_AL_OEM_FEATURES_SLASH_TIPS_SLASH_TUTORIAL_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_OemHelp CONSUMER_KEY(HID_CONSUMER_AL_OEM_HELP, HID_TYPE_SEL) -#define Consumer_AL_OnlineCommunity CONSUMER_KEY(HID_CONSUMER_AL_ONLINE_COMMUNITY, HID_TYPE_SEL) -#define Consumer_AL_Entertainment_Content_Browser CONSUMER_KEY(HID_CONSUMER_AL_ENTERTAINMENT_CONTENT_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_OnlineShoppingBrowser CONSUMER_KEY(HID_CONSUMER_AL_ONLINE_SHOPPING_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_SmartcardInformationSlashHelp CONSUMER_KEY(HID_CONSUMER_AL_SMARTCARD_INFORMATION_SLASH_HELP, HID_TYPE_SEL) -#define Consumer_AL_MarketMonitorSlashFinanceBrowser CONSUMER_KEY(HID_CONSUMER_AL_MARKET_MONITOR_SLASH_FINANCE_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_CustomizedCorporateNewsBrowser CONSUMER_KEY(HID_CONSUMER_AL_CUSTOMIZED_CORPORATE_NEWS_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_OnlineActivityBrowser CONSUMER_KEY(HID_CONSUMER_AL_ONLINE_ACTIVITY_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_ResearchSlashSearchBrowser CONSUMER_KEY(HID_CONSUMER_AL_RESEARCH_SLASH_SEARCH_BROWSER, HID_TYPE_SEL) -#define Consumer_AL_AudioPlayer CONSUMER_KEY(HID_CONSUMER_AL_AUDIO_PLAYER, HID_TYPE_SEL) +#define Consumer_AL_OemHelp CONSUMER_KEY(HID_CONSUMER_AL_OEM_HELP, HID_TYPE_SEL) +#define Consumer_AL_OnlineCommunity CONSUMER_KEY(HID_CONSUMER_AL_ONLINE_COMMUNITY, HID_TYPE_SEL) +#define Consumer_AL_Entertainment_Content_Browser CONSUMER_KEY(HID_CONSUMER_AL_ENTERTAINMENT_CONTENT_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_OnlineShoppingBrowser CONSUMER_KEY(HID_CONSUMER_AL_ONLINE_SHOPPING_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_SmartcardInformationSlashHelp CONSUMER_KEY(HID_CONSUMER_AL_SMARTCARD_INFORMATION_SLASH_HELP, HID_TYPE_SEL) +#define Consumer_AL_MarketMonitorSlashFinanceBrowser CONSUMER_KEY(HID_CONSUMER_AL_MARKET_MONITOR_SLASH_FINANCE_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_CustomizedCorporateNewsBrowser CONSUMER_KEY(HID_CONSUMER_AL_CUSTOMIZED_CORPORATE_NEWS_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_OnlineActivityBrowser CONSUMER_KEY(HID_CONSUMER_AL_ONLINE_ACTIVITY_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_ResearchSlashSearchBrowser CONSUMER_KEY(HID_CONSUMER_AL_RESEARCH_SLASH_SEARCH_BROWSER, HID_TYPE_SEL) +#define Consumer_AL_AudioPlayer CONSUMER_KEY(HID_CONSUMER_AL_AUDIO_PLAYER, HID_TYPE_SEL) -#define Consumer_AlMessageStatus CONSUMER_KEY(HID_CONSUMER_AL_MESSAGE_STATUS, HID_TYPE_SEL) -#define Consumer_AlContactSync CONSUMER_KEY(HID_CONSUMER_AL_CONTACT_SYNC, HID_TYPE_SEL) -#define Consumer_AlNavigation CONSUMER_KEY(HID_CONSUMER_AL_NAVIGATION, HID_TYPE_SEL) +#define Consumer_AlMessageStatus CONSUMER_KEY(HID_CONSUMER_AL_MESSAGE_STATUS, HID_TYPE_SEL) +#define Consumer_AlContactSync CONSUMER_KEY(HID_CONSUMER_AL_CONTACT_SYNC, HID_TYPE_SEL) +#define Consumer_AlNavigation CONSUMER_KEY(HID_CONSUMER_AL_NAVIGATION, HID_TYPE_SEL) -#define Consumer_GenericGuiApplicationControls CONSUMER_KEY(HID_CONSUMER_GENERIC_GUI_APPLICATION_CONTROLS, HID_TYPE_NARY) -#define Consumer_AC_New CONSUMER_KEY(HID_CONSUMER_AC_NEW, HID_TYPE_SEL) -#define Consumer_AC_Open CONSUMER_KEY(HID_CONSUMER_AC_OPEN, HID_TYPE_SEL) -#define Consumer_AC_Close CONSUMER_KEY(HID_CONSUMER_AC_CLOSE, HID_TYPE_SEL) -#define Consumer_AC_Exit CONSUMER_KEY(HID_CONSUMER_AC_EXIT, HID_TYPE_SEL) -#define Consumer_AC_Maximize CONSUMER_KEY(HID_CONSUMER_AC_MAXIMIZE, HID_TYPE_SEL) -#define Consumer_AC_Minimize CONSUMER_KEY(HID_CONSUMER_AC_MINIMIZE, HID_TYPE_SEL) -#define Consumer_AC_Save CONSUMER_KEY(HID_CONSUMER_AC_SAVE, HID_TYPE_SEL) -#define Consumer_AC_Print CONSUMER_KEY(HID_CONSUMER_AC_PRINT, HID_TYPE_SEL) -#define Consumer_AC_Properties CONSUMER_KEY(HID_CONSUMER_AC_PROPERTIES, HID_TYPE_SEL) -#define Consumer_AC_Undo CONSUMER_KEY(HID_CONSUMER_AC_UNDO, HID_TYPE_SEL) -#define Consumer_AC_Copy CONSUMER_KEY(HID_CONSUMER_AC_COPY, HID_TYPE_SEL) -#define Consumer_AC_Cut CONSUMER_KEY(HID_CONSUMER_AC_CUT, HID_TYPE_SEL) -#define Consumer_AC_Paste CONSUMER_KEY(HID_CONSUMER_AC_PASTE, HID_TYPE_SEL) -#define Consumer_AC_SelectAll CONSUMER_KEY(HID_CONSUMER_AC_SELECT_ALL, HID_TYPE_SEL) -#define Consumer_AC_Find CONSUMER_KEY(HID_CONSUMER_AC_FIND, HID_TYPE_SEL) -#define Consumer_AC_FindAndReplace CONSUMER_KEY(HID_CONSUMER_AC_FIND_AND_REPLACE, HID_TYPE_SEL) -#define Consumer_AC_Search CONSUMER_KEY(HID_CONSUMER_AC_SEARCH, HID_TYPE_SEL) -#define Consumer_AC_GoTo CONSUMER_KEY(HID_CONSUMER_AC_GO_TO, HID_TYPE_SEL) -#define Consumer_AC_Home CONSUMER_KEY(HID_CONSUMER_AC_HOME, HID_TYPE_SEL) -#define Consumer_AC_Back CONSUMER_KEY(HID_CONSUMER_AC_BACK, HID_TYPE_SEL) -#define Consumer_AC_Forward CONSUMER_KEY(HID_CONSUMER_AC_FORWARD, HID_TYPE_SEL) -#define Consumer_AC_Stop CONSUMER_KEY(HID_CONSUMER_AC_STOP, HID_TYPE_SEL) -#define Consumer_AC_Refresh CONSUMER_KEY(HID_CONSUMER_AC_REFRESH, HID_TYPE_SEL) -#define Consumer_AC_PreviousLink CONSUMER_KEY(HID_CONSUMER_AC_PREVIOUS_LINK, HID_TYPE_SEL) -#define Consumer_AC_NextLink CONSUMER_KEY(HID_CONSUMER_AC_NEXT_LINK, HID_TYPE_SEL) -#define Consumer_AC_Bookmarks CONSUMER_KEY(HID_CONSUMER_AC_BOOKMARKS, HID_TYPE_SEL) -#define Consumer_AC_History CONSUMER_KEY(HID_CONSUMER_AC_HISTORY, HID_TYPE_SEL) -#define Consumer_AC_Subscriptions CONSUMER_KEY(HID_CONSUMER_AC_SUBSCRIPTIONS, HID_TYPE_SEL) -#define Consumer_AC_ZoomIn CONSUMER_KEY(HID_CONSUMER_AC_ZOOM_IN, HID_TYPE_SEL) -#define Consumer_AC_ZoomOut CONSUMER_KEY(HID_CONSUMER_AC_ZOOM_OUT, HID_TYPE_SEL) -#define Consumer_AC_Zoom CONSUMER_KEY(HID_CONSUMER_AC_ZOOM, HID_TYPE_LC) -#define Consumer_AC_FullScreenView CONSUMER_KEY(HID_CONSUMER_AC_FULL_SCREEN_VIEW, HID_TYPE_SEL) -#define Consumer_AC_FullSCreenView CONSUMER_KEY(HID_CONSUMER_AC_FULL_SCREEN_VIEW, HID_TYPE_SEL) -#define Consumer_AC_NormalView CONSUMER_KEY(HID_CONSUMER_AC_NORMAL_VIEW, HID_TYPE_SEL) -#define Consumer_AC_ViewToggle CONSUMER_KEY(HID_CONSUMER_AC_VIEW_TOGGLE, HID_TYPE_SEL) -#define Consumer_AC_ScrollUp CONSUMER_KEY(HID_CONSUMER_AC_SCROLL_UP, HID_TYPE_SEL) -#define Consumer_AC_ScrollDown CONSUMER_KEY(HID_CONSUMER_AC_SCROLL_DOWN, HID_TYPE_SEL) -#define Consumer_AC_Scroll CONSUMER_KEY(HID_CONSUMER_AC_SCROLL, HID_TYPE_LC) -#define Consumer_AC_PanLeft CONSUMER_KEY(HID_CONSUMER_AC_PAN_LEFT, HID_TYPE_SEL) -#define Consumer_AC_PanRight CONSUMER_KEY(HID_CONSUMER_AC_PAN_RIGHT, HID_TYPE_SEL) -#define Consumer_AC_Pan CONSUMER_KEY(HID_CONSUMER_AC_PAN, HID_TYPE_LC) -#define Consumer_AC_NewWindow CONSUMER_KEY(HID_CONSUMER_AC_NEW_WINDOW, HID_TYPE_SEL) -#define Consumer_AC_TileHorizontally CONSUMER_KEY(HID_CONSUMER_AC_TILE_HORIZONTALLY, HID_TYPE_SEL) -#define Consumer_AC_TileVertically CONSUMER_KEY(HID_CONSUMER_AC_TILE_VERTICALLY, HID_TYPE_SEL) -#define Consumer_AC_Format CONSUMER_KEY(HID_CONSUMER_AC_FORMAT, HID_TYPE_SEL) -#define Consumer_AC_Edit CONSUMER_KEY(HID_CONSUMER_AC_EDIT, HID_TYPE_SEL) -#define Consumer_AC_Bold CONSUMER_KEY(HID_CONSUMER_AC_BOLD, HID_TYPE_SEL) -#define Consumer_AC_Italics CONSUMER_KEY(HID_CONSUMER_AC_ITALICS, HID_TYPE_SEL) -#define Consumer_AC_Underline CONSUMER_KEY(HID_CONSUMER_AC_UNDERLINE, HID_TYPE_SEL) -#define Consumer_AC_Strikethrough CONSUMER_KEY(HID_CONSUMER_AC_STRIKETHROUGH, HID_TYPE_SEL) -#define Consumer_AC_Subscript CONSUMER_KEY(HID_CONSUMER_AC_SUBSCRIPT, HID_TYPE_SEL) -#define Consumer_AC_Superscript CONSUMER_KEY(HID_CONSUMER_AC_SUPERSCRIPT, HID_TYPE_SEL) -#define Consumer_AC_AllCaps CONSUMER_KEY(HID_CONSUMER_AC_ALL_CAPS, HID_TYPE_SEL) -#define Consumer_AC_Rotate CONSUMER_KEY(HID_CONSUMER_AC_ROTATE, HID_TYPE_SEL) -#define Consumer_AC_Resize CONSUMER_KEY(HID_CONSUMER_AC_RESIZE, HID_TYPE_SEL) -#define Consumer_AC_FlipHorizontal CONSUMER_KEY(HID_CONSUMER_AC_FLIP_HORIZONTAL, HID_TYPE_SEL) -#define Consumer_AC_FlipVertical CONSUMER_KEY(HID_CONSUMER_AC_FLIP_VERTICAL, HID_TYPE_SEL) -#define Consumer_AC_MirrorHorizontal CONSUMER_KEY(HID_CONSUMER_AC_MIRROR_HORIZONTAL, HID_TYPE_SEL) -#define Consumer_AC_MirrorVertical CONSUMER_KEY(HID_CONSUMER_AC_MIRROR_VERTICAL, HID_TYPE_SEL) -#define Consumer_AC_FontSelect CONSUMER_KEY(HID_CONSUMER_AC_FONT_SELECT, HID_TYPE_SEL) -#define Consumer_AC_FontColor CONSUMER_KEY(HID_CONSUMER_AC_FONT_COLOR, HID_TYPE_SEL) -#define Consumer_AC_FontSize CONSUMER_KEY(HID_CONSUMER_AC_FONT_SIZE, HID_TYPE_SEL) -#define Consumer_AC_JustifyLeft CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_LEFT, HID_TYPE_SEL) -#define Consumer_AC_JustifyCenterH CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_CENTER_H, HID_TYPE_SEL) -#define Consumer_AC_JustifyRight CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_RIGHT, HID_TYPE_SEL) -#define Consumer_AC_JustifyBlockH CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_BLOCK_H, HID_TYPE_SEL) -#define Consumer_AC_JustifyTop CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_TOP, HID_TYPE_SEL) -#define Consumer_AC_JustifyCenterV CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_CENTER_V, HID_TYPE_SEL) -#define Consumer_AC_JustifyBottom CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_BOTTOM, HID_TYPE_SEL) -#define Consumer_AC_JustifyBlockV CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_BLOCK_V, HID_TYPE_SEL) -#define Consumer_AC_IndentDecrease CONSUMER_KEY(HID_CONSUMER_AC_INDENT_DECREASE, HID_TYPE_SEL) -#define Consumer_AC_IndentIncrease CONSUMER_KEY(HID_CONSUMER_AC_INDENT_INCREASE, HID_TYPE_SEL) -#define Consumer_AC_NumberedList CONSUMER_KEY(HID_CONSUMER_AC_NUMBERED_LIST, HID_TYPE_SEL) -#define Consumer_AC_RestartNumbering CONSUMER_KEY(HID_CONSUMER_AC_RESTART_NUMBERING, HID_TYPE_SEL) -#define Consumer_AC_BulletedList CONSUMER_KEY(HID_CONSUMER_AC_BULLETED_LIST, HID_TYPE_SEL) -#define Consumer_AC_Promote CONSUMER_KEY(HID_CONSUMER_AC_PROMOTE, HID_TYPE_SEL) -#define Consumer_AC_Demote CONSUMER_KEY(HID_CONSUMER_AC_DEMOTE, HID_TYPE_SEL) -#define Consumer_AC_Yes CONSUMER_KEY(HID_CONSUMER_AC_YES, HID_TYPE_SEL) -#define Consumer_AC_No CONSUMER_KEY(HID_CONSUMER_AC_NO, HID_TYPE_SEL) -#define Consumer_AC_Cancel CONSUMER_KEY(HID_CONSUMER_AC_CANCEL, HID_TYPE_SEL) -#define Consumer_AC_Catalog CONSUMER_KEY(HID_CONSUMER_AC_CATALOG, HID_TYPE_SEL) -#define Consumer_AC_BuySlashCheckout CONSUMER_KEY(HID_CONSUMER_AC_BUY_SLASH_CHECKOUT, HID_TYPE_SEL) -#define Consumer_AC_AddToCart CONSUMER_KEY(HID_CONSUMER_AC_ADD_TO_CART, HID_TYPE_SEL) -#define Consumer_AC_Expand CONSUMER_KEY(HID_CONSUMER_AC_EXPAND, HID_TYPE_SEL) -#define Consumer_AC_ExpandAll CONSUMER_KEY(HID_CONSUMER_AC_EXPAND_ALL, HID_TYPE_SEL) -#define Consumer_AC_Collapse CONSUMER_KEY(HID_CONSUMER_AC_COLLAPSE, HID_TYPE_SEL) -#define Consumer_AC_CollapseAll CONSUMER_KEY(HID_CONSUMER_AC_COLLAPSE_ALL, HID_TYPE_SEL) -#define Consumer_AC_PrintPreview CONSUMER_KEY(HID_CONSUMER_AC_PRINT_PREVIEW, HID_TYPE_SEL) -#define Consumer_AC_PasteSpecial CONSUMER_KEY(HID_CONSUMER_AC_PASTE_SPECIAL, HID_TYPE_SEL) -#define Consumer_AC_InsertMode CONSUMER_KEY(HID_CONSUMER_AC_INSERT_MODE, HID_TYPE_SEL) -#define Consumer_AC_Delete CONSUMER_KEY(HID_CONSUMER_AC_DELETE, HID_TYPE_SEL) -#define Consumer_AC_Lock CONSUMER_KEY(HID_CONSUMER_AC_LOCK, HID_TYPE_SEL) -#define Consumer_AC_Unlock CONSUMER_KEY(HID_CONSUMER_AC_UNLOCK, HID_TYPE_SEL) -#define Consumer_AC_Protect CONSUMER_KEY(HID_CONSUMER_AC_PROTECT, HID_TYPE_SEL) -#define Consumer_AC_Unprotect CONSUMER_KEY(HID_CONSUMER_AC_UNPROTECT, HID_TYPE_SEL) -#define Consumer_AC_AttachComment CONSUMER_KEY(HID_CONSUMER_AC_ATTACH_COMMENT, HID_TYPE_SEL) -#define Consumer_AC_DeleteComment CONSUMER_KEY(HID_CONSUMER_AC_DELETE_COMMENT, HID_TYPE_SEL) -#define Consumer_AC_ViewComment CONSUMER_KEY(HID_CONSUMER_AC_VIEW_COMMENT, HID_TYPE_SEL) -#define Consumer_AC_SelectWord CONSUMER_KEY(HID_CONSUMER_AC_SELECT_WORD, HID_TYPE_SEL) -#define Consumer_AC_SelectSentence CONSUMER_KEY(HID_CONSUMER_AC_SELECT_SENTENCE, HID_TYPE_SEL) -#define Consumer_AC_SelectParagraph CONSUMER_KEY(HID_CONSUMER_AC_SELECT_PARAGRAPH, HID_TYPE_SEL) -#define Consumer_AC_SelectColumn CONSUMER_KEY(HID_CONSUMER_AC_SELECT_COLUMN, HID_TYPE_SEL) -#define Consumer_AC_SelectRow CONSUMER_KEY(HID_CONSUMER_AC_SELECT_ROW, HID_TYPE_SEL) -#define Consumer_AC_SelectTable CONSUMER_KEY(HID_CONSUMER_AC_SELECT_TABLE, HID_TYPE_SEL) -#define Consumer_AC_SelectObject CONSUMER_KEY(HID_CONSUMER_AC_SELECT_OBJECT, HID_TYPE_SEL) -#define Consumer_AC_RedoSlashRepeat CONSUMER_KEY(HID_CONSUMER_AC_REDO_SLASH_REPEAT, HID_TYPE_SEL) -#define Consumer_AC_Sort CONSUMER_KEY(HID_CONSUMER_AC_SORT, HID_TYPE_SEL) -#define Consumer_AC_Sort_Ascending CONSUMER_KEY(HID_CONSUMER_AC_SORT_ASCENDING, HID_TYPE_SEL) -#define Consumer_AC_Sort_Descending CONSUMER_KEY(HID_CONSUMER_AC_SORT_DESCENDING, HID_TYPE_SEL) -#define Consumer_AC_Filter CONSUMER_KEY(HID_CONSUMER_AC_FILTER, HID_TYPE_SEL) -#define Consumer_AC_SetClock CONSUMER_KEY(HID_CONSUMER_AC_SET_CLOCK, HID_TYPE_SEL) -#define Consumer_AC_ViewClock CONSUMER_KEY(HID_CONSUMER_AC_VIEW_CLOCK, HID_TYPE_SEL) -#define Consumer_AC_SelectTimeZone CONSUMER_KEY(HID_CONSUMER_AC_SELECT_TIME_ZONE, HID_TYPE_SEL) -#define Consumer_AC_EditTimeZones CONSUMER_KEY(HID_CONSUMER_AC_EDIT_TIME_ZONES, HID_TYPE_SEL) -#define Consumer_AC_SetAlarm CONSUMER_KEY(HID_CONSUMER_AC_SET_ALARM, HID_TYPE_SEL) -#define Consumer_AC_ClearAlarm CONSUMER_KEY(HID_CONSUMER_AC_CLEAR_ALARM, HID_TYPE_SEL) -#define Consumer_AC_SnoozeAlarm CONSUMER_KEY(HID_CONSUMER_AC_SNOOZE_ALARM, HID_TYPE_SEL) -#define Consumer_AC_ResetAlarm CONSUMER_KEY(HID_CONSUMER_AC_RESET_ALARM, HID_TYPE_SEL) -#define Consumer_AC_Synchronize CONSUMER_KEY(HID_CONSUMER_AC_SYNCHRONIZE, HID_TYPE_SEL) -#define Consumer_AC_SendSlashReceive CONSUMER_KEY(HID_CONSUMER_AC_SEND_SLASH_RECEIVE, HID_TYPE_SEL) -#define Consumer_AC_SendTo CONSUMER_KEY(HID_CONSUMER_AC_SEND_TO, HID_TYPE_SEL) -#define Consumer_AC_Reply CONSUMER_KEY(HID_CONSUMER_AC_REPLY, HID_TYPE_SEL) -#define Consumer_AC_ReplyAll CONSUMER_KEY(HID_CONSUMER_AC_REPLY_ALL, HID_TYPE_SEL) -#define Consumer_AC_ForwardMsg CONSUMER_KEY(HID_CONSUMER_AC_FORWARD_MSG, HID_TYPE_SEL) -#define Consumer_AC_Send CONSUMER_KEY(HID_CONSUMER_AC_SEND, HID_TYPE_SEL) -#define Consumer_AC_AttachFile CONSUMER_KEY(HID_CONSUMER_AC_ATTACH_FILE, HID_TYPE_SEL) -#define Consumer_AC_Upload CONSUMER_KEY(HID_CONSUMER_AC_UPLOAD, HID_TYPE_SEL) -#define Consumer_AC_Download CONSUMER_KEY(HID_CONSUMER_AC_DOWNLOAD, HID_TYPE_SEL) -#define Consumer_AC_SetBorders CONSUMER_KEY(HID_CONSUMER_AC_SET_BORDERS, HID_TYPE_SEL) -#define Consumer_AC_InsertRow CONSUMER_KEY(HID_CONSUMER_AC_INSERT_ROW, HID_TYPE_SEL) -#define Consumer_AC_InsertColumn CONSUMER_KEY(HID_CONSUMER_AC_INSERT_COLUMN, HID_TYPE_SEL) -#define Consumer_AC_InsertFile CONSUMER_KEY(HID_CONSUMER_AC_INSERT_FILE, HID_TYPE_SEL) -#define Consumer_AC_InsertPicture CONSUMER_KEY(HID_CONSUMER_AC_INSERT_PICTURE, HID_TYPE_SEL) -#define Consumer_AC_InsertObject CONSUMER_KEY(HID_CONSUMER_AC_INSERT_OBJECT, HID_TYPE_SEL) -#define Consumer_AC_InsertSymbol CONSUMER_KEY(HID_CONSUMER_AC_INSERT_SYMBOL, HID_TYPE_SEL) -#define Consumer_AC_SaveandClose CONSUMER_KEY(HID_CONSUMER_AC_SAVE_AND_CLOSE, HID_TYPE_SEL) -#define Consumer_AC_Rename CONSUMER_KEY(HID_CONSUMER_AC_RENAME, HID_TYPE_SEL) -#define Consumer_AC_Merge CONSUMER_KEY(HID_CONSUMER_AC_MERGE, HID_TYPE_SEL) -#define Consumer_AC_Split CONSUMER_KEY(HID_CONSUMER_AC_SPLIT, HID_TYPE_SEL) -#define Consumer_AC_Distribute_Horizontally CONSUMER_KEY(HID_CONSUMER_AC_DISTRIBUTE_HORIZONTALLY, HID_TYPE_SEL) -#define Consumer_AC_Distribute_Vertically CONSUMER_KEY(HID_CONSUMER_AC_DISTRIBUTE_VERTICALLY, HID_TYPE_SEL) +#define Consumer_GenericGuiApplicationControls CONSUMER_KEY(HID_CONSUMER_GENERIC_GUI_APPLICATION_CONTROLS, HID_TYPE_NARY) +#define Consumer_AC_New CONSUMER_KEY(HID_CONSUMER_AC_NEW, HID_TYPE_SEL) +#define Consumer_AC_Open CONSUMER_KEY(HID_CONSUMER_AC_OPEN, HID_TYPE_SEL) +#define Consumer_AC_Close CONSUMER_KEY(HID_CONSUMER_AC_CLOSE, HID_TYPE_SEL) +#define Consumer_AC_Exit CONSUMER_KEY(HID_CONSUMER_AC_EXIT, HID_TYPE_SEL) +#define Consumer_AC_Maximize CONSUMER_KEY(HID_CONSUMER_AC_MAXIMIZE, HID_TYPE_SEL) +#define Consumer_AC_Minimize CONSUMER_KEY(HID_CONSUMER_AC_MINIMIZE, HID_TYPE_SEL) +#define Consumer_AC_Save CONSUMER_KEY(HID_CONSUMER_AC_SAVE, HID_TYPE_SEL) +#define Consumer_AC_Print CONSUMER_KEY(HID_CONSUMER_AC_PRINT, HID_TYPE_SEL) +#define Consumer_AC_Properties CONSUMER_KEY(HID_CONSUMER_AC_PROPERTIES, HID_TYPE_SEL) +#define Consumer_AC_Undo CONSUMER_KEY(HID_CONSUMER_AC_UNDO, HID_TYPE_SEL) +#define Consumer_AC_Copy CONSUMER_KEY(HID_CONSUMER_AC_COPY, HID_TYPE_SEL) +#define Consumer_AC_Cut CONSUMER_KEY(HID_CONSUMER_AC_CUT, HID_TYPE_SEL) +#define Consumer_AC_Paste CONSUMER_KEY(HID_CONSUMER_AC_PASTE, HID_TYPE_SEL) +#define Consumer_AC_SelectAll CONSUMER_KEY(HID_CONSUMER_AC_SELECT_ALL, HID_TYPE_SEL) +#define Consumer_AC_Find CONSUMER_KEY(HID_CONSUMER_AC_FIND, HID_TYPE_SEL) +#define Consumer_AC_FindAndReplace CONSUMER_KEY(HID_CONSUMER_AC_FIND_AND_REPLACE, HID_TYPE_SEL) +#define Consumer_AC_Search CONSUMER_KEY(HID_CONSUMER_AC_SEARCH, HID_TYPE_SEL) +#define Consumer_AC_GoTo CONSUMER_KEY(HID_CONSUMER_AC_GO_TO, HID_TYPE_SEL) +#define Consumer_AC_Home CONSUMER_KEY(HID_CONSUMER_AC_HOME, HID_TYPE_SEL) +#define Consumer_AC_Back CONSUMER_KEY(HID_CONSUMER_AC_BACK, HID_TYPE_SEL) +#define Consumer_AC_Forward CONSUMER_KEY(HID_CONSUMER_AC_FORWARD, HID_TYPE_SEL) +#define Consumer_AC_Stop CONSUMER_KEY(HID_CONSUMER_AC_STOP, HID_TYPE_SEL) +#define Consumer_AC_Refresh CONSUMER_KEY(HID_CONSUMER_AC_REFRESH, HID_TYPE_SEL) +#define Consumer_AC_PreviousLink CONSUMER_KEY(HID_CONSUMER_AC_PREVIOUS_LINK, HID_TYPE_SEL) +#define Consumer_AC_NextLink CONSUMER_KEY(HID_CONSUMER_AC_NEXT_LINK, HID_TYPE_SEL) +#define Consumer_AC_Bookmarks CONSUMER_KEY(HID_CONSUMER_AC_BOOKMARKS, HID_TYPE_SEL) +#define Consumer_AC_History CONSUMER_KEY(HID_CONSUMER_AC_HISTORY, HID_TYPE_SEL) +#define Consumer_AC_Subscriptions CONSUMER_KEY(HID_CONSUMER_AC_SUBSCRIPTIONS, HID_TYPE_SEL) +#define Consumer_AC_ZoomIn CONSUMER_KEY(HID_CONSUMER_AC_ZOOM_IN, HID_TYPE_SEL) +#define Consumer_AC_ZoomOut CONSUMER_KEY(HID_CONSUMER_AC_ZOOM_OUT, HID_TYPE_SEL) +#define Consumer_AC_Zoom CONSUMER_KEY(HID_CONSUMER_AC_ZOOM, HID_TYPE_LC) +#define Consumer_AC_FullScreenView CONSUMER_KEY(HID_CONSUMER_AC_FULL_SCREEN_VIEW, HID_TYPE_SEL) +#define Consumer_AC_FullSCreenView CONSUMER_KEY(HID_CONSUMER_AC_FULL_SCREEN_VIEW, HID_TYPE_SEL) +#define Consumer_AC_NormalView CONSUMER_KEY(HID_CONSUMER_AC_NORMAL_VIEW, HID_TYPE_SEL) +#define Consumer_AC_ViewToggle CONSUMER_KEY(HID_CONSUMER_AC_VIEW_TOGGLE, HID_TYPE_SEL) +#define Consumer_AC_ScrollUp CONSUMER_KEY(HID_CONSUMER_AC_SCROLL_UP, HID_TYPE_SEL) +#define Consumer_AC_ScrollDown CONSUMER_KEY(HID_CONSUMER_AC_SCROLL_DOWN, HID_TYPE_SEL) +#define Consumer_AC_Scroll CONSUMER_KEY(HID_CONSUMER_AC_SCROLL, HID_TYPE_LC) +#define Consumer_AC_PanLeft CONSUMER_KEY(HID_CONSUMER_AC_PAN_LEFT, HID_TYPE_SEL) +#define Consumer_AC_PanRight CONSUMER_KEY(HID_CONSUMER_AC_PAN_RIGHT, HID_TYPE_SEL) +#define Consumer_AC_Pan CONSUMER_KEY(HID_CONSUMER_AC_PAN, HID_TYPE_LC) +#define Consumer_AC_NewWindow CONSUMER_KEY(HID_CONSUMER_AC_NEW_WINDOW, HID_TYPE_SEL) +#define Consumer_AC_TileHorizontally CONSUMER_KEY(HID_CONSUMER_AC_TILE_HORIZONTALLY, HID_TYPE_SEL) +#define Consumer_AC_TileVertically CONSUMER_KEY(HID_CONSUMER_AC_TILE_VERTICALLY, HID_TYPE_SEL) +#define Consumer_AC_Format CONSUMER_KEY(HID_CONSUMER_AC_FORMAT, HID_TYPE_SEL) +#define Consumer_AC_Edit CONSUMER_KEY(HID_CONSUMER_AC_EDIT, HID_TYPE_SEL) +#define Consumer_AC_Bold CONSUMER_KEY(HID_CONSUMER_AC_BOLD, HID_TYPE_SEL) +#define Consumer_AC_Italics CONSUMER_KEY(HID_CONSUMER_AC_ITALICS, HID_TYPE_SEL) +#define Consumer_AC_Underline CONSUMER_KEY(HID_CONSUMER_AC_UNDERLINE, HID_TYPE_SEL) +#define Consumer_AC_Strikethrough CONSUMER_KEY(HID_CONSUMER_AC_STRIKETHROUGH, HID_TYPE_SEL) +#define Consumer_AC_Subscript CONSUMER_KEY(HID_CONSUMER_AC_SUBSCRIPT, HID_TYPE_SEL) +#define Consumer_AC_Superscript CONSUMER_KEY(HID_CONSUMER_AC_SUPERSCRIPT, HID_TYPE_SEL) +#define Consumer_AC_AllCaps CONSUMER_KEY(HID_CONSUMER_AC_ALL_CAPS, HID_TYPE_SEL) +#define Consumer_AC_Rotate CONSUMER_KEY(HID_CONSUMER_AC_ROTATE, HID_TYPE_SEL) +#define Consumer_AC_Resize CONSUMER_KEY(HID_CONSUMER_AC_RESIZE, HID_TYPE_SEL) +#define Consumer_AC_FlipHorizontal CONSUMER_KEY(HID_CONSUMER_AC_FLIP_HORIZONTAL, HID_TYPE_SEL) +#define Consumer_AC_FlipVertical CONSUMER_KEY(HID_CONSUMER_AC_FLIP_VERTICAL, HID_TYPE_SEL) +#define Consumer_AC_MirrorHorizontal CONSUMER_KEY(HID_CONSUMER_AC_MIRROR_HORIZONTAL, HID_TYPE_SEL) +#define Consumer_AC_MirrorVertical CONSUMER_KEY(HID_CONSUMER_AC_MIRROR_VERTICAL, HID_TYPE_SEL) +#define Consumer_AC_FontSelect CONSUMER_KEY(HID_CONSUMER_AC_FONT_SELECT, HID_TYPE_SEL) +#define Consumer_AC_FontColor CONSUMER_KEY(HID_CONSUMER_AC_FONT_COLOR, HID_TYPE_SEL) +#define Consumer_AC_FontSize CONSUMER_KEY(HID_CONSUMER_AC_FONT_SIZE, HID_TYPE_SEL) +#define Consumer_AC_JustifyLeft CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_LEFT, HID_TYPE_SEL) +#define Consumer_AC_JustifyCenterH CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_CENTER_H, HID_TYPE_SEL) +#define Consumer_AC_JustifyRight CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_RIGHT, HID_TYPE_SEL) +#define Consumer_AC_JustifyBlockH CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_BLOCK_H, HID_TYPE_SEL) +#define Consumer_AC_JustifyTop CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_TOP, HID_TYPE_SEL) +#define Consumer_AC_JustifyCenterV CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_CENTER_V, HID_TYPE_SEL) +#define Consumer_AC_JustifyBottom CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_BOTTOM, HID_TYPE_SEL) +#define Consumer_AC_JustifyBlockV CONSUMER_KEY(HID_CONSUMER_AC_JUSTIFY_BLOCK_V, HID_TYPE_SEL) +#define Consumer_AC_IndentDecrease CONSUMER_KEY(HID_CONSUMER_AC_INDENT_DECREASE, HID_TYPE_SEL) +#define Consumer_AC_IndentIncrease CONSUMER_KEY(HID_CONSUMER_AC_INDENT_INCREASE, HID_TYPE_SEL) +#define Consumer_AC_NumberedList CONSUMER_KEY(HID_CONSUMER_AC_NUMBERED_LIST, HID_TYPE_SEL) +#define Consumer_AC_RestartNumbering CONSUMER_KEY(HID_CONSUMER_AC_RESTART_NUMBERING, HID_TYPE_SEL) +#define Consumer_AC_BulletedList CONSUMER_KEY(HID_CONSUMER_AC_BULLETED_LIST, HID_TYPE_SEL) +#define Consumer_AC_Promote CONSUMER_KEY(HID_CONSUMER_AC_PROMOTE, HID_TYPE_SEL) +#define Consumer_AC_Demote CONSUMER_KEY(HID_CONSUMER_AC_DEMOTE, HID_TYPE_SEL) +#define Consumer_AC_Yes CONSUMER_KEY(HID_CONSUMER_AC_YES, HID_TYPE_SEL) +#define Consumer_AC_No CONSUMER_KEY(HID_CONSUMER_AC_NO, HID_TYPE_SEL) +#define Consumer_AC_Cancel CONSUMER_KEY(HID_CONSUMER_AC_CANCEL, HID_TYPE_SEL) +#define Consumer_AC_Catalog CONSUMER_KEY(HID_CONSUMER_AC_CATALOG, HID_TYPE_SEL) +#define Consumer_AC_BuySlashCheckout CONSUMER_KEY(HID_CONSUMER_AC_BUY_SLASH_CHECKOUT, HID_TYPE_SEL) +#define Consumer_AC_AddToCart CONSUMER_KEY(HID_CONSUMER_AC_ADD_TO_CART, HID_TYPE_SEL) +#define Consumer_AC_Expand CONSUMER_KEY(HID_CONSUMER_AC_EXPAND, HID_TYPE_SEL) +#define Consumer_AC_ExpandAll CONSUMER_KEY(HID_CONSUMER_AC_EXPAND_ALL, HID_TYPE_SEL) +#define Consumer_AC_Collapse CONSUMER_KEY(HID_CONSUMER_AC_COLLAPSE, HID_TYPE_SEL) +#define Consumer_AC_CollapseAll CONSUMER_KEY(HID_CONSUMER_AC_COLLAPSE_ALL, HID_TYPE_SEL) +#define Consumer_AC_PrintPreview CONSUMER_KEY(HID_CONSUMER_AC_PRINT_PREVIEW, HID_TYPE_SEL) +#define Consumer_AC_PasteSpecial CONSUMER_KEY(HID_CONSUMER_AC_PASTE_SPECIAL, HID_TYPE_SEL) +#define Consumer_AC_InsertMode CONSUMER_KEY(HID_CONSUMER_AC_INSERT_MODE, HID_TYPE_SEL) +#define Consumer_AC_Delete CONSUMER_KEY(HID_CONSUMER_AC_DELETE, HID_TYPE_SEL) +#define Consumer_AC_Lock CONSUMER_KEY(HID_CONSUMER_AC_LOCK, HID_TYPE_SEL) +#define Consumer_AC_Unlock CONSUMER_KEY(HID_CONSUMER_AC_UNLOCK, HID_TYPE_SEL) +#define Consumer_AC_Protect CONSUMER_KEY(HID_CONSUMER_AC_PROTECT, HID_TYPE_SEL) +#define Consumer_AC_Unprotect CONSUMER_KEY(HID_CONSUMER_AC_UNPROTECT, HID_TYPE_SEL) +#define Consumer_AC_AttachComment CONSUMER_KEY(HID_CONSUMER_AC_ATTACH_COMMENT, HID_TYPE_SEL) +#define Consumer_AC_DeleteComment CONSUMER_KEY(HID_CONSUMER_AC_DELETE_COMMENT, HID_TYPE_SEL) +#define Consumer_AC_ViewComment CONSUMER_KEY(HID_CONSUMER_AC_VIEW_COMMENT, HID_TYPE_SEL) +#define Consumer_AC_SelectWord CONSUMER_KEY(HID_CONSUMER_AC_SELECT_WORD, HID_TYPE_SEL) +#define Consumer_AC_SelectSentence CONSUMER_KEY(HID_CONSUMER_AC_SELECT_SENTENCE, HID_TYPE_SEL) +#define Consumer_AC_SelectParagraph CONSUMER_KEY(HID_CONSUMER_AC_SELECT_PARAGRAPH, HID_TYPE_SEL) +#define Consumer_AC_SelectColumn CONSUMER_KEY(HID_CONSUMER_AC_SELECT_COLUMN, HID_TYPE_SEL) +#define Consumer_AC_SelectRow CONSUMER_KEY(HID_CONSUMER_AC_SELECT_ROW, HID_TYPE_SEL) +#define Consumer_AC_SelectTable CONSUMER_KEY(HID_CONSUMER_AC_SELECT_TABLE, HID_TYPE_SEL) +#define Consumer_AC_SelectObject CONSUMER_KEY(HID_CONSUMER_AC_SELECT_OBJECT, HID_TYPE_SEL) +#define Consumer_AC_RedoSlashRepeat CONSUMER_KEY(HID_CONSUMER_AC_REDO_SLASH_REPEAT, HID_TYPE_SEL) +#define Consumer_AC_Sort CONSUMER_KEY(HID_CONSUMER_AC_SORT, HID_TYPE_SEL) +#define Consumer_AC_Sort_Ascending CONSUMER_KEY(HID_CONSUMER_AC_SORT_ASCENDING, HID_TYPE_SEL) +#define Consumer_AC_Sort_Descending CONSUMER_KEY(HID_CONSUMER_AC_SORT_DESCENDING, HID_TYPE_SEL) +#define Consumer_AC_Filter CONSUMER_KEY(HID_CONSUMER_AC_FILTER, HID_TYPE_SEL) +#define Consumer_AC_SetClock CONSUMER_KEY(HID_CONSUMER_AC_SET_CLOCK, HID_TYPE_SEL) +#define Consumer_AC_ViewClock CONSUMER_KEY(HID_CONSUMER_AC_VIEW_CLOCK, HID_TYPE_SEL) +#define Consumer_AC_SelectTimeZone CONSUMER_KEY(HID_CONSUMER_AC_SELECT_TIME_ZONE, HID_TYPE_SEL) +#define Consumer_AC_EditTimeZones CONSUMER_KEY(HID_CONSUMER_AC_EDIT_TIME_ZONES, HID_TYPE_SEL) +#define Consumer_AC_SetAlarm CONSUMER_KEY(HID_CONSUMER_AC_SET_ALARM, HID_TYPE_SEL) +#define Consumer_AC_ClearAlarm CONSUMER_KEY(HID_CONSUMER_AC_CLEAR_ALARM, HID_TYPE_SEL) +#define Consumer_AC_SnoozeAlarm CONSUMER_KEY(HID_CONSUMER_AC_SNOOZE_ALARM, HID_TYPE_SEL) +#define Consumer_AC_ResetAlarm CONSUMER_KEY(HID_CONSUMER_AC_RESET_ALARM, HID_TYPE_SEL) +#define Consumer_AC_Synchronize CONSUMER_KEY(HID_CONSUMER_AC_SYNCHRONIZE, HID_TYPE_SEL) +#define Consumer_AC_SendSlashReceive CONSUMER_KEY(HID_CONSUMER_AC_SEND_SLASH_RECEIVE, HID_TYPE_SEL) +#define Consumer_AC_SendTo CONSUMER_KEY(HID_CONSUMER_AC_SEND_TO, HID_TYPE_SEL) +#define Consumer_AC_Reply CONSUMER_KEY(HID_CONSUMER_AC_REPLY, HID_TYPE_SEL) +#define Consumer_AC_ReplyAll CONSUMER_KEY(HID_CONSUMER_AC_REPLY_ALL, HID_TYPE_SEL) +#define Consumer_AC_ForwardMsg CONSUMER_KEY(HID_CONSUMER_AC_FORWARD_MSG, HID_TYPE_SEL) +#define Consumer_AC_Send CONSUMER_KEY(HID_CONSUMER_AC_SEND, HID_TYPE_SEL) +#define Consumer_AC_AttachFile CONSUMER_KEY(HID_CONSUMER_AC_ATTACH_FILE, HID_TYPE_SEL) +#define Consumer_AC_Upload CONSUMER_KEY(HID_CONSUMER_AC_UPLOAD, HID_TYPE_SEL) +#define Consumer_AC_Download CONSUMER_KEY(HID_CONSUMER_AC_DOWNLOAD, HID_TYPE_SEL) +#define Consumer_AC_SetBorders CONSUMER_KEY(HID_CONSUMER_AC_SET_BORDERS, HID_TYPE_SEL) +#define Consumer_AC_InsertRow CONSUMER_KEY(HID_CONSUMER_AC_INSERT_ROW, HID_TYPE_SEL) +#define Consumer_AC_InsertColumn CONSUMER_KEY(HID_CONSUMER_AC_INSERT_COLUMN, HID_TYPE_SEL) +#define Consumer_AC_InsertFile CONSUMER_KEY(HID_CONSUMER_AC_INSERT_FILE, HID_TYPE_SEL) +#define Consumer_AC_InsertPicture CONSUMER_KEY(HID_CONSUMER_AC_INSERT_PICTURE, HID_TYPE_SEL) +#define Consumer_AC_InsertObject CONSUMER_KEY(HID_CONSUMER_AC_INSERT_OBJECT, HID_TYPE_SEL) +#define Consumer_AC_InsertSymbol CONSUMER_KEY(HID_CONSUMER_AC_INSERT_SYMBOL, HID_TYPE_SEL) +#define Consumer_AC_SaveandClose CONSUMER_KEY(HID_CONSUMER_AC_SAVE_AND_CLOSE, HID_TYPE_SEL) +#define Consumer_AC_Rename CONSUMER_KEY(HID_CONSUMER_AC_RENAME, HID_TYPE_SEL) +#define Consumer_AC_Merge CONSUMER_KEY(HID_CONSUMER_AC_MERGE, HID_TYPE_SEL) +#define Consumer_AC_Split CONSUMER_KEY(HID_CONSUMER_AC_SPLIT, HID_TYPE_SEL) +#define Consumer_AC_Distribute_Horizontally CONSUMER_KEY(HID_CONSUMER_AC_DISTRIBUTE_HORIZONTALLY, HID_TYPE_SEL) +#define Consumer_AC_Distribute_Vertically CONSUMER_KEY(HID_CONSUMER_AC_DISTRIBUTE_VERTICALLY, HID_TYPE_SEL) -#define Consumer_AC_NextKeyboardLayoutSelect CONSUMER_KEY(HID_CONSUMER_AC_NEXT_KEYBOARD_LAYOUT_SELECT, HID_TYPE_SEL) -#define Consumer_AC_NavigationGuidance CONSUMER_KEY(HID_CONSUMER_AC_NAVIGATION_GUIDANCE, HID_TYPE_SEL) -#define Consumer_AC_DesktopShowAllWindows CONSUMER_KEY(HID_CONSUMER_AC_DESKTOP_SHOW_ALL_WINDOWS, HID_TYPE_SEL) -#define Consumer_AC_SoftKeyLeft CONSUMER_KEY(HID_CONSUMER_AC_SOFT_KEY_LEFT, HID_TYPE_SEL) -#define Consumer_AC_SoftKeyRight CONSUMER_KEY(HID_CONSUMER_AC_SOFT_KEY_RIGHT, HID_TYPE_SEL) -#define Consumer_AC_DesktopShowAllApplications CONSUMER_KEY(HID_CONSUMER_AC_DESKTOP_SHOW_ALL_APPLICATIONS, HID_TYPE_SEL) +#define Consumer_AC_NextKeyboardLayoutSelect CONSUMER_KEY(HID_CONSUMER_AC_NEXT_KEYBOARD_LAYOUT_SELECT, HID_TYPE_SEL) +#define Consumer_AC_NavigationGuidance CONSUMER_KEY(HID_CONSUMER_AC_NAVIGATION_GUIDANCE, HID_TYPE_SEL) +#define Consumer_AC_DesktopShowAllWindows CONSUMER_KEY(HID_CONSUMER_AC_DESKTOP_SHOW_ALL_WINDOWS, HID_TYPE_SEL) +#define Consumer_AC_SoftKeyLeft CONSUMER_KEY(HID_CONSUMER_AC_SOFT_KEY_LEFT, HID_TYPE_SEL) +#define Consumer_AC_SoftKeyRight CONSUMER_KEY(HID_CONSUMER_AC_SOFT_KEY_RIGHT, HID_TYPE_SEL) +#define Consumer_AC_DesktopShowAllApplications CONSUMER_KEY(HID_CONSUMER_AC_DESKTOP_SHOW_ALL_APPLICATIONS, HID_TYPE_SEL) -#define Consumer_AC_IdleKeepAlive CONSUMER_KEY(HID_CONSUMER_AC_IDLE_KEEP_ALIVE, HID_TYPE_SEL) +#define Consumer_AC_IdleKeepAlive CONSUMER_KEY(HID_CONSUMER_AC_IDLE_KEEP_ALIVE, HID_TYPE_SEL) -#define Consumer_ExtendedKeyboardAttributesCollection CONSUMER_KEY(HID_CONSUMER_EXTENDED_KEYBOARD_ATTRIBUTES_COLLECTION, HID_TYPE_CL) -#define Consumer_KeyboardFormFactor CONSUMER_KEY(HID_CONSUMER_KEYBOARD_FORM_FACTOR, HID_TYPE_SV) -#define Consumer_KeyboardKeyType CONSUMER_KEY(HID_CONSUMER_KEYBOARD_KEY_TYPE, HID_TYPE_SV) -#define Consumer_KeyboardPhysicalLayout CONSUMER_KEY(HID_CONSUMER_KEYBOARD_PHYSICAL_LAYOUT, HID_TYPE_SV) -#define Consumer_VendorSpecificKeyboardPhysicalLayout CONSUMER_KEY(HID_CONSUMER_VENDOR_SPECIFIC_KEYBOARD_PHYSICAL_LAYOUT, HID_TYPE_SV) -#define Consumer_KeyboardIetfLanguageTagIndex CONSUMER_KEY(HID_CONSUMER_KEYBOARD_IETF_LANGUAGE_TAG_INDEX, HID_TYPE_SV) -#define Consumer_ImplementedKeyboardInputAssistControls CONSUMER_KEY(HID_CONSUMER_IMPLEMENTED_KEYBOARD_INPUT_ASSIST_CONTROLS, HID_TYPE_SV) -#define Consumer_KeyboardInputAssistPrevious CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_PREVIOUS, HID_TYPE_SEL) -#define Consumer_KeyboardInputAssistNext CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_NEXT, HID_TYPE_SEL) -#define Consumer_KeyboardInputAssistPreviousGroup CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_PREVIOUS_GROUP, HID_TYPE_SEL) -#define Consumer_KeyboardInputAssistNextGroup CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_NEXT_GROUP, HID_TYPE_SEL) -#define Consumer_KeyboardInputAssistAccept CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_ACCEPT, HID_TYPE_SEL) -#define Consumer_KeyboardInputAssistCancel CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_CANCEL, HID_TYPE_SEL) - -#define Consumer_PrivacyScreenToggle CONSUMER_KEY(HID_CONSUMER_PRIVACY_SCREEN_TOGGLE, HID_TYPE_OOC) -#define Consumer_PrivacyScreenLevelDecrement CONSUMER_KEY(HID_CONSUMER_PRIVACY_SCREEN_LEVEL_DECREMENT, HID_TYPE_RTC) -#define Consumer_PrivacyScreenLevelIncrement CONSUMER_KEY(HID_CONSUMER_PRIVACY_SCREEN_LEVEL_INCREMENT, HID_TYPE_RTC) -#define Consumer_PrivacyScreenLevelMinimum CONSUMER_KEY(HID_CONSUMER_PRIVACY_SCREEN_LEVEL_MINIMUM, HID_TYPE_OSC) +#define Consumer_ExtendedKeyboardAttributesCollection CONSUMER_KEY(HID_CONSUMER_EXTENDED_KEYBOARD_ATTRIBUTES_COLLECTION, HID_TYPE_CL) +#define Consumer_KeyboardFormFactor CONSUMER_KEY(HID_CONSUMER_KEYBOARD_FORM_FACTOR, HID_TYPE_SV) +#define Consumer_KeyboardKeyType CONSUMER_KEY(HID_CONSUMER_KEYBOARD_KEY_TYPE, HID_TYPE_SV) +#define Consumer_KeyboardPhysicalLayout CONSUMER_KEY(HID_CONSUMER_KEYBOARD_PHYSICAL_LAYOUT, HID_TYPE_SV) +#define Consumer_VendorSpecificKeyboardPhysicalLayout CONSUMER_KEY(HID_CONSUMER_VENDOR_SPECIFIC_KEYBOARD_PHYSICAL_LAYOUT, HID_TYPE_SV) +#define Consumer_KeyboardIetfLanguageTagIndex CONSUMER_KEY(HID_CONSUMER_KEYBOARD_IETF_LANGUAGE_TAG_INDEX, HID_TYPE_SV) +#define Consumer_ImplementedKeyboardInputAssistControls CONSUMER_KEY(HID_CONSUMER_IMPLEMENTED_KEYBOARD_INPUT_ASSIST_CONTROLS, HID_TYPE_SV) +#define Consumer_KeyboardInputAssistPrevious CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_PREVIOUS, HID_TYPE_SEL) +#define Consumer_KeyboardInputAssistNext CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_NEXT, HID_TYPE_SEL) +#define Consumer_KeyboardInputAssistPreviousGroup CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_PREVIOUS_GROUP, HID_TYPE_SEL) +#define Consumer_KeyboardInputAssistNextGroup CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_NEXT_GROUP, HID_TYPE_SEL) +#define Consumer_KeyboardInputAssistAccept CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_ACCEPT, HID_TYPE_SEL) +#define Consumer_KeyboardInputAssistCancel CONSUMER_KEY(HID_CONSUMER_KEYBOARD_INPUT_ASSIST_CANCEL, HID_TYPE_SEL) +#define Consumer_PrivacyScreenToggle CONSUMER_KEY(HID_CONSUMER_PRIVACY_SCREEN_TOGGLE, HID_TYPE_OOC) +#define Consumer_PrivacyScreenLevelDecrement CONSUMER_KEY(HID_CONSUMER_PRIVACY_SCREEN_LEVEL_DECREMENT, HID_TYPE_RTC) +#define Consumer_PrivacyScreenLevelIncrement CONSUMER_KEY(HID_CONSUMER_PRIVACY_SCREEN_LEVEL_INCREMENT, HID_TYPE_RTC) +#define Consumer_PrivacyScreenLevelMinimum CONSUMER_KEY(HID_CONSUMER_PRIVACY_SCREEN_LEVEL_MINIMUM, HID_TYPE_OSC) diff --git a/src/kaleidoscope/key_defs/keyboard.h b/src/kaleidoscope/key_defs/keyboard.h index bf4f58da..44d7da18 100644 --- a/src/kaleidoscope/key_defs/keyboard.h +++ b/src/kaleidoscope/key_defs/keyboard.h @@ -19,224 +19,224 @@ // Keyboard HID mappings // Reserved (no_event_indicated) -#define Key_NoEvent Key(HID_KEYBOARD_NO_EVENT, KEY_FLAGS) -#define Key_ErrorRollover Key(HID_KEYBOARD_ERROR_ROLLOVER, KEY_FLAGS) -#define Key_PostFail Key(HID_KEYBOARD_POST_FAIL, KEY_FLAGS) -#define Key_ErrorUndefined Key(HID_KEYBOARD_ERROR_UNDEFINED, KEY_FLAGS) -#define Key_A Key(HID_KEYBOARD_A_AND_A, KEY_FLAGS) -#define Key_B Key(HID_KEYBOARD_B_AND_B, KEY_FLAGS) -#define Key_C Key(HID_KEYBOARD_C_AND_C, KEY_FLAGS) -#define Key_D Key(HID_KEYBOARD_D_AND_D, KEY_FLAGS) -#define Key_E Key(HID_KEYBOARD_E_AND_E, KEY_FLAGS) -#define Key_F Key(HID_KEYBOARD_F_AND_F, KEY_FLAGS) -#define Key_G Key(HID_KEYBOARD_G_AND_G, KEY_FLAGS) -#define Key_H Key(HID_KEYBOARD_H_AND_H, KEY_FLAGS) -#define Key_I Key(HID_KEYBOARD_I_AND_I, KEY_FLAGS) -#define Key_J Key(HID_KEYBOARD_J_AND_J, KEY_FLAGS) -#define Key_K Key(HID_KEYBOARD_K_AND_K, KEY_FLAGS) -#define Key_L Key(HID_KEYBOARD_L_AND_L, KEY_FLAGS) -#define Key_M Key(HID_KEYBOARD_M_AND_M, KEY_FLAGS) -#define Key_N Key(HID_KEYBOARD_N_AND_N, KEY_FLAGS) -#define Key_O Key(HID_KEYBOARD_O_AND_O, KEY_FLAGS) -#define Key_P Key(HID_KEYBOARD_P_AND_P, KEY_FLAGS) -#define Key_Q Key(HID_KEYBOARD_Q_AND_Q, KEY_FLAGS) -#define Key_R Key(HID_KEYBOARD_R_AND_R, KEY_FLAGS) -#define Key_S Key(HID_KEYBOARD_S_AND_S, KEY_FLAGS) -#define Key_T Key(HID_KEYBOARD_T_AND_T, KEY_FLAGS) -#define Key_U Key(HID_KEYBOARD_U_AND_U, KEY_FLAGS) -#define Key_V Key(HID_KEYBOARD_V_AND_V, KEY_FLAGS) -#define Key_W Key(HID_KEYBOARD_W_AND_W, KEY_FLAGS) -#define Key_X Key(HID_KEYBOARD_X_AND_X, KEY_FLAGS) -#define Key_Y Key(HID_KEYBOARD_Y_AND_Y, KEY_FLAGS) -#define Key_Z Key(HID_KEYBOARD_Z_AND_Z, KEY_FLAGS) -#define Key_1 Key(HID_KEYBOARD_1_AND_EXCLAMATION_POINT, KEY_FLAGS) -#define Key_2 Key(HID_KEYBOARD_2_AND_AT, KEY_FLAGS) -#define Key_3 Key(HID_KEYBOARD_3_AND_POUND, KEY_FLAGS) -#define Key_4 Key(HID_KEYBOARD_4_AND_DOLLAR, KEY_FLAGS) -#define Key_5 Key(HID_KEYBOARD_5_AND_PERCENT, KEY_FLAGS) -#define Key_6 Key(HID_KEYBOARD_6_AND_CARAT, KEY_FLAGS) -#define Key_7 Key(HID_KEYBOARD_7_AND_AMPERSAND, KEY_FLAGS) -#define Key_8 Key(HID_KEYBOARD_8_AND_ASTERISK, KEY_FLAGS) -#define Key_9 Key(HID_KEYBOARD_9_AND_LEFT_PAREN, KEY_FLAGS) -#define Key_0 Key(HID_KEYBOARD_0_AND_RIGHT_PAREN, KEY_FLAGS) -#define Key_Enter Key(HID_KEYBOARD_ENTER, KEY_FLAGS) // (MARKED AS ENTER_SLASH_RETURN) -#define Key_Escape Key(HID_KEYBOARD_ESCAPE, KEY_FLAGS) -#define Key_Backspace Key(HID_KEYBOARD_DELETE, KEY_FLAGS) // (BACKSPACE) -#define Key_Tab Key(HID_KEYBOARD_TAB, KEY_FLAGS) -#define Key_Spacebar Key(HID_KEYBOARD_SPACEBAR, KEY_FLAGS) -#define Key_Minus Key(HID_KEYBOARD_MINUS_AND_UNDERSCORE, KEY_FLAGS) // (UNDERSCORE) -#define Key_Equals Key(HID_KEYBOARD_EQUALS_AND_PLUS, KEY_FLAGS) -#define Key_LeftBracket Key(HID_KEYBOARD_LEFT_BRACKET_AND_LEFT_CURLY_BRACE, KEY_FLAGS) -#define Key_RightBracket Key(HID_KEYBOARD_RIGHT_BRACKET_AND_RIGHT_CURLY_BRACE, KEY_FLAGS) -#define Key_Backslash Key(HID_KEYBOARD_BACKSLASH_AND_PIPE, KEY_FLAGS) -#define Key_NonUsPound Key(HID_KEYBOARD_NON_US_POUND_AND_TILDE, KEY_FLAGS) -#define Key_Semicolon Key(HID_KEYBOARD_SEMICOLON_AND_COLON, KEY_FLAGS) -#define Key_Quote Key(HID_KEYBOARD_QUOTE_AND_DOUBLEQUOTE, KEY_FLAGS) -#define Key_Backtick Key(HID_KEYBOARD_GRAVE_ACCENT_AND_TILDE, KEY_FLAGS) -#define Key_Comma Key(HID_KEYBOARD_COMMA_AND_LESS_THAN, KEY_FLAGS) -#define Key_Period Key(HID_KEYBOARD_PERIOD_AND_GREATER_THAN, KEY_FLAGS) -#define Key_Slash Key(HID_KEYBOARD_SLASH_AND_QUESTION_MARK, KEY_FLAGS) -#define Key_CapsLock Key(HID_KEYBOARD_CAPS_LOCK, KEY_FLAGS) -#define Key_F1 Key(HID_KEYBOARD_F1, KEY_FLAGS) -#define Key_F2 Key(HID_KEYBOARD_F2, KEY_FLAGS) -#define Key_F3 Key(HID_KEYBOARD_F3, KEY_FLAGS) -#define Key_F4 Key(HID_KEYBOARD_F4, KEY_FLAGS) -#define Key_F5 Key(HID_KEYBOARD_F5, KEY_FLAGS) -#define Key_F6 Key(HID_KEYBOARD_F6, KEY_FLAGS) -#define Key_F7 Key(HID_KEYBOARD_F7, KEY_FLAGS) -#define Key_F8 Key(HID_KEYBOARD_F8, KEY_FLAGS) -#define Key_F9 Key(HID_KEYBOARD_F9, KEY_FLAGS) -#define Key_F10 Key(HID_KEYBOARD_F10, KEY_FLAGS) -#define Key_F11 Key(HID_KEYBOARD_F11, KEY_FLAGS) -#define Key_F12 Key(HID_KEYBOARD_F12, KEY_FLAGS) -#define Key_PrintScreen Key(HID_KEYBOARD_PRINTSCREEN, KEY_FLAGS) -#define Key_ScrollLock Key(HID_KEYBOARD_SCROLL_LOCK, KEY_FLAGS) -#define Key_Pause Key(HID_KEYBOARD_PAUSE, KEY_FLAGS) -#define Key_Insert Key(HID_KEYBOARD_INSERT, KEY_FLAGS) -#define Key_Home Key(HID_KEYBOARD_HOME, KEY_FLAGS) -#define Key_PageUp Key(HID_KEYBOARD_PAGE_UP, KEY_FLAGS) -#define Key_Delete Key(HID_KEYBOARD_DELETE_FORWARD, KEY_FLAGS) -#define Key_End Key(HID_KEYBOARD_END, KEY_FLAGS) -#define Key_PageDown Key(HID_KEYBOARD_PAGE_DOWN, KEY_FLAGS) -#define Key_RightArrow Key(HID_KEYBOARD_RIGHT_ARROW, KEY_FLAGS) -#define Key_LeftArrow Key(HID_KEYBOARD_LEFT_ARROW, KEY_FLAGS) -#define Key_DownArrow Key(HID_KEYBOARD_DOWN_ARROW, KEY_FLAGS) -#define Key_UpArrow Key(HID_KEYBOARD_UP_ARROW, KEY_FLAGS) -#define Key_KeypadNumLock Key(HID_KEYPAD_NUM_LOCK_AND_CLEAR, KEY_FLAGS) -#define Key_KeypadDivide Key(HID_KEYPAD_DIVIDE, KEY_FLAGS) -#define Key_KeypadMultiply Key(HID_KEYPAD_MULTIPLY, KEY_FLAGS) -#define Key_KeypadSubtract Key(HID_KEYPAD_SUBTRACT, KEY_FLAGS) -#define Key_KeypadAdd Key(HID_KEYPAD_ADD, KEY_FLAGS) -#define Key_KeypadEnter Key(HID_KEYPAD_ENTER, KEY_FLAGS) -#define Key_Keypad1 Key(HID_KEYPAD_1_AND_END, KEY_FLAGS) -#define Key_Keypad2 Key(HID_KEYPAD_2_AND_DOWN_ARROW, KEY_FLAGS) -#define Key_Keypad3 Key(HID_KEYPAD_3_AND_PAGE_DOWN, KEY_FLAGS) -#define Key_Keypad4 Key(HID_KEYPAD_4_AND_LEFT_ARROW, KEY_FLAGS) -#define Key_Keypad5 Key(HID_KEYPAD_5, KEY_FLAGS) -#define Key_Keypad6 Key(HID_KEYPAD_6_AND_RIGHT_ARROW, KEY_FLAGS) -#define Key_Keypad7 Key(HID_KEYPAD_7_AND_HOME, KEY_FLAGS) -#define Key_Keypad8 Key(HID_KEYPAD_8_AND_UP_ARROW, KEY_FLAGS) -#define Key_Keypad9 Key(HID_KEYPAD_9_AND_PAGE_UP, KEY_FLAGS) -#define Key_Keypad0 Key(HID_KEYPAD_0_AND_INSERT, KEY_FLAGS) -#define Key_KeypadDot Key(HID_KEYPAD_PERIOD_AND_DELETE, KEY_FLAGS) +#define Key_NoEvent Key(HID_KEYBOARD_NO_EVENT, KEY_FLAGS) +#define Key_ErrorRollover Key(HID_KEYBOARD_ERROR_ROLLOVER, KEY_FLAGS) +#define Key_PostFail Key(HID_KEYBOARD_POST_FAIL, KEY_FLAGS) +#define Key_ErrorUndefined Key(HID_KEYBOARD_ERROR_UNDEFINED, KEY_FLAGS) +#define Key_A Key(HID_KEYBOARD_A_AND_A, KEY_FLAGS) +#define Key_B Key(HID_KEYBOARD_B_AND_B, KEY_FLAGS) +#define Key_C Key(HID_KEYBOARD_C_AND_C, KEY_FLAGS) +#define Key_D Key(HID_KEYBOARD_D_AND_D, KEY_FLAGS) +#define Key_E Key(HID_KEYBOARD_E_AND_E, KEY_FLAGS) +#define Key_F Key(HID_KEYBOARD_F_AND_F, KEY_FLAGS) +#define Key_G Key(HID_KEYBOARD_G_AND_G, KEY_FLAGS) +#define Key_H Key(HID_KEYBOARD_H_AND_H, KEY_FLAGS) +#define Key_I Key(HID_KEYBOARD_I_AND_I, KEY_FLAGS) +#define Key_J Key(HID_KEYBOARD_J_AND_J, KEY_FLAGS) +#define Key_K Key(HID_KEYBOARD_K_AND_K, KEY_FLAGS) +#define Key_L Key(HID_KEYBOARD_L_AND_L, KEY_FLAGS) +#define Key_M Key(HID_KEYBOARD_M_AND_M, KEY_FLAGS) +#define Key_N Key(HID_KEYBOARD_N_AND_N, KEY_FLAGS) +#define Key_O Key(HID_KEYBOARD_O_AND_O, KEY_FLAGS) +#define Key_P Key(HID_KEYBOARD_P_AND_P, KEY_FLAGS) +#define Key_Q Key(HID_KEYBOARD_Q_AND_Q, KEY_FLAGS) +#define Key_R Key(HID_KEYBOARD_R_AND_R, KEY_FLAGS) +#define Key_S Key(HID_KEYBOARD_S_AND_S, KEY_FLAGS) +#define Key_T Key(HID_KEYBOARD_T_AND_T, KEY_FLAGS) +#define Key_U Key(HID_KEYBOARD_U_AND_U, KEY_FLAGS) +#define Key_V Key(HID_KEYBOARD_V_AND_V, KEY_FLAGS) +#define Key_W Key(HID_KEYBOARD_W_AND_W, KEY_FLAGS) +#define Key_X Key(HID_KEYBOARD_X_AND_X, KEY_FLAGS) +#define Key_Y Key(HID_KEYBOARD_Y_AND_Y, KEY_FLAGS) +#define Key_Z Key(HID_KEYBOARD_Z_AND_Z, KEY_FLAGS) +#define Key_1 Key(HID_KEYBOARD_1_AND_EXCLAMATION_POINT, KEY_FLAGS) +#define Key_2 Key(HID_KEYBOARD_2_AND_AT, KEY_FLAGS) +#define Key_3 Key(HID_KEYBOARD_3_AND_POUND, KEY_FLAGS) +#define Key_4 Key(HID_KEYBOARD_4_AND_DOLLAR, KEY_FLAGS) +#define Key_5 Key(HID_KEYBOARD_5_AND_PERCENT, KEY_FLAGS) +#define Key_6 Key(HID_KEYBOARD_6_AND_CARAT, KEY_FLAGS) +#define Key_7 Key(HID_KEYBOARD_7_AND_AMPERSAND, KEY_FLAGS) +#define Key_8 Key(HID_KEYBOARD_8_AND_ASTERISK, KEY_FLAGS) +#define Key_9 Key(HID_KEYBOARD_9_AND_LEFT_PAREN, KEY_FLAGS) +#define Key_0 Key(HID_KEYBOARD_0_AND_RIGHT_PAREN, KEY_FLAGS) +#define Key_Enter Key(HID_KEYBOARD_ENTER, KEY_FLAGS) // (MARKED AS ENTER_SLASH_RETURN) +#define Key_Escape Key(HID_KEYBOARD_ESCAPE, KEY_FLAGS) +#define Key_Backspace Key(HID_KEYBOARD_DELETE, KEY_FLAGS) // (BACKSPACE) +#define Key_Tab Key(HID_KEYBOARD_TAB, KEY_FLAGS) +#define Key_Spacebar Key(HID_KEYBOARD_SPACEBAR, KEY_FLAGS) +#define Key_Minus Key(HID_KEYBOARD_MINUS_AND_UNDERSCORE, KEY_FLAGS) // (UNDERSCORE) +#define Key_Equals Key(HID_KEYBOARD_EQUALS_AND_PLUS, KEY_FLAGS) +#define Key_LeftBracket Key(HID_KEYBOARD_LEFT_BRACKET_AND_LEFT_CURLY_BRACE, KEY_FLAGS) +#define Key_RightBracket Key(HID_KEYBOARD_RIGHT_BRACKET_AND_RIGHT_CURLY_BRACE, KEY_FLAGS) +#define Key_Backslash Key(HID_KEYBOARD_BACKSLASH_AND_PIPE, KEY_FLAGS) +#define Key_NonUsPound Key(HID_KEYBOARD_NON_US_POUND_AND_TILDE, KEY_FLAGS) +#define Key_Semicolon Key(HID_KEYBOARD_SEMICOLON_AND_COLON, KEY_FLAGS) +#define Key_Quote Key(HID_KEYBOARD_QUOTE_AND_DOUBLEQUOTE, KEY_FLAGS) +#define Key_Backtick Key(HID_KEYBOARD_GRAVE_ACCENT_AND_TILDE, KEY_FLAGS) +#define Key_Comma Key(HID_KEYBOARD_COMMA_AND_LESS_THAN, KEY_FLAGS) +#define Key_Period Key(HID_KEYBOARD_PERIOD_AND_GREATER_THAN, KEY_FLAGS) +#define Key_Slash Key(HID_KEYBOARD_SLASH_AND_QUESTION_MARK, KEY_FLAGS) +#define Key_CapsLock Key(HID_KEYBOARD_CAPS_LOCK, KEY_FLAGS) +#define Key_F1 Key(HID_KEYBOARD_F1, KEY_FLAGS) +#define Key_F2 Key(HID_KEYBOARD_F2, KEY_FLAGS) +#define Key_F3 Key(HID_KEYBOARD_F3, KEY_FLAGS) +#define Key_F4 Key(HID_KEYBOARD_F4, KEY_FLAGS) +#define Key_F5 Key(HID_KEYBOARD_F5, KEY_FLAGS) +#define Key_F6 Key(HID_KEYBOARD_F6, KEY_FLAGS) +#define Key_F7 Key(HID_KEYBOARD_F7, KEY_FLAGS) +#define Key_F8 Key(HID_KEYBOARD_F8, KEY_FLAGS) +#define Key_F9 Key(HID_KEYBOARD_F9, KEY_FLAGS) +#define Key_F10 Key(HID_KEYBOARD_F10, KEY_FLAGS) +#define Key_F11 Key(HID_KEYBOARD_F11, KEY_FLAGS) +#define Key_F12 Key(HID_KEYBOARD_F12, KEY_FLAGS) +#define Key_PrintScreen Key(HID_KEYBOARD_PRINTSCREEN, KEY_FLAGS) +#define Key_ScrollLock Key(HID_KEYBOARD_SCROLL_LOCK, KEY_FLAGS) +#define Key_Pause Key(HID_KEYBOARD_PAUSE, KEY_FLAGS) +#define Key_Insert Key(HID_KEYBOARD_INSERT, KEY_FLAGS) +#define Key_Home Key(HID_KEYBOARD_HOME, KEY_FLAGS) +#define Key_PageUp Key(HID_KEYBOARD_PAGE_UP, KEY_FLAGS) +#define Key_Delete Key(HID_KEYBOARD_DELETE_FORWARD, KEY_FLAGS) +#define Key_End Key(HID_KEYBOARD_END, KEY_FLAGS) +#define Key_PageDown Key(HID_KEYBOARD_PAGE_DOWN, KEY_FLAGS) +#define Key_RightArrow Key(HID_KEYBOARD_RIGHT_ARROW, KEY_FLAGS) +#define Key_LeftArrow Key(HID_KEYBOARD_LEFT_ARROW, KEY_FLAGS) +#define Key_DownArrow Key(HID_KEYBOARD_DOWN_ARROW, KEY_FLAGS) +#define Key_UpArrow Key(HID_KEYBOARD_UP_ARROW, KEY_FLAGS) +#define Key_KeypadNumLock Key(HID_KEYPAD_NUM_LOCK_AND_CLEAR, KEY_FLAGS) +#define Key_KeypadDivide Key(HID_KEYPAD_DIVIDE, KEY_FLAGS) +#define Key_KeypadMultiply Key(HID_KEYPAD_MULTIPLY, KEY_FLAGS) +#define Key_KeypadSubtract Key(HID_KEYPAD_SUBTRACT, KEY_FLAGS) +#define Key_KeypadAdd Key(HID_KEYPAD_ADD, KEY_FLAGS) +#define Key_KeypadEnter Key(HID_KEYPAD_ENTER, KEY_FLAGS) +#define Key_Keypad1 Key(HID_KEYPAD_1_AND_END, KEY_FLAGS) +#define Key_Keypad2 Key(HID_KEYPAD_2_AND_DOWN_ARROW, KEY_FLAGS) +#define Key_Keypad3 Key(HID_KEYPAD_3_AND_PAGE_DOWN, KEY_FLAGS) +#define Key_Keypad4 Key(HID_KEYPAD_4_AND_LEFT_ARROW, KEY_FLAGS) +#define Key_Keypad5 Key(HID_KEYPAD_5, KEY_FLAGS) +#define Key_Keypad6 Key(HID_KEYPAD_6_AND_RIGHT_ARROW, KEY_FLAGS) +#define Key_Keypad7 Key(HID_KEYPAD_7_AND_HOME, KEY_FLAGS) +#define Key_Keypad8 Key(HID_KEYPAD_8_AND_UP_ARROW, KEY_FLAGS) +#define Key_Keypad9 Key(HID_KEYPAD_9_AND_PAGE_UP, KEY_FLAGS) +#define Key_Keypad0 Key(HID_KEYPAD_0_AND_INSERT, KEY_FLAGS) +#define Key_KeypadDot Key(HID_KEYPAD_PERIOD_AND_DELETE, KEY_FLAGS) #define Key_NonUsBackslashAndPipe Key(HID_KEYBOARD_NON_US_BACKSLASH_AND_PIPE, KEY_FLAGS) -#define Key_PcApplication Key(HID_KEYBOARD_APPLICATION, KEY_FLAGS) -#define Key_Power Key(HID_KEYBOARD_POWER, KEY_FLAGS) -#define Key_KeypadEquals Key(HID_KEYPAD_EQUALS, KEY_FLAGS) -#define Key_F13 Key(HID_KEYBOARD_F13, KEY_FLAGS) -#define Key_F14 Key(HID_KEYBOARD_F14, KEY_FLAGS) -#define Key_F15 Key(HID_KEYBOARD_F15, KEY_FLAGS) -#define Key_F16 Key(HID_KEYBOARD_F16, KEY_FLAGS) -#define Key_F17 Key(HID_KEYBOARD_F17, KEY_FLAGS) -#define Key_F18 Key(HID_KEYBOARD_F18, KEY_FLAGS) -#define Key_F19 Key(HID_KEYBOARD_F19, KEY_FLAGS) -#define Key_F20 Key(HID_KEYBOARD_F20, KEY_FLAGS) -#define Key_F21 Key(HID_KEYBOARD_F21, KEY_FLAGS) -#define Key_F22 Key(HID_KEYBOARD_F22, KEY_FLAGS) -#define Key_F23 Key(HID_KEYBOARD_F23, KEY_FLAGS) -#define Key_F24 Key(HID_KEYBOARD_F24, KEY_FLAGS) -#define Key_Execute Key(HID_KEYBOARD_EXECUTE, KEY_FLAGS) -#define Key_Help Key(HID_KEYBOARD_HELP, KEY_FLAGS) -#define Key_Menu Key(HID_KEYBOARD_MENU, KEY_FLAGS) -#define Key_Select Key(HID_KEYBOARD_SELECT, KEY_FLAGS) -#define Key_Stop Key(HID_KEYBOARD_STOP, KEY_FLAGS) -#define Key_Again Key(HID_KEYBOARD_AGAIN, KEY_FLAGS) -#define Key_Undo Key(HID_KEYBOARD_UNDO, KEY_FLAGS) -#define Key_Cut Key(HID_KEYBOARD_CUT, KEY_FLAGS) -#define Key_Copy Key(HID_KEYBOARD_COPY, KEY_FLAGS) -#define Key_Paste Key(HID_KEYBOARD_PASTE, KEY_FLAGS) -#define Key_Find Key(HID_KEYBOARD_FIND, KEY_FLAGS) -#define Key_Mute Key(HID_KEYBOARD_MUTE, KEY_FLAGS) -#define Key_VolumeUp Key(HID_KEYBOARD_VOLUME_UP, KEY_FLAGS) -#define Key_VolumeDown Key(HID_KEYBOARD_VOLUME_DOWN, KEY_FLAGS) -#define Key_LockingCapsLock Key(HID_KEYBOARD_LOCKING_CAPS_LOCK, KEY_FLAGS) -#define Key_LockingNumLock Key(HID_KEYBOARD_LOCKING_NUM_LOCK, KEY_FLAGS) -#define Key_LockingScrollLock Key(HID_KEYBOARD_LOCKING_SCROLL_LOCK, KEY_FLAGS) -#define Key_KeypadComma Key(HID_KEYPAD_COMMA, KEY_FLAGS) -#define Key_KeypadEqualSign Key(HID_KEYPAD_EQUAL_SIGN, KEY_FLAGS) -#define Key_International1 Key(HID_KEYBOARD_INTERNATIONAL1, KEY_FLAGS) -#define Key_International2 Key(HID_KEYBOARD_INTERNATIONAL2, KEY_FLAGS) -#define Key_International3 Key(HID_KEYBOARD_INTERNATIONAL3, KEY_FLAGS) -#define Key_International4 Key(HID_KEYBOARD_INTERNATIONAL4, KEY_FLAGS) -#define Key_International5 Key(HID_KEYBOARD_INTERNATIONAL5, KEY_FLAGS) -#define Key_International6 Key(HID_KEYBOARD_INTERNATIONAL6, KEY_FLAGS) -#define Key_International7 Key(HID_KEYBOARD_INTERNATIONAL7, KEY_FLAGS) -#define Key_International8 Key(HID_KEYBOARD_INTERNATIONAL8, KEY_FLAGS) -#define Key_International9 Key(HID_KEYBOARD_INTERNATIONAL9, KEY_FLAGS) -#define Key_Lang1 Key(HID_KEYBOARD_LANG1, KEY_FLAGS) -#define Key_Lang2 Key(HID_KEYBOARD_LANG2, KEY_FLAGS) -#define Key_Lang3 Key(HID_KEYBOARD_LANG3, KEY_FLAGS) -#define Key_Lang4 Key(HID_KEYBOARD_LANG4, KEY_FLAGS) -#define Key_Lang5 Key(HID_KEYBOARD_LANG5, KEY_FLAGS) -#define Key_Lang6 Key(HID_KEYBOARD_LANG6, KEY_FLAGS) -#define Key_Lang7 Key(HID_KEYBOARD_LANG7, KEY_FLAGS) -#define Key_Lang8 Key(HID_KEYBOARD_LANG8, KEY_FLAGS) -#define Key_Lang9 Key(HID_KEYBOARD_LANG9, KEY_FLAGS) -#define Key_AlternateErase Key(HID_KEYBOARD_ALTERNATE_ERASE, KEY_FLAGS) -#define Key_Sysreq Key(HID_KEYBOARD_SYSREQ_SLASH_ATTENTION, KEY_FLAGS) -#define Key_Cancel Key(HID_KEYBOARD_CANCEL, KEY_FLAGS) -#define Key_Clear Key(HID_KEYBOARD_CLEAR, KEY_FLAGS) -#define Key_Prior Key(HID_KEYBOARD_PRIOR, KEY_FLAGS) -#define Key_Return Key(HID_KEYBOARD_RETURN, KEY_FLAGS) -#define Key_Separator Key(HID_KEYBOARD_SEPARATOR, KEY_FLAGS) -#define Key_Out Key(HID_KEYBOARD_OUT, KEY_FLAGS) -#define Key_Oper Key(HID_KEYBOARD_OPER, KEY_FLAGS) -#define Key_ClearSlashAgain Key(HID_KEYBOARD_CLEAR_SLASH_AGAIN, KEY_FLAGS) -#define Key_CrselSlashProps Key(HID_KEYBOARD_CRSEL_SLASH_PROPS, KEY_FLAGS) -#define Key_Exsel Key(HID_KEYBOARD_EXSEL, KEY_FLAGS) +#define Key_PcApplication Key(HID_KEYBOARD_APPLICATION, KEY_FLAGS) +#define Key_Power Key(HID_KEYBOARD_POWER, KEY_FLAGS) +#define Key_KeypadEquals Key(HID_KEYPAD_EQUALS, KEY_FLAGS) +#define Key_F13 Key(HID_KEYBOARD_F13, KEY_FLAGS) +#define Key_F14 Key(HID_KEYBOARD_F14, KEY_FLAGS) +#define Key_F15 Key(HID_KEYBOARD_F15, KEY_FLAGS) +#define Key_F16 Key(HID_KEYBOARD_F16, KEY_FLAGS) +#define Key_F17 Key(HID_KEYBOARD_F17, KEY_FLAGS) +#define Key_F18 Key(HID_KEYBOARD_F18, KEY_FLAGS) +#define Key_F19 Key(HID_KEYBOARD_F19, KEY_FLAGS) +#define Key_F20 Key(HID_KEYBOARD_F20, KEY_FLAGS) +#define Key_F21 Key(HID_KEYBOARD_F21, KEY_FLAGS) +#define Key_F22 Key(HID_KEYBOARD_F22, KEY_FLAGS) +#define Key_F23 Key(HID_KEYBOARD_F23, KEY_FLAGS) +#define Key_F24 Key(HID_KEYBOARD_F24, KEY_FLAGS) +#define Key_Execute Key(HID_KEYBOARD_EXECUTE, KEY_FLAGS) +#define Key_Help Key(HID_KEYBOARD_HELP, KEY_FLAGS) +#define Key_Menu Key(HID_KEYBOARD_MENU, KEY_FLAGS) +#define Key_Select Key(HID_KEYBOARD_SELECT, KEY_FLAGS) +#define Key_Stop Key(HID_KEYBOARD_STOP, KEY_FLAGS) +#define Key_Again Key(HID_KEYBOARD_AGAIN, KEY_FLAGS) +#define Key_Undo Key(HID_KEYBOARD_UNDO, KEY_FLAGS) +#define Key_Cut Key(HID_KEYBOARD_CUT, KEY_FLAGS) +#define Key_Copy Key(HID_KEYBOARD_COPY, KEY_FLAGS) +#define Key_Paste Key(HID_KEYBOARD_PASTE, KEY_FLAGS) +#define Key_Find Key(HID_KEYBOARD_FIND, KEY_FLAGS) +#define Key_Mute Key(HID_KEYBOARD_MUTE, KEY_FLAGS) +#define Key_VolumeUp Key(HID_KEYBOARD_VOLUME_UP, KEY_FLAGS) +#define Key_VolumeDown Key(HID_KEYBOARD_VOLUME_DOWN, KEY_FLAGS) +#define Key_LockingCapsLock Key(HID_KEYBOARD_LOCKING_CAPS_LOCK, KEY_FLAGS) +#define Key_LockingNumLock Key(HID_KEYBOARD_LOCKING_NUM_LOCK, KEY_FLAGS) +#define Key_LockingScrollLock Key(HID_KEYBOARD_LOCKING_SCROLL_LOCK, KEY_FLAGS) +#define Key_KeypadComma Key(HID_KEYPAD_COMMA, KEY_FLAGS) +#define Key_KeypadEqualSign Key(HID_KEYPAD_EQUAL_SIGN, KEY_FLAGS) +#define Key_International1 Key(HID_KEYBOARD_INTERNATIONAL1, KEY_FLAGS) +#define Key_International2 Key(HID_KEYBOARD_INTERNATIONAL2, KEY_FLAGS) +#define Key_International3 Key(HID_KEYBOARD_INTERNATIONAL3, KEY_FLAGS) +#define Key_International4 Key(HID_KEYBOARD_INTERNATIONAL4, KEY_FLAGS) +#define Key_International5 Key(HID_KEYBOARD_INTERNATIONAL5, KEY_FLAGS) +#define Key_International6 Key(HID_KEYBOARD_INTERNATIONAL6, KEY_FLAGS) +#define Key_International7 Key(HID_KEYBOARD_INTERNATIONAL7, KEY_FLAGS) +#define Key_International8 Key(HID_KEYBOARD_INTERNATIONAL8, KEY_FLAGS) +#define Key_International9 Key(HID_KEYBOARD_INTERNATIONAL9, KEY_FLAGS) +#define Key_Lang1 Key(HID_KEYBOARD_LANG1, KEY_FLAGS) +#define Key_Lang2 Key(HID_KEYBOARD_LANG2, KEY_FLAGS) +#define Key_Lang3 Key(HID_KEYBOARD_LANG3, KEY_FLAGS) +#define Key_Lang4 Key(HID_KEYBOARD_LANG4, KEY_FLAGS) +#define Key_Lang5 Key(HID_KEYBOARD_LANG5, KEY_FLAGS) +#define Key_Lang6 Key(HID_KEYBOARD_LANG6, KEY_FLAGS) +#define Key_Lang7 Key(HID_KEYBOARD_LANG7, KEY_FLAGS) +#define Key_Lang8 Key(HID_KEYBOARD_LANG8, KEY_FLAGS) +#define Key_Lang9 Key(HID_KEYBOARD_LANG9, KEY_FLAGS) +#define Key_AlternateErase Key(HID_KEYBOARD_ALTERNATE_ERASE, KEY_FLAGS) +#define Key_Sysreq Key(HID_KEYBOARD_SYSREQ_SLASH_ATTENTION, KEY_FLAGS) +#define Key_Cancel Key(HID_KEYBOARD_CANCEL, KEY_FLAGS) +#define Key_Clear Key(HID_KEYBOARD_CLEAR, KEY_FLAGS) +#define Key_Prior Key(HID_KEYBOARD_PRIOR, KEY_FLAGS) +#define Key_Return Key(HID_KEYBOARD_RETURN, KEY_FLAGS) +#define Key_Separator Key(HID_KEYBOARD_SEPARATOR, KEY_FLAGS) +#define Key_Out Key(HID_KEYBOARD_OUT, KEY_FLAGS) +#define Key_Oper Key(HID_KEYBOARD_OPER, KEY_FLAGS) +#define Key_ClearSlashAgain Key(HID_KEYBOARD_CLEAR_SLASH_AGAIN, KEY_FLAGS) +#define Key_CrselSlashProps Key(HID_KEYBOARD_CRSEL_SLASH_PROPS, KEY_FLAGS) +#define Key_Exsel Key(HID_KEYBOARD_EXSEL, KEY_FLAGS) // Reserved 0xA5-AF -#define Key_Keypad00 Key(HID_KEYPAD_00, KEY_FLAGS) -#define Key_Keypad000 Key(HID_KEYPAD_000, KEY_FLAGS) -#define Key_ThousandsSeparator Key(HID_THOUSANDS_SEPARATOR, KEY_FLAGS) -#define Key_DecimalSeparator Key(HID_DECIMAL_SEPARATOR, KEY_FLAGS) -#define Key_CurrencyUnit Key(HID_CURRENCY_UNIT, KEY_FLAGS) -#define Key_CurrencySubunit Key(HID_CURRENCY_SUBUNIT, KEY_FLAGS) -#define Key_KeypadLeftParen Key(HID_KEYPAD_LEFT_PAREN, KEY_FLAGS) -#define Key_KeypadRightParen Key(HID_KEYPAD_RIGHT_PAREN, KEY_FLAGS) -#define Key_KeypadLeftCurlyBrace Key(HID_KEYPAD_LEFT_CURLY_BRACE, KEY_FLAGS) -#define Key_KeypadRightCurlyBrace Key(HID_KEYPAD_RIGHT_CURLY_BRACE, KEY_FLAGS) -#define Key_KeypadTab Key(HID_KEYPAD_TAB, KEY_FLAGS) -#define Key_KeypadBackspace Key(HID_KEYPAD_BACKSPACE, KEY_FLAGS) -#define Key_KeypadA Key(HID_KEYPAD_A, KEY_FLAGS) -#define Key_KeypadB Key(HID_KEYPAD_B, KEY_FLAGS) -#define Key_KeypadC Key(HID_KEYPAD_C, KEY_FLAGS) -#define Key_KeypadD Key(HID_KEYPAD_D, KEY_FLAGS) -#define Key_KeypadE Key(HID_KEYPAD_E, KEY_FLAGS) -#define Key_KeypadF Key(HID_KEYPAD_F, KEY_FLAGS) -#define Key_KeypadXor Key(HID_KEYPAD_XOR, KEY_FLAGS) -#define Key_KeypadCarat Key(HID_KEYPAD_CARAT, KEY_FLAGS) -#define Key_KeypadPercent Key(HID_KEYPAD_PERCENT, KEY_FLAGS) -#define Key_KeypadLessThan Key(HID_KEYPAD_LESS_THAN, KEY_FLAGS) -#define Key_KeypadGreaterThan Key(HID_KEYPAD_GREATER_THAN, KEY_FLAGS) -#define Key_KeypadAmpersand Key(HID_KEYPAD_AMPERSAND, KEY_FLAGS) -#define Key_KeypadDoubleampersand Key(HID_KEYPAD_DOUBLEAMPERSAND, KEY_FLAGS) -#define Key_KeypadPipe Key(HID_KEYPAD_PIPE, KEY_FLAGS) -#define Key_KeypadDoublepipe Key(HID_KEYPAD_DOUBLEPIPE, KEY_FLAGS) -#define Key_KeypadColon Key(HID_KEYPAD_COLON, KEY_FLAGS) -#define Key_KeypadPoundSign Key(HID_KEYPAD_POUND_SIGN, KEY_FLAGS) -#define Key_KeypadSpace Key(HID_KEYPAD_SPACE, KEY_FLAGS) -#define Key_KeypadAtSign Key(HID_KEYPAD_AT_SIGN, KEY_FLAGS) +#define Key_Keypad00 Key(HID_KEYPAD_00, KEY_FLAGS) +#define Key_Keypad000 Key(HID_KEYPAD_000, KEY_FLAGS) +#define Key_ThousandsSeparator Key(HID_THOUSANDS_SEPARATOR, KEY_FLAGS) +#define Key_DecimalSeparator Key(HID_DECIMAL_SEPARATOR, KEY_FLAGS) +#define Key_CurrencyUnit Key(HID_CURRENCY_UNIT, KEY_FLAGS) +#define Key_CurrencySubunit Key(HID_CURRENCY_SUBUNIT, KEY_FLAGS) +#define Key_KeypadLeftParen Key(HID_KEYPAD_LEFT_PAREN, KEY_FLAGS) +#define Key_KeypadRightParen Key(HID_KEYPAD_RIGHT_PAREN, KEY_FLAGS) +#define Key_KeypadLeftCurlyBrace Key(HID_KEYPAD_LEFT_CURLY_BRACE, KEY_FLAGS) +#define Key_KeypadRightCurlyBrace Key(HID_KEYPAD_RIGHT_CURLY_BRACE, KEY_FLAGS) +#define Key_KeypadTab Key(HID_KEYPAD_TAB, KEY_FLAGS) +#define Key_KeypadBackspace Key(HID_KEYPAD_BACKSPACE, KEY_FLAGS) +#define Key_KeypadA Key(HID_KEYPAD_A, KEY_FLAGS) +#define Key_KeypadB Key(HID_KEYPAD_B, KEY_FLAGS) +#define Key_KeypadC Key(HID_KEYPAD_C, KEY_FLAGS) +#define Key_KeypadD Key(HID_KEYPAD_D, KEY_FLAGS) +#define Key_KeypadE Key(HID_KEYPAD_E, KEY_FLAGS) +#define Key_KeypadF Key(HID_KEYPAD_F, KEY_FLAGS) +#define Key_KeypadXor Key(HID_KEYPAD_XOR, KEY_FLAGS) +#define Key_KeypadCarat Key(HID_KEYPAD_CARAT, KEY_FLAGS) +#define Key_KeypadPercent Key(HID_KEYPAD_PERCENT, KEY_FLAGS) +#define Key_KeypadLessThan Key(HID_KEYPAD_LESS_THAN, KEY_FLAGS) +#define Key_KeypadGreaterThan Key(HID_KEYPAD_GREATER_THAN, KEY_FLAGS) +#define Key_KeypadAmpersand Key(HID_KEYPAD_AMPERSAND, KEY_FLAGS) +#define Key_KeypadDoubleampersand Key(HID_KEYPAD_DOUBLEAMPERSAND, KEY_FLAGS) +#define Key_KeypadPipe Key(HID_KEYPAD_PIPE, KEY_FLAGS) +#define Key_KeypadDoublepipe Key(HID_KEYPAD_DOUBLEPIPE, KEY_FLAGS) +#define Key_KeypadColon Key(HID_KEYPAD_COLON, KEY_FLAGS) +#define Key_KeypadPoundSign Key(HID_KEYPAD_POUND_SIGN, KEY_FLAGS) +#define Key_KeypadSpace Key(HID_KEYPAD_SPACE, KEY_FLAGS) +#define Key_KeypadAtSign Key(HID_KEYPAD_AT_SIGN, KEY_FLAGS) #define Key_KeypadExclamationPoint Key(HID_KEYPAD_EXCLAMATION_POINT, KEY_FLAGS) -#define Key_KeypadMemoryStore Key(HID_KEYPAD_MEMORY_STORE, KEY_FLAGS) -#define Key_KeypadMemoryRecall Key(HID_KEYPAD_MEMORY_RECALL, KEY_FLAGS) -#define Key_KeypadMemoryClear Key(HID_KEYPAD_MEMORY_CLEAR, KEY_FLAGS) -#define Key_KeypadMemoryAdd Key(HID_KEYPAD_MEMORY_ADD, KEY_FLAGS) -#define Key_KeypadMemorySubtract Key(HID_KEYPAD_MEMORY_SUBTRACT, KEY_FLAGS) -#define Key_KeypadMemoryMultiply Key(HID_KEYPAD_MEMORY_MULTIPLY, KEY_FLAGS) -#define Key_KeypadMemoryDivide Key(HID_KEYPAD_MEMORY_DIVIDE, KEY_FLAGS) -#define Key_KeypadPlusSlashMinus Key(HID_KEYPAD_PLUS_SLASH_MINUS, KEY_FLAGS) -#define Key_KeypadClear Key(HID_KEYPAD_CLEAR, KEY_FLAGS) -#define Key_KeypadClearEntry Key(HID_KEYPAD_CLEAR_ENTRY, KEY_FLAGS) -#define Key_KeypadBinary Key(HID_KEYPAD_BINARY, KEY_FLAGS) -#define Key_KeypadOctal Key(HID_KEYPAD_OCTAL, KEY_FLAGS) -#define Key_KeypadDecimal Key(HID_KEYPAD_DECIMAL, KEY_FLAGS) -#define Key_KeypadHexadecimal Key(HID_KEYPAD_HEXADECIMAL, KEY_FLAGS) +#define Key_KeypadMemoryStore Key(HID_KEYPAD_MEMORY_STORE, KEY_FLAGS) +#define Key_KeypadMemoryRecall Key(HID_KEYPAD_MEMORY_RECALL, KEY_FLAGS) +#define Key_KeypadMemoryClear Key(HID_KEYPAD_MEMORY_CLEAR, KEY_FLAGS) +#define Key_KeypadMemoryAdd Key(HID_KEYPAD_MEMORY_ADD, KEY_FLAGS) +#define Key_KeypadMemorySubtract Key(HID_KEYPAD_MEMORY_SUBTRACT, KEY_FLAGS) +#define Key_KeypadMemoryMultiply Key(HID_KEYPAD_MEMORY_MULTIPLY, KEY_FLAGS) +#define Key_KeypadMemoryDivide Key(HID_KEYPAD_MEMORY_DIVIDE, KEY_FLAGS) +#define Key_KeypadPlusSlashMinus Key(HID_KEYPAD_PLUS_SLASH_MINUS, KEY_FLAGS) +#define Key_KeypadClear Key(HID_KEYPAD_CLEAR, KEY_FLAGS) +#define Key_KeypadClearEntry Key(HID_KEYPAD_CLEAR_ENTRY, KEY_FLAGS) +#define Key_KeypadBinary Key(HID_KEYPAD_BINARY, KEY_FLAGS) +#define Key_KeypadOctal Key(HID_KEYPAD_OCTAL, KEY_FLAGS) +#define Key_KeypadDecimal Key(HID_KEYPAD_DECIMAL, KEY_FLAGS) +#define Key_KeypadHexadecimal Key(HID_KEYPAD_HEXADECIMAL, KEY_FLAGS) -#define Key_LeftControl Key(HID_KEYBOARD_LEFT_CONTROL, KEY_FLAGS) -#define Key_LeftShift Key(HID_KEYBOARD_LEFT_SHIFT, KEY_FLAGS) -#define Key_LeftAlt Key(HID_KEYBOARD_LEFT_ALT, KEY_FLAGS) -#define Key_LeftGui Key(HID_KEYBOARD_LEFT_GUI, KEY_FLAGS) -#define Key_RightControl Key(HID_KEYBOARD_RIGHT_CONTROL, KEY_FLAGS) -#define Key_RightShift Key(HID_KEYBOARD_RIGHT_SHIFT, KEY_FLAGS) -#define Key_RightAlt Key(HID_KEYBOARD_RIGHT_ALT, KEY_FLAGS) -#define Key_RightGui Key(HID_KEYBOARD_RIGHT_GUI, KEY_FLAGS) +#define Key_LeftControl Key(HID_KEYBOARD_LEFT_CONTROL, KEY_FLAGS) +#define Key_LeftShift Key(HID_KEYBOARD_LEFT_SHIFT, KEY_FLAGS) +#define Key_LeftAlt Key(HID_KEYBOARD_LEFT_ALT, KEY_FLAGS) +#define Key_LeftGui Key(HID_KEYBOARD_LEFT_GUI, KEY_FLAGS) +#define Key_RightControl Key(HID_KEYBOARD_RIGHT_CONTROL, KEY_FLAGS) +#define Key_RightShift Key(HID_KEYBOARD_RIGHT_SHIFT, KEY_FLAGS) +#define Key_RightAlt Key(HID_KEYBOARD_RIGHT_ALT, KEY_FLAGS) +#define Key_RightGui Key(HID_KEYBOARD_RIGHT_GUI, KEY_FLAGS) diff --git a/src/kaleidoscope/key_defs/keymaps.h b/src/kaleidoscope/key_defs/keymaps.h index 22854edd..9039607c 100644 --- a/src/kaleidoscope/key_defs/keymaps.h +++ b/src/kaleidoscope/key_defs/keymaps.h @@ -18,30 +18,34 @@ #include // for uint8_t -static const uint8_t LAYER_OP_OFFSET = 42; +static const uint8_t LAYER_OP_OFFSET = 42; static const uint8_t LAYER_SHIFT_OFFSET = LAYER_OP_OFFSET; -static const uint8_t LAYER_MOVE_OFFSET = LAYER_SHIFT_OFFSET + LAYER_OP_OFFSET;; +static const uint8_t LAYER_MOVE_OFFSET = LAYER_SHIFT_OFFSET + LAYER_OP_OFFSET; +; -#define KEYMAP_0 0 -#define KEYMAP_1 1 -#define KEYMAP_2 2 -#define KEYMAP_3 3 -#define KEYMAP_4 4 -#define KEYMAP_5 5 -#define KEYMAP_6 6 -#define KEYMAP_7 7 - - -#define KEYMAP_PREVIOUS 33 -#define KEYMAP_NEXT 34 +// Layer number constants +#define KEYMAP_0 0 +#define KEYMAP_1 1 +#define KEYMAP_2 2 +#define KEYMAP_3 3 +#define KEYMAP_4 4 +#define KEYMAP_5 5 +#define KEYMAP_6 6 +#define KEYMAP_7 7 +// Previous/next layer key constants +#define KEYMAP_PREVIOUS 33 +#define KEYMAP_NEXT 34 +// Layer lock keys #define Key_Keymap0 Key(KEYMAP_0, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap1 Key(KEYMAP_1, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap2 Key(KEYMAP_2, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap3 Key(KEYMAP_3, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap4 Key(KEYMAP_4, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap5 Key(KEYMAP_5, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) + +// Layer shift keys #define Key_Keymap0_Momentary Key(KEYMAP_0 + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap1_Momentary Key(KEYMAP_1 + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap2_Momentary Key(KEYMAP_2 + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) @@ -49,7 +53,8 @@ static const uint8_t LAYER_MOVE_OFFSET = LAYER_SHIFT_OFFSET + LAYER_OP_OFFSET;; #define Key_Keymap4_Momentary Key(KEYMAP_4 + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_Keymap5_Momentary Key(KEYMAP_5 + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) -#define Key_KeymapNext_Momentary Key(KEYMAP_NEXT + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) +// Next/previous layer shift keys +#define Key_KeymapNext_Momentary Key(KEYMAP_NEXT + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define Key_KeymapPrevious_Momentary Key(KEYMAP_PREVIOUS + LAYER_SHIFT_OFFSET, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) @@ -58,7 +63,7 @@ static const uint8_t LAYER_MOVE_OFFSET = LAYER_SHIFT_OFFSET + LAYER_OP_OFFSET;; * When locking a layer, it will remain active until unlocked explicitly. `n` * can be a number, or an enum value declared previously. */ -#define LockLayer(n) Key(n, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) +#define LockLayer(n) Key(n, KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) #define UnlockLayer(n) LockLayer(n) /** Temporarily shift to layer `n`. diff --git a/src/kaleidoscope/key_defs/sysctl.h b/src/kaleidoscope/key_defs/sysctl.h index b09c63ea..1947b458 100644 --- a/src/kaleidoscope/key_defs/sysctl.h +++ b/src/kaleidoscope/key_defs/sysctl.h @@ -18,50 +18,50 @@ // System control mappings -#define System_PowerDown SYSTEM_KEY(HID_SYSTEM_POWER_DOWN, HID_TYPE_OSC) -#define System_Sleep SYSTEM_KEY(HID_SYSTEM_SLEEP, HID_TYPE_OSC) -#define System_WakeUp SYSTEM_KEY(HID_SYSTEM_WAKE_UP, HID_TYPE_OSC) -#define System_ContextMenu SYSTEM_KEY(HID_SYSTEM_CONTEXT_MENU, HID_TYPE_OSC) -#define System_MainMenu SYSTEM_KEY(HID_SYSTEM_MAIN_MENU, HID_TYPE_OSC) -#define System_AppMenu SYSTEM_KEY(HID_SYSTEM_APP_MENU, HID_TYPE_OSC) -#define System_MenuHelp SYSTEM_KEY(HID_SYSTEM_MENU_HELP, HID_TYPE_OSC) -#define System_MenuExit SYSTEM_KEY(HID_SYSTEM_MENU_EXIT, HID_TYPE_OSC) -#define System_MenuSelect SYSTEM_KEY(HID_SYSTEM_MENU_SELECT, HID_TYPE_OSC) -#define System_MenuRight SYSTEM_KEY(HID_SYSTEM_MENU_RIGHT, HID_TYPE_RTC) -#define System_MenuLeft SYSTEM_KEY(HID_SYSTEM_MENU_LEFT, HID_TYPE_RTC) -#define System_MenuUp SYSTEM_KEY(HID_SYSTEM_MENU_UP, HID_TYPE_RTC) -#define System_MenuDown SYSTEM_KEY(HID_SYSTEM_MENU_DOWN, HID_TYPE_RTC) -#define System_ColdRestart SYSTEM_KEY(HID_SYSTEM_COLD_RESTART, HID_TYPE_OSC) -#define System_WarmRestart SYSTEM_KEY(HID_SYSTEM_WARM_RESTART, HID_TYPE_OSC) -#define System_DPadUp SYSTEM_KEY(HID_D_PAD_UP, HID_TYPE_OOC) -#define System_DPadDown SYSTEM_KEY(HID_D_PAD_DOWN, HID_TYPE_OOC) -#define System_DPadRight SYSTEM_KEY(HID_D_PAD_RIGHT, HID_TYPE_OOC) -#define System_DPadLeft SYSTEM_KEY(HID_D_PAD_LEFT, HID_TYPE_OOC) +#define System_PowerDown SYSTEM_KEY(HID_SYSTEM_POWER_DOWN, HID_TYPE_OSC) +#define System_Sleep SYSTEM_KEY(HID_SYSTEM_SLEEP, HID_TYPE_OSC) +#define System_WakeUp SYSTEM_KEY(HID_SYSTEM_WAKE_UP, HID_TYPE_OSC) +#define System_ContextMenu SYSTEM_KEY(HID_SYSTEM_CONTEXT_MENU, HID_TYPE_OSC) +#define System_MainMenu SYSTEM_KEY(HID_SYSTEM_MAIN_MENU, HID_TYPE_OSC) +#define System_AppMenu SYSTEM_KEY(HID_SYSTEM_APP_MENU, HID_TYPE_OSC) +#define System_MenuHelp SYSTEM_KEY(HID_SYSTEM_MENU_HELP, HID_TYPE_OSC) +#define System_MenuExit SYSTEM_KEY(HID_SYSTEM_MENU_EXIT, HID_TYPE_OSC) +#define System_MenuSelect SYSTEM_KEY(HID_SYSTEM_MENU_SELECT, HID_TYPE_OSC) +#define System_MenuRight SYSTEM_KEY(HID_SYSTEM_MENU_RIGHT, HID_TYPE_RTC) +#define System_MenuLeft SYSTEM_KEY(HID_SYSTEM_MENU_LEFT, HID_TYPE_RTC) +#define System_MenuUp SYSTEM_KEY(HID_SYSTEM_MENU_UP, HID_TYPE_RTC) +#define System_MenuDown SYSTEM_KEY(HID_SYSTEM_MENU_DOWN, HID_TYPE_RTC) +#define System_ColdRestart SYSTEM_KEY(HID_SYSTEM_COLD_RESTART, HID_TYPE_OSC) +#define System_WarmRestart SYSTEM_KEY(HID_SYSTEM_WARM_RESTART, HID_TYPE_OSC) +#define System_DPadUp SYSTEM_KEY(HID_D_PAD_UP, HID_TYPE_OOC) +#define System_DPadDown SYSTEM_KEY(HID_D_PAD_DOWN, HID_TYPE_OOC) +#define System_DPadRight SYSTEM_KEY(HID_D_PAD_RIGHT, HID_TYPE_OOC) +#define System_DPadLeft SYSTEM_KEY(HID_D_PAD_LEFT, HID_TYPE_OOC) -#define System_IndexTrigger SYSTEM_KEY(HID_INDEX_TRIGGER, HID_TYPE_MC) -#define System_PalmTrigger SYSTEM_KEY(HID_PALM_TRIGGER, HID_TYPE_MC) -#define System_Thumbstick SYSTEM_KEY(HID_THUMBSTICK, HID_TYPE_CP) -#define System_SystemFunctionShift SYSTEM_KEY(HID_SYSTEM_FUNCTION_SHIFT, HID_TYPE_MC) -#define System_SystemFunctionShiftLock SYSTEM_KEY(HID_SYSTEM_FUNCTION_SHIFT_LOCK, HID_TYPE_OOC) +#define System_IndexTrigger SYSTEM_KEY(HID_INDEX_TRIGGER, HID_TYPE_MC) +#define System_PalmTrigger SYSTEM_KEY(HID_PALM_TRIGGER, HID_TYPE_MC) +#define System_Thumbstick SYSTEM_KEY(HID_THUMBSTICK, HID_TYPE_CP) +#define System_SystemFunctionShift SYSTEM_KEY(HID_SYSTEM_FUNCTION_SHIFT, HID_TYPE_MC) +#define System_SystemFunctionShiftLock SYSTEM_KEY(HID_SYSTEM_FUNCTION_SHIFT_LOCK, HID_TYPE_OOC) #define System_SystemFunctionShiftLockIndicator SYSTEM_KEY(HID_SYSTEM_FUNCTION_SHIFT_LOCK_INDICATOR, HID_TYPE_DV) -#define System_DismissNotification SYSTEM_KEY(HID_DISMISS_NOTIFICATION, HID_TYPE_OSC) -#define System_DoNotDisturb SYSTEM_KEY(HID_DO_NOT_DISTURB, HID_TYPE_OOC) +#define System_DismissNotification SYSTEM_KEY(HID_DISMISS_NOTIFICATION, HID_TYPE_OSC) +#define System_DoNotDisturb SYSTEM_KEY(HID_DO_NOT_DISTURB, HID_TYPE_OOC) -#define System_Dock SYSTEM_KEY(HID_SYSTEM_DOCK, HID_TYPE_OSC) -#define System_Undock SYSTEM_KEY(HID_SYSTEM_UNDOCK, HID_TYPE_OSC) -#define System_Setup SYSTEM_KEY(HID_SYSTEM_SETUP, HID_TYPE_OSC) -#define System_Break SYSTEM_KEY(HID_SYSTEM_BREAK, HID_TYPE_OSC) -#define System_DebuggerBreak SYSTEM_KEY(HID_SYSTEM_DEBUGGER_BREAK, HID_TYPE_OSC) -#define System_ApplicationBreak SYSTEM_KEY(HID_APPLICATION_BREAK, HID_TYPE_OSC) -#define System_ApplicationDebuggerBreak SYSTEM_KEY(HID_APPLICATION_DEBUGGER_BREAK, HID_TYPE_OSC) -#define System_SpeakerMute SYSTEM_KEY(HID_SYSTEM_SPEAKER_MUTE, HID_TYPE_OSC) -#define System_Hibernate SYSTEM_KEY(HID_SYSTEM_HIBERNATE, HID_TYPE_OSC) +#define System_Dock SYSTEM_KEY(HID_SYSTEM_DOCK, HID_TYPE_OSC) +#define System_Undock SYSTEM_KEY(HID_SYSTEM_UNDOCK, HID_TYPE_OSC) +#define System_Setup SYSTEM_KEY(HID_SYSTEM_SETUP, HID_TYPE_OSC) +#define System_Break SYSTEM_KEY(HID_SYSTEM_BREAK, HID_TYPE_OSC) +#define System_DebuggerBreak SYSTEM_KEY(HID_SYSTEM_DEBUGGER_BREAK, HID_TYPE_OSC) +#define System_ApplicationBreak SYSTEM_KEY(HID_APPLICATION_BREAK, HID_TYPE_OSC) +#define System_ApplicationDebuggerBreak SYSTEM_KEY(HID_APPLICATION_DEBUGGER_BREAK, HID_TYPE_OSC) +#define System_SpeakerMute SYSTEM_KEY(HID_SYSTEM_SPEAKER_MUTE, HID_TYPE_OSC) +#define System_Hibernate SYSTEM_KEY(HID_SYSTEM_HIBERNATE, HID_TYPE_OSC) -#define System_DisplayInvert SYSTEM_KEY(HID_SYSTEM_DISPLAY_INVERT, HID_TYPE_OSC) -#define System_DisplayInternal SYSTEM_KEY(HID_SYSTEM_DISPLAY_INTERNAL, HID_TYPE_OSC) -#define System_DisplayExternal SYSTEM_KEY(HID_SYSTEM_DISPLAY_EXTERNAL, HID_TYPE_OSC) -#define System_DisplayBoth SYSTEM_KEY(HID_SYSTEM_DISPLAY_BOTH, HID_TYPE_OSC) -#define System_DisplayDual SYSTEM_KEY(HID_SYSTEM_DISPLAY_DUAL, HID_TYPE_OSC) -#define System_DisplayToggleIntSlashExt SYSTEM_KEY(HID_SYSTEM_DISPLAY_TOGGLE_INT_SLASH_EXT, HID_TYPE_OSC) +#define System_DisplayInvert SYSTEM_KEY(HID_SYSTEM_DISPLAY_INVERT, HID_TYPE_OSC) +#define System_DisplayInternal SYSTEM_KEY(HID_SYSTEM_DISPLAY_INTERNAL, HID_TYPE_OSC) +#define System_DisplayExternal SYSTEM_KEY(HID_SYSTEM_DISPLAY_EXTERNAL, HID_TYPE_OSC) +#define System_DisplayBoth SYSTEM_KEY(HID_SYSTEM_DISPLAY_BOTH, HID_TYPE_OSC) +#define System_DisplayDual SYSTEM_KEY(HID_SYSTEM_DISPLAY_DUAL, HID_TYPE_OSC) +#define System_DisplayToggleIntSlashExt SYSTEM_KEY(HID_SYSTEM_DISPLAY_TOGGLE_INT_SLASH_EXT, HID_TYPE_OSC) #define System_DisplaySwapPrimarySlashSecondary SYSTEM_KEY(HID_SYSTEM_DISPLAY_SWAP_PRIMARY_SLASH_SECONDARY, HID_TYPE_OSC) -#define System_DisplayLCDAutoscale SYSTEM_KEY(HID_SYSTEM_DISPLAY_LCD_AUTOSCALE, HID_TYPE_OSC) +#define System_DisplayLCDAutoscale SYSTEM_KEY(HID_SYSTEM_DISPLAY_LCD_AUTOSCALE, HID_TYPE_OSC) diff --git a/src/kaleidoscope/keymaps.h b/src/kaleidoscope/keymaps.h index c2e95a0f..4141c676 100644 --- a/src/kaleidoscope/keymaps.h +++ b/src/kaleidoscope/keymaps.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/device/device.h" // for Device @@ -27,8 +27,7 @@ extern const Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * ka namespace kaleidoscope { -inline -Key keyFromKeymap(uint8_t layer, KeyAddr key_addr) { +inline Key keyFromKeymap(uint8_t layer, KeyAddr key_addr) { return keymaps_linear[layer][key_addr.toInt()].readFromProgmem(); } diff --git a/src/kaleidoscope/keyswitch_state.h b/src/kaleidoscope/keyswitch_state.h index 1e6e37e1..13c560ea 100644 --- a/src/kaleidoscope/keyswitch_state.h +++ b/src/kaleidoscope/keyswitch_state.h @@ -28,29 +28,29 @@ * If you want an event which fires only once when a key is pressed, use * keyToggledOn() or keyToggledOff() (defined below). */ -#define keyIsPressed(keyState) ((keyState) & IS_PRESSED) +#define keyIsPressed(keyState) ((keyState)&IS_PRESSED) /* keyWasPressed(): This is true if the key was pressed during the previous scan cycle, regardless of whether it is pressed or not in this scan cycle. */ -#define keyWasPressed(keyState) ((keyState) & WAS_PRESSED) +#define keyWasPressed(keyState) ((keyState)&WAS_PRESSED) /* keyToggledOn(): This is true if the key is newly pressed during this scan * cycle, i.e. was not pressed in the previous scan cycle but is now. * Use this for events which should fire exactly once per keypress, on a * "key-down" event. */ -#define keyToggledOn(keyState) (keyIsPressed(keyState) && ! keyWasPressed(keyState)) +#define keyToggledOn(keyState) (keyIsPressed(keyState) && !keyWasPressed(keyState)) /* keyToggledOff(): This is true if the key is newly not-pressed during this * scan cycle, i.e. is not pressed now but was in the previous scan cycle. * Use this for events which should fire exactly once per keypress, on a * "key-up" event. */ -#define keyToggledOff(keyState) (keyWasPressed(keyState) && ! keyIsPressed(keyState)) +#define keyToggledOff(keyState) (keyWasPressed(keyState) && !keyIsPressed(keyState)) /* keyIsInjected(): This is true if the key was marked as injected by another * plugin, i.e. it was generated artificially instead of corresponding to a * "real" keypress. */ -#define keyIsInjected(keyState) ((keyState) & INJECTED) +#define keyIsInjected(keyState) ((keyState)&INJECTED) diff --git a/src/kaleidoscope/layers.cpp b/src/kaleidoscope/layers.cpp index fe684713..c1252efd 100644 --- a/src/kaleidoscope/layers.cpp +++ b/src/kaleidoscope/layers.cpp @@ -14,8 +14,8 @@ * this program. If not, see . */ -#include // for uint8_t, int8_t -#include // for memmove, memset +#include // for uint8_t, int8_t +#include // for memmove, memset #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyAddrMap.h" // for KeyAddrMap<>::Iterator @@ -45,8 +45,7 @@ __attribute__((weak)) uint8_t layer_count = 0; -__attribute__((weak)) -extern constexpr Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns] = {}; +__attribute__((weak)) extern constexpr Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns] = {}; namespace kaleidoscope { uint8_t Layer_::active_layer_count_ = 1; @@ -153,7 +152,7 @@ void Layer_::updateActiveLayers(void) { for (auto key_addr : KeyAddr::all()) { for (uint8_t i = active_layer_count_; i > 0; --i) { uint8_t layer = active_layers_[i - 1]; - Key key = (*getKey)(layer, key_addr); + Key key = (*getKey)(layer, key_addr); if (key != Key_Transparent) { active_layer_keymap_[key_addr.toInt()] = layer; @@ -176,7 +175,7 @@ void Layer_::move(uint8_t layer) { layer = 0; } active_layer_count_ = 1; - active_layers_[0] = layer; + active_layers_[0] = layer; updateActiveLayers(); diff --git a/src/kaleidoscope/layers.h b/src/kaleidoscope/layers.h index 6966156d..b013944d 100644 --- a/src/kaleidoscope/layers.h +++ b/src/kaleidoscope/layers.h @@ -16,19 +16,21 @@ #pragma once -#include // for PROGMEM -#include // for uint8_t, int8_t - -#include "kaleidoscope/KeyAddr.h" // for KeyAddr -#include "kaleidoscope/KeyEvent.h" // for KeyEvent -#include "kaleidoscope/device/device.h" // for Device -#include "kaleidoscope/key_defs.h" // for Key -#include "kaleidoscope/keymaps.h" // IWYU pragma: keep -#include "kaleidoscope/macro_helpers.h" // for __NL__ -#include "kaleidoscope_internal/device.h" // for device -#include "kaleidoscope_internal/shortname.h" // for _INIT_HID_GETSHOR... +#include // for PROGMEM +#include // for uint8_t, int8_t + +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/device/device.h" // for Device +#include "kaleidoscope/key_defs.h" // for Key +#include "kaleidoscope/keymaps.h" // IWYU pragma: keep +#include "kaleidoscope/macro_helpers.h" // for __NL__ +#include "kaleidoscope_internal/device.h" // for device +#include "kaleidoscope_internal/shortname.h" // for _INIT_HID_GETSHOR... #include "kaleidoscope_internal/sketch_exploration/sketch_exploration.h" // for _INIT_SKETCH_EXPL... +// clang-format off + #define START_KEYMAPS __NL__ \ constexpr Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns] PROGMEM = { @@ -48,6 +50,8 @@ layers __NL__ \ END_KEYMAPS +// clang-format on + extern uint8_t layer_count; namespace kaleidoscope { @@ -101,7 +105,7 @@ class Layer_ { static void handleLayerKeyEvent(const KeyEvent &event); - typedef Key(*GetKeyFunction)(uint8_t layer, KeyAddr key_addr); + typedef Key (*GetKeyFunction)(uint8_t layer, KeyAddr key_addr); static GetKeyFunction getKey; static Key getKeyFromPROGMEM(uint8_t layer, KeyAddr key_addr); @@ -109,7 +113,7 @@ class Layer_ { static void updateActiveLayers(void); private: - using forEachHandler = void(*)(uint8_t index, uint8_t layer); + using forEachHandler = void (*)(uint8_t index, uint8_t layer); public: static void forEachActiveLayer(forEachHandler h); diff --git a/src/kaleidoscope/macro_helpers.h b/src/kaleidoscope/macro_helpers.h index 7ce9ab69..4016802b 100644 --- a/src/kaleidoscope/macro_helpers.h +++ b/src/kaleidoscope/macro_helpers.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once // Code generated by muli-line pre-processor macros is hard to read after diff --git a/src/kaleidoscope/macro_map.h b/src/kaleidoscope/macro_map.h index e5fd2082..e464a491 100644 --- a/src/kaleidoscope/macro_map.h +++ b/src/kaleidoscope/macro_map.h @@ -26,6 +26,8 @@ * prior written authorization from the authors. */ +// clang-format off + #pragma once #define EVAL0(...) __VA_ARGS__ diff --git a/src/kaleidoscope/plugin.h b/src/kaleidoscope/plugin.h index 4e7a1d53..e52d4711 100644 --- a/src/kaleidoscope/plugin.h +++ b/src/kaleidoscope/plugin.h @@ -29,4 +29,4 @@ class Plugin { // their documentation! }; -} // namespace kaleidoscope +} // namespace kaleidoscope diff --git a/src/kaleidoscope/plugin/AccessTransientLEDMode.h b/src/kaleidoscope/plugin/AccessTransientLEDMode.h index f0b8a139..5ff05de6 100644 --- a/src/kaleidoscope/plugin/AccessTransientLEDMode.h +++ b/src/kaleidoscope/plugin/AccessTransientLEDMode.h @@ -23,7 +23,6 @@ namespace plugin { class AccessTransientLEDMode { public: - // This method is called when a plugin's LED mode is activated. // Derived plugins may reimplement it to store the id of their // exported LED mode. A plugin can thus check @@ -34,9 +33,8 @@ class AccessTransientLEDMode { } protected: - uint8_t led_mode_id_ = 255; /* 255 means uninitialized */ }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope diff --git a/src/kaleidoscope/plugin/LEDControl.cpp b/src/kaleidoscope/plugin/LEDControl.cpp index 0fee52ef..517c94b1 100644 --- a/src/kaleidoscope/plugin/LEDControl.cpp +++ b/src/kaleidoscope/plugin/LEDControl.cpp @@ -16,8 +16,8 @@ #include "kaleidoscope/plugin/LEDControl.h" -#include // for PSTR, strcmp_P -#include // for Focus, FocusSerial +#include // for PSTR, strcmp_P +#include // for Focus, FocusSerial #include "kaleidoscope/KeyAddrMap.h" // for KeyAddrMap<>::Iter... #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -27,21 +27,21 @@ #include "kaleidoscope/keyswitch_state.h" // for keyToggledOn #include "kaleidoscope_internal/LEDModeManager.h" // for LEDModeManager -using namespace kaleidoscope::internal; // NOLINT(build/namespaces) +using namespace kaleidoscope::internal; // NOLINT(build/namespaces) namespace kaleidoscope { namespace plugin { static constexpr uint8_t uninitialized_mode_id = 255; -uint8_t LEDControl::mode_id_ = uninitialized_mode_id; +uint8_t LEDControl::mode_id_ = uninitialized_mode_id; uint8_t LEDControl::num_led_modes_ = LEDModeManager::numLEDModes(); LEDMode *LEDControl::cur_led_mode_ = nullptr; -bool LEDControl::enabled_ = true; +bool LEDControl::enabled_ = true; LEDControl::LEDControl(void) { } -uint8_t LEDControl::sync_interval_ = 32; +uint8_t LEDControl::sync_interval_ = 32; uint16_t LEDControl::last_sync_time_ = 0; void LEDControl::next_mode() { @@ -65,8 +65,7 @@ void LEDControl::prev_mode() { return set_mode(mode_id_); } -void -LEDControl::set_mode(uint8_t mode_) { +void LEDControl::set_mode(uint8_t mode_) { if (mode_ >= num_led_modes_) return; diff --git a/src/kaleidoscope/plugin/LEDControl.h b/src/kaleidoscope/plugin/LEDControl.h index ec426ab1..6dd7b40c 100644 --- a/src/kaleidoscope/plugin/LEDControl.h +++ b/src/kaleidoscope/plugin/LEDControl.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint8_t, uint16_t +#include // for uint8_t, uint16_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -30,9 +30,9 @@ constexpr uint8_t LED_TOGGLE = 0b00000001; // Synthetic, internal -constexpr Key Key_LEDEffectNext = Key(0, KEY_FLAGS | SYNTHETIC | IS_INTERNAL | LED_TOGGLE); +constexpr Key Key_LEDEffectNext = Key(0, KEY_FLAGS | SYNTHETIC | IS_INTERNAL | LED_TOGGLE); constexpr Key Key_LEDEffectPrevious = Key(1, KEY_FLAGS | SYNTHETIC | IS_INTERNAL | LED_TOGGLE); -constexpr Key Key_LEDToggle = Key(2, KEY_FLAGS | SYNTHETIC | IS_INTERNAL | LED_TOGGLE); +constexpr Key Key_LEDToggle = Key(2, KEY_FLAGS | SYNTHETIC | IS_INTERNAL | LED_TOGGLE); namespace kaleidoscope { namespace plugin { @@ -67,8 +67,7 @@ class LEDControl : public kaleidoscope::Plugin { } template static LEDMode__ *get_mode() { - return static_cast(cur_led_mode_); - + return static_cast(cur_led_mode_); } static void refreshAll() { diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index 891b10df..34624078 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -27,7 +27,7 @@ namespace plugin { // class LEDOff : public LEDMode { public: - LEDOff(void) { } + LEDOff(void) {} protected: void onActivate(void) final; diff --git a/src/kaleidoscope/plugin/LEDControl/LEDUtils.cpp b/src/kaleidoscope/plugin/LEDControl/LEDUtils.cpp index dca9e84e..ec8a05e1 100644 --- a/src/kaleidoscope/plugin/LEDControl/LEDUtils.cpp +++ b/src/kaleidoscope/plugin/LEDControl/LEDUtils.cpp @@ -18,8 +18,7 @@ #include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ -cRGB -breath_compute(uint8_t hue, uint8_t saturation, uint8_t phase_offset) { +cRGB breath_compute(uint8_t hue, uint8_t saturation, uint8_t phase_offset) { using kaleidoscope::Runtime; @@ -46,8 +45,8 @@ breath_compute(uint8_t hue, uint8_t saturation, uint8_t phase_offset) { i = 255 - i; } - i = i << 1; - uint8_t ii = (i * i) >> 8; + i = i << 1; + uint8_t ii = (i * i) >> 8; uint8_t iii = (ii * i) >> 8; i = (((3 * (uint16_t)(ii)) - (2 * (uint16_t)(iii))) / 2) + 80; @@ -59,8 +58,7 @@ breath_compute(uint8_t hue, uint8_t saturation, uint8_t phase_offset) { // From http://web.mit.edu/storborg/Public/hsvtorgb.c - talk to Scott about licensing -cRGB -hsvToRgb(uint16_t h, uint16_t s, uint16_t v) { +cRGB hsvToRgb(uint16_t h, uint16_t s, uint16_t v) { cRGB color; /* HSV to RGB conversion function with only integer diff --git a/src/kaleidoscope/plugin/LEDControl/LEDUtils.h b/src/kaleidoscope/plugin/LEDControl/LEDUtils.h index 3e11ab53..9f1b6a86 100644 --- a/src/kaleidoscope/plugin/LEDControl/LEDUtils.h +++ b/src/kaleidoscope/plugin/LEDControl/LEDUtils.h @@ -16,7 +16,7 @@ #pragma once -#include // for uint16_t, uint8_t +#include // for uint16_t, uint8_t #include "kaleidoscope/device/device.h" // for cRGB diff --git a/src/kaleidoscope/plugin/LEDMode.h b/src/kaleidoscope/plugin/LEDMode.h index f03cf28e..7c54555c 100644 --- a/src/kaleidoscope/plugin/LEDMode.h +++ b/src/kaleidoscope/plugin/LEDMode.h @@ -16,11 +16,11 @@ #pragma once -#include "kaleidoscope/KeyAddr.h" // for KeyAddr -#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult -#include "kaleidoscope/plugin.h" // for Plugin +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/plugin.h" // for Plugin #include "kaleidoscope/plugin/AccessTransientLEDMode.h" // IWYU pragma: keep -#include "kaleidoscope/plugin/LEDModeInterface.h" // for LEDModeInterface +#include "kaleidoscope/plugin/LEDModeInterface.h" // for LEDModeInterface namespace kaleidoscope { @@ -28,7 +28,7 @@ namespace internal { // Forward declaration class LEDModeManager; -} // namespace internal +} // namespace internal namespace plugin { @@ -45,11 +45,11 @@ namespace plugin { * update, and possibly @ref refreshAt too. */ class LEDMode : public kaleidoscope::Plugin, - public LEDModeInterface { + public LEDModeInterface { friend class LEDControl; friend class kaleidoscope::internal::LEDModeManager; - protected: + protected: // These methods should only be called by LEDControl. /** One-time setup, called at keyboard boot. @@ -96,7 +96,6 @@ class LEDMode : public kaleidoscope::Plugin, virtual void refreshAt(KeyAddr key_addr) {} public: - /** Plugin initialization. * * Called via `Runtime.use()`, registers the LED mode, and does the @@ -109,5 +108,5 @@ class LEDMode : public kaleidoscope::Plugin, } }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope diff --git a/src/kaleidoscope/plugin/LEDModeInterface.cpp b/src/kaleidoscope/plugin/LEDModeInterface.cpp index a09180e2..998b24eb 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.cpp +++ b/src/kaleidoscope/plugin/LEDModeInterface.cpp @@ -25,5 +25,5 @@ void LEDModeInterface::activate() { LEDControl::activate(this); } -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope diff --git a/src/kaleidoscope/plugin/LEDModeInterface.h b/src/kaleidoscope/plugin/LEDModeInterface.h index 4d572fa9..2964760f 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.h +++ b/src/kaleidoscope/plugin/LEDModeInterface.h @@ -21,7 +21,6 @@ namespace plugin { class LEDModeInterface { public: - void activate(); // This auxiliary class helps to generate a verbose error message @@ -38,5 +37,5 @@ class LEDModeInterface { typedef NoLEDMode DynamicLEDMode; }; -} // namespace plugin -} // namespace kaleidoscope +} // namespace plugin +} // namespace kaleidoscope diff --git a/src/kaleidoscope/progmem_helpers.h b/src/kaleidoscope/progmem_helpers.h index 33e616d8..21ec46e8 100644 --- a/src/kaleidoscope/progmem_helpers.h +++ b/src/kaleidoscope/progmem_helpers.h @@ -21,16 +21,16 @@ // Load any intrinsic data type or trivial class stored in PROGMEM into an // object of that type in memory. -template -void loadFromProgmem(_Type const& pgm_object, _Type& object) { +template +void loadFromProgmem(_Type const &pgm_object, _Type &object) { memcpy_P(&object, &pgm_object, sizeof(object)); } // Copy an object from PROGMEM to RAM. This works as long as the type has a // suitable constructor that does not require arguments (i.e. "trivial classes") // or if `_Type` is an intrinsic data type. -template -_Type cloneFromProgmem(_Type const& pgm_object) { +template +_Type cloneFromProgmem(_Type const &pgm_object) { _Type object; memcpy_P(&object, &pgm_object, sizeof(object)); return object; diff --git a/src/kaleidoscope/util/crc16.h b/src/kaleidoscope/util/crc16.h index 4ff17823..896e1729 100644 --- a/src/kaleidoscope/util/crc16.h +++ b/src/kaleidoscope/util/crc16.h @@ -70,8 +70,7 @@ static inline uint16_t _crc_ccitt_update(uint16_t crc, uint8_t data) { data ^= (crc & 255); data ^= data << 4; - return ((((uint16_t)data << 8) | (crc >> 8)) ^ (uint8_t)(data >> 4) - ^ ((uint16_t)data << 3)); + return ((((uint16_t)data << 8) | (crc >> 8)) ^ (uint8_t)(data >> 4) ^ ((uint16_t)data << 3)); } static inline uint8_t _crc_ibutton_update(uint8_t crc, uint8_t data) __attribute__((always_inline, unused)); diff --git a/src/kaleidoscope/util/flasher/Base.h b/src/kaleidoscope/util/flasher/Base.h index fd7e7bc3..ce4772dd 100644 --- a/src/kaleidoscope/util/flasher/Base.h +++ b/src/kaleidoscope/util/flasher/Base.h @@ -25,31 +25,31 @@ namespace util { namespace flasher { struct BaseProps { - static constexpr uint8_t page_size = 64; + static constexpr uint8_t page_size = 64; static constexpr uint8_t frame_size = 16; - static constexpr uint8_t blank = 0xff; - static constexpr uint8_t delay = 1; + static constexpr uint8_t blank = 0xff; + static constexpr uint8_t delay = 1; static struct command { - static constexpr uint8_t page_address = 0x01; - static constexpr uint8_t continue_page = 0x02; - static constexpr uint8_t execute = 0x03; - static constexpr uint8_t erase_program = 0x04; + static constexpr uint8_t page_address = 0x01; + static constexpr uint8_t continue_page = 0x02; + static constexpr uint8_t execute = 0x03; + static constexpr uint8_t erase_program = 0x04; static constexpr uint8_t get_version_and_crc = 0x06; } command; }; -template +template class Base { public: Base() {} - template - static uint8_t flash(uint8_t address, T& firmware) { + template + static uint8_t flash(uint8_t address, T &firmware) { return 0; } - template - static uint8_t verify(uint8_t address, T& firmware) { + template + static uint8_t verify(uint8_t address, T &firmware) { return 0; } static uint8_t command(uint8_t address, uint8_t command) { diff --git a/src/kaleidoscope/util/flasher/KeyboardioI2CBootloader.h b/src/kaleidoscope/util/flasher/KeyboardioI2CBootloader.h index 03758e6a..a4b95fba 100644 --- a/src/kaleidoscope/util/flasher/KeyboardioI2CBootloader.h +++ b/src/kaleidoscope/util/flasher/KeyboardioI2CBootloader.h @@ -31,11 +31,11 @@ namespace kaleidoscope { namespace util { namespace flasher { -template -class KeyboardioI2CBootloader: kaleidoscope::util::flasher::Base<_Props> { +template +class KeyboardioI2CBootloader : kaleidoscope::util::flasher::Base<_Props> { public: - template - static bool flash(uint8_t address, T& firmware) { + template + static bool flash(uint8_t address, T &firmware) { if (!verify(address, firmware)) { return false; } @@ -53,8 +53,8 @@ class KeyboardioI2CBootloader: kaleidoscope::util::flasher::Base<_Props> { return command(address, _Props::command.execute) == 0 ? true : false; } - template - static bool verify(uint8_t address, T& firmware) { + template + static bool verify(uint8_t address, T &firmware) { CRCAndVersion crc_and_version = get_version(address, firmware); return (crc_and_version.version != 0xff) && (crc_and_version.crc != 0xffff); } @@ -75,15 +75,16 @@ class KeyboardioI2CBootloader: kaleidoscope::util::flasher::Base<_Props> { static uint8_t read_crc16(uint8_t addr, CRCAndVersion *crc_and_version, - uint16_t offset, uint16_t length) { + uint16_t offset, + uint16_t length) { uint8_t result; Wire.beginTransmission(addr); Wire.write(_Props::command.get_version_and_crc); - Wire.write(offset & 0xff); // addr (lo) - Wire.write(offset >> 8); // addr (hi) - Wire.write(length & 0xff); // len (lo) - Wire.write(length >> 8); // len (hi) + Wire.write(offset & 0xff); // addr (lo) + Wire.write(offset >> 8); // addr (hi) + Wire.write(length & 0xff); // len (lo) + Wire.write(length >> 8); // len (hi) result = Wire.endTransmission(false); if (result != 0) { return result; @@ -93,7 +94,7 @@ class KeyboardioI2CBootloader: kaleidoscope::util::flasher::Base<_Props> { delay(100); Wire.requestFrom(addr, 3); - uint8_t v = Wire.read(); + uint8_t v = Wire.read(); crc_and_version->version = v; if (Wire.available() == 0) { return 0xFF; @@ -110,8 +111,8 @@ class KeyboardioI2CBootloader: kaleidoscope::util::flasher::Base<_Props> { return result; } - template - static CRCAndVersion get_version(uint8_t addr, T& firmware) { + template + static CRCAndVersion get_version(uint8_t addr, T &firmware) { static CRCAndVersion crc_and_version = {0xff, 0xff}; // This here to resolve some weird I2C startup bug. @@ -119,15 +120,13 @@ class KeyboardioI2CBootloader: kaleidoscope::util::flasher::Base<_Props> { // address and the CRC request (0x06), the CRC parameters are never written // doing a read first seems to let things settle in a way that allows the // right to respond correctly - Wire.requestFrom(addr, (uint8_t) 3); + Wire.requestFrom(addr, (uint8_t)3); while (Wire.available()) { // throw away the info, as cksum calculation request has yet to be issued. Wire.read(); } - int result = read_crc16(addr, &crc_and_version, - firmware.offsets[0] + 4, - firmware.length - 4); + int result = read_crc16(addr, &crc_and_version, firmware.offsets[0] + 4, firmware.length - 4); return crc_and_version; } @@ -142,8 +141,8 @@ class KeyboardioI2CBootloader: kaleidoscope::util::flasher::Base<_Props> { return result != 0; } - template - static bool write_firmware(uint8_t addr, T& firmware) { + template + static bool write_firmware(uint8_t addr, T &firmware) { uint8_t result; uint8_t o = 0; @@ -180,7 +179,7 @@ class KeyboardioI2CBootloader: kaleidoscope::util::flasher::Base<_Props> { // write the CRC16, little end first Wire.write(crc16 & 0xff); Wire.write(crc16 >> 8); - Wire.write(0x00); // dummy end uint8_t + Wire.write(0x00); // dummy end uint8_t result = Wire.endTransmission(); // got something other than NACK. Start over. if (result != 3) { @@ -193,16 +192,15 @@ class KeyboardioI2CBootloader: kaleidoscope::util::flasher::Base<_Props> { return true; } - template - static bool verify_firmware(uint8_t addr, T& firmware) { + template + static bool verify_firmware(uint8_t addr, T &firmware) { uint8_t result = 3; CRCAndVersion crc_and_version; while (result != 0) { // skip the first 4 uint8_ts, are they were probably overwritten by the // reset vector preservation - result = read_crc16(addr, &crc_and_version, - firmware.offsets[0] + 4, firmware.length - 4); + result = read_crc16(addr, &crc_and_version, firmware.offsets[0] + 4, firmware.length - 4); if (result != 0) { delay(100); continue; @@ -217,7 +215,6 @@ class KeyboardioI2CBootloader: kaleidoscope::util::flasher::Base<_Props> { return crc_and_version.crc == check_crc16; } - }; } // namespace flasher diff --git a/src/kaleidoscope/version.h b/src/kaleidoscope/version.h index 97cf4171..ff58d767 100644 --- a/src/kaleidoscope/version.h +++ b/src/kaleidoscope/version.h @@ -1,5 +1,7 @@ // -*- mode: c++ -*- +// clang-format off + #pragma once // We use `include-what-you-use`, which uses `clang` to help manage header diff --git a/src/kaleidoscope_internal/LEDModeManager.cpp b/src/kaleidoscope_internal/LEDModeManager.cpp index 4c42351c..33a66652 100644 --- a/src/kaleidoscope_internal/LEDModeManager.cpp +++ b/src/kaleidoscope_internal/LEDModeManager.cpp @@ -27,7 +27,7 @@ namespace { // internal state of the LED mode management lives in // an anonymous namespace. -uint8_t cur_mode_id = 255; // We use 255 as a flag value that signals +uint8_t cur_mode_id = 255; // We use 255 as a flag value that signals // uninitialized. That's why we can only have // LED mode ids in the range [0..254]. @@ -86,7 +86,7 @@ kaleidoscope::plugin::LEDMode *LEDModeManager::getLEDMode(uint8_t mode_id) { // if (fac.isPersistentLEDMode()) { current_led_mode_dynamic = false; - cur_led_mode = fac.getPersistentLEDMode(); + cur_led_mode = fac.getPersistentLEDMode(); } else { current_led_mode_dynamic = true; @@ -102,5 +102,5 @@ kaleidoscope::plugin::LEDMode *LEDModeManager::getLEDMode(uint8_t mode_id) { return cur_led_mode; } -} // namespace internal -} // namespace kaleidoscope +} // namespace internal +} // namespace kaleidoscope diff --git a/src/kaleidoscope_internal/LEDModeManager.h b/src/kaleidoscope_internal/LEDModeManager.h index 2bab69b1..245f5638 100644 --- a/src/kaleidoscope_internal/LEDModeManager.h +++ b/src/kaleidoscope_internal/LEDModeManager.h @@ -16,16 +16,16 @@ #pragma once -#include // for PROGMEM -#include // for size_t -#include // for uint8_t +#include // for PROGMEM +#include // for size_t +#include // for uint8_t // IWYU pragma: no_include #include "kaleidoscope/macro_helpers.h" // for __NL__ #include "kaleidoscope/plugin.h" // for Plugin #include "kaleidoscope/plugin/LEDMode.h" // for LEDMode #include "kaleidoscope/plugin/LEDModeInterface.h" // for LEDModeInt... -#include "kaleidoscope_internal/array_like_storage.h" // IWYU pragma: keep +#include "kaleidoscope_internal/array_like_storage.h" // IWYU pragma: keep #include "kaleidoscope_internal/type_traits/has_method.h" // for DEFINE_HAS... #if defined(KALEIDOSCOPE_VIRTUAL_BUILD) || defined(ARDUINO_ARCH_STM32) @@ -35,7 +35,7 @@ // To enable placement new, we need to supply a global operator // function. // -inline void* operator new (size_t, void* __p) throw() { +inline void *operator new(size_t, void *__p) throw() { return __p; } #endif @@ -47,12 +47,13 @@ namespace plugin { class LEDControl; class LEDModeInterface; -} // namespace plugin +} // namespace plugin namespace internal { namespace led_mode_management { -template struct Bool2Type {}; +template +struct Bool2Type {}; // Functions of this type allocate a new LED mode within a global // buffer and give it access to it's parent plugin. @@ -68,11 +69,9 @@ template struct Bool2Type {}; // a polymorphic class with only one method, that is accessed directly // instead of the detour via the vtable. // -typedef kaleidoscope::plugin::LEDMode* -(*LEDModeFactoryFunc)(void *raw_buffer, - kaleidoscope::plugin::LEDModeInterface *parent_plugin, - uint8_t mode_id - ); +typedef kaleidoscope::plugin::LEDMode *(*LEDModeFactoryFunc)(void *raw_buffer, + kaleidoscope::plugin::LEDModeInterface *parent_plugin, + uint8_t mode_id); template inline void registerLEDModeActivated(Bool2Type, @@ -89,8 +88,11 @@ inline void registerLEDModeActivated(Bool2Type, } DEFINE_HAS_METHOD_TRAITS(Plugin, - /* registerLEDModeActivated not templated */ (), (), - registerLEDModeActivated, void, (uint8_t led_mode_id)) + /* registerLEDModeActivated not templated */ (), + (), + registerLEDModeActivated, + void, + (uint8_t led_mode_id)) // A templated implementation of LEDModeFactoryFunc. // @@ -111,12 +113,11 @@ template static kaleidoscope::plugin::LEDMode * generateLEDMode(void *raw_buffer, kaleidoscope::plugin::LEDModeInterface *parent_plugin, - uint8_t mode_id - ) { + uint8_t mode_id) { // We know the type of the parent plugin via the template parameter // ParentPlugin__, thus it is safe to cast to the actual type. // - auto parent_plugin_actual = static_cast(parent_plugin); + auto parent_plugin_actual = static_cast(parent_plugin); // Types defined by template parameters like ParentPlugin__ must // be declared explicitly using the "typename" keyword. @@ -127,18 +128,17 @@ generateLEDMode(void *raw_buffer, // Generate a transient LED mode within the LED mode buffer. // - auto led_mode_ptr - = new (raw_buffer) TLM{parent_plugin_actual}; + auto led_mode_ptr = new (raw_buffer) TLM{parent_plugin_actual}; - constexpr bool accesses_transient_led_mode - = Plugin_HasMethod_registerLEDModeActivated::value; + constexpr bool accesses_transient_led_mode = Plugin_HasMethod_registerLEDModeActivated::value; // Register the newly created LED mode with its parent plugin. // Please note that this call is optimized away by the compiler // for all those plugins that do not reimplement registerLEDModeActivated. // registerLEDModeActivated(Bool2Type(), - parent_plugin_actual, mode_id); + parent_plugin_actual, + mode_id); return led_mode_ptr; } @@ -158,7 +158,7 @@ struct LEDModeFactory { } kaleidoscope::plugin::LEDMode *getPersistentLEDMode() const { - return static_cast(parent_plugin_); + return static_cast(parent_plugin_); } kaleidoscope::plugin::LEDMode *generateTransientLEDMode( @@ -177,10 +177,12 @@ struct LEDModeFactory { // The traits class remove_pointer is part of the C++ standard library // but not present on Arduino. // -template< class T > struct remove_pointer { +template +struct remove_pointer { typedef T type; }; -template< class T > struct remove_pointer { +template +struct remove_pointer { typedef T type; }; @@ -237,7 +239,7 @@ constexpr bool pluginControlsLEDMode(int led_mode_plugin_type) { template struct GenerateLEDModeFactory { - static constexpr LEDModeFactory apply(kaleidoscope::Plugin */* non LED mode plugin*/) { + static constexpr LEDModeFactory apply(kaleidoscope::Plugin * /* non LED mode plugin*/) { return LEDModeFactory{nullptr, nullptr}; } }; @@ -253,7 +255,7 @@ struct GenerateLEDModeFactory { static constexpr LEDModeFactory apply(Plugin__ *plugin) { return LEDModeFactory{ plugin, - generateLEDMode // pointer to template instantiation of + generateLEDMode // pointer to template instantiation of // generateLEDMode<...> }; } @@ -295,10 +297,9 @@ struct TransientLEDModeSize { // in this check as it is an empty class (size == 1 byte) and // thus does not affect the maximum size computation. // -template +template struct TransientLEDModeMaxSize { - static constexpr size_t this_size - = TransientLEDModeSize::value; + static constexpr size_t this_size = TransientLEDModeSize::value; static constexpr size_t nested_size = TransientLEDModeMaxSize::value; @@ -312,11 +313,10 @@ struct TransientLEDModeMaxSize { static constexpr size_t value = TransientLEDModeSize::value; }; -} // namespace led_mode_management +} // namespace led_mode_management class LEDModeManager { public: - // Everything in this class private on purpose. // // Only the class LEDControl is supposed to gain @@ -352,8 +352,6 @@ class LEDModeManager { #endif private: - - // For the sake of convenience make type LEDModeFactory // available in class namespace // @@ -375,13 +373,15 @@ class LEDModeManager { persistent_led_mode->setup(); } - static void setupLEDMode(kaleidoscope::Plugin */*not_a_persistent_led_mode*/) {} + static void setupLEDMode(kaleidoscope::Plugin * /*not_a_persistent_led_mode*/) {} static uint8_t led_mode_buffer_[]; }; -} // namespace internal -} // namespace kaleidoscope +} // namespace internal +} // namespace kaleidoscope + +// clang-format off // Some auxiliary macros that are mapped to the list of // plugins defined via KALEIDOSCOPE_INIT_PLUGINS follow. diff --git a/src/kaleidoscope_internal/array_like_storage.h b/src/kaleidoscope_internal/array_like_storage.h index 855ff5e2..76485fbc 100644 --- a/src/kaleidoscope_internal/array_like_storage.h +++ b/src/kaleidoscope_internal/array_like_storage.h @@ -29,54 +29,49 @@ namespace internal { // template + bool... MoreTypeInfo__> class ArrayLikeStorage { public: - typedef ArrayLikeStorage NestedArray; - template - constexpr ArrayLikeStorage(StoredType__ entry, MoreEntities__...more_entities) + template + constexpr ArrayLikeStorage(StoredType__ entry, MoreEntities__... more_entities) : entry_(entry), nested_array_(more_entities...) {} - static constexpr uint8_t n_entries - = NestedArray::n_entries + 1; + static constexpr uint8_t n_entries = NestedArray::n_entries + 1; typedef StoredType__ ContentType; private: StoredType__ entry_; NestedArray nested_array_; -} __attribute__((packed)); // Make sure that there are no padding +} __attribute__((packed)); // Make sure that there are no padding // bytes added by the compiler. // This is important to let the class // have the same layout as a POD array. template + bool... MoreTypeInfo__> class ArrayLikeStorage { + false /* Not of appropriate type */, + MoreTypeInfo__...> { public: - typedef ArrayLikeStorage NestedArray; - template - constexpr ArrayLikeStorage(AnyType__/* non-matching entity */, - MoreEntities__...more_entities) + template + constexpr ArrayLikeStorage(AnyType__ /* non-matching entity */, + MoreEntities__... more_entities) : nested_array_(more_entities...) {} - static constexpr uint8_t n_entries - = NestedArray::n_entries; + static constexpr uint8_t n_entries = NestedArray::n_entries; typedef StoredType__ ContentType; private: - NestedArray nested_array_; } __attribute__((packed)); @@ -84,10 +79,8 @@ template struct ArrayLikeStorage { public: - explicit constexpr ArrayLikeStorage(StoredType__ entry) - : entry_(entry) - {} + : entry_(entry) {} static constexpr uint8_t n_entries = 1; @@ -101,14 +94,13 @@ template struct ArrayLikeStorage { public: - template - explicit constexpr ArrayLikeStorage(AnyType__/* non-matching entity */) {} + explicit constexpr ArrayLikeStorage(AnyType__ /* non-matching entity */) {} static constexpr uint8_t n_entries = 0; typedef StoredType__ ContentType; } __attribute__((packed)); -} // namespace internal -} // namespace kaleidoscope +} // namespace internal +} // namespace kaleidoscope diff --git a/src/kaleidoscope_internal/compiler_warnings.h b/src/kaleidoscope_internal/compiler_warnings.h index 526abaee..cd4ddd82 100644 --- a/src/kaleidoscope_internal/compiler_warnings.h +++ b/src/kaleidoscope_internal/compiler_warnings.h @@ -14,8 +14,12 @@ * this program. If not, see . */ +// clang-format off + #pragma once +#include "kaleidoscope/macro_helpers.h" // for __NL__ + // Please note that due to a bug in older gcc versions the following // warning suppressions mechanism does not work for gcc versions below 6.1. diff --git a/src/kaleidoscope_internal/deprecations.h b/src/kaleidoscope_internal/deprecations.h index 5cedea76..ff38a46a 100644 --- a/src/kaleidoscope_internal/deprecations.h +++ b/src/kaleidoscope_internal/deprecations.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include "kaleidoscope/macro_helpers.h" diff --git a/src/kaleidoscope_internal/event_dispatch.h b/src/kaleidoscope_internal/event_dispatch.h index 0e58d9d4..c2594283 100644 --- a/src/kaleidoscope_internal/event_dispatch.h +++ b/src/kaleidoscope_internal/event_dispatch.h @@ -31,6 +31,8 @@ * generated code in an entirely different namespace. */ +// clang-format off + #pragma once #include "kaleidoscope/event_handlers.h" diff --git a/src/kaleidoscope_internal/eventhandler_signature_check.h b/src/kaleidoscope_internal/eventhandler_signature_check.h index 117e70c3..9269023c 100644 --- a/src/kaleidoscope_internal/eventhandler_signature_check.h +++ b/src/kaleidoscope_internal/eventhandler_signature_check.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include "kaleidoscope/event_handlers.h" // for _PROCESS_E... diff --git a/src/kaleidoscope_internal/shortname.h b/src/kaleidoscope_internal/shortname.h index caaedac4..80f6fa88 100644 --- a/src/kaleidoscope_internal/shortname.h +++ b/src/kaleidoscope_internal/shortname.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once /* diff --git a/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h b/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h index eb49fc0f..005e0b1b 100644 --- a/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h +++ b/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h @@ -16,13 +16,13 @@ #pragma once -#include // for uint8_t +#include // for uint8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr #include "kaleidoscope/key_defs.h" // for Key, Key_NoKey -namespace kaleidoscope { // NOLINT(build/namespaces) -namespace sketch_exploration { // NOLINT(build/namespaces) +namespace kaleidoscope { // NOLINT(build/namespaces) +namespace sketch_exploration { // NOLINT(build/namespaces) // A simple keymap adaptor class that makes the keymap conveniently accessible. // at compiletime. @@ -30,17 +30,14 @@ namespace sketch_exploration { // NOLINT(build/namespaces) template class KeymapAdaptor { private: - - const Key(&keymap_)[_n_layers][_layer_size]; + const Key (&keymap_)[_n_layers][_layer_size]; public: - - static constexpr uint8_t n_layers = _n_layers; + static constexpr uint8_t n_layers = _n_layers; static constexpr uint8_t layer_size = _layer_size; - explicit constexpr KeymapAdaptor(const Key(&keymap)[_n_layers][_layer_size]) - : keymap_{keymap} - {} + explicit constexpr KeymapAdaptor(const Key (&keymap)[_n_layers][_layer_size]) + : keymap_{keymap} {} constexpr Key getKey(uint8_t layer, uint8_t offset) const { return keymap_[layer][offset]; @@ -54,8 +51,7 @@ class KeymapAdaptor { // class EmptyKeymapAdaptor { public: - - static constexpr uint8_t n_layers = 0; + static constexpr uint8_t n_layers = 0; static constexpr uint8_t layer_size = 0; constexpr Key getKey(uint8_t layer, uint8_t offset) const { @@ -74,36 +70,32 @@ class EmptyKeymapAdaptor { template class AccumulationHelper : public KeymapAdaptor<_n_layers, _layer_size> { private: - const _Accumulation &op_; private: - typedef typename _Accumulation::ResultType ResultType; constexpr ResultType accumulateOnLayer(uint8_t layer, uint8_t offset) const { return (offset >= _layer_size) - ? op_.init_value - : op_.apply(this->getKey(layer, offset), - this->accumulateOnLayer(layer, offset + 1)); + ? op_.init_value + : op_.apply(this->getKey(layer, offset), + this->accumulateOnLayer(layer, offset + 1)); } constexpr ResultType accumulate(uint8_t layer) const { return (layer >= _n_layers) - ? op_.init_value - : op_.apply(this->accumulateOnLayer(layer, 0), + ? op_.init_value + : op_.apply(this->accumulateOnLayer(layer, 0), this->accumulate(layer + 1)); } public: - typedef KeymapAdaptor<_n_layers, _layer_size> ParentType; - constexpr AccumulationHelper(const Key(&keymap)[_n_layers][_layer_size], + constexpr AccumulationHelper(const Key (&keymap)[_n_layers][_layer_size], const _Accumulation &op) - : ParentType{keymap}, - op_{op} - {} + : ParentType{keymap}, + op_{op} {} constexpr ResultType apply() const { return this->accumulate(0); @@ -115,16 +107,13 @@ class AccumulationHelper : public KeymapAdaptor<_n_layers, _layer_size> { template class EmptyKeymapAccumulationHelper { private: - const _Accumulation &op_; typedef typename _Accumulation::ResultType ResultType; public: - explicit constexpr EmptyKeymapAccumulationHelper(const _Accumulation &op) - : op_{op} - {} + : op_{op} {} constexpr ResultType apply() const { return op_.init_value; @@ -150,7 +139,8 @@ struct NumKeysEqual { typedef uint8_t ResultType; static constexpr ResultType init_value = 0; - explicit constexpr NumKeysEqual(Key k) : k_{k} {} + explicit constexpr NumKeysEqual(Key k) + : k_{k} {} constexpr ResultType apply(Key test_key, ResultType r) const { return (test_key == k_) ? r + 1 : r; @@ -166,7 +156,8 @@ struct HasKey { typedef bool ResultType; static constexpr ResultType init_value = false; - explicit constexpr HasKey(Key k) : k_{k} {} + explicit constexpr HasKey(Key k) + : k_{k} {} constexpr ResultType apply(Key test_key, ResultType r) const { return (test_key == k_) ? true : r; @@ -208,6 +199,8 @@ extern void pluginsExploreSketch(); // //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// clang-format off + // This macro defines a Sketch interface class that is passed to the // exploreSketch<_Sketch>(...)-hook. // @@ -302,5 +295,7 @@ extern void pluginsExploreSketch(); } /* namespace sketch_exploration */ \ } /* namespace kaleidoscope */ -} // namespace sketch_exploration -} // namespace kaleidoscope +// clang-format on + +} // namespace sketch_exploration +} // namespace kaleidoscope diff --git a/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h b/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h index e2085454..19084978 100644 --- a/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h +++ b/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h @@ -25,26 +25,25 @@ namespace sketch_exploration { struct EmptyPluginTypeList { typedef void Plugin; typedef EmptyPluginTypeList Next; - static constexpr int size = 0; + static constexpr int size = 0; static constexpr bool is_last = true; }; template struct BareType { - typedef typename std::remove_const < - typename std::remove_reference<_T>::type - >::type Type; + typedef typename std::remove_const< + typename std::remove_reference<_T>::type>::type Type; }; -template +template struct PluginTypeList { typedef typename BareType<_Plugin>::Type Plugin; static constexpr int id = _id; - typedef PluginTypeList < _id + 1, _MorePlugins... > Next; + typedef PluginTypeList<_id + 1, _MorePlugins...> Next; - static constexpr int size = 1 + Next::size; + static constexpr int size = 1 + Next::size; static constexpr bool is_last = false; }; @@ -56,22 +55,22 @@ struct PluginTypeList<_id, _Plugin> { typedef EmptyPluginTypeList Next; - static constexpr int size = 1; + static constexpr int size = 1; static constexpr bool is_last = true; }; -template -auto makePluginTypeList(const _Plugins&...p) -> PluginTypeList<0, _Plugins...> {} +template +auto makePluginTypeList(const _Plugins &...p) -> PluginTypeList<0, _Plugins...> {} template struct Entry { - typedef typename Entry < _PluginTypeList, _id - 1 >::Next::Plugin Type; - typedef typename Entry < _PluginTypeList, _id - 1 >::Next::Next Next; + typedef typename Entry<_PluginTypeList, _id - 1>::Next::Plugin Type; + typedef typename Entry<_PluginTypeList, _id - 1>::Next::Next Next; - static constexpr int id = Entry < _PluginTypeList, _id - 1 >::id + 1; + static constexpr int id = Entry<_PluginTypeList, _id - 1>::id + 1; static_assert(id == _id, ""); - static constexpr bool is_last = Entry < _PluginTypeList, _id - 1 >::Next::is_last; + static constexpr bool is_last = Entry<_PluginTypeList, _id - 1>::Next::is_last; }; template @@ -79,7 +78,7 @@ struct Entry<_PluginTypeList, 0> { typedef typename _PluginTypeList::Plugin Type; typedef typename _PluginTypeList::Next Next; - static constexpr int id = 0; + static constexpr int id = 0; static constexpr bool is_last = _PluginTypeList::is_last; }; @@ -87,48 +86,45 @@ template struct OccurrencesAux { static constexpr int value = (std::is_same::Type, _WantedPlugin>::value) - ? OccurrencesAux < _PluginTypeList, _WantedPlugin, _id - 1 >::value + 1 - : OccurrencesAux < _PluginTypeList, _WantedPlugin, _id - 1 >::value; + ? OccurrencesAux<_PluginTypeList, _WantedPlugin, _id - 1>::value + 1 + : OccurrencesAux<_PluginTypeList, _WantedPlugin, _id - 1>::value; }; template struct OccurrencesAux<_PluginTypeList, _WantedPlugin, 0> { - static constexpr int value - = (std::is_same::Type, _WantedPlugin>::value) - ? 1 - : 0; + static constexpr int value = (std::is_same::Type, _WantedPlugin>::value) + ? 1 + : 0; }; template struct Occurrences - : public OccurrencesAux < _PluginTypeList, _WantedPlugin, _PluginTypeList::size - 1 > {}; + : public OccurrencesAux<_PluginTypeList, _WantedPlugin, _PluginTypeList::size - 1> {}; template struct PluginPositionAux { static constexpr int value = - (PluginPositionAux < _PluginTypeList, _WantedPlugin, _id - 1 >::value != -1) - ? PluginPositionAux < _PluginTypeList, _WantedPlugin, _id - 1 >::value + (PluginPositionAux<_PluginTypeList, _WantedPlugin, _id - 1>::value != -1) + ? PluginPositionAux<_PluginTypeList, _WantedPlugin, _id - 1>::value : (std::is_same::Type, _WantedPlugin>::value) - ? _id - : -1; + ? _id + : -1; }; template struct PluginPositionAux<_PluginTypeList, _WantedPlugin, 0> { - static constexpr int value - = (std::is_same::Type, _WantedPlugin>::value) - ? 0 - : -1; + static constexpr int value = (std::is_same::Type, _WantedPlugin>::value) + ? 0 + : -1; }; template struct PluginPosition - : public PluginPositionAux < _PluginTypeList, _WantedPlugin, _PluginTypeList::size - 1 > {}; + : public PluginPositionAux<_PluginTypeList, _WantedPlugin, _PluginTypeList::size - 1> {}; template struct IsRegistered { - static constexpr bool value - = (PluginPosition<_PluginTypeList, _WantedPlugin>::value != -1); + static constexpr bool value = (PluginPosition<_PluginTypeList, _WantedPlugin>::value != -1); }; template @@ -153,8 +149,10 @@ struct Plugins__ { using Occurrences = Occurrences<_PluginTypeList, _PluginType>; }; -} // namespace sketch_exploration -} // namespace kaleidoscope +} // namespace sketch_exploration +} // namespace kaleidoscope + +// clang-format off #define _FIX_PLUGIN_TYPE_AND_NAME_AMBIGUITIES(T) T diff --git a/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.cpp b/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.cpp index 6338c377..54ca9db6 100644 --- a/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.cpp +++ b/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.cpp @@ -20,8 +20,7 @@ namespace sketch_exploration { // This empty weak symbol is necessary if the KEYMAP(...) macro // is not used in the sketch. // -__attribute__((weak)) -void pluginsExploreSketch() {} +__attribute__((weak)) void pluginsExploreSketch() {} -} // namespace sketch_exploration -} // namespace kaleidoscope +} // namespace sketch_exploration +} // namespace kaleidoscope diff --git a/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h b/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h index 75dd6760..7e0aafa3 100644 --- a/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h +++ b/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include "kaleidoscope_internal/sketch_exploration/keymap_exploration.h" diff --git a/src/kaleidoscope_internal/type_traits/has_member.h b/src/kaleidoscope_internal/type_traits/has_member.h index 62de2755..9e49cb88 100644 --- a/src/kaleidoscope_internal/type_traits/has_member.h +++ b/src/kaleidoscope_internal/type_traits/has_member.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include "kaleidoscope/macro_helpers.h" // for __NL__ diff --git a/src/kaleidoscope_internal/type_traits/has_method.h b/src/kaleidoscope_internal/type_traits/has_method.h index a0961543..298a53e0 100644 --- a/src/kaleidoscope_internal/type_traits/has_method.h +++ b/src/kaleidoscope_internal/type_traits/has_method.h @@ -14,6 +14,8 @@ * this program. If not, see . */ +// clang-format off + #pragma once #include "kaleidoscope/macro_helpers.h" // for __NL__, UNWRAP, ADD_TEMPLATE... diff --git a/test/MatrixAddr/test.cpp b/test/MatrixAddr/test.cpp index 1681c644..be5cf9f9 100644 --- a/test/MatrixAddr/test.cpp +++ b/test/MatrixAddr/test.cpp @@ -37,7 +37,7 @@ void testIndexedAccess() { template std::string typenameString() { std::string nameString; - char * name = 0; + char *name = 0; int status; name = abi::__cxa_demangle(typeid(MA__).name(), 0, 0, &status); if (name != 0) { @@ -54,7 +54,7 @@ void testRelation() { std::cout << "MA1:" << typenameString() << std::endl; logType(); - std::cout << "MA2:" << typenameString() << std::endl; + std::cout << "MA2:" << typenameString() << std::endl; logType(); MA1__ mAddr1(3, 5); diff --git a/testing/AbsoluteMouseReport.cpp b/testing/AbsoluteMouseReport.cpp index 0c1303af..7b9bc3da 100644 --- a/testing/AbsoluteMouseReport.cpp +++ b/testing/AbsoluteMouseReport.cpp @@ -26,9 +26,9 @@ namespace kaleidoscope { namespace testing { -AbsoluteMouseReport::AbsoluteMouseReport(const void* data) { - const ReportData& report_data = - *static_cast(data); +AbsoluteMouseReport::AbsoluteMouseReport(const void *data) { + const ReportData &report_data = + *static_cast(data); memcpy(&report_data_, &report_data, sizeof(report_data_)); timestamp_ = Runtime.millisAtCycleStart(); } diff --git a/testing/AbsoluteMouseReport.h b/testing/AbsoluteMouseReport.h index 71666ad8..887c2c1b 100644 --- a/testing/AbsoluteMouseReport.h +++ b/testing/AbsoluteMouseReport.h @@ -31,7 +31,7 @@ class AbsoluteMouseReport { static constexpr uint8_t kHidReportType = HID_REPORTID_MOUSE_ABSOLUTE; - AbsoluteMouseReport(const void* data); + AbsoluteMouseReport(const void *data); uint32_t Timestamp() const; std::vector Buttons() const; @@ -45,4 +45,4 @@ class AbsoluteMouseReport { }; } // namespace testing -} // namespce kaleidoscope +} // namespace kaleidoscope diff --git a/testing/ConsumerControlReport.cpp b/testing/ConsumerControlReport.cpp index ca2e0220..8239ae11 100644 --- a/testing/ConsumerControlReport.cpp +++ b/testing/ConsumerControlReport.cpp @@ -25,8 +25,8 @@ namespace kaleidoscope { namespace testing { ConsumerControlReport::ConsumerControlReport(const void *data) { - const ReportData& report_data = - *static_cast(data); + const ReportData &report_data = + *static_cast(data); memcpy(&report_data_, &report_data, sizeof(report_data_)); timestamp_ = Runtime.millisAtCycleStart(); } diff --git a/testing/ExpectedKeyboardReport.cpp b/testing/ExpectedKeyboardReport.cpp index 152a5af5..bf1f014a 100644 --- a/testing/ExpectedKeyboardReport.cpp +++ b/testing/ExpectedKeyboardReport.cpp @@ -22,12 +22,12 @@ namespace testing { ExpectedKeyboardReport::ExpectedKeyboardReport(uint32_t timestamp, const std::set &keycodes, std::string message) { - timestamp_ = timestamp; - keycodes_ = std::set(keycodes); + timestamp_ = timestamp; + keycodes_ = std::set(keycodes); failure_message_ = message; } -const std::set & ExpectedKeyboardReport::Keycodes() const { +const std::set &ExpectedKeyboardReport::Keycodes() const { return keycodes_; } @@ -35,7 +35,7 @@ uint32_t ExpectedKeyboardReport::Timestamp() const { return timestamp_; } -const std::string & ExpectedKeyboardReport::Message() const { +const std::string &ExpectedKeyboardReport::Message() const { return failure_message_; } diff --git a/testing/ExpectedKeyboardReport.h b/testing/ExpectedKeyboardReport.h index 85ef298c..ce967a7b 100644 --- a/testing/ExpectedKeyboardReport.h +++ b/testing/ExpectedKeyboardReport.h @@ -27,14 +27,14 @@ namespace testing { class ExpectedKeyboardReport { public: ExpectedKeyboardReport(uint32_t timestamp, - const std::set & keycodes, + const std::set &keycodes, std::string message = ""); - const std::set & Keycodes() const; + const std::set &Keycodes() const; uint32_t Timestamp() const; - const std::string & Message() const; + const std::string &Message() const; private: uint32_t timestamp_; diff --git a/testing/ExpectedMouseReport.cpp b/testing/ExpectedMouseReport.cpp index d59a7aed..fb85d7e5 100644 --- a/testing/ExpectedMouseReport.cpp +++ b/testing/ExpectedMouseReport.cpp @@ -21,23 +21,25 @@ namespace testing { ExpectedMouseReport::ExpectedMouseReport(uint32_t timestamp, uint8_t buttons, - int8_t x, int8_t y, - int8_t v, int8_t h, + int8_t x, + int8_t y, + int8_t v, + int8_t h, std::string message) { - timestamp_ = timestamp; + timestamp_ = timestamp; report_data_.buttons = buttons; - report_data_.xAxis = x; - report_data_.yAxis = y; - report_data_.vWheel = v; - report_data_.hWheel = h; - failure_message_ = message; + report_data_.xAxis = x; + report_data_.yAxis = y; + report_data_.vWheel = v; + report_data_.hWheel = h; + failure_message_ = message; } uint32_t ExpectedMouseReport::Timestamp() const { return timestamp_; } -const std::string & ExpectedMouseReport::Message() const { +const std::string &ExpectedMouseReport::Message() const { return failure_message_; } diff --git a/testing/ExpectedMouseReport.h b/testing/ExpectedMouseReport.h index cb511832..1d6f2e41 100644 --- a/testing/ExpectedMouseReport.h +++ b/testing/ExpectedMouseReport.h @@ -29,7 +29,11 @@ namespace testing { class ExpectedMouseReport { public: ExpectedMouseReport(uint32_t timestamp, - uint8_t buttons, int8_t x, int8_t y, int8_t v, int8_t h, + uint8_t buttons, + int8_t x, + int8_t y, + int8_t v, + int8_t h, std::string message = ""); uint8_t Buttons() const; @@ -40,7 +44,7 @@ class ExpectedMouseReport { uint32_t Timestamp() const; - const std::string & Message() const; + const std::string &Message() const; private: uint32_t timestamp_; diff --git a/testing/HIDState.cpp b/testing/HIDState.cpp index 8a4df87b..68c3fb4c 100644 --- a/testing/HIDState.cpp +++ b/testing/HIDState.cpp @@ -27,43 +27,43 @@ namespace kaleidoscope { namespace testing { -const std::vector& HIDState::AbsoluteMouse() const { +const std::vector &HIDState::AbsoluteMouse() const { return absolute_mouse_reports_; } -const AbsoluteMouseReport& HIDState::AbsoluteMouse(size_t i) const { +const AbsoluteMouseReport &HIDState::AbsoluteMouse(size_t i) const { return absolute_mouse_reports_.at(i); } -const std::vector& HIDState::ConsumerControl() const { +const std::vector &HIDState::ConsumerControl() const { return consumer_control_reports_; } -const ConsumerControlReport& HIDState::ConsumerControl(size_t i) const { +const ConsumerControlReport &HIDState::ConsumerControl(size_t i) const { return consumer_control_reports_.at(i); } -const std::vector& HIDState::Keyboard() const { +const std::vector &HIDState::Keyboard() const { return keyboard_reports_; } -const KeyboardReport& HIDState::Keyboard(size_t i) const { +const KeyboardReport &HIDState::Keyboard(size_t i) const { return keyboard_reports_.at(i); } -const std::vector& HIDState::Mouse() const { +const std::vector &HIDState::Mouse() const { return mouse_reports_; } -const MouseReport& HIDState::Mouse(size_t i) const { +const MouseReport &HIDState::Mouse(size_t i) const { return mouse_reports_.at(i); } -const std::vector& HIDState::SystemControl() const { +const std::vector &HIDState::SystemControl() const { return system_control_reports_; } -const SystemControlReport& HIDState::SystemControl(size_t i) const { +const SystemControlReport &HIDState::SystemControl(size_t i) const { return system_control_reports_.at(i); } @@ -71,7 +71,7 @@ namespace internal { // static void HIDStateBuilder::ProcessHidReport( - uint8_t id, const void* data, int len, int result) { + uint8_t id, const void *data, int len, int result) { switch (id) { case HID_REPORTID_KEYBOARD: { LOG(ERROR) << "Dropped BootKeyboardReport: unimplemented"; @@ -112,11 +112,11 @@ std::unique_ptr HIDStateBuilder::Snapshot() { // Populate state. // TODO: Grab a copy of current instantaneous state, like: // key states, layer stack, led states - hid_state->absolute_mouse_reports_ = std::move(absolute_mouse_reports_); + hid_state->absolute_mouse_reports_ = std::move(absolute_mouse_reports_); hid_state->consumer_control_reports_ = std::move(consumer_control_reports_); - hid_state->keyboard_reports_ = std::move(keyboard_reports_); - hid_state->mouse_reports_ = std::move(mouse_reports_); - hid_state->system_control_reports_ = std::move(system_control_reports_); + hid_state->keyboard_reports_ = std::move(keyboard_reports_); + hid_state->mouse_reports_ = std::move(mouse_reports_); + hid_state->system_control_reports_ = std::move(system_control_reports_); Clear(); // Clear global state. return hid_state; @@ -132,27 +132,27 @@ void HIDStateBuilder::Clear() { } // static -void HIDStateBuilder::ProcessAbsoluteMouseReport(const AbsoluteMouseReport& report) { +void HIDStateBuilder::ProcessAbsoluteMouseReport(const AbsoluteMouseReport &report) { absolute_mouse_reports_.push_back(report); } // static -void HIDStateBuilder::ProcessConsumerControlReport(const ConsumerControlReport& report) { +void HIDStateBuilder::ProcessConsumerControlReport(const ConsumerControlReport &report) { consumer_control_reports_.push_back(report); } // static -void HIDStateBuilder::ProcessKeyboardReport(const KeyboardReport& report) { +void HIDStateBuilder::ProcessKeyboardReport(const KeyboardReport &report) { keyboard_reports_.push_back(report); } // static -void HIDStateBuilder::ProcessMouseReport(const MouseReport& report) { +void HIDStateBuilder::ProcessMouseReport(const MouseReport &report) { mouse_reports_.push_back(report); } // static -void HIDStateBuilder::ProcessSystemControlReport(const SystemControlReport& report) { +void HIDStateBuilder::ProcessSystemControlReport(const SystemControlReport &report) { system_control_reports_.push_back(report); } @@ -167,6 +167,6 @@ std::vector HIDStateBuilder::mouse_reports_; // static std::vector HIDStateBuilder::system_control_reports_; -} // namesapce internal +} // namespace internal } // namespace testing } // namespace kaleidoscope diff --git a/testing/HIDState.h b/testing/HIDState.h index e585fc8e..9b93e770 100644 --- a/testing/HIDState.h +++ b/testing/HIDState.h @@ -34,20 +34,20 @@ class HIDStateBuilder; class HIDState { public: - const std::vector& AbsoluteMouse() const; - const AbsoluteMouseReport& AbsoluteMouse(size_t i) const; + const std::vector &AbsoluteMouse() const; + const AbsoluteMouseReport &AbsoluteMouse(size_t i) const; - const std::vector& ConsumerControl() const; - const ConsumerControlReport& ConsumerControl(size_t i) const; + const std::vector &ConsumerControl() const; + const ConsumerControlReport &ConsumerControl(size_t i) const; - const std::vector& Keyboard() const; - const KeyboardReport& Keyboard(size_t i) const; + const std::vector &Keyboard() const; + const KeyboardReport &Keyboard(size_t i) const; - const std::vector& Mouse() const; - const MouseReport& Mouse(size_t i) const; + const std::vector &Mouse() const; + const MouseReport &Mouse(size_t i) const; - const std::vector& SystemControl() const; - const SystemControlReport& SystemControl(size_t i) const; + const std::vector &SystemControl() const; + const SystemControlReport &SystemControl(size_t i) const; private: friend class internal::HIDStateBuilder; @@ -64,17 +64,17 @@ namespace internal { class HIDStateBuilder { public: static void ProcessHidReport( - uint8_t id, const void* data, int len, int result); + uint8_t id, const void *data, int len, int result); static std::unique_ptr Snapshot(); private: static void Clear(); - static void ProcessAbsoluteMouseReport(const AbsoluteMouseReport& report); - static void ProcessConsumerControlReport(const ConsumerControlReport& report); - static void ProcessKeyboardReport(const KeyboardReport& report); - static void ProcessMouseReport(const MouseReport& report); - static void ProcessSystemControlReport(const SystemControlReport& report); + static void ProcessAbsoluteMouseReport(const AbsoluteMouseReport &report); + static void ProcessConsumerControlReport(const ConsumerControlReport &report); + static void ProcessKeyboardReport(const KeyboardReport &report); + static void ProcessMouseReport(const MouseReport &report); + static void ProcessSystemControlReport(const SystemControlReport &report); static std::vector absolute_mouse_reports_; static std::vector consumer_control_reports_; diff --git a/testing/KeyboardReport.cpp b/testing/KeyboardReport.cpp index 873dd648..89bf822f 100644 --- a/testing/KeyboardReport.cpp +++ b/testing/KeyboardReport.cpp @@ -24,9 +24,9 @@ namespace kaleidoscope { namespace testing { -KeyboardReport::KeyboardReport(const void* data) { - const ReportData& report_data = - *static_cast(data); +KeyboardReport::KeyboardReport(const void *data) { + const ReportData &report_data = + *static_cast(data); memcpy(&report_data_, &report_data, sizeof(report_data_)); timestamp_ = Runtime.millisAtCycleStart(); } @@ -37,7 +37,7 @@ uint32_t KeyboardReport::Timestamp() const { std::vector KeyboardReport::ActiveKeycodes() const { auto keycodes = ActiveNonModifierKeycodes(); - auto mods = ActiveModifierKeycodes(); + auto mods = ActiveModifierKeycodes(); keycodes.insert(keycodes.end(), mods.begin(), mods.end()); return keycodes; } @@ -62,7 +62,7 @@ std::vector KeyboardReport::ActiveNonModifierKeycodes() const { std::vector active_keycodes; for (uint8_t i = 0; i < HID_LAST_KEY; ++i) { - uint8_t bit = 1 << (uint8_t(i) % 8); + uint8_t bit = 1 << (uint8_t(i) % 8); uint8_t keycode = report_data_.keys[i / 8] & bit; if (keycode) active_keycodes.push_back(i); } diff --git a/testing/KeyboardReport.h b/testing/KeyboardReport.h index 29c41c70..a798d28c 100644 --- a/testing/KeyboardReport.h +++ b/testing/KeyboardReport.h @@ -31,7 +31,7 @@ class KeyboardReport { static constexpr uint8_t kHidReportType = HID_REPORTID_NKRO_KEYBOARD; - KeyboardReport(const void* data); + KeyboardReport(const void *data); uint32_t Timestamp() const; std::vector ActiveKeycodes() const; diff --git a/testing/MouseReport.cpp b/testing/MouseReport.cpp index 25077b44..49bb9121 100644 --- a/testing/MouseReport.cpp +++ b/testing/MouseReport.cpp @@ -26,9 +26,9 @@ namespace kaleidoscope { namespace testing { -MouseReport::MouseReport(const void* data) { - const ReportData& report_data = - *static_cast(data); +MouseReport::MouseReport(const void *data) { + const ReportData &report_data = + *static_cast(data); memcpy(&report_data_, &report_data, sizeof(report_data_)); timestamp_ = Runtime.millisAtCycleStart(); } diff --git a/testing/MouseReport.h b/testing/MouseReport.h index eddd2e7a..8b4d0258 100644 --- a/testing/MouseReport.h +++ b/testing/MouseReport.h @@ -31,7 +31,7 @@ class MouseReport { static constexpr uint8_t kHidReportType = HID_REPORTID_MOUSE; - MouseReport(const void* data); + MouseReport(const void *data); static constexpr uint8_t kButtonLeft = MOUSE_LEFT; @@ -53,4 +53,4 @@ class MouseReport { }; } // namespace testing -} // namespce kaleidoscope +} // namespace kaleidoscope diff --git a/testing/SimHarness.cpp b/testing/SimHarness.cpp index 45efe633..26f94f68 100644 --- a/testing/SimHarness.cpp +++ b/testing/SimHarness.cpp @@ -26,7 +26,7 @@ void SimHarness::RunCycle() { if (CycleTime() > 1) { // We incrememnt the time before running the loop so that // millisAtCycleStart ends up where we want it to - for (size_t i = 1; i < CycleTime() ; i++) { + for (size_t i = 1; i < CycleTime(); i++) { // The current millis implementation gets us 1 milli per call to millis. millis(); } diff --git a/testing/State.cpp b/testing/State.cpp index 9561e102..eb70977e 100644 --- a/testing/State.cpp +++ b/testing/State.cpp @@ -21,12 +21,12 @@ namespace testing { // static std::unique_ptr State::Snapshot() { - auto state = std::make_unique(); + auto state = std::make_unique(); state->hid_state_ = internal::HIDStateBuilder::Snapshot(); return state; } -const HIDState* State::HIDReports() const { +const HIDState *State::HIDReports() const { return hid_state_.get(); } diff --git a/testing/State.h b/testing/State.h index d028d670..b8951b5c 100644 --- a/testing/State.h +++ b/testing/State.h @@ -33,7 +33,7 @@ class State { public: static std::unique_ptr Snapshot(); - const HIDState* HIDReports() const; + const HIDState *HIDReports() const; private: std::unique_ptr hid_state_; diff --git a/testing/SystemControlReport.cpp b/testing/SystemControlReport.cpp index 0f0a7d9b..2fb7cc0a 100644 --- a/testing/SystemControlReport.cpp +++ b/testing/SystemControlReport.cpp @@ -24,9 +24,9 @@ namespace kaleidoscope { namespace testing { -SystemControlReport::SystemControlReport(const void* data) { - const ReportData& report_data = - *static_cast(data); +SystemControlReport::SystemControlReport(const void *data) { + const ReportData &report_data = + *static_cast(data); memcpy(&report_data_, &report_data, sizeof(report_data_)); if (report_data_.key != 0) { this->push_back(report_data_.key); diff --git a/testing/SystemControlReport.h b/testing/SystemControlReport.h index 44719abb..c5d4edcf 100644 --- a/testing/SystemControlReport.h +++ b/testing/SystemControlReport.h @@ -31,7 +31,7 @@ class SystemControlReport : public std::vector { static constexpr uint8_t kHidReportType = HID_REPORTID_SYSTEMCONTROL; - SystemControlReport(const void* data); + SystemControlReport(const void *data); uint32_t Timestamp() const; uint8_t ActiveKeycode() const; diff --git a/testing/VirtualDeviceTest.cpp b/testing/VirtualDeviceTest.cpp index 263e02ac..e7da0619 100644 --- a/testing/VirtualDeviceTest.cpp +++ b/testing/VirtualDeviceTest.cpp @@ -45,7 +45,7 @@ void VirtualDeviceTest::ClearState() { expected_mouse_reports_.clear(); } -const HIDState* VirtualDeviceTest::HIDReports() const { +const HIDState *VirtualDeviceTest::HIDReports() const { if (output_state_ == nullptr) return nullptr; return output_state_->HIDReports(); } @@ -125,12 +125,18 @@ void VirtualDeviceTest::RemoveFromKeyboardReport(Key key) { // ============================================================================= void VirtualDeviceTest::ExpectMouseReport(uint8_t buttons, - int8_t x, int8_t y, - int8_t v, int8_t h, + int8_t x, + int8_t y, + int8_t v, + int8_t h, std::string description) { uint32_t report_timestamp = Runtime.millisAtCycleStart(); ExpectedMouseReport new_report(report_timestamp, - buttons, x, y, v, h, + buttons, + x, + y, + v, + h, description); expected_mouse_reports_.push_back(new_report); } @@ -152,18 +158,18 @@ void VirtualDeviceTest::CheckKeyboardReports() const { expected_keyboard_report_count); for (int i = 0; i < observed_keyboard_report_count; ++i) { - auto observed_report = HIDReports()->Keyboard(i); + auto observed_report = HIDReports()->Keyboard(i); auto observed_keycodes = observed_report.ActiveKeycodes(); if (i < expected_keyboard_report_count) { - auto expected_report = expected_keyboard_reports_[i]; + auto expected_report = expected_keyboard_reports_[i]; auto expected_keycodes = expected_report.Keycodes(); EXPECT_THAT(observed_keycodes, ::testing::ElementsAreArray(expected_keycodes)) - << expected_keyboard_reports_[i].Message() << " (i=" << i << ")"; + << expected_keyboard_reports_[i].Message() << " (i=" << i << ")"; EXPECT_EQ(observed_report.Timestamp(), expected_report.Timestamp()) - << "Report timestamps don't match (i=" << i << ")"; + << "Report timestamps don't match (i=" << i << ")"; } else { @@ -193,17 +199,17 @@ void VirtualDeviceTest::CheckMouseReports() const { auto expected_report = expected_mouse_reports_[i]; EXPECT_EQ(observed_report.Buttons(), expected_report.Buttons()) - << expected_mouse_reports_[i].Message() << " (i=" << i << ")"; + << expected_mouse_reports_[i].Message() << " (i=" << i << ")"; EXPECT_EQ(observed_report.XAxis(), expected_report.XAxis()) - << expected_mouse_reports_[i].Message() << " (i=" << i << ")"; + << expected_mouse_reports_[i].Message() << " (i=" << i << ")"; EXPECT_EQ(observed_report.YAxis(), expected_report.YAxis()) - << expected_mouse_reports_[i].Message() << " (i=" << i << ")"; + << expected_mouse_reports_[i].Message() << " (i=" << i << ")"; EXPECT_EQ(observed_report.VWheel(), expected_report.VWheel()) - << expected_mouse_reports_[i].Message() << " (i=" << i << ")"; + << expected_mouse_reports_[i].Message() << " (i=" << i << ")"; EXPECT_EQ(observed_report.HWheel(), expected_report.HWheel()) - << expected_mouse_reports_[i].Message() << " (i=" << i << ")"; + << expected_mouse_reports_[i].Message() << " (i=" << i << ")"; EXPECT_EQ(observed_report.Timestamp(), expected_report.Timestamp()) - << "Report timestamps don't match (i=" << i << ")"; + << "Report timestamps don't match (i=" << i << ")"; } else { std::bitset<8> observed_buttons{observed_report.Buttons()}; diff --git a/testing/VirtualDeviceTest.h b/testing/VirtualDeviceTest.h index 81c89b35..9231c4cd 100644 --- a/testing/VirtualDeviceTest.h +++ b/testing/VirtualDeviceTest.h @@ -38,16 +38,19 @@ namespace testing { // differentiated types for those polymorphic functions. class AddKeycodes : public std::set { public: - AddKeycodes(std::initializer_list list) : std::set(list) {} + AddKeycodes(std::initializer_list list) + : std::set(list) {} }; class RemoveKeycodes : public std::set { public: - RemoveKeycodes(std::initializer_list list) : std::set(list) {} + RemoveKeycodes(std::initializer_list list) + : std::set(list) {} }; class Keycodes : public std::set { public: - Keycodes(std::initializer_list list) : std::set(list) {} + Keycodes(std::initializer_list list) + : std::set(list) {} }; @@ -78,7 +81,7 @@ class VirtualDeviceTest : public ::testing::Test { void ClearState(); // Get a pointer to the current list of observed HID reports - const HIDState* HIDReports() const; + const HIDState *HIDReports() const; // Get the timestamp of a logged Keyboard HID report uint32_t ReportTimestamp(size_t index) const; @@ -116,8 +119,7 @@ class VirtualDeviceTest : public ::testing::Test { std::vector expected_mouse_reports_ = {}; - void ExpectMouseReport(uint8_t buttons, int8_t x, int8_t y, - int8_t v, int8_t h, std::string description); + void ExpectMouseReport(uint8_t buttons, int8_t x, int8_t y, int8_t v, int8_t h, std::string description); // --------------------------------------------------------------------------- std::set current_keyboard_keycodes_ = {}; @@ -132,7 +134,6 @@ class VirtualDeviceTest : public ::testing::Test { void CheckReports() const; void CheckKeyboardReports() const; void CheckMouseReports() const; - }; } // namespace testing diff --git a/testing/setup-googletest.h b/testing/setup-googletest.h index 69136f62..85cb034e 100644 --- a/testing/setup-googletest.h +++ b/testing/setup-googletest.h @@ -30,12 +30,12 @@ #include "testing/matchers.h" #include "testing/VirtualDeviceTest.h" -#define SETUP_GOOGLETEST() \ - void executeTestFunction() { \ - setup(); /* setup Kaleidoscope */ \ - /* Turn off virtual_io's input. */ \ - Kaleidoscope.device().keyScanner().setEnableReadMatrix(false); \ - testing::InitGoogleTest(); \ - int result = RUN_ALL_TESTS(); \ - exit(result); \ +#define SETUP_GOOGLETEST() \ + void executeTestFunction() { \ + setup(); /* setup Kaleidoscope */ \ + /* Turn off virtual_io's input. */ \ + Kaleidoscope.device().keyScanner().setEnableReadMatrix(false); \ + testing::InitGoogleTest(); \ + int result = RUN_ALL_TESTS(); \ + exit(result); \ } diff --git a/tests/hid/hid-v1.2-consumer-keys/test/testcase.cpp b/tests/hid/hid-v1.2-consumer-keys/test/testcase.cpp index eb2c110a..d3bc896f 100644 --- a/tests/hid/hid-v1.2-consumer-keys/test/testcase.cpp +++ b/tests/hid/hid-v1.2-consumer-keys/test/testcase.cpp @@ -27,7 +27,7 @@ using ::testing::IsEmpty; class KeyboardReports : public VirtualDeviceTest {}; TEST_F(KeyboardReports, HIDUsageTablev12KeycodesAdded) { - sim_.Press(0, 0); // VoiceCommand + sim_.Press(0, 0); // VoiceCommand auto state = RunCycle(); ASSERT_EQ(state->HIDReports()->ConsumerControl().size(), 1); diff --git a/tests/issues/1010/test/testcase.cpp b/tests/issues/1010/test/testcase.cpp index 6a8eeee7..ff2e7728 100644 --- a/tests/issues/1010/test/testcase.cpp +++ b/tests/issues/1010/test/testcase.cpp @@ -25,37 +25,36 @@ namespace testing { class Issue1010 : public ::testing::Test { public: - static constexpr uint8_t MAX_CS_KEYS = 64; enum : uint16_t { MACRO_FIRST = (SYNTHETIC | 0b00100000) << 8, MACRO_LAST = MACRO_FIRST + 255, - FIRST = 0xc000, + FIRST = 0xc000, KALEIDOSCOPE_FIRST = FIRST, OS_FIRST, - OSM_FIRST = OS_FIRST, - OSM_LAST = OSM_FIRST + 7, + OSM_FIRST = OS_FIRST, + OSM_LAST = OSM_FIRST + 7, OSL_FIRST, - OSL_LAST = OSL_FIRST + 7, - OS_LAST = OSL_LAST, + OSL_LAST = OSL_FIRST + 7, + OS_LAST = OSL_LAST, DU_FIRST, - DUM_FIRST = DU_FIRST, - DUM_LAST = DUM_FIRST + (8 << 8), + DUM_FIRST = DU_FIRST, + DUM_LAST = DUM_FIRST + (8 << 8), DUL_FIRST, - DUL_LAST = DUL_FIRST + (8 << 8), - DU_LAST = DUL_LAST, + DUL_LAST = DUL_FIRST + (8 << 8), + DU_LAST = DUL_LAST, TD_FIRST, - TD_LAST = TD_FIRST + 15, + TD_LAST = TD_FIRST + 15, LEAD_FIRST, - LEAD_LAST = LEAD_FIRST + 7, + LEAD_LAST = LEAD_FIRST + 7, CYCLE, SYSTER, TT_FIRST, - TT_LAST = TT_FIRST + 255, + TT_LAST = TT_FIRST + 255, STENO_FIRST, - STENO_LAST = STENO_FIRST + 42, + STENO_LAST = STENO_FIRST + 42, SC_FIRST, SC_LAST, REDIAL, @@ -66,7 +65,7 @@ class Issue1010 : public ::testing::Test { OS_ACTIVE_STICKY, OS_CANCEL, CS_FIRST, - CS_LAST = CS_FIRST + MAX_CS_KEYS, + CS_LAST = CS_FIRST + MAX_CS_KEYS, SAFE_START, KALEIDOSCOPE_SAFE_START = SAFE_START diff --git a/tests/issues/1057/common.h b/tests/issues/1057/common.h index 424d2ce4..ec9e49b8 100644 --- a/tests/issues/1057/common.h +++ b/tests/issues/1057/common.h @@ -23,11 +23,11 @@ namespace kaleidoscope { namespace testing { -constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 200; -constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 0; -constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 0; -constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 0; +constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 200; +constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 0; +constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 0; +constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 0; constexpr uint8_t QUKEYS_MAX_INTERVAL_FOR_TAP_REPEAT = 0; -} // namespace testing -} // namespace kaleidoscope +} // namespace testing +} // namespace kaleidoscope diff --git a/tests/issues/1107/Qukeys/common.h b/tests/issues/1107/Qukeys/common.h index 2707c775..5a34ce46 100644 --- a/tests/issues/1107/Qukeys/common.h +++ b/tests/issues/1107/Qukeys/common.h @@ -23,11 +23,11 @@ namespace kaleidoscope { namespace testing { -constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 10; -constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 0; -constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 0; -constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 0; +constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 10; +constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 0; +constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 0; +constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 0; constexpr uint8_t QUKEYS_MAX_INTERVAL_FOR_TAP_REPEAT = 0; -} // namespace testing -} // namespace kaleidoscope +} // namespace testing +} // namespace kaleidoscope diff --git a/tests/issues/1107/Qukeys/test/testcase.cpp b/tests/issues/1107/Qukeys/test/testcase.cpp index 2d7e58d5..7cba0d6f 100644 --- a/tests/issues/1107/Qukeys/test/testcase.cpp +++ b/tests/issues/1107/Qukeys/test/testcase.cpp @@ -34,7 +34,8 @@ using ::testing::IsEmpty; class QukeysIssue1107 : public VirtualDeviceTest { protected: std::set expected_keycodes_ = {}; - std::unique_ptr state_ = nullptr; + std::unique_ptr state_ = nullptr; + public: void testDelayedTimeout() { state_ = RunCycle(); @@ -44,7 +45,7 @@ class QukeysIssue1107 : public VirtualDeviceTest { state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 0) - << "There should be no HID report after the qukey is pressed"; + << "There should be no HID report after the qukey is pressed"; // Record time at start uint32_t start = Kaleidoscope.millisAtCycleStart(); @@ -61,10 +62,10 @@ class QukeysIssue1107 : public VirtualDeviceTest { uint32_t end = Kaleidoscope.millisAtCycleStart(); ASSERT_EQ((end - start), (QUKEYS_HOLD_TIMEOUT + 2)) - << "Only one millisecond should be registered elapsed per cycle"; + << "Only one millisecond should be registered elapsed per cycle"; ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 2) - << "There should be two HID reports after the release of a timed-out qukey"; + << "There should be two HID reports after the release of a timed-out qukey"; } }; diff --git a/tests/issues/840/test/testcase.cpp b/tests/issues/840/test/testcase.cpp index 8f3744fe..eff70025 100644 --- a/tests/issues/840/test/testcase.cpp +++ b/tests/issues/840/test/testcase.cpp @@ -27,13 +27,13 @@ using ::testing::IsEmpty; class Issue840 : public VirtualDeviceTest {}; TEST_F(Issue840, HasNotRegressed) { - sim_.Press(2, 1); // Press System_PowerDown + sim_.Press(2, 1); // Press System_PowerDown auto state = RunCycle(); ASSERT_EQ(state->HIDReports()->SystemControl().size(), 1); EXPECT_THAT(state->HIDReports()->SystemControl(0), Contains(System_PowerDown)); - sim_.Press(3, 5); // Press System_Sleep + sim_.Press(3, 5); // Press System_Sleep state = RunCycle(); ASSERT_EQ(state->HIDReports()->SystemControl().size(), 1); diff --git a/tests/issues/951/test/testcase.cpp b/tests/issues/951/test/testcase.cpp index bd9a2e24..ffe19b84 100644 --- a/tests/issues/951/test/testcase.cpp +++ b/tests/issues/951/test/testcase.cpp @@ -27,11 +27,11 @@ namespace { using ::testing::IsEmpty; -class Issue951: public VirtualDeviceTest {}; +class Issue951 : public VirtualDeviceTest {}; TEST_F(Issue951, InitialLayerState) { EXPECT_THAT(Layer.isActive(0), true) - << "Layer 0 should be active when the keyboard starts up."; + << "Layer 0 should be active when the keyboard starts up."; } } // namespace diff --git a/tests/issues/970/common.h b/tests/issues/970/common.h index 01ea3d07..f37d7551 100644 --- a/tests/issues/970/common.h +++ b/tests/issues/970/common.h @@ -23,11 +23,11 @@ namespace kaleidoscope { namespace testing { -constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 200; -constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 90; -constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 10; -constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 20; +constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 200; +constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 90; +constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 10; +constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 20; constexpr uint8_t QUKEYS_MAX_INTERVAL_FOR_TAP_REPEAT = 0; -} -} +} // namespace testing +} // namespace kaleidoscope diff --git a/tests/plugins/Qukeys/TapRepeat/common.h b/tests/plugins/Qukeys/TapRepeat/common.h index 922d2ca2..b6c1d132 100644 --- a/tests/plugins/Qukeys/TapRepeat/common.h +++ b/tests/plugins/Qukeys/TapRepeat/common.h @@ -23,11 +23,11 @@ namespace kaleidoscope { namespace testing { -constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 200; -constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 0; -constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 0; -constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 0; +constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 200; +constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 0; +constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 0; +constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 0; constexpr uint8_t QUKEYS_MAX_TAP_REPEAT_INTERVAL = 20; -} -} +} // namespace testing +} // namespace kaleidoscope diff --git a/tests/plugins/Qukeys/basic/common.h b/tests/plugins/Qukeys/basic/common.h index 2fd22a78..9b0cd475 100644 --- a/tests/plugins/Qukeys/basic/common.h +++ b/tests/plugins/Qukeys/basic/common.h @@ -23,11 +23,11 @@ namespace kaleidoscope { namespace testing { -constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 200; -constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 90; -constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 10; -constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 20; +constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 200; +constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 90; +constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 10; +constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 20; constexpr uint8_t QUKEYS_MAX_TAP_REPEAT_INTERVAL = 0; -} -} +} // namespace testing +} // namespace kaleidoscope diff --git a/tests/plugins/Qukeys/basic/test/testcase.cpp b/tests/plugins/Qukeys/basic/test/testcase.cpp index bfc1c38a..d8c4c85d 100644 --- a/tests/plugins/Qukeys/basic/test/testcase.cpp +++ b/tests/plugins/Qukeys/basic/test/testcase.cpp @@ -35,7 +35,7 @@ using ::testing::IsEmpty; class QukeysBasic : public VirtualDeviceTest { protected: std::set expected_keycodes_ = {}; - std::unique_ptr state_ = nullptr; + std::unique_ptr state_ = nullptr; }; TEST_F(QukeysBasic, TapQukeyAlone) { @@ -45,7 +45,7 @@ TEST_F(QukeysBasic, TapQukeyAlone) { state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 0) - << "There should be no HID report after the qukey is pressed"; + << "There should be no HID report after the qukey is pressed"; sim_.RunForMillis(20); // Release `A` sim_.Release(key_addr_A); @@ -54,17 +54,17 @@ TEST_F(QukeysBasic, TapQukeyAlone) { state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 2) - << "There should be two HID reports after the release of a tapped qukey"; + << "There should be two HID reports after the release of a tapped qukey"; expected_keycodes_.insert(Key_A.getKeyCode()); EXPECT_THAT(state_->HIDReports()->Keyboard(0).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The first report should include only `A`"; + << "The first report should include only `A`"; expected_keycodes_.erase(Key_A.getKeyCode()); EXPECT_THAT(state_->HIDReports()->Keyboard(1).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The second report should be empty"; + << "The second report should be empty"; state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 0); @@ -94,14 +94,14 @@ TEST_F(QukeysBasic, HoldQukeyAlone) { uint32_t t1 = Kaleidoscope.millisAtCycleStart(); EXPECT_THAT(t1 - t0, ::testing::Ge(QUKEYS_HOLD_TIMEOUT)) - << "The HID report should be sent after the hold timeout has elapsed"; + << "The HID report should be sent after the hold timeout has elapsed"; expected_keycodes_.insert(Key_LeftGui.getKeyCode()); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 1) - << "There should be only one HID report"; + << "There should be only one HID report"; EXPECT_THAT(state_->HIDReports()->Keyboard(0).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The HID report should contain just `Key_LeftGui`"; + << "The HID report should contain just `Key_LeftGui`"; sim_.RunForMillis(100); @@ -110,12 +110,12 @@ TEST_F(QukeysBasic, HoldQukeyAlone) { state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 1) - << "There should be a HID report immediately after the key is released"; + << "There should be a HID report immediately after the key is released"; expected_keycodes_.erase(Key_LeftGui.getKeyCode()); EXPECT_THAT(state_->HIDReports()->Keyboard(0).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The HID report should be empty at this point"; + << "The HID report should be empty at this point"; state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 0); @@ -130,7 +130,7 @@ TEST_F(QukeysBasic, FullOverlap) { sim_.Press(key_addr_X); state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 0) - << "After both keys are pressed, there should still be no reports"; + << "After both keys are pressed, there should still be no reports"; sim_.RunForMillis(50); sim_.Release(key_addr_X); @@ -139,30 +139,30 @@ TEST_F(QukeysBasic, FullOverlap) { expected_keycodes_.insert(Key_LeftShift.getKeyCode()); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 3) - << "After the subsequent key is released, we should get 3 reports"; + << "After the subsequent key is released, we should get 3 reports"; EXPECT_THAT(state_->HIDReports()->Keyboard(0).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The first report should contain the qukey's altername keycode"; + << "The first report should contain the qukey's altername keycode"; expected_keycodes_.insert(Key_X.getKeyCode()); EXPECT_THAT(state_->HIDReports()->Keyboard(1).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The second report should add the subsequent key"; + << "The second report should add the subsequent key"; expected_keycodes_.erase(Key_X.getKeyCode()); EXPECT_THAT(state_->HIDReports()->Keyboard(2).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The third report should be the release of the subsequent key"; + << "The third report should be the release of the subsequent key"; sim_.Release(key_addr_F); sim_.RunCycles(3); state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 1) - << "After the qukey is release, we should get one report"; + << "After the qukey is release, we should get one report"; expected_keycodes_.erase(Key_LeftShift.getKeyCode()); EXPECT_THAT(state_->HIDReports()->Keyboard(0).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The HID report should now be empty"; + << "The HID report should now be empty"; state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 0); @@ -177,39 +177,39 @@ TEST_F(QukeysBasic, RolloverPrimary) { sim_.Press(key_addr_X); state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 0) - << "After both keys are pressed, there should still be no reports"; + << "After both keys are pressed, there should still be no reports"; sim_.RunForMillis(50); sim_.Release(key_addr_F); sim_.RunForMillis(50); state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 3) - << "After the qukey is released, and the overlap threshold is exceeded, there should be 3 reports"; + << "After the qukey is released, and the overlap threshold is exceeded, there should be 3 reports"; expected_keycodes_.insert(Key_F.getKeyCode()); EXPECT_THAT(state_->HIDReports()->Keyboard(0).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The first report should contain the qukey's primary value"; + << "The first report should contain the qukey's primary value"; expected_keycodes_.insert(Key_X.getKeyCode()); EXPECT_THAT(state_->HIDReports()->Keyboard(1).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The second report should contain the subsequent (normal) key"; + << "The second report should contain the subsequent (normal) key"; expected_keycodes_.erase(Key_F.getKeyCode()); EXPECT_THAT(state_->HIDReports()->Keyboard(2).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The third report should contain the release of the qukey"; + << "The third report should contain the release of the qukey"; sim_.Release(key_addr_X); sim_.RunCycles(3); state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 1) - << "After the normal key is released, we should get one report"; + << "After the normal key is released, we should get one report"; expected_keycodes_.erase(Key_X.getKeyCode()); EXPECT_THAT(state_->HIDReports()->Keyboard(0).ActiveKeycodes(), ::testing::ElementsAreArray(expected_keycodes_)) - << "The HID report should now be empty"; + << "The HID report should now be empty"; state_ = RunCycle(); ASSERT_EQ(state_->HIDReports()->Keyboard().size(), 0); diff --git a/tests/simulator/timestamps/test/testcase.cpp b/tests/simulator/timestamps/test/testcase.cpp index 891d0372..6bb1bc6e 100644 --- a/tests/simulator/timestamps/test/testcase.cpp +++ b/tests/simulator/timestamps/test/testcase.cpp @@ -28,7 +28,7 @@ constexpr KeyAddr key_addr_A{2, 1}; class ReportTimestamps : public VirtualDeviceTest {}; TEST_F(ReportTimestamps, Keyboard) { - int delay = 10; + int delay = 10; int current_time = 0; sim_.RunForMillis(delay); @@ -40,7 +40,7 @@ TEST_F(ReportTimestamps, Keyboard) { ASSERT_EQ(state->HIDReports()->Keyboard().size(), 1); EXPECT_THAT(state->HIDReports()->Keyboard(0).Timestamp(), current_time) - << "Report timestamp is the same as the simulator clock as of the end of the last cycle"; + << "Report timestamp is the same as the simulator clock as of the end of the last cycle"; sim_.RunForMillis(delay); current_time += delay; @@ -51,7 +51,7 @@ TEST_F(ReportTimestamps, Keyboard) { ASSERT_EQ(state->HIDReports()->Keyboard().size(), 1); EXPECT_THAT(state->HIDReports()->Keyboard(0).Timestamp(), current_time) - << "Report timestamp is the same as the simulator clock as of the end of the last cycle"; + << "Report timestamp is the same as the simulator clock as of the end of the last cycle"; } } // namespace diff --git a/tests/simulator/timing/test/testcase.cpp b/tests/simulator/timing/test/testcase.cpp index 59b36706..9f4f84fd 100644 --- a/tests/simulator/timing/test/testcase.cpp +++ b/tests/simulator/timing/test/testcase.cpp @@ -71,7 +71,6 @@ TEST_F(SimulatorTiming, LongTimeElapses) { TEST_F(SimulatorTiming, 3msPerCycleTestRunCycles) { - sim_.SetCycleTime(3); // Record time at start uint32_t start = Kaleidoscope.millisAtCycleStart(); @@ -79,7 +78,7 @@ TEST_F(SimulatorTiming, 3msPerCycleTestRunCycles) { sim_.RunCycles(1); // Record time at end uint32_t end = Kaleidoscope.millisAtCycleStart(); - ASSERT_EQ((end - start), 3) << "Start was " << start << " and end was " << end; + ASSERT_EQ((end - start), 3) << "Start was " << start << " and end was " << end; // Record time at start @@ -88,9 +87,7 @@ TEST_F(SimulatorTiming, 3msPerCycleTestRunCycles) { sim_.RunCycles(10); // Record time at end end = Kaleidoscope.millisAtCycleStart(); - ASSERT_EQ((end - start), 30) << "Start was " << start << " and end was " << end; - - + ASSERT_EQ((end - start), 30) << "Start was " << start << " and end was " << end; } @@ -103,7 +100,6 @@ TEST_F(SimulatorTiming, 4msPerCycleTestRunForMillis) { // Record time at end uint32_t end = Kaleidoscope.millisAtCycleStart(); ASSERT_EQ((end - start), 40); - } } // namespace