Compile deprecated Layer code conditionally

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1024/head
Michael Richters 4 years ago
parent 4c47ce1185
commit 1946e1de0b
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -152,18 +152,6 @@ Key Layer_::getKeyFromPROGMEM(uint8_t layer, KeyAddr key_addr) {
return keyFromKeymap(layer, key_addr); return keyFromKeymap(layer, key_addr);
} }
// Deprecated
void Layer_::updateLiveCompositeKeymap(KeyAddr key_addr) {
// We could update the active keys cache here (as commented below), but I
// think that's unlikely to serve whatever purpose the caller had in
// mind. `Layer.lookup()` will still give the correct result, and without a
// `Key` value is specified, this function no longer serves a purpose.
// #include "kaleidoscope/LiveKeys.h"
// int8_t layer = active_layer_keymap_[key_addr.toInt()];
// live_keys.activate(key_addr, (*getKey)(layer, key_addr));
}
void Layer_::updateActiveLayers(void) { void Layer_::updateActiveLayers(void) {
// First, set every entry in the active layer keymap to point to the default // First, set every entry in the active layer keymap to point to the default
// layer (layer 0). // layer (layer 0).

@ -81,6 +81,7 @@ class Layer_ {
// The `Runtime.lookupKey()` function replaces this one, for plugins that // The `Runtime.lookupKey()` function replaces this one, for plugins that
// still want to do this same check. // still want to do this same check.
#ifndef NDEPRECATED
DEPRECATED(LAYER_LOOKUP) DEPRECATED(LAYER_LOOKUP)
static Key lookup(KeyAddr key_addr) { static Key lookup(KeyAddr key_addr) {
// First check the keyboard state array // First check the keyboard state array
@ -91,6 +92,8 @@ class Layer_ {
} }
return key; return key;
} }
#endif
static Key lookupOnActiveLayer(KeyAddr key_addr) { static Key lookupOnActiveLayer(KeyAddr key_addr) {
uint8_t layer = active_layer_keymap_[key_addr.toInt()]; uint8_t layer = active_layer_keymap_[key_addr.toInt()];
return (*getKey)(layer, key_addr); return (*getKey)(layer, key_addr);
@ -125,12 +128,15 @@ class Layer_ {
static Key getKeyFromPROGMEM(uint8_t layer, KeyAddr key_addr); static Key getKeyFromPROGMEM(uint8_t layer, KeyAddr key_addr);
#ifndef NDEPRECATED
DEPRECATED(LAYER_UPDATELIVECOMPOSITEKEYMAP) DEPRECATED(LAYER_UPDATELIVECOMPOSITEKEYMAP)
static void updateLiveCompositeKeymap(KeyAddr key_addr, Key mappedKey) { static void updateLiveCompositeKeymap(KeyAddr key_addr, Key mappedKey) {
live_keys.activate(key_addr, mappedKey); live_keys.activate(key_addr, mappedKey);
} }
DEPRECATED(LAYER_UPDATELIVECOMPOSITEKEYMAP) DEPRECATED(LAYER_UPDATELIVECOMPOSITEKEYMAP)
static void updateLiveCompositeKeymap(KeyAddr key_addr); static void updateLiveCompositeKeymap(KeyAddr key_addr) {}
#endif
static void updateActiveLayers(void); static void updateActiveLayers(void);
private: private:

Loading…
Cancel
Save