diff options
| author | Nick Brassel <nick@tzarc.org> | 2021-01-03 15:26:43 +1100 |
|---|---|---|
| committer | Nick Brassel <nick@tzarc.org> | 2021-01-03 15:26:43 +1100 |
| commit | 271c0cf136c5dd5b9456d8b79272e67bc1a13cea (patch) | |
| tree | c2b6eec8c298acc0de000e980d806f68dbe84482 | |
| parent | e8e090acede2596e19de40628543f4ed27d33ab0 (diff) | |
| parent | f3ac792c096c10c9dd5004e6e06aad60710ef599 (diff) | |
| download | qmk_firmware-271c0cf136c5dd5b9456d8b79272e67bc1a13cea.tar.gz qmk_firmware-271c0cf136c5dd5b9456d8b79272e67bc1a13cea.zip | |
Merge remote-tracking branch 'upstream/master' into develop
| -rw-r--r-- | drivers/chibios/spi_master.c | 10 | ||||
| -rw-r--r-- | quantum/rgblight.c | 8 |
2 files changed, 12 insertions, 6 deletions
diff --git a/drivers/chibios/spi_master.c b/drivers/chibios/spi_master.c index 5aa60742e..8341b59a5 100644 --- a/drivers/chibios/spi_master.c +++ b/drivers/chibios/spi_master.c | |||
| @@ -115,11 +115,17 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) { | |||
| 115 | return true; | 115 | return true; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | spi_status_t spi_write(uint8_t data) { return spi_transmit(&data, 1); } | 118 | spi_status_t spi_write(uint8_t data) { |
| 119 | uint8_t rxData; | ||
| 120 | spiExchange(&SPI_DRIVER, 1, &data, &rxData); | ||
| 121 | |||
| 122 | return rxData; | ||
| 123 | } | ||
| 119 | 124 | ||
| 120 | spi_status_t spi_read(void) { | 125 | spi_status_t spi_read(void) { |
| 121 | uint8_t data = 0; | 126 | uint8_t data = 0; |
| 122 | spi_receive(&data, 1); | 127 | spiReceive(&SPI_DRIVER, 1, &data); |
| 128 | |||
| 123 | return data; | 129 | return data; |
| 124 | } | 130 | } |
| 125 | 131 | ||
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 3297f3a71..d277029e4 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
| @@ -628,7 +628,7 @@ void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_set | |||
| 628 | 628 | ||
| 629 | #ifdef RGBLIGHT_LAYERS | 629 | #ifdef RGBLIGHT_LAYERS |
| 630 | void rgblight_set_layer_state(uint8_t layer, bool enabled) { | 630 | void rgblight_set_layer_state(uint8_t layer, bool enabled) { |
| 631 | rgblight_layer_mask_t mask = 1 << layer; | 631 | rgblight_layer_mask_t mask = (rgblight_layer_mask_t)1 << layer; |
| 632 | if (enabled) { | 632 | if (enabled) { |
| 633 | rgblight_status.enabled_layer_mask |= mask; | 633 | rgblight_status.enabled_layer_mask |= mask; |
| 634 | } else { | 634 | } else { |
| @@ -649,7 +649,7 @@ void rgblight_set_layer_state(uint8_t layer, bool enabled) { | |||
| 649 | } | 649 | } |
| 650 | 650 | ||
| 651 | bool rgblight_get_layer_state(uint8_t layer) { | 651 | bool rgblight_get_layer_state(uint8_t layer) { |
| 652 | rgblight_layer_mask_t mask = 1 << layer; | 652 | rgblight_layer_mask_t mask = (rgblight_layer_mask_t)1 << layer; |
| 653 | return (rgblight_status.enabled_layer_mask & mask) != 0; | 653 | return (rgblight_status.enabled_layer_mask & mask) != 0; |
| 654 | } | 654 | } |
| 655 | 655 | ||
| @@ -688,14 +688,14 @@ static uint16_t _blink_timer; | |||
| 688 | 688 | ||
| 689 | void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) { | 689 | void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) { |
| 690 | rgblight_set_layer_state(layer, true); | 690 | rgblight_set_layer_state(layer, true); |
| 691 | _blinked_layer_mask |= 1 << layer; | 691 | _blinked_layer_mask |= (rgblight_layer_mask_t)1 << layer; |
| 692 | _blink_timer = sync_timer_read() + duration_ms; | 692 | _blink_timer = sync_timer_read() + duration_ms; |
| 693 | } | 693 | } |
| 694 | 694 | ||
| 695 | void rgblight_unblink_layers(void) { | 695 | void rgblight_unblink_layers(void) { |
| 696 | if (_blinked_layer_mask != 0 && timer_expired(sync_timer_read(), _blink_timer)) { | 696 | if (_blinked_layer_mask != 0 && timer_expired(sync_timer_read(), _blink_timer)) { |
| 697 | for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) { | 697 | for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) { |
| 698 | if ((_blinked_layer_mask & 1 << layer) != 0) { | 698 | if ((_blinked_layer_mask & (rgblight_layer_mask_t)1 << layer) != 0) { |
| 699 | rgblight_set_layer_state(layer, false); | 699 | rgblight_set_layer_state(layer, false); |
| 700 | } | 700 | } |
| 701 | } | 701 | } |
