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 5e6084c0..939e2991 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 @@ -310,8 +310,8 @@ void RaiseKeyScanner::readMatrix() { } void RaiseKeyScanner::actOnMatrixScan() { - for (byte row = 0; row < Props_::matrix_rows; row++) { - for (byte col = 0; col < Props_::left_columns; col++) { + for (uint8_t row = 0; row < Props_::matrix_rows; row++) { + for (uint8_t col = 0; col < Props_::left_columns; col++) { uint8_t keynum = (row * Props_::left_columns) + col; uint8_t keyState; 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 b1a6810b..66242176 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 @@ -87,7 +87,7 @@ uint8_t RaiseSide::controllerAddress() { // // returns the Wire.endTransmission code (0 = success) // https://www.arduino.cc/en/Reference/WireEndTransmission -byte RaiseSide::setKeyscanInterval(byte delay) { +uint8_t RaiseSide::setKeyscanInterval(uint8_t delay) { uint8_t data[] = {TWI_CMD_KEYSCAN_INTERVAL, delay}; return twi_.writeTo(data, ELEMENTS(data)); } @@ -106,7 +106,7 @@ int RaiseSide::readSLEDCurrent() { return readRegister(TWI_CMD_SLED_CURRENT); } -byte RaiseSide::setSLEDCurrent(byte current) { +uint8_t RaiseSide::setSLEDCurrent(uint8_t current) { uint8_t data[] = {TWI_CMD_SLED_CURRENT, current}; return twi_.writeTo(data, ELEMENTS(data)); } @@ -131,14 +131,14 @@ int RaiseSide::readLEDSPIFrequency() { // // returns the Wire.endTransmission code (0 = success) // https://www.arduino.cc/en/Reference/WireEndTransmission -byte RaiseSide::setLEDSPIFrequency(byte frequency) { +uint8_t RaiseSide::setLEDSPIFrequency(uint8_t frequency) { uint8_t data[] = {TWI_CMD_LED_SPI_FREQUENCY, frequency}; return twi_.writeTo(data, ELEMENTS(data)); } // returns -1 on error, otherwise returns the value of the hall sensor integer int RaiseSide::readJoint() { - byte return_value = 0; + uint8_t return_value = 0; uint8_t data[] = {TWI_CMD_JOINED}; uint8_t result = twi_.writeTo(data, ELEMENTS(data)); @@ -160,7 +160,7 @@ int RaiseSide::readJoint() { } int RaiseSide::readRegister(uint8_t cmd) { - byte return_value = 0; + uint8_t return_value = 0; uint8_t data[] = {cmd}; uint8_t result = twi_.writeTo(data, ELEMENTS(data)); 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 66c1d47d..8d63024b 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 @@ -43,7 +43,7 @@ namespace raise { typedef union { cRGB leds[LEDS_PER_HAND]; - byte bytes[LED_BANKS][LED_BYTES_PER_BANK]; + uint8_t bytes[LED_BANKS][LED_BYTES_PER_BANK]; } LEDData_t; // return what bank the led is in @@ -56,19 +56,19 @@ typedef union { class RaiseSide { public: - explicit RaiseSide(byte ad01) : ad01_(ad01), twi_(i2c_addr_base_ | ad01) {} + explicit RaiseSide(uint8_t ad01) : ad01_(ad01), twi_(i2c_addr_base_ | ad01) {} int readVersion(); int readSLEDVersion(); int readSLEDCurrent(); - byte setSLEDCurrent(byte current); + uint8_t setSLEDCurrent(uint8_t current); int readJoint(); int readLayout(); - byte setKeyscanInterval(byte delay); + uint8_t setKeyscanInterval(uint8_t delay); int readKeyscanInterval(); - byte setLEDSPIFrequency(byte frequency); + uint8_t setLEDSPIFrequency(uint8_t frequency); int readLEDSPIFrequency(); bool moreKeysWaiting(); 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 f9d241c6..901231be 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 @@ -112,8 +112,8 @@ void __attribute__((optimize(3))) ErgoDox::readMatrix() { } void __attribute__((optimize(3))) ErgoDox::actOnMatrixScan() { - for (byte row = 0; row < matrix_rows; row++) { - for (byte col = 0; col < matrix_columns; col++) { + for (uint8_t row = 0; row < matrix_rows; row++) { + for (uint8_t col = 0; col < matrix_columns; col++) { uint8_t key_state = (bitRead(previousKeyState_[row], col) << 0) | (bitRead(keyState_[row], col) << 1); if (keyToggledOn(key_state) || keyToggledOff(key_state)) { 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 8e8699bc..cf3e6f3c 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 @@ -122,8 +122,8 @@ void KeyScanner::readMatrix() { } void KeyScanner::actOnMatrixScan() { - for (byte col = 0; col < Props_::matrix_columns; col++) { - for (byte row = 0; row < Props_::matrix_rows; row++) { + for (uint8_t col = 0; col < Props_::matrix_columns; col++) { + for (uint8_t row = 0; row < Props_::matrix_rows; row++) { uint8_t keyState = (bitRead(matrix_state_[col].previous, row) << 0) | (bitRead(matrix_state_[col].current, row) << 1); if (keyState) { ThisType::handleKeyswitchEvent(Key_NoKey, typename Props_::KeyAddr(row, col), keyState); 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 0fb2e820..85f8e566 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 @@ -124,7 +124,7 @@ void Model01LEDDriver::syncLeds() { isLEDChanged = false; } -boolean Model01LEDDriver::ledPowerFault() { +bool Model01LEDDriver::ledPowerFault() { if (PINB & _BV(4)) { return true; } else { @@ -165,9 +165,9 @@ void Model01KeyScanner::readMatrix() { } } -void Model01KeyScanner::actOnHalfRow(byte row, byte colState, byte colPrevState, byte startPos) { +void Model01KeyScanner::actOnHalfRow(uint8_t row, uint8_t colState, uint8_t colPrevState, uint8_t startPos) { if ((colState != colPrevState) || (colState != 0)) { - for (byte col = 0; col < 8; 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)); @@ -182,7 +182,7 @@ void Model01KeyScanner::actOnHalfRow(byte row, byte colState, byte colPrevState, } void Model01KeyScanner::actOnMatrixScan() { - for (byte row = 0; row < 4; row++) { + for (uint8_t row = 0; row < 4; row++) { actOnHalfRow(row, leftHandState.rows[row], previousLeftHandState.rows[row], 7); actOnHalfRow(row, rightHandState.rows[row], previousRightHandState.rows[row], 15); } 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 14f60631..61d2f65b 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 @@ -60,7 +60,7 @@ class Model01LEDDriver : public kaleidoscope::driver::led::Base(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; } diff --git a/src/kaleidoscope/driver/hid/base/Keyboard.h b/src/kaleidoscope/driver/hid/base/Keyboard.h index c7aac2a8..61bcbdbd 100644 --- a/src/kaleidoscope/driver/hid/base/Keyboard.h +++ b/src/kaleidoscope/driver/hid/base/Keyboard.h @@ -229,7 +229,7 @@ class Keyboard { return nkro_keyboard_.isKeyPressed(key.getKeyCode()); } - boolean isModifierKeyActive(Key modifier_key) { + bool isModifierKeyActive(Key modifier_key) { if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) { return boot_keyboard_.isModifierActive(modifier_key.getKeyCode()); } @@ -237,7 +237,7 @@ class Keyboard { return nkro_keyboard_.isModifierActive(modifier_key.getKeyCode()); } - boolean wasModifierKeyActive(Key modifier_key) { + bool wasModifierKeyActive(Key modifier_key) { if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) { return boot_keyboard_.wasModifierActive(modifier_key.getKeyCode()); } @@ -245,7 +245,7 @@ class Keyboard { return nkro_keyboard_.wasModifierActive(modifier_key.getKeyCode()); } - boolean isAnyModifierKeyActive() { + bool isAnyModifierKeyActive() { if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) { return boot_keyboard_.isAnyModifierActive(); } @@ -253,7 +253,7 @@ class Keyboard { return nkro_keyboard_.isAnyModifierActive(); } - boolean wasAnyModifierKeyActive() { + bool wasAnyModifierKeyActive() { if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) { return boot_keyboard_.wasAnyModifierActive(); } @@ -290,7 +290,7 @@ class Keyboard { // the upcoming USB HID report and passes them through to KeyboardioHID // immediately - void pressModifiers(byte flags) { + void pressModifiers(uint8_t flags) { if (flags & SHIFT_HELD) { pressRawKey(Key_LeftShift); } @@ -312,7 +312,7 @@ class Keyboard { // the upcoming USB HID report and passes them through to KeyboardioHID // immediately - void releaseModifiers(byte flags) { + void releaseModifiers(uint8_t flags) { if (flags & SHIFT_HELD) { releaseRawKey(Key_LeftShift); } diff --git a/src/kaleidoscope/driver/keyscanner/ATmega.h b/src/kaleidoscope/driver/keyscanner/ATmega.h index 3fa4bb83..b8e05eb3 100644 --- a/src/kaleidoscope/driver/keyscanner/ATmega.h +++ b/src/kaleidoscope/driver/keyscanner/ATmega.h @@ -123,8 +123,8 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> { } void __attribute__((optimize(3))) actOnMatrixScan() { - for (byte row = 0; row < _KeyScannerProps::matrix_rows; row++) { - for (byte col = 0; col < _KeyScannerProps::matrix_columns; col++) { + for (uint8_t row = 0; row < _KeyScannerProps::matrix_rows; row++) { + for (uint8_t col = 0; col < _KeyScannerProps::matrix_columns; col++) { uint8_t keyState = (bitRead(matrix_state_[row].previous, col) << 0) | (bitRead(matrix_state_[row].current, col) << 1); if (keyState) { ThisType::handleKeyswitchEvent(Key_NoKey, typename _KeyScannerProps::KeyAddr(row, col), keyState); diff --git a/src/kaleidoscope/layers.cpp b/src/kaleidoscope/layers.cpp index b7ff8c55..9a395d48 100644 --- a/src/kaleidoscope/layers.cpp +++ b/src/kaleidoscope/layers.cpp @@ -224,7 +224,7 @@ void Layer_::deactivate(uint8_t layer) { kaleidoscope::Hooks::onLayerChange(); } -boolean Layer_::isActive(uint8_t layer) { +bool Layer_::isActive(uint8_t layer) { for (int8_t i = 0; i < active_layer_count_; ++i) { if (active_layers_[i] == layer) return true; diff --git a/src/kaleidoscope/layers.h b/src/kaleidoscope/layers.h index 9428cc28..9f92d9f2 100644 --- a/src/kaleidoscope/layers.h +++ b/src/kaleidoscope/layers.h @@ -94,7 +94,7 @@ class Layer_ { static uint8_t mostRecent() { return active_layers_[active_layer_count_ - 1]; } - static boolean isActive(uint8_t layer); + static bool isActive(uint8_t layer); static void handleLayerKeyEvent(const KeyEvent &event);