Skip to content

Commit

Permalink
Add FSPI interface for esp32s2 and honor the DATA_PIN and CLOCK_PIN s…
Browse files Browse the repository at this point in the history
…ince the SPI channels can be remapped
  • Loading branch information
m-g-m committed Jul 17, 2022
1 parent 0838804 commit 84dfb69
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/platforms/esp/32/fastspi_esp32.h
Expand Up @@ -45,11 +45,14 @@ FASTLED_NAMESPACE_BEGIN
* THE SOFTWARE.
*/

#include<SPI.h>

#ifndef FASTLED_ESP32_SPI_BUS
#define FASTLED_ESP32_SPI_BUS VSPI
#endif

SPIClass ledSPI(FASTLED_ESP32_SPI_BUS);
static SPIClass ledSPI(FASTLED_ESP32_SPI_BUS);


#if FASTLED_ESP32_SPI_BUS == VSPI
static uint8_t spiClk = 18;
Expand All @@ -61,6 +64,11 @@ SPIClass ledSPI(FASTLED_ESP32_SPI_BUS);
static uint8_t spiMiso = 12;
static uint8_t spiMosi = 13;
static uint8_t spiCs = 15;
#elif FASTLED_ESP32_SPI_BUS == FSPI // ESP32S2 has FSPI and can map to arbitrary pins
#define spiMosi DATA_PIN
#define spiClk CLOCK_PIN
#define spiMiso -1
#define spiCs -1
#endif

template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint32_t SPI_SPEED>
Expand Down Expand Up @@ -169,4 +177,4 @@ class ESP32SPIOutput {
}
};

FASTLED_NAMESPACE_END
FASTLED_NAMESPACE_END

0 comments on commit 84dfb69

Please sign in to comment.