forked from forks/qmk_firmware
Merge remote-tracking branch 'upstream/master' into develop
This commit is contained in:
commit
271c0cf136
|
@ -115,11 +115,17 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
spi_status_t spi_write(uint8_t data) { return spi_transmit(&data, 1); }
|
spi_status_t spi_write(uint8_t data) {
|
||||||
|
uint8_t rxData;
|
||||||
|
spiExchange(&SPI_DRIVER, 1, &data, &rxData);
|
||||||
|
|
||||||
|
return rxData;
|
||||||
|
}
|
||||||
|
|
||||||
spi_status_t spi_read(void) {
|
spi_status_t spi_read(void) {
|
||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
spi_receive(&data, 1);
|
spiReceive(&SPI_DRIVER, 1, &data);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -628,7 +628,7 @@ void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_set
|
||||||
|
|
||||||
#ifdef RGBLIGHT_LAYERS
|
#ifdef RGBLIGHT_LAYERS
|
||||||
void rgblight_set_layer_state(uint8_t layer, bool enabled) {
|
void rgblight_set_layer_state(uint8_t layer, bool enabled) {
|
||||||
rgblight_layer_mask_t mask = 1 << layer;
|
rgblight_layer_mask_t mask = (rgblight_layer_mask_t)1 << layer;
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
rgblight_status.enabled_layer_mask |= mask;
|
rgblight_status.enabled_layer_mask |= mask;
|
||||||
} else {
|
} else {
|
||||||
|
@ -649,7 +649,7 @@ void rgblight_set_layer_state(uint8_t layer, bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rgblight_get_layer_state(uint8_t layer) {
|
bool rgblight_get_layer_state(uint8_t layer) {
|
||||||
rgblight_layer_mask_t mask = 1 << layer;
|
rgblight_layer_mask_t mask = (rgblight_layer_mask_t)1 << layer;
|
||||||
return (rgblight_status.enabled_layer_mask & mask) != 0;
|
return (rgblight_status.enabled_layer_mask & mask) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,14 +688,14 @@ static uint16_t _blink_timer;
|
||||||
|
|
||||||
void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) {
|
void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) {
|
||||||
rgblight_set_layer_state(layer, true);
|
rgblight_set_layer_state(layer, true);
|
||||||
_blinked_layer_mask |= 1 << layer;
|
_blinked_layer_mask |= (rgblight_layer_mask_t)1 << layer;
|
||||||
_blink_timer = sync_timer_read() + duration_ms;
|
_blink_timer = sync_timer_read() + duration_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgblight_unblink_layers(void) {
|
void rgblight_unblink_layers(void) {
|
||||||
if (_blinked_layer_mask != 0 && timer_expired(sync_timer_read(), _blink_timer)) {
|
if (_blinked_layer_mask != 0 && timer_expired(sync_timer_read(), _blink_timer)) {
|
||||||
for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) {
|
for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) {
|
||||||
if ((_blinked_layer_mask & 1 << layer) != 0) {
|
if ((_blinked_layer_mask & (rgblight_layer_mask_t)1 << layer) != 0) {
|
||||||
rgblight_set_layer_state(layer, false);
|
rgblight_set_layer_state(layer, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue