Merge pull request #12339 from s-hadinger/esp32c3_phase2

Esp32c3 fix compilation for SPI and uDisplay
This commit is contained in:
s-hadinger 2021-06-10 20:07:42 +02:00 committed by GitHub
commit 5b62c5abd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 6 deletions

View File

@ -38,3 +38,17 @@
#define __UINT32_TYPE__ unsigned int
#endif // __riscv
// 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 )))
#endif
#if CONFIG_IDF_TARGET_ESP32C3
// 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)
//alias for different chips, deprecated for the chips after esp32s2
#define SPI_HOST SPI1_HOST
#define HSPI_HOST SPI2_HOST
#define VSPI_HOST SPI2_HOST /* No SPI3_host on C3 */
#endif

View File

@ -29,9 +29,9 @@ License along with NeoPixel. If not, see
#include "driver/spi_master.h"
#if defined(CONFIG_IDF_TARGET_ESP32C3)
#if defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(HSPI_HOST)
// HSPI_HOST depreciated in C3
#define HSPI_HOST SPI3_HOST
#define HSPI_HOST SPI2_HOST
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)

View File

@ -54,8 +54,13 @@ enum uColorType { uCOLOR_BW, uCOLOR_COLOR };
#undef GPIO_CLR
#undef GPIO_SET_SLOW
#undef GPIO_CLR_SLOW
#if CONFIG_IDF_TARGET_ESP32C3
#define GPIO_CLR(A) GPIO.out_w1tc.val = (1 << A)
#define GPIO_SET(A) GPIO.out_w1ts.val = (1 << A)
#else // plain ESP32
#define GPIO_CLR(A) GPIO.out_w1tc = (1 << A)
#define GPIO_SET(A) GPIO.out_w1ts = (1 << A)
#endif
#define GPIO_CLR_SLOW(A) digitalWrite(A, LOW)
#define GPIO_SET_SLOW(A) digitalWrite(A, HIGH)

View File

@ -74,10 +74,6 @@ lib_extra_dirs = lib/libesp32
lib_ignore =
NimBLE-Arduino
Micro-RTSP
ILI9488
SSD3115
RA8876
universal display Library
; *** EXPERIMENTAL Tasmota version for ESP32 IDF4.4.
[env:tasmota32idf4]