summaryrefslogtreecommitdiff
path: root/platforms/chibios/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'platforms/chibios/drivers')
-rw-r--r--platforms/chibios/drivers/audio_dac_additive.c28
-rw-r--r--platforms/chibios/drivers/eeprom/eeprom_kinetis_flexram.c8
-rw-r--r--platforms/chibios/drivers/serial.c2
-rw-r--r--platforms/chibios/drivers/spi_master.c72
-rw-r--r--platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c2
-rw-r--r--platforms/chibios/drivers/wear_leveling/wear_leveling_efl.c32
-rw-r--r--platforms/chibios/drivers/wear_leveling/wear_leveling_efl_config.h2
-rw-r--r--platforms/chibios/drivers/wear_leveling/wear_leveling_rp2040_flash.c4
-rw-r--r--platforms/chibios/drivers/wear_leveling/wear_leveling_rp2040_flash_config.h2
-rw-r--r--platforms/chibios/drivers/ws2812_bitbang.c2
-rw-r--r--platforms/chibios/drivers/ws2812_pwm.c2
-rw-r--r--platforms/chibios/drivers/ws2812_spi.c20
12 files changed, 127 insertions, 49 deletions
diff --git a/platforms/chibios/drivers/audio_dac_additive.c b/platforms/chibios/drivers/audio_dac_additive.c
index 22e4fa2608..26e044b048 100644
--- a/platforms/chibios/drivers/audio_dac_additive.c
+++ b/platforms/chibios/drivers/audio_dac_additive.c
@@ -84,7 +84,7 @@ static const dacsample_t dac_buffer_trapezoid[AUDIO_DAC_BUFFER_SIZE] = {0x0, 0
0xfff, 0xfdf, 0xf7f, 0xf1f, 0xebf, 0xe5f, 0xdff, 0xd9f, 0xd3f, 0xcdf, 0xc7f, 0xc1f, 0xbbf, 0xb5f, 0xaff, 0xa9f, 0xa3f, 0x9df, 0x97f, 0x91f, 0x8bf, 0x85f, 0x7ff, 0x79f, 0x73f, 0x6df, 0x67f, 0x61f, 0x5bf, 0x55f, 0x4ff, 0x49f, 0x43f, 0x3df, 0x37f, 0x31f, 0x2bf, 0x25f, 0x1ff, 0x19f, 0x13f, 0xdf, 0x7f, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
#endif // AUDIO_DAC_SAMPLE_WAVEFORM_TRAPEZOID
-static dacsample_t dac_buffer_empty[AUDIO_DAC_BUFFER_SIZE] = {AUDIO_DAC_OFF_VALUE};
+static dacsample_t dac_buffer[AUDIO_DAC_BUFFER_SIZE];
/* keep track of the sample position for for each frequency */
static float dac_if[AUDIO_MAX_SIMULTANEOUS_TONES] = {0.0};
@@ -121,24 +121,27 @@ __attribute__((weak)) uint16_t dac_value_generate(void) {
/* doing additive wave synthesis over all currently playing tones = adding up
* sine-wave-samples for each frequency, scaled by the number of active tones
*/
- uint16_t value = 0;
- float frequency = 0.0f;
+ uint_fast16_t value = 0;
+ float frequency = 0.0f;
- for (uint8_t i = 0; i < active_tones_snapshot_length; i++) {
+ for (size_t i = 0; i < active_tones_snapshot_length; i++) {
/* Note: a user implementation does not have to rely on the active_tones_snapshot, but
* could directly query the active frequencies through audio_get_processed_frequency */
frequency = active_tones_snapshot[i];
- dac_if[i] = dac_if[i] + ((frequency * AUDIO_DAC_BUFFER_SIZE) / AUDIO_DAC_SAMPLE_RATE) * 2 / 3;
+ float new_dac_if = dac_if[i];
+ new_dac_if += frequency * ((float)AUDIO_DAC_BUFFER_SIZE / AUDIO_DAC_SAMPLE_RATE * 2.0f / 3.0f);
/*Note: the 2/3 are necessary to get the correct frequencies on the
* DAC output (as measured with an oscilloscope), since the gpt
* timer runs with 3*AUDIO_DAC_SAMPLE_RATE; and the DAC callback
* is called twice per conversion.*/
- dac_if[i] = fmodf(dac_if[i], AUDIO_DAC_BUFFER_SIZE);
+ while (new_dac_if >= AUDIO_DAC_BUFFER_SIZE)
+ new_dac_if -= AUDIO_DAC_BUFFER_SIZE;
+ dac_if[i] = new_dac_if;
// Wavetable generation/lookup
- uint16_t dac_i = (uint16_t)dac_if[i];
+ size_t dac_i = (size_t)new_dac_if;
#if defined(AUDIO_DAC_SAMPLE_WAVEFORM_SINE)
value += dac_buffer_sine[dac_i] / active_tones_snapshot_length;
@@ -308,10 +311,17 @@ void audio_driver_initialize(void) {
DACD1.params->dac->CR &= ~DAC_CR_BOFF1;
DACD2.params->dac->CR &= ~DAC_CR_BOFF2;
+ /* Start the DAC output with all off values. This buffer will then get fed
+ * with samples from dac_end, which will play notes.
+ */
+ for (size_t i = 0; i < AUDIO_DAC_BUFFER_SIZE; i++) {
+ dac_buffer[i] = AUDIO_DAC_OFF_VALUE;
+ }
+
if (AUDIO_PIN == A4) {
- dacStartConversion(&DACD1, &dac_conv_cfg, dac_buffer_empty, AUDIO_DAC_BUFFER_SIZE);
+ dacStartConversion(&DACD1, &dac_conv_cfg, dac_buffer, AUDIO_DAC_BUFFER_SIZE);
} else if (AUDIO_PIN == A5) {
- dacStartConversion(&DACD2, &dac_conv_cfg, dac_buffer_empty, AUDIO_DAC_BUFFER_SIZE);
+ dacStartConversion(&DACD2, &dac_conv_cfg, dac_buffer, AUDIO_DAC_BUFFER_SIZE);
}
// no inverted/out-of-phase waveform (yet?), only pulling AUDIO_PIN_ALT to AUDIO_DAC_OFF_VALUE
diff --git a/platforms/chibios/drivers/eeprom/eeprom_kinetis_flexram.c b/platforms/chibios/drivers/eeprom/eeprom_kinetis_flexram.c
index 6468cbf3fa..9cf956b2f7 100644
--- a/platforms/chibios/drivers/eeprom/eeprom_kinetis_flexram.c
+++ b/platforms/chibios/drivers/eeprom/eeprom_kinetis_flexram.c
@@ -146,7 +146,7 @@ uint32_t eeprom_read_dword(const uint32_t *addr) {
*
* FIXME: needs doc
*/
-void eeprom_read_block(void *buf, const void *addr, uint32_t len) {
+void eeprom_read_block(void *buf, const void *addr, size_t len) {
uint32_t offset = (uint32_t)addr;
uint8_t *dest = (uint8_t *)buf;
uint32_t end = offset + len;
@@ -271,7 +271,7 @@ void eeprom_write_dword(uint32_t *addr, uint32_t value) {
*
* FIXME: needs doc
*/
-void eeprom_write_block(const void *buf, void *addr, uint32_t len) {
+void eeprom_write_block(const void *buf, void *addr, size_t len) {
uint32_t offset = (uint32_t)addr;
const uint8_t *src = (const uint8_t *)buf;
@@ -480,7 +480,7 @@ uint32_t eeprom_read_dword(const uint32_t *addr) {
return eeprom_read_byte(p) | (eeprom_read_byte(p + 1) << 8) | (eeprom_read_byte(p + 2) << 16) | (eeprom_read_byte(p + 3) << 24);
}
-void eeprom_read_block(void *buf, const void *addr, uint32_t len) {
+void eeprom_read_block(void *buf, const void *addr, size_t len) {
const uint8_t *p = (const uint8_t *)addr;
uint8_t * dest = (uint8_t *)buf;
while (len--) {
@@ -506,7 +506,7 @@ void eeprom_write_dword(uint32_t *addr, uint32_t value) {
eeprom_write_byte(p, value >> 24);
}
-void eeprom_write_block(const void *buf, void *addr, uint32_t len) {
+void eeprom_write_block(const void *buf, void *addr, size_t len) {
uint8_t * p = (uint8_t *)addr;
const uint8_t *src = (const uint8_t *)buf;
while (len--) {
diff --git a/platforms/chibios/drivers/serial.c b/platforms/chibios/drivers/serial.c
index f087d0c2ed..f199716a2b 100644
--- a/platforms/chibios/drivers/serial.c
+++ b/platforms/chibios/drivers/serial.c
@@ -10,7 +10,7 @@
#include <hal.h>
// TODO: resolve/remove build warnings
-#if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) && defined(PROTOCOL_CHIBIOS) && defined(WS2812_DRIVER_BITBANG)
+#if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) && defined(PROTOCOL_CHIBIOS) && defined(WS2812_BITBANG)
# warning "RGBLED_SPLIT not supported with bitbang WS2812 driver"
#endif
diff --git a/platforms/chibios/drivers/spi_master.c b/platforms/chibios/drivers/spi_master.c
index c3ab0623f0..481a2e422a 100644
--- a/platforms/chibios/drivers/spi_master.c
+++ b/platforms/chibios/drivers/spi_master.c
@@ -18,14 +18,14 @@
#include "timer.h"
-static pin_t currentSlavePin = NO_PIN;
+static bool spiStarted = false;
-#if defined(K20x) || defined(KL2x) || defined(RP2040)
-static SPIConfig spiConfig = {NULL, 0, 0, 0};
-#else
-static SPIConfig spiConfig = {false, NULL, 0, 0, 0, 0};
+#if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
+static pin_t currentSlavePin;
#endif
+static SPIConfig spiConfig;
+
__attribute__((weak)) void spi_init(void) {
static bool is_initialised = false;
if (!is_initialised) {
@@ -33,28 +33,45 @@ __attribute__((weak)) void spi_init(void) {
// Try releasing special pins for a short time
setPinInput(SPI_SCK_PIN);
- setPinInput(SPI_MOSI_PIN);
- setPinInput(SPI_MISO_PIN);
+ if (SPI_MOSI_PIN != NO_PIN) {
+ setPinInput(SPI_MOSI_PIN);
+ }
+ if (SPI_MISO_PIN != NO_PIN) {
+ setPinInput(SPI_MISO_PIN);
+ }
chThdSleepMilliseconds(10);
#if defined(USE_GPIOV1)
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), SPI_SCK_PAL_MODE);
- palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_PAL_MODE);
- palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_PAL_MODE);
+ if (SPI_MOSI_PIN != NO_PIN) {
+ palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_PAL_MODE);
+ }
+ if (SPI_MISO_PIN != NO_PIN) {
+ palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_PAL_MODE);
+ }
#else
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), SPI_SCK_FLAGS);
- palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_FLAGS);
- palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_FLAGS);
+ if (SPI_MOSI_PIN != NO_PIN) {
+ palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_FLAGS);
+ }
+ if (SPI_MISO_PIN != NO_PIN) {
+ palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_FLAGS);
+ }
#endif
spiStop(&SPI_DRIVER);
- currentSlavePin = NO_PIN;
+ spiStarted = false;
}
}
bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
- if (currentSlavePin != NO_PIN || slavePin == NO_PIN) {
+ if (spiStarted) {
+ return false;
+ }
+#if SPI_SELECT_MODE != SPI_SELECT_MODE_NONE
+ if (slavePin == NO_PIN) {
return false;
}
+#endif
#if !(defined(WB32F3G71xx) || defined(WB32FQ95xx))
uint16_t roundedDivisor = 2;
@@ -247,13 +264,29 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
}
#endif
- currentSlavePin = slavePin;
+ spiStarted = true;
+#if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
+ currentSlavePin = slavePin;
+#endif
+#if SPI_SELECT_MODE == SPI_SELECT_MODE_PAD
spiConfig.ssport = PAL_PORT(slavePin);
spiConfig.sspad = PAL_PAD(slavePin);
-
setPinOutput(slavePin);
+#elif SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
+ if (slavePin != NO_PIN) {
+ setPinOutput(slavePin);
+ }
+#else
+# error "Unsupported SPI_SELECT_MODE"
+#endif
+
spiStart(&SPI_DRIVER, &spiConfig);
spiSelect(&SPI_DRIVER);
+#if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
+ if (slavePin != NO_PIN) {
+ writePinLow(slavePin);
+ }
+#endif
return true;
}
@@ -283,9 +316,14 @@ spi_status_t spi_receive(uint8_t *data, uint16_t length) {
}
void spi_stop(void) {
- if (currentSlavePin != NO_PIN) {
+ if (spiStarted) {
+#if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
+ if (currentSlavePin != NO_PIN) {
+ writePinHigh(currentSlavePin);
+ }
+#endif
spiUnselect(&SPI_DRIVER);
spiStop(&SPI_DRIVER);
- currentSlavePin = NO_PIN;
+ spiStarted = false;
}
}
diff --git a/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c b/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c
index 8d59e13bb2..de317e269a 100644
--- a/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c
+++ b/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c
@@ -268,7 +268,7 @@ static inline void sync_ws2812_transfer(void) {
busy_wait_until(LAST_TRANSFER);
}
-void ws2812_setleds(LED_TYPE* ledarray, uint16_t leds) {
+void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
static bool is_initialized = false;
if (unlikely(!is_initialized)) {
is_initialized = ws2812_init();
diff --git a/platforms/chibios/drivers/wear_leveling/wear_leveling_efl.c b/platforms/chibios/drivers/wear_leveling/wear_leveling_efl.c
index 3e4f5ffb89..3d6ed52e5c 100644
--- a/platforms/chibios/drivers/wear_leveling/wear_leveling_efl.c
+++ b/platforms/chibios/drivers/wear_leveling/wear_leveling_efl.c
@@ -17,6 +17,9 @@ static flash_sector_t first_sector = UINT16_MAX;
static flash_sector_t sector_count = UINT16_MAX;
static BaseFlash * flash;
+static volatile bool is_issuing_read = false;
+static volatile bool ecc_error_occurred = false;
+
// "Automatic" detection of the flash size -- ideally ChibiOS would have this already, but alas, it doesn't.
static inline uint32_t detect_flash_size(void) {
#if defined(WEAR_LEVELING_EFL_FLASH_SIZE)
@@ -131,11 +134,38 @@ bool backing_store_lock(void) {
return true;
}
+static backing_store_int_t backing_store_safe_read_from_location(backing_store_int_t *loc) {
+ backing_store_int_t value;
+ is_issuing_read = true;
+ ecc_error_occurred = false;
+ value = ~(*loc);
+ is_issuing_read = false;
+ return value;
+}
+
bool backing_store_read(uint32_t address, backing_store_int_t *value) {
uint32_t offset = (base_offset + address);
backing_store_int_t *loc = (backing_store_int_t *)flashGetOffsetAddress(flash, offset);
- *value = ~(*loc);
+ backing_store_int_t tmp = backing_store_safe_read_from_location(loc);
+
+ if (ecc_error_occurred) {
+ bs_dprintf("Failed to read from backing store, ECC error detected\n");
+ ecc_error_occurred = false;
+ *value = 0;
+ return false;
+ }
+
+ *value = tmp;
+
bs_dprintf("Read ");
wl_dump(offset, value, sizeof(backing_store_int_t));
return true;
}
+
+bool backing_store_allow_ecc_errors(void) {
+ return is_issuing_read;
+}
+
+void backing_store_signal_ecc_error(void) {
+ ecc_error_occurred = true;
+}
diff --git a/platforms/chibios/drivers/wear_leveling/wear_leveling_efl_config.h b/platforms/chibios/drivers/wear_leveling/wear_leveling_efl_config.h
index e74cf85efd..0f0fa694e9 100644
--- a/platforms/chibios/drivers/wear_leveling/wear_leveling_efl_config.h
+++ b/platforms/chibios/drivers/wear_leveling/wear_leveling_efl_config.h
@@ -50,5 +50,5 @@
// 1kB logical EEPROM
#ifndef WEAR_LEVELING_LOGICAL_SIZE
-# define WEAR_LEVELING_LOGICAL_SIZE 1024
+# define WEAR_LEVELING_LOGICAL_SIZE ((WEAR_LEVELING_BACKING_SIZE) / 2)
#endif // WEAR_LEVELING_LOGICAL_SIZE
diff --git a/platforms/chibios/drivers/wear_leveling/wear_leveling_rp2040_flash.c b/platforms/chibios/drivers/wear_leveling/wear_leveling_rp2040_flash.c
index 640628e1e9..6624c30b5b 100644
--- a/platforms/chibios/drivers/wear_leveling/wear_leveling_rp2040_flash.c
+++ b/platforms/chibios/drivers/wear_leveling/wear_leveling_rp2040_flash.c
@@ -25,8 +25,8 @@
#define FLASHCMD_READ_STATUS 0x05
#define FLASHCMD_WRITE_ENABLE 0x06
-extern uint8_t BOOT2_ROM[256];
-static uint32_t BOOT2_ROM_RAM[64];
+extern const uint8_t BOOT2_ROM[256];
+static uint32_t BOOT2_ROM_RAM[64];
static ssi_hw_t *const ssi = (ssi_hw_t *)XIP_SSI_BASE;
diff --git a/platforms/chibios/drivers/wear_leveling/wear_leveling_rp2040_flash_config.h b/platforms/chibios/drivers/wear_leveling/wear_leveling_rp2040_flash_config.h
index 93a9aa0372..e1e2433601 100644
--- a/platforms/chibios/drivers/wear_leveling/wear_leveling_rp2040_flash_config.h
+++ b/platforms/chibios/drivers/wear_leveling/wear_leveling_rp2040_flash_config.h
@@ -18,7 +18,7 @@
// 32kB logical EEPROM
#ifndef WEAR_LEVELING_LOGICAL_SIZE
-# define WEAR_LEVELING_LOGICAL_SIZE 4096
+# define WEAR_LEVELING_LOGICAL_SIZE ((WEAR_LEVELING_BACKING_SIZE) / 2)
#endif // WEAR_LEVELING_LOGICAL_SIZE
// Define how much flash space we have (defaults to lib/pico-sdk/src/boards/include/boards/***)
diff --git a/platforms/chibios/drivers/ws2812_bitbang.c b/platforms/chibios/drivers/ws2812_bitbang.c
index c55e0f654c..e3b735a1a6 100644
--- a/platforms/chibios/drivers/ws2812_bitbang.c
+++ b/platforms/chibios/drivers/ws2812_bitbang.c
@@ -72,7 +72,7 @@ void ws2812_init(void) {
}
// Setleds for standard RGB
-void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
+void ws2812_setleds(rgb_led_t *ledarray, uint16_t leds) {
static bool s_init = false;
if (!s_init) {
ws2812_init();
diff --git a/platforms/chibios/drivers/ws2812_pwm.c b/platforms/chibios/drivers/ws2812_pwm.c
index cfee547a82..440687bd72 100644
--- a/platforms/chibios/drivers/ws2812_pwm.c
+++ b/platforms/chibios/drivers/ws2812_pwm.c
@@ -379,7 +379,7 @@ void ws2812_write_led_rgbw(uint16_t led_number, uint8_t r, uint8_t g, uint8_t b,
}
// Setleds for standard RGB
-void ws2812_setleds(LED_TYPE* ledarray, uint16_t leds) {
+void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
static bool s_init = false;
if (!s_init) {
ws2812_init();
diff --git a/platforms/chibios/drivers/ws2812_spi.c b/platforms/chibios/drivers/ws2812_spi.c
index f188576e04..01162f07f4 100644
--- a/platforms/chibios/drivers/ws2812_spi.c
+++ b/platforms/chibios/drivers/ws2812_spi.c
@@ -6,8 +6,8 @@
/* Adapted from https://github.com/gamazeps/ws2812b-chibios-SPIDMA/ */
// Define the spi your LEDs are plugged to here
-#ifndef WS2812_SPI
-# define WS2812_SPI SPID1
+#ifndef WS2812_SPI_DRIVER
+# define WS2812_SPI_DRIVER SPID1
#endif
#ifndef WS2812_SPI_MOSI_PAL_MODE
@@ -106,7 +106,7 @@ static uint8_t get_protocol_eq(uint8_t data, int pos) {
return eq;
}
-static void set_led_color_rgb(LED_TYPE color, int pos) {
+static void set_led_color_rgb(rgb_led_t color, int pos) {
uint8_t* tx_start = &txbuf[PREAMBLE_SIZE];
#if (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_GRB)
@@ -179,15 +179,15 @@ void ws2812_init(void) {
#endif
};
- spiAcquireBus(&WS2812_SPI); /* Acquire ownership of the bus. */
- spiStart(&WS2812_SPI, &spicfg); /* Setup transfer parameters. */
- spiSelect(&WS2812_SPI); /* Slave Select assertion. */
+ spiAcquireBus(&WS2812_SPI_DRIVER); /* Acquire ownership of the bus. */
+ spiStart(&WS2812_SPI_DRIVER, &spicfg); /* Setup transfer parameters. */
+ spiSelect(&WS2812_SPI_DRIVER); /* Slave Select assertion. */
#ifdef WS2812_SPI_USE_CIRCULAR_BUFFER
- spiStartSend(&WS2812_SPI, ARRAY_SIZE(txbuf), txbuf);
+ spiStartSend(&WS2812_SPI_DRIVER, ARRAY_SIZE(txbuf), txbuf);
#endif
}
-void ws2812_setleds(LED_TYPE* ledarray, uint16_t leds) {
+void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
static bool s_init = false;
if (!s_init) {
ws2812_init();
@@ -202,9 +202,9 @@ void ws2812_setleds(LED_TYPE* ledarray, uint16_t leds) {
// Instead spiSend can be used to send synchronously (or the thread logic can be added back).
#ifndef WS2812_SPI_USE_CIRCULAR_BUFFER
# ifdef WS2812_SPI_SYNC
- spiSend(&WS2812_SPI, ARRAY_SIZE(txbuf), txbuf);
+ spiSend(&WS2812_SPI_DRIVER, ARRAY_SIZE(txbuf), txbuf);
# else
- spiStartSend(&WS2812_SPI, ARRAY_SIZE(txbuf), txbuf);
+ spiStartSend(&WS2812_SPI_DRIVER, ARRAY_SIZE(txbuf), txbuf);
# endif
#endif
}