Skip to content

Commit

Permalink
Define new API
Browse files Browse the repository at this point in the history
Signed-off-by: Evy Bongers <[email protected]>
  • Loading branch information
EvyBongers committed Mar 12, 2024
1 parent 4cf6ed5 commit 586c353
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <Arduino.h> // for F, __FlashStringHelper
#include <Kaleidoscope-FocusSerial.h> // for Focus, FocusSerial
#include <Kaleidoscope-Ranges.h> // for DUL_FIRST, DUM_FIRST, DUL_LAST, DUM_LAST
#include <Kaleidoscope-Ranges.h> // 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
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 8 additions & 1 deletion plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include <Arduino.h> // for PROGMEM
#include <Kaleidoscope-Ranges.h> // for DUL_FIRST, DUM_FIRST
#include <Kaleidoscope-Ranges.h> // for DUL_FIRST, DUM_FIRST, QK_FIRST
#include <stdint.h> // for uint8_t, uint16_t, int8_t

#include "kaleidoscope/KeyAddr.h" // for KeyAddr
Expand Down Expand Up @@ -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);
}

0 comments on commit 586c353

Please sign in to comment.