Skip to content

Commit

Permalink
Fix spi c2 c6 bus numbers and SPI Reg Base defines (#19988)
Browse files Browse the repository at this point in the history
* C2 and C6 have same SPI bus as C3
* Update esp32x_fixes.h
* Release Platforms
  • Loading branch information
Jason2866 authored Nov 13, 2023
1 parent 73f219e commit 0ee62e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 deletions.
31 changes: 4 additions & 27 deletions include/esp32x_fixes.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,38 +58,15 @@
#define FSPI_HOST SPI2_HOST
#define HSPI_HOST SPI3_HOST
#define VSPI_HOST SPI3_HOST
#ifndef REG_SPI_BASE
#define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 )))
// SPI_MOSI_DLEN_REG is not defined anymore in esp32s3, instead use SPI_MS_DLEN_REG
// SPI_MOSI_DLEN_REG is not defined anymore in esp32s3
#define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x)
#endif // REG_SPI_BASE

#elif CONFIG_IDF_TARGET_ESP32C3
#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6
#define SPI_HOST SPI1_HOST
#define HSPI_HOST SPI2_HOST
#define VSPI_HOST SPI2_HOST /* No SPI3_host on C3 */
#if ESP_IDF_VERSION_MAJOR < 5
// fix a bug in esp-idf 4.4 for esp32c3
#ifndef REG_SPI_BASE
#define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 )))
// SPI_MOSI_DLEN_REG is not defined anymore in esp32c3, instead use SPI_MS_DLEN_REG
#define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x)
#endif // REG_SPI_BASE
#endif //ESP_IDF_VERSION_MAJOR < 5

#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C6
#define SPI_HOST SPI1_HOST
#define HSPI_HOST SPI1_HOST /* No SPI2_host on C2/C6 */
#define VSPI_HOST SPI1_HOST /* No SPI3_host on C2/C6 */
#define VSPI_HOST SPI2_HOST /* No SPI3_host on C2/C6 */
#define VSPI SPI
// #if ESP_IDF_VERSION_MAJOR < 5
// // fix a bug in esp-idf 4.4 for esp32c3
// #ifndef REG_SPI_BASE
// #define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 )))
// // SPI_MOSI_DLEN_REG is not defined anymore in esp32c3, instead use SPI_MS_DLEN_REG
// SPI_MOSI_DLEN_REG is not defined anymore
#define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x)
// #endif // REG_SPI_BASE
// #endif //ESP_IDF_VERSION_MAJOR < 5


#endif // TARGET
4 changes: 2 additions & 2 deletions platformio_tasmota32.ini
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ lib_ignore =


[core32]
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.06/platform-espressif32.zip
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.11.00/platform-espressif32.zip
platform_packages =
build_unflags = ${esp32_defaults.build_unflags}
build_flags = ${esp32_defaults.build_flags}

[core32_30]
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.12/platform-espressif32.zip
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.11.10/platform-espressif32.zip
platform_packages =
build_unflags = ${core32.build_unflags}
build_flags = ${core32.build_flags}

0 comments on commit 0ee62e5

Please sign in to comment.