From 586c353b19c6aa35176fd95c1f472bc1fa0e6222 Mon Sep 17 00:00:00 2001 From: Evy Bongers Date: Tue, 12 Mar 2024 12:13:13 +0100 Subject: [PATCH] Define new API Signed-off-by: Evy Bongers --- .../src/kaleidoscope/plugin/Qukeys.cpp | 8 +++++++- .../Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.cpp b/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.cpp index ca0b7e00ed..e7f1b9eabe 100644 --- a/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.cpp +++ b/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.cpp @@ -20,7 +20,7 @@ #include // for F, __FlashStringHelper #include // for Focus, FocusSerial -#include // for DUL_FIRST, DUM_FIRST, DUL_LAST, DUM_LAST +#include // for DUL_FIRST, DUM_FIRST, DUL_LAST, DUM_LAST, QK_FIRST, QK_LAST #include "kaleidoscope/KeyAddrEventQueue.h" // for KeyAddrEventQueue #include "kaleidoscope/KeyEvent.h" // for KeyEvent @@ -314,6 +314,12 @@ bool Qukeys::isQukey(KeyAddr k) { return true; } + // Then, we check to see if this is a Qukey using the new API (defined in the keymap) + if (key >= ranges::QK_FIRST && key <= ranges::QK_LAST) { + // TODO + return false; // for now + } + // Last, we check the qukeys array for a match uint8_t layer_index = Layer.lookupActiveLayer(k); for (uint8_t i{0}; i < qukeys_count_; ++i) { diff --git a/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h b/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h index 6fcf2678f2..8f9ef9ec11 100644 --- a/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h +++ b/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h @@ -19,7 +19,7 @@ #pragma once #include // for PROGMEM -#include // for DUL_FIRST, DUM_FIRST +#include // for DUL_FIRST, DUM_FIRST, QK_FIRST #include // for uint8_t, uint16_t, int8_t #include "kaleidoscope/KeyAddr.h" // for KeyAddr @@ -244,3 +244,10 @@ extern kaleidoscope::plugin::Qukeys Qukeys; qukey_defs}; \ Qukeys.configureQukeys(qk_table); \ } + +/// This defines a `Key` object that will be handled by the Qukey plugin. +/// The argument `n` is the index number of the `Qukey` in the array (starting +/// at zero). +constexpr kaleidoscope::Key QK(uint8_t n) { + return kaleidoscope::Key(kaleidoscope::ranges::QK_FIRST + n); +}