Replace `boolean` & `byte` with `bool` & `uint8_t`

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1139/head
Michael Richters 3 years ago committed by Jesse Vincent
parent 93d6fa7dec
commit ef7956a0a5
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -310,8 +310,8 @@ void RaiseKeyScanner::readMatrix() {
} }
void RaiseKeyScanner::actOnMatrixScan() { void RaiseKeyScanner::actOnMatrixScan() {
for (byte row = 0; row < Props_::matrix_rows; row++) { for (uint8_t row = 0; row < Props_::matrix_rows; row++) {
for (byte col = 0; col < Props_::left_columns; col++) { for (uint8_t col = 0; col < Props_::left_columns; col++) {
uint8_t keynum = (row * Props_::left_columns) + col; uint8_t keynum = (row * Props_::left_columns) + col;
uint8_t keyState; uint8_t keyState;

@ -87,7 +87,7 @@ uint8_t RaiseSide::controllerAddress() {
// //
// returns the Wire.endTransmission code (0 = success) // returns the Wire.endTransmission code (0 = success)
// https://www.arduino.cc/en/Reference/WireEndTransmission // 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}; uint8_t data[] = {TWI_CMD_KEYSCAN_INTERVAL, delay};
return twi_.writeTo(data, ELEMENTS(data)); return twi_.writeTo(data, ELEMENTS(data));
} }
@ -106,7 +106,7 @@ int RaiseSide::readSLEDCurrent() {
return readRegister(TWI_CMD_SLED_CURRENT); 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}; uint8_t data[] = {TWI_CMD_SLED_CURRENT, current};
return twi_.writeTo(data, ELEMENTS(data)); return twi_.writeTo(data, ELEMENTS(data));
} }
@ -131,14 +131,14 @@ int RaiseSide::readLEDSPIFrequency() {
// //
// returns the Wire.endTransmission code (0 = success) // returns the Wire.endTransmission code (0 = success)
// https://www.arduino.cc/en/Reference/WireEndTransmission // 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}; uint8_t data[] = {TWI_CMD_LED_SPI_FREQUENCY, frequency};
return twi_.writeTo(data, ELEMENTS(data)); return twi_.writeTo(data, ELEMENTS(data));
} }
// returns -1 on error, otherwise returns the value of the hall sensor integer // returns -1 on error, otherwise returns the value of the hall sensor integer
int RaiseSide::readJoint() { int RaiseSide::readJoint() {
byte return_value = 0; uint8_t return_value = 0;
uint8_t data[] = {TWI_CMD_JOINED}; uint8_t data[] = {TWI_CMD_JOINED};
uint8_t result = twi_.writeTo(data, ELEMENTS(data)); uint8_t result = twi_.writeTo(data, ELEMENTS(data));
@ -160,7 +160,7 @@ int RaiseSide::readJoint() {
} }
int RaiseSide::readRegister(uint8_t cmd) { int RaiseSide::readRegister(uint8_t cmd) {
byte return_value = 0; uint8_t return_value = 0;
uint8_t data[] = {cmd}; uint8_t data[] = {cmd};
uint8_t result = twi_.writeTo(data, ELEMENTS(data)); uint8_t result = twi_.writeTo(data, ELEMENTS(data));

@ -43,7 +43,7 @@ namespace raise {
typedef union { typedef union {
cRGB leds[LEDS_PER_HAND]; cRGB leds[LEDS_PER_HAND];
byte bytes[LED_BANKS][LED_BYTES_PER_BANK]; uint8_t bytes[LED_BANKS][LED_BYTES_PER_BANK];
} LEDData_t; } LEDData_t;
// return what bank the led is in // return what bank the led is in
@ -56,19 +56,19 @@ typedef union {
class RaiseSide { class RaiseSide {
public: 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 readVersion();
int readSLEDVersion(); int readSLEDVersion();
int readSLEDCurrent(); int readSLEDCurrent();
byte setSLEDCurrent(byte current); uint8_t setSLEDCurrent(uint8_t current);
int readJoint(); int readJoint();
int readLayout(); int readLayout();
byte setKeyscanInterval(byte delay); uint8_t setKeyscanInterval(uint8_t delay);
int readKeyscanInterval(); int readKeyscanInterval();
byte setLEDSPIFrequency(byte frequency); uint8_t setLEDSPIFrequency(uint8_t frequency);
int readLEDSPIFrequency(); int readLEDSPIFrequency();
bool moreKeysWaiting(); bool moreKeysWaiting();

@ -112,8 +112,8 @@ void __attribute__((optimize(3))) ErgoDox::readMatrix() {
} }
void __attribute__((optimize(3))) ErgoDox::actOnMatrixScan() { void __attribute__((optimize(3))) ErgoDox::actOnMatrixScan() {
for (byte row = 0; row < matrix_rows; row++) { for (uint8_t row = 0; row < matrix_rows; row++) {
for (byte col = 0; col < matrix_columns; col++) { for (uint8_t col = 0; col < matrix_columns; col++) {
uint8_t key_state = (bitRead(previousKeyState_[row], col) << 0) | uint8_t key_state = (bitRead(previousKeyState_[row], col) << 0) |
(bitRead(keyState_[row], col) << 1); (bitRead(keyState_[row], col) << 1);
if (keyToggledOn(key_state) || keyToggledOff(key_state)) { if (keyToggledOn(key_state) || keyToggledOff(key_state)) {

@ -122,8 +122,8 @@ void KeyScanner::readMatrix() {
} }
void KeyScanner::actOnMatrixScan() { void KeyScanner::actOnMatrixScan() {
for (byte col = 0; col < Props_::matrix_columns; col++) { for (uint8_t col = 0; col < Props_::matrix_columns; col++) {
for (byte row = 0; row < Props_::matrix_rows; row++) { 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); uint8_t keyState = (bitRead(matrix_state_[col].previous, row) << 0) | (bitRead(matrix_state_[col].current, row) << 1);
if (keyState) { if (keyState) {
ThisType::handleKeyswitchEvent(Key_NoKey, typename Props_::KeyAddr(row, col), keyState); ThisType::handleKeyswitchEvent(Key_NoKey, typename Props_::KeyAddr(row, col), keyState);

@ -124,7 +124,7 @@ void Model01LEDDriver::syncLeds() {
isLEDChanged = false; isLEDChanged = false;
} }
boolean Model01LEDDriver::ledPowerFault() { bool Model01LEDDriver::ledPowerFault() {
if (PINB & _BV(4)) { if (PINB & _BV(4)) {
return true; return true;
} else { } 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)) { 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 // Build up the key state for row, col
uint8_t keyState = ((bitRead(colPrevState, 0) << 0) | uint8_t keyState = ((bitRead(colPrevState, 0) << 0) |
(bitRead(colState, 0) << 1)); (bitRead(colState, 0) << 1));
@ -182,7 +182,7 @@ void Model01KeyScanner::actOnHalfRow(byte row, byte colState, byte colPrevState,
} }
void Model01KeyScanner::actOnMatrixScan() { 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, leftHandState.rows[row], previousLeftHandState.rows[row], 7);
actOnHalfRow(row, rightHandState.rows[row], previousRightHandState.rows[row], 15); actOnHalfRow(row, rightHandState.rows[row], previousRightHandState.rows[row], 15);
} }

@ -60,7 +60,7 @@ class Model01LEDDriver : public kaleidoscope::driver::led::Base<Model01LEDDriver
static uint8_t getBrightness(); static uint8_t getBrightness();
static void enableHighPowerLeds(); static void enableHighPowerLeds();
static boolean ledPowerFault(); static bool ledPowerFault();
private: private:
static bool isLEDChanged; static bool isLEDChanged;

@ -40,7 +40,7 @@ namespace keyboardio {
uint8_t twi_uninitialized = 1; uint8_t twi_uninitialized = 1;
Model01Side::Model01Side(byte setAd01) { Model01Side::Model01Side(uint8_t setAd01) {
ad01 = setAd01; ad01 = setAd01;
addr = SCANNER_I2C_ADDR_BASE | ad01; addr = SCANNER_I2C_ADDR_BASE | ad01;
if (twi_uninitialized--) { if (twi_uninitialized--) {
@ -70,7 +70,7 @@ uint8_t Model01Side::controllerAddress() {
// //
// returns the Wire.endTransmission code (0 = success) // returns the Wire.endTransmission code (0 = success)
// https://www.arduino.cc/en/Reference/WireEndTransmission // https://www.arduino.cc/en/Reference/WireEndTransmission
byte Model01Side::setKeyscanInterval(byte delay) { uint8_t Model01Side::setKeyscanInterval(uint8_t delay) {
uint8_t data[] = {TWI_CMD_KEYSCAN_INTERVAL, delay}; uint8_t data[] = {TWI_CMD_KEYSCAN_INTERVAL, delay};
uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0); uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0);
@ -101,7 +101,7 @@ int Model01Side::readLEDSPIFrequency() {
// //
// returns the Wire.endTransmission code (0 = success) // returns the Wire.endTransmission code (0 = success)
// https://www.arduino.cc/en/Reference/WireEndTransmission // https://www.arduino.cc/en/Reference/WireEndTransmission
byte Model01Side::setLEDSPIFrequency(byte frequency) { uint8_t Model01Side::setLEDSPIFrequency(uint8_t frequency) {
uint8_t data[] = {TWI_CMD_LED_SPI_FREQUENCY, frequency}; uint8_t data[] = {TWI_CMD_LED_SPI_FREQUENCY, frequency};
uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0); uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0);
@ -112,7 +112,7 @@ byte Model01Side::setLEDSPIFrequency(byte frequency) {
int Model01Side::readRegister(uint8_t cmd) { int Model01Side::readRegister(uint8_t cmd) {
byte return_value = 0; uint8_t return_value = 0;
uint8_t data[] = {cmd}; uint8_t data[] = {cmd};
uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0); uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0);
@ -168,7 +168,7 @@ void Model01Side::sendLEDData() {
auto constexpr gamma8 = kaleidoscope::driver::color::gamma_correction; auto constexpr gamma8 = kaleidoscope::driver::color::gamma_correction;
void Model01Side::sendLEDBank(byte bank) { void Model01Side::sendLEDBank(uint8_t bank) {
uint8_t data[LED_BYTES_PER_BANK + 1]; uint8_t data[LED_BYTES_PER_BANK + 1];
data[0] = TWI_CMD_LED_BASE + bank; data[0] = TWI_CMD_LED_BASE + bank;
for (uint8_t i = 0 ; i < LED_BYTES_PER_BANK; i++) { for (uint8_t i = 0 ; i < LED_BYTES_PER_BANK; i++) {
@ -196,7 +196,7 @@ void Model01Side::setAllLEDsTo(cRGB color) {
uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0); uint8_t result = twi_writeTo(addr, data, ELEMENTS(data), 1, 0);
} }
void Model01Side::setOneLEDTo(byte led, cRGB color) { void Model01Side::setOneLEDTo(uint8_t led, cRGB color) {
uint8_t data[] = {TWI_CMD_LED_SET_ONE_TO, uint8_t data[] = {TWI_CMD_LED_SET_ONE_TO,
led, led,
pgm_read_byte(&gamma8[color.b]), pgm_read_byte(&gamma8[color.b]),

@ -48,7 +48,7 @@ namespace keyboardio {
typedef union { typedef union {
cRGB leds[LEDS_PER_HAND]; cRGB leds[LEDS_PER_HAND];
byte bytes[LED_BANKS][LED_BYTES_PER_BANK]; uint8_t bytes[LED_BANKS][LED_BYTES_PER_BANK];
} LEDData_t; } LEDData_t;
typedef union { typedef union {
@ -62,19 +62,19 @@ typedef union {
// used to configure interrupts, configuration for a particular controller // used to configure interrupts, configuration for a particular controller
class Model01Side { class Model01Side {
public: public:
explicit Model01Side(byte setAd01); explicit Model01Side(uint8_t setAd01);
~Model01Side() {} ~Model01Side() {}
int readVersion(); int readVersion();
byte setKeyscanInterval(byte delay); uint8_t setKeyscanInterval(uint8_t delay);
int readKeyscanInterval(); int readKeyscanInterval();
byte setLEDSPIFrequency(byte frequency); uint8_t setLEDSPIFrequency(uint8_t frequency);
int readLEDSPIFrequency(); int readLEDSPIFrequency();
void sendLEDData(); void sendLEDData();
void setOneLEDTo(byte led, cRGB color); void setOneLEDTo(uint8_t led, cRGB color);
void setAllLEDsTo(cRGB color); void setAllLEDsTo(cRGB color);
keydata_t getKeyData(); keydata_t getKeyData();
bool readKeys(); bool readKeys();
@ -93,8 +93,8 @@ class Model01Side {
int addr; int addr;
int ad01; int ad01;
keydata_t keyData; keydata_t keyData;
byte nextLEDBank = 0; uint8_t nextLEDBank = 0;
void sendLEDBank(byte bank); void sendLEDBank(uint8_t bank);
int readRegister(uint8_t cmd); int readRegister(uint8_t cmd);
}; };
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -163,9 +163,9 @@ void Model100KeyScanner::readMatrix() {
} }
} }
void Model100KeyScanner::actOnHalfRow(byte row, byte colState, byte colPrevState, byte startPos) { void Model100KeyScanner::actOnHalfRow(uint8_t row, uint8_t colState, uint8_t colPrevState, uint8_t startPos) {
if ((colState != colPrevState) || (colState != 0)) { 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 // Build up the key state for row, col
uint8_t keyState = ((bitRead(colPrevState, 0) << 0) | uint8_t keyState = ((bitRead(colPrevState, 0) << 0) |
(bitRead(colState, 0) << 1)); (bitRead(colState, 0) << 1));
@ -180,7 +180,7 @@ void Model100KeyScanner::actOnHalfRow(byte row, byte colState, byte colPrevState
} }
void Model100KeyScanner::actOnMatrixScan() { void Model100KeyScanner::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, leftHandState.rows[row], previousLeftHandState.rows[row], 7);
actOnHalfRow(row, rightHandState.rows[row], previousRightHandState.rows[row], 15); actOnHalfRow(row, rightHandState.rows[row], previousRightHandState.rows[row], 15);
} }

@ -112,7 +112,7 @@ class Model100KeyScanner : public kaleidoscope::driver::keyscanner::Base<Model10
static driver::keyboardio::keydata_t previousLeftHandState; static driver::keyboardio::keydata_t previousLeftHandState;
static driver::keyboardio::keydata_t previousRightHandState; static driver::keyboardio::keydata_t previousRightHandState;
static void actOnHalfRow(byte row, byte colState, byte colPrevState, byte startPos); static void actOnHalfRow(uint8_t row, uint8_t colState, uint8_t colPrevState, uint8_t startPos);
}; };
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Model100KeyScanner; class Model100KeyScanner;

@ -38,7 +38,7 @@ namespace keyboardio {
uint8_t twi_uninitialized = 1; uint8_t twi_uninitialized = 1;
Model100Side::Model100Side(byte setAd01) { Model100Side::Model100Side(uint8_t setAd01) {
ad01 = setAd01; ad01 = setAd01;
addr = SCANNER_I2C_ADDR_BASE | ad01; addr = SCANNER_I2C_ADDR_BASE | ad01;
markDeviceUnavailable(); markDeviceUnavailable();
@ -66,7 +66,7 @@ uint8_t Model100Side::controllerAddress() {
// //
// returns the Wire.endTransmission code (0 = success) // returns the Wire.endTransmission code (0 = success)
// https://www.arduino.cc/en/Reference/WireEndTransmission // https://www.arduino.cc/en/Reference/WireEndTransmission
byte Model100Side::setKeyscanInterval(byte delay) { uint8_t Model100Side::setKeyscanInterval(uint8_t delay) {
uint8_t data[] = {TWI_CMD_KEYSCAN_INTERVAL, delay}; uint8_t data[] = {TWI_CMD_KEYSCAN_INTERVAL, delay};
uint8_t result = writeData(data, ELEMENTS(data)); uint8_t result = writeData(data, ELEMENTS(data));
return result; return result;
@ -96,7 +96,7 @@ int Model100Side::readLEDSPIFrequency() {
// //
// returns the Wire.endTransmission code (0 = success) // returns the Wire.endTransmission code (0 = success)
// https://www.arduino.cc/en/Reference/WireEndTransmission // https://www.arduino.cc/en/Reference/WireEndTransmission
byte Model100Side::setLEDSPIFrequency(byte frequency) { uint8_t Model100Side::setLEDSPIFrequency(uint8_t frequency) {
uint8_t data[] = {TWI_CMD_LED_SPI_FREQUENCY, frequency}; uint8_t data[] = {TWI_CMD_LED_SPI_FREQUENCY, frequency};
uint8_t result = writeData(data, ELEMENTS(data)); uint8_t result = writeData(data, ELEMENTS(data));
@ -153,7 +153,7 @@ uint8_t Model100Side::writeData(uint8_t *data, uint8_t length) {
} }
int Model100Side::readRegister(uint8_t cmd) { int Model100Side::readRegister(uint8_t cmd) {
byte return_value = 0; uint8_t return_value = 0;
uint8_t data[] = {cmd}; uint8_t data[] = {cmd};
uint8_t result = writeData(data, ELEMENTS(data)); uint8_t result = writeData(data, ELEMENTS(data));
@ -220,7 +220,7 @@ void Model100Side::sendLEDData() {
} }
void Model100Side::sendLEDBank(byte bank) { void Model100Side::sendLEDBank(uint8_t bank) {
uint8_t data[LED_BYTES_PER_BANK + 1]; uint8_t data[LED_BYTES_PER_BANK + 1];
data[0] = TWI_CMD_LED_BASE + bank; data[0] = TWI_CMD_LED_BASE + bank;
for (uint8_t i = 0 ; i < LED_BYTES_PER_BANK; i++) { for (uint8_t i = 0 ; i < LED_BYTES_PER_BANK; i++) {
@ -248,7 +248,7 @@ void Model100Side::setAllLEDsTo(cRGB color) {
uint8_t result = writeData(data, ELEMENTS(data)); uint8_t result = writeData(data, ELEMENTS(data));
} }
void Model100Side::setOneLEDTo(byte led, cRGB color) { void Model100Side::setOneLEDTo(uint8_t led, cRGB color) {
uint8_t data[] = {TWI_CMD_LED_SET_ONE_TO, uint8_t data[] = {TWI_CMD_LED_SET_ONE_TO,
led, led,
color.b, color.b,

@ -25,12 +25,12 @@ class LEDRainbowEffect : public Plugin,
public: public:
LEDRainbowEffect(void) {} LEDRainbowEffect(void) {}
void brightness(byte); void brightness(uint8_t);
byte brightness(void) { uint8_t brightness(void) {
return rainbow_value; return rainbow_value;
} }
void update_delay(byte); void update_delay(uint8_t);
byte update_delay(void) { uint8_t update_delay(void) {
return rainbow_update_delay; return rainbow_update_delay;
} }
@ -57,12 +57,12 @@ class LEDRainbowEffect : public Plugin,
uint8_t rainbow_steps = 1; // number of hues we skip in a 360 range per update uint8_t rainbow_steps = 1; // number of hues we skip in a 360 range per update
uint8_t rainbow_last_update = 0; uint8_t rainbow_last_update = 0;
byte rainbow_saturation = 255; uint8_t rainbow_saturation = 255;
}; };
private: private:
uint8_t rainbow_update_delay = 40; // delay between updates (ms) uint8_t rainbow_update_delay = 40; // delay between updates (ms)
byte rainbow_value = 50; uint8_t rainbow_value = 50;
}; };
@ -70,12 +70,12 @@ class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface {
public: public:
LEDRainbowWaveEffect(void) {} LEDRainbowWaveEffect(void) {}
void brightness(byte); void brightness(uint8_t);
byte brightness(void) { uint8_t brightness(void) {
return rainbow_value; return rainbow_value;
} }
void update_delay(byte); void update_delay(uint8_t);
byte update_delay(void) { uint8_t update_delay(void) {
return rainbow_update_delay; return rainbow_update_delay;
} }
@ -102,11 +102,11 @@ class LEDRainbowWaveEffect : public Plugin, public LEDModeInterface {
uint8_t rainbow_wave_steps = 1; // number of hues we skip in a 360 range per update uint8_t rainbow_wave_steps = 1; // number of hues we skip in a 360 range per update
uint8_t rainbow_last_update = 0; uint8_t rainbow_last_update = 0;
byte rainbow_saturation = 255; uint8_t rainbow_saturation = 255;
}; };
uint8_t rainbow_update_delay = 40; // delay between updates (ms) uint8_t rainbow_update_delay = 40; // delay between updates (ms)
byte rainbow_value = 50; uint8_t rainbow_value = 50;
}; };
} }
} }

@ -29,9 +29,9 @@ EventHandlerResult MagicCombo::onNameQuery() {
} }
EventHandlerResult MagicCombo::afterEachCycle() { EventHandlerResult MagicCombo::afterEachCycle() {
for (byte i = 0; i < magiccombo::combos_length; i++) { for (uint8_t i = 0; i < magiccombo::combos_length; i++) {
bool match = true; bool match = true;
byte j; uint8_t j;
for (j = 0; j < MAX_COMBO_LENGTH; j++) { for (j = 0; j < MAX_COMBO_LENGTH; j++) {
int8_t comboKey = pgm_read_byte(&(magiccombo::combos[i].keys[j])); int8_t comboKey = pgm_read_byte(&(magiccombo::combos[i].keys[j]));

@ -30,7 +30,7 @@ uint16_t MouseWrapper::next_width;
uint16_t MouseWrapper::next_height; uint16_t MouseWrapper::next_height;
uint16_t MouseWrapper::section_top; uint16_t MouseWrapper::section_top;
uint16_t MouseWrapper::section_left; uint16_t MouseWrapper::section_left;
boolean MouseWrapper::is_warping; bool MouseWrapper::is_warping;
uint8_t MouseWrapper::accel_step; uint8_t MouseWrapper::accel_step;
uint8_t MouseWrapper::speed_limit = 127; uint8_t MouseWrapper::speed_limit = 127;

@ -57,7 +57,7 @@ class MouseWrapper {
static uint16_t next_height; static uint16_t next_height;
static uint16_t section_top; static uint16_t section_top;
static uint16_t section_left; static uint16_t section_left;
static boolean is_warping; static bool is_warping;
static uint8_t acceleration(uint8_t cycles); static uint8_t acceleration(uint8_t cycles);

@ -29,7 +29,7 @@ namespace kaleidoscope {
// when calling this function (e.g. `bitfieldSize<uint16_t>(n)`). The default `UnitType` // when calling this function (e.g. `bitfieldSize<uint16_t>(n)`). The default `UnitType`
// is `byte` (i.e. `uint8_t`, which is almost always what we want, so most of the time we // 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)`). // can also drop that template parameter (e.g. `bitfieldSize(n)`).
template <typename _UnitType = byte, typename _WidthType> template <typename _UnitType = uint8_t, typename _WidthType>
constexpr _WidthType bitfieldSize(_WidthType n) { constexpr _WidthType bitfieldSize(_WidthType n) {
return ((n - 1) / (8 * sizeof(_UnitType))) + 1; return ((n - 1) / (8 * sizeof(_UnitType))) + 1;
} }

@ -229,7 +229,7 @@ class Keyboard {
return nkro_keyboard_.isKeyPressed(key.getKeyCode()); return nkro_keyboard_.isKeyPressed(key.getKeyCode());
} }
boolean isModifierKeyActive(Key modifier_key) { bool isModifierKeyActive(Key modifier_key) {
if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) { if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) {
return boot_keyboard_.isModifierActive(modifier_key.getKeyCode()); return boot_keyboard_.isModifierActive(modifier_key.getKeyCode());
} }
@ -237,7 +237,7 @@ class Keyboard {
return nkro_keyboard_.isModifierActive(modifier_key.getKeyCode()); return nkro_keyboard_.isModifierActive(modifier_key.getKeyCode());
} }
boolean wasModifierKeyActive(Key modifier_key) { bool wasModifierKeyActive(Key modifier_key) {
if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) { if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) {
return boot_keyboard_.wasModifierActive(modifier_key.getKeyCode()); return boot_keyboard_.wasModifierActive(modifier_key.getKeyCode());
} }
@ -245,7 +245,7 @@ class Keyboard {
return nkro_keyboard_.wasModifierActive(modifier_key.getKeyCode()); return nkro_keyboard_.wasModifierActive(modifier_key.getKeyCode());
} }
boolean isAnyModifierKeyActive() { bool isAnyModifierKeyActive() {
if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) { if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) {
return boot_keyboard_.isAnyModifierActive(); return boot_keyboard_.isAnyModifierActive();
} }
@ -253,7 +253,7 @@ class Keyboard {
return nkro_keyboard_.isAnyModifierActive(); return nkro_keyboard_.isAnyModifierActive();
} }
boolean wasAnyModifierKeyActive() { bool wasAnyModifierKeyActive() {
if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) { if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) {
return boot_keyboard_.wasAnyModifierActive(); return boot_keyboard_.wasAnyModifierActive();
} }
@ -290,7 +290,7 @@ class Keyboard {
// the upcoming USB HID report and passes them through to KeyboardioHID // the upcoming USB HID report and passes them through to KeyboardioHID
// immediately // immediately
void pressModifiers(byte flags) { void pressModifiers(uint8_t flags) {
if (flags & SHIFT_HELD) { if (flags & SHIFT_HELD) {
pressRawKey(Key_LeftShift); pressRawKey(Key_LeftShift);
} }
@ -312,7 +312,7 @@ class Keyboard {
// the upcoming USB HID report and passes them through to KeyboardioHID // the upcoming USB HID report and passes them through to KeyboardioHID
// immediately // immediately
void releaseModifiers(byte flags) { void releaseModifiers(uint8_t flags) {
if (flags & SHIFT_HELD) { if (flags & SHIFT_HELD) {
releaseRawKey(Key_LeftShift); releaseRawKey(Key_LeftShift);
} }

@ -123,8 +123,8 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> {
} }
void __attribute__((optimize(3))) actOnMatrixScan() { void __attribute__((optimize(3))) actOnMatrixScan() {
for (byte row = 0; row < _KeyScannerProps::matrix_rows; row++) { for (uint8_t row = 0; row < _KeyScannerProps::matrix_rows; row++) {
for (byte col = 0; col < _KeyScannerProps::matrix_columns; col++) { 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); uint8_t keyState = (bitRead(matrix_state_[row].previous, col) << 0) | (bitRead(matrix_state_[row].current, col) << 1);
if (keyState) { if (keyState) {
ThisType::handleKeyswitchEvent(Key_NoKey, typename _KeyScannerProps::KeyAddr(row, col), keyState); ThisType::handleKeyswitchEvent(Key_NoKey, typename _KeyScannerProps::KeyAddr(row, col), keyState);

@ -224,7 +224,7 @@ void Layer_::deactivate(uint8_t layer) {
kaleidoscope::Hooks::onLayerChange(); 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) { for (int8_t i = 0; i < active_layer_count_; ++i) {
if (active_layers_[i] == layer) if (active_layers_[i] == layer)
return true; return true;

@ -94,7 +94,7 @@ class Layer_ {
static uint8_t mostRecent() { static uint8_t mostRecent() {
return active_layers_[active_layer_count_ - 1]; 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); static void handleLayerKeyEvent(const KeyEvent &event);

Loading…
Cancel
Save