Skip to content

Commit

Permalink
Merge pull request #1411 from m-g-m/master
Browse files Browse the repository at this point in the history
Add esp32s2 spi (FSPI) support, some code usability improvements
  • Loading branch information
samguyer committed Nov 26, 2022
2 parents d217136 + 5de804c commit add6cf5
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 can re-route 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 add6cf5

Please sign in to comment.