bus_wrapper improvements for SPI output

- Identifying ESP32 hardware SPI by pin number is broken and flawed, replace with temporary hack instead until a better method of assigned resources can be devised
  - NeoPixelBus doesn't support HSPI, only VSPI right now, so matching HSPI pins to enable a non-existent VSPI driver is broken
  - ESP32 SPI peripherals can use alternate pins, so choosing to use hardware SPI only on the default pins is flawed
- Specify pins during Begin() call to allow for alternate pins and avoid driving the chip select signal
- Dotstar Software/Hardware output tested on ESP32, other SPI protocols and ESP8266 support was not tested
This commit is contained in:
Louis Beaudoin
2021-02-17 17:03:57 +00:00
parent 3a03bc41a7
commit 96d5c03a6d
2 changed files with 14 additions and 10 deletions

View File

@@ -122,7 +122,7 @@ class BusDigital : public Bus {
//Fix for turning off onboard LED breaking bus
#ifdef LED_BUILTIN
if (_bri == 0 && b > 0) {
if (_pins[0] == LED_BUILTIN || _pins[1] == LED_BUILTIN) PolyBus::begin(_busPtr, _iType);
if (_pins[0] == LED_BUILTIN || _pins[1] == LED_BUILTIN) PolyBus::begin(_busPtr, _iType, _pins);
}
#endif
_bri = b;
@@ -159,7 +159,7 @@ class BusDigital : public Bus {
}
void reinit() {
PolyBus::begin(_busPtr, _iType);
PolyBus::begin(_busPtr, _iType, _pins);
}
void cleanup() {