Merge pull request #1002 from keyboardio/f/remove-deprecations

Remove stuff that was deprecated as of december 31
pull/1007/head
Jesse Vincent 4 years ago committed by GitHub
commit b3b56efdf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -338,7 +338,7 @@ The layer system used to be index-ordered, meaning that we'd look keys up on
layers based on the _index_ of active layers. Kaleidoscope now uses activation
order, which looks up keys based on the order of layer activation.
This means that the following functions are deprecated, and will be removed by **2020-12-31**:
The following functions have been removed as of **2021-01-01**:
- `Layer.top()`, which used to return the topmost layer index. Use
`Layer.mostRecent()` instead, which returns the most recently activated layer.
@ -532,7 +532,7 @@ which accepts a value between 0 and 100 (interpreted as a percentage). User who
used higher values for `setReleaseDelay()` will want a lower values for
`setOverlapThreshold()`.
These functions have been deprecated since 2019-08-22, and will be removed by **2020-12-31**:
These functions have been removed as of **2020-12-31**:
- `Qukeys.setTimeout(millis)`
- `Qukeys.setReleaseDelay(millis)`
@ -548,13 +548,13 @@ Storing the settable settings in EEPROM makes it depend on `Kaleidoscope-EEPROM-
Older versions of the plugin required one to set up `Key_Redial` manually, and let the plugin know about it via `Redial.key`. This is no longer required, as the plugin sets up the redial key itself. As such, `Redial.key` was removed, and `Key_Redial` is defined by the plugin itself. To upgrade, simply remove your definition of `Key_Redial` and the `Redial.key` assignment from your sketch.
### Key masking has been deprecated
### Key masking has been removed
Key masking was a band-aid introduced to avoid accidentally sending unintended keys when key mapping changes between a key being pressed and released. Since the introduction of keymap caching, this is no longer necessary, as long as we can keep the mapping consistent. Users of key masking are encouraged to find ways to use the caching mechanism instead.
As an example, if you had a key event handler that in some cases masked a key, it should now map it to `Key_NoKey` instead, until released.
The masking API has been deprecated, and is scheduled to be removed after **2020-11-25**.
The masking API has been removed on **2021-01-01**
## Deprecated APIs and their replacements

@ -262,8 +262,6 @@ raise::keydata_t RaiseKeyScanner::leftHandState;
raise::keydata_t RaiseKeyScanner::rightHandState;
raise::keydata_t RaiseKeyScanner::previousLeftHandState;
raise::keydata_t RaiseKeyScanner::previousRightHandState;
raise::keydata_t RaiseKeyScanner::leftHandMask;
raise::keydata_t RaiseKeyScanner::rightHandMask;
bool RaiseKeyScanner::lastLeftOnline;
bool RaiseKeyScanner::lastRightOnline;
@ -337,53 +335,6 @@ void RaiseKeyScanner::scanMatrix() {
actOnMatrixScan();
}
void RaiseKeyScanner::maskKey(KeyAddr key_addr) {
if (!key_addr.isValid())
return;
auto row = key_addr.row();
auto col = key_addr.col();
if (col >= Props_::left_columns) {
rightHandMask.rows[row] |= 1 << (Props_::right_columns - (col - Props_::left_columns));
} else {
leftHandMask.rows[row] |= 1 << (Props_::right_columns - col);
}
}
void RaiseKeyScanner::unMaskKey(KeyAddr key_addr) {
if (!key_addr.isValid())
return;
auto row = key_addr.row();
auto col = key_addr.col();
if (col >= Props_::left_columns) {
rightHandMask.rows[row] &= ~(1 << (Props_::right_columns - (col - Props_::left_columns)));
} else {
leftHandMask.rows[row] &= ~(1 << (Props_::right_columns - col));
}
}
bool RaiseKeyScanner::isKeyMasked(KeyAddr key_addr) {
if (!key_addr.isValid())
return false;
auto row = key_addr.row();
auto col = key_addr.col();
if (col >= 8) {
return rightHandMask.rows[row] & (1 << (7 - (col - 8)));
} else {
return leftHandMask.rows[row] & (1 << (7 - col));
}
}
void RaiseKeyScanner::maskHeldKeys() {
memcpy(leftHandMask.rows, leftHandState.rows, sizeof(leftHandMask));
memcpy(rightHandMask.rows, rightHandState.rows, sizeof(rightHandMask));
}
bool RaiseKeyScanner::isKeyswitchPressed(KeyAddr key_addr) {
auto row = key_addr.row();
auto col = key_addr.col();

@ -129,11 +129,6 @@ class RaiseKeyScanner : public kaleidoscope::driver::keyscanner::Base<RaiseKeySc
static void readMatrix();
static void actOnMatrixScan();
static void maskKey(KeyAddr key_addr);
static void unMaskKey(KeyAddr key_addr);
static bool isKeyMasked(KeyAddr key_addr);
static void maskHeldKeys();
static bool isKeyswitchPressed(KeyAddr key_addr);
static uint8_t pressedKeyswitchCount();
@ -150,9 +145,6 @@ class RaiseKeyScanner : public kaleidoscope::driver::keyscanner::Base<RaiseKeySc
static raise::keydata_t previousLeftHandState;
static raise::keydata_t previousRightHandState;
static raise::keydata_t leftHandMask;
static raise::keydata_t rightHandMask;
static bool lastLeftOnline;
static bool lastRightOnline;
};

@ -39,7 +39,6 @@ namespace ez {
ErgoDoxScanner ErgoDox::scanner_;
uint8_t ErgoDox::previousKeyState_[matrix_rows];
uint8_t ErgoDox::keyState_[matrix_rows];
uint8_t ErgoDox::masks_[matrix_rows];
uint8_t ErgoDox::debounce_matrix_[matrix_rows][matrix_columns];
uint8_t ErgoDox::debounce = 5;
@ -133,27 +132,6 @@ void ErgoDox::scanMatrix() {
actOnMatrixScan();
}
void ErgoDox::maskKey(KeyAddr key_addr) {
if (!key_addr.isValid())
return;
bitWrite(masks_[key_addr.row()], key_addr.col(), 1);
}
void ErgoDox::unMaskKey(KeyAddr key_addr) {
if (!key_addr.isValid())
return;
bitWrite(masks_[key_addr.row()], key_addr.col(), 0);
}
bool ErgoDox::isKeyMasked(KeyAddr key_addr) {
if (!key_addr.isValid())
return false;
return bitRead(masks_[key_addr.row()], key_addr.col());
}
// ErgoDox-specific stuff
void ErgoDox::setStatusLED(uint8_t led, bool state) {
if (state) {

@ -67,10 +67,6 @@ class ErgoDox : public kaleidoscope::device::ATmega32U4Keyboard<ErgoDoxProps> {
void actOnMatrixScan(void);
void setup();
void maskKey(KeyAddr key_addr);
void unMaskKey(KeyAddr key_addr);
bool isKeyMasked(KeyAddr key_addr);
bool isKeyswitchPressed(KeyAddr key_addr);
bool isKeyswitchPressed(uint8_t keyIndex);
uint8_t pressedKeyswitchCount();
@ -90,7 +86,6 @@ class ErgoDox : public kaleidoscope::device::ATmega32U4Keyboard<ErgoDoxProps> {
static ErgoDoxScanner scanner_;
static uint8_t previousKeyState_[matrix_rows];
static uint8_t keyState_[matrix_rows];
static uint8_t masks_[matrix_rows];
static uint8_t debounce_matrix_[matrix_rows][matrix_columns];
static uint8_t debounceMaskForRow(uint8_t row);

@ -139,8 +139,6 @@ driver::keyboardio::keydata_t Model01KeyScanner::leftHandState;
driver::keyboardio::keydata_t Model01KeyScanner::rightHandState;
driver::keyboardio::keydata_t Model01KeyScanner::previousLeftHandState;
driver::keyboardio::keydata_t Model01KeyScanner::previousRightHandState;
driver::keyboardio::keydata_t Model01KeyScanner::leftHandMask;
driver::keyboardio::keydata_t Model01KeyScanner::rightHandMask;
void Model01KeyScanner::enableScannerPower(void) {
// Turn on power to the LED net
@ -197,65 +195,6 @@ void Model01KeyScanner::scanMatrix() {
actOnMatrixScan();
}
// In the maskKey(), unMaskKey(), and isKeyMasked() functions, we read and write bits in
// two bitfields -- one for each half of the keyboard. The fourth bit of the column number
// tells us which bitfield (right or left) to access, thus the "8" (B00001000). The row
// number tells us which element of the array to access. The last three bits of the column
// number tell us which of the eight bits to access, thus the "7" (B00000111), and we
// shift a bit starting from the left (B10000000, or 128) by that many places to get
// there. This is all nice and convenient because the keyboard has 64 keys, in symmetric
// halves, with eight keys per logical row.
constexpr byte HIGH_BIT = B10000000;
constexpr byte HAND_BIT = B00001000;
constexpr byte ROW_BITS = B00110000;
constexpr byte COL_BITS = B00000111;
void Model01KeyScanner::maskKey(KeyAddr key_addr) {
if (!key_addr.isValid())
return;
auto row = key_addr.row();
auto col = key_addr.col();
if (col & HAND_BIT) {
rightHandMask.rows[row] |= (HIGH_BIT >> (col & COL_BITS));
} else {
leftHandMask.rows[row] |= (HIGH_BIT >> (col & COL_BITS));
}
}
void Model01KeyScanner::unMaskKey(KeyAddr key_addr) {
if (!key_addr.isValid())
return;
auto row = key_addr.row();
auto col = key_addr.col();
if (col & HAND_BIT) {
rightHandMask.rows[row] &= ~(HIGH_BIT >> (col & COL_BITS));
} else {
leftHandMask.rows[row] &= ~(HIGH_BIT >> (col & COL_BITS));
}
}
bool Model01KeyScanner::isKeyMasked(KeyAddr key_addr) {
if (!key_addr.isValid())
return false;
auto row = key_addr.row();
auto col = key_addr.col();
if (col & HAND_BIT) {
return rightHandMask.rows[row] & (HIGH_BIT >> (col & COL_BITS));
} else {
return leftHandMask.rows[row] & (HIGH_BIT >> (col & COL_BITS));
}
}
void Model01KeyScanner::maskHeldKeys() {
memcpy(leftHandMask.rows, leftHandState.rows, sizeof(leftHandMask));
memcpy(rightHandMask.rows, rightHandState.rows, sizeof(rightHandMask));
}
void Model01KeyScanner::setKeyscanInterval(uint8_t interval) {
Model01Hands::leftHand.setKeyscanInterval(interval);
Model01Hands::rightHand.setKeyscanInterval(interval);

@ -85,11 +85,6 @@ class Model01KeyScanner : public kaleidoscope::driver::keyscanner::Base<Model01K
static void readMatrix();
static void actOnMatrixScan();
static void maskKey(KeyAddr key_addr);
static void unMaskKey(KeyAddr key_addr);
static bool isKeyMasked(KeyAddr key_addr);
static void maskHeldKeys();
static bool isKeyswitchPressed(KeyAddr key_addr);
static uint8_t pressedKeyswitchCount();
@ -104,9 +99,6 @@ class Model01KeyScanner : public kaleidoscope::driver::keyscanner::Base<Model01K
static driver::keyboardio::keydata_t previousLeftHandState;
static driver::keyboardio::keydata_t previousRightHandState;
static driver::keyboardio::keydata_t leftHandMask;
static driver::keyboardio::keydata_t rightHandMask;
static void actOnHalfRow(byte row, byte colState, byte colPrevState, byte startPos);
static void enableScannerPower();
};

@ -35,25 +35,6 @@
#define LT(layer, key) Key(kaleidoscope::ranges::DUL_FIRST + (layer << 8) + (Key_ ## key).getKeyCode())
#define _DEPRECATED_MESSAGE_QUKEY_ROW_COL_CONSTRUCTOR \
"The `Qukey(layer, row, col, alternate_key)` constructor using separate\n" \
"`row` & `col` parameters has been deprecated. Please replace this\n" \
"constructor with the new `KeyAddr` version:\n" \
" `Qukey(layer, KeyAddr(row, col), alternate_key)`" \
"The deprecated function will be removed after 2020-12-31"
#define _DEPRECATED_MESSAGE_QUKEYS_TIMEOUT \
"The Qukeys.setTimeout() function has been renamed to setHoldTimeout()\n" \
"in order to distinguish it from the other timeouts more clearly." \
"The deprecated function will be removed after 2020-12-31"
#define _DEPRECATED_MESSAGE_QUKEYS_RELEASEDELAY \
"The Qukeys.setReleaseDelay() is now obsolete. The rollover grace period\n" \
"for qukey release has been replaced with an improved version based on\n" \
"the percentage of overlap between the qukey and the subsequent\n" \
"key. Please use the setOverlapThreshold() function instead." \
"The deprecated function will be removed after 2020-12-31"
namespace kaleidoscope {
namespace plugin {
@ -76,11 +57,6 @@ struct Qukey {
// into which we can copy the values from a PROGMEM Qukey object.
Qukey() = default;
// Old-style Qukey constructor for backwards compatibility.
DEPRECATED(QUKEY_ROW_COL_CONSTRUCTOR)
constexpr
Qukey(int8_t layer, uint8_t row, uint8_t col, Key alternate_key)
: layer(layer), addr(KeyAddr(row, col)), alternate_key(alternate_key) {}
};
@ -146,19 +122,6 @@ class Qukeys : public kaleidoscope::Plugin {
qukeys_count_ = _qukeys_count;
}
// Obsolete configuration functions.
DEPRECATED(QUKEYS_TIMEOUT)
void setTimeout(uint16_t time_limit) {
setHoldTimeout(time_limit);
}
DEPRECATED(QUKEYS_RELEASEDELAY)
void setReleaseDelay(uint8_t release_delay) {
if (release_delay == 0) {
overlap_threshold_ = 0;
} else {
overlap_threshold_ = 60;
}
}
// A wildcard value for a qukey that exists on every layer.
static constexpr int8_t layer_wildcard{-1};

@ -250,51 +250,6 @@ class Base {
}
/** @} */
/** @defgroup kaleidoscope_hardware_masking Kaleidoscope::Hardware/Key masking
*
* Sometimes there are situations when one wants to ignore key events for a
* while, to mask them out. Masked keys will be ignored until they are
* released.
*
* This is implemented in the Hardware library because that knows best how
* to mask efficiently, as this requires a deeper knowledge of the hardware,
* which is all but hidden from the rest of the plugins.
* @{
*/
/**
* Mask out a key.
*
* Masking a key out means that any other event than a release will be
* ignored until said release.
*
* @param key_addr is the matrix address of the key.
*/
void maskKey(KeyAddr key_addr) DEPRECATED(KEY_MASKING) {
key_scanner_.maskKey(key_addr);
}
/**
* Unmask a key.
*
* Remove the mask - if any - for a given key. To be used when the mask
* needs to be removed without the key being released.
*
* @param key_addr is the matrix address of the key.
*/
void unMaskKey(KeyAddr key_addr) {
key_scanner_.unMaskKey(key_addr);
}
/**
* Check whether a key is masked or not.
*
* @param key_addr is the matrix address of the key.
*
* @returns true if the key is masked, false otherwise.
*/
bool isKeyMasked(KeyAddr key_addr) {
return key_scanner_.isKeyMasked(key_addr);
}
/** @} */
/** @defgroup kaleidoscope_hardware_reattach Kaleidoscope::Hardware/Attach & Detach
*
* In situations where one wants to re-initialize the devices, perhaps to

@ -72,7 +72,6 @@ void VirtualKeyScanner::setup() {
for (auto key_addr : KeyAddr::all()) {
keystates_[key_addr.toInt()] = KeyState::NotPressed;
keystates_prev_[key_addr.toInt()] = KeyState::NotPressed;
mask_[key_addr.toInt()] = false;
}
}
@ -296,30 +295,6 @@ bool VirtualKeyScanner::wasKeyswitchPressed(KeyAddr key_addr) const {
return true;
}
void VirtualKeyScanner::maskKey(KeyAddr key_addr) {
if (!key_addr.isValid()) {
log_error("Virtual::maskKey: key_addr invalid\n");
return;
}
mask_[key_addr.toInt()] = true;
}
void VirtualKeyScanner::unMaskKey(KeyAddr key_addr) {
if (!key_addr.isValid()) {
log_error("Virtual::unMaskKey: key_addr invalid\n");
return;
}
mask_[key_addr.toInt()] = false;
}
bool VirtualKeyScanner::isKeyMasked(KeyAddr key_addr) const {
if (!key_addr.isValid()) {
log_error("Virtual::isKeyMasked: key_addr invalid\n");
return false;
}
return mask_[key_addr.toInt()];
}
void VirtualKeyScanner::setKeystate(KeyAddr keyAddr, KeyState ks) {
keystates_[keyAddr.toInt()] = ks;
}

@ -64,10 +64,6 @@ class VirtualKeyScanner
uint8_t previousPressedKeyswitchCount() const;
bool wasKeyswitchPressed(KeyAddr key_addr) const;
void maskKey(KeyAddr key_addr);
void unMaskKey(KeyAddr key_addr);
bool isKeyMasked(KeyAddr key_addr) const;
void setEnableReadMatrix(bool state) {
read_matrix_enabled_ = state;
}
@ -89,7 +85,6 @@ class VirtualKeyScanner
KeyState keystates_[matrix_rows * matrix_columns]; // NOLINT(runtime/arrays)
KeyState keystates_prev_[matrix_rows * matrix_columns]; // NOLINT(runtime/arrays)
bool mask_[matrix_rows * matrix_columns]; // NOLINT(runtime/arrays)
};
class VirtualLEDDriver

@ -159,26 +159,6 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> {
key_addr.col()) != 0);
}
void maskKey(typename _KeyScannerProps::KeyAddr key_addr) {
if (!key_addr.isValid())
return;
bitWrite(matrix_state_[key_addr.row()].masks, key_addr.col(), 1);
}
void unMaskKey(typename _KeyScannerProps::KeyAddr key_addr) {
if (!key_addr.isValid())
return;
bitWrite(matrix_state_[key_addr.row()].masks, key_addr.col(), 0);
}
bool isKeyMasked(typename _KeyScannerProps::KeyAddr key_addr) {
if (!key_addr.isValid())
return false;
return bitRead(matrix_state_[key_addr.row()].masks,
key_addr.col());
}
bool do_scan_;
@ -198,7 +178,6 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> {
struct row_state_t {
typename _KeyScannerProps::RowState previous;
typename _KeyScannerProps::RowState current;
typename _KeyScannerProps::RowState masks;
debounce_t debouncer;
};

@ -60,11 +60,6 @@ class Base {
return false;
}
void maskKey(KeyAddr key_addr) {}
void unMaskKey(KeyAddr key_addr) {}
bool isKeyMasked(KeyAddr key_addr) {
return false;
}
};
}

@ -96,20 +96,6 @@ void handleKeyswitchEvent(Key mappedKey, KeyAddr key_addr, uint8_t keyState) {
}
}
/* If the key we are dealing with is masked, ignore it until it is released.
* When releasing it, clear the mask, so future key events can be handled
* appropriately.
*
* See layers.cpp for an example that masks keys, and the reason why it does
* so.
*/
if (Runtime.device().isKeyMasked(key_addr)) {
if (keyToggledOff(keyState)) {
Runtime.device().unMaskKey(key_addr);
} else {
return;
}
}
/* Convert key_addr to the correct mappedKey
* The condition here means that if mappedKey and key_addr are both valid,

@ -96,24 +96,14 @@ class Layer_ {
static void activate(uint8_t layer);
static void deactivate(uint8_t layer);
static void activateNext();
static void deactivateTop() DEPRECATED(LAYER_DEACTIVATETOP) {
deactivateMostRecent();
}
static void deactivateMostRecent();
static void move(uint8_t layer);
static uint8_t top(void) DEPRECATED(LAYER_TOP) {
return mostRecent();
}
static uint8_t mostRecent() {
return active_layers_[active_layer_count_ - 1];
}
static boolean isActive(uint8_t layer);
static uint32_t getLayerState(void) DEPRECATED(LAYER_GETLAYERSTATE) {
return layer_state_;
}
static Key eventHandler(Key mappedKey, KeyAddr key_addr, uint8_t keyState);
typedef Key(*GetKeyFunction)(uint8_t layer, KeyAddr key_addr);

@ -27,22 +27,3 @@
/* Messages */
#define _DEPRECATED_MESSAGE_KEY_MASKING __NL__ \
"Key masking has been deprecated, please map keys to NoKey instead.\n" __NL__ \
"\n" __NL__ \
"For further information and examples on how to do that, \n" __NL__ \
"please see UPGRADING.md"
#define _DEPRECATED_MESSAGE_LAYER_DEACTIVATETOP __NL__ \
"`Layer.deactivateTop()` is deprecated.\n" __NL__ \
"Please use `Layer.deactivateMostRecent()` instead."
#define _DEPRECATED_MESSAGE_LAYER_TOP __NL__ \
"`Layer.top()` is deprecated.\n" __NL__ \
"Please use `Layer.mostRecent()` instead."
#define _DEPRECATED_MESSAGE_LAYER_GETLAYERSTATE __NL__ \
"`Layer.getLayerState()` is deprecated.\n" __NL__ \
"Layers are now in activation-order, please use" __NL__ \
"`Layer.forEachActiveLayer()` instead."

Loading…
Cancel
Save