Skip to content

Commit 3ebf47b

Browse files
authored
fix(spi): Correct SPI mapping for ESP32S2
1 parent 77fc0c1 commit 3ebf47b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

cores/esp32/esp32-hal-spi.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,13 @@ extern "C" {
2727
#include <stdbool.h>
2828

2929
#define SPI_HAS_TRANSACTION
30-
31-
#ifdef CONFIG_IDF_TARGET_ESP32S2
32-
#define FSPI 1 //SPI 1 bus. ESP32S2: for external memory only (can use the same data lines but different SS)
33-
#define HSPI 2 //SPI 2 bus. ESP32S2: external memory or device - it can be matrixed to any pins
34-
#define SPI2 2 // Another name for ESP32S2 SPI 2
35-
#define SPI3 3 //SPI 3 bus. ESP32S2: device only - it can be matrixed to any pins
36-
#elif CONFIG_IDF_TARGET_ESP32
30+
#ifdef CONFIG_IDF_TARGET_ESP32
3731
#define FSPI 1 //SPI 1 bus attached to the flash (can use the same data lines but different SS)
3832
#define HSPI 2 //SPI 2 bus normally mapped to pins 12 - 15, but can be matrixed to any pins
3933
#define VSPI 3 //SPI 3 bus normally attached to pins 5, 18, 19 and 23, but can be matrixed to any pins
4034
#else
41-
#define FSPI 0
42-
#define HSPI 1
35+
#define FSPI 0 // ESP32C2, C3, C6, H2, S2, S3, P4 - SPI 2 bus
36+
#define HSPI 1 // ESP32S2, S3, P4 - SPI 3 bus
4337
#endif
4438

4539
// This defines are not representing the real Divider of the ESP32
@@ -97,6 +91,8 @@ void spiSSSet(spi_t *spi);
9791
void spiSSClear(spi_t *spi);
9892

9993
void spiWaitReady(spi_t *spi);
94+
//invert hardware SS
95+
void spiSSInvert(spi_t *spi, bool invert);
10096

10197
uint32_t spiGetClockDiv(spi_t *spi);
10298
uint8_t spiGetDataMode(spi_t *spi);

0 commit comments

Comments
 (0)