Skip to content

Commit

Permalink
fix ESP32-S3
Browse files Browse the repository at this point in the history
  • Loading branch information
lumapu committed Apr 22, 2024
1 parent dc15aae commit 9d8ef19
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/applyPatches.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ def applyPatch(libName, patchFile):
# list of patches to apply (relative to /src)
applyPatch("ESPAsyncWebServer-esphome", "../patches/AsyncWeb_Prometheus.patch")

if env['PIOENV'][:13] == "opendtufusion":
applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch")
elif env['PIOENV'][:5] == "esp32":
#if env['PIOENV'][:13] == "opendtufusion":
#applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch")
#el
if (env['PIOENV'][:5] == "esp32") or (env['PIOENV'][:13] == "opendtufusion"):
applyPatch("GxEPD2", "../patches/GxEPD2_HAL.patch")

if (env['PIOENV'][:13] == "opendtufusion") or (env['PIOENV'][:5] == "esp32"):
Expand Down
5 changes: 5 additions & 0 deletions src/hm/nrfHal.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ class nrfHal: public RF24_hal, public SpiPatcherHandle {
mPinEn = static_cast<gpio_num_t>(en);
mSpiSpeed = speed;

#if defined(CONFIG_IDF_TARGET_ESP32S3)
mHostDevice = SPI2_HOST;
#else
mHostDevice = (14 == sclk) ? SPI2_HOST : SPI3_HOST;
#endif

mSpiPatcher = SpiPatcher::getInstance(mHostDevice);

gpio_reset_pin(mPinMosi);
Expand Down
5 changes: 5 additions & 0 deletions src/hms/cmtHal.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ class cmtHal : public SpiPatcherHandle {
mPinFcs = static_cast<gpio_num_t>(fcs);
mSpiSpeed = speed;

#if defined(CONFIG_IDF_TARGET_ESP32S3)
mHostDevice = SPI2_HOST;
#else
mHostDevice = (14 == clk) ? SPI2_HOST : SPI3_HOST;
#endif

mSpiPatcher = SpiPatcher::getInstance(mHostDevice);

gpio_reset_pin(mPinSdio);
Expand Down
5 changes: 5 additions & 0 deletions src/network/AhoyEthernetSpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ class AhoyEthernetSpi {
gpio_reset_pin(static_cast<gpio_num_t>(pin_int));
gpio_set_pull_mode(static_cast<gpio_num_t>(pin_int), GPIO_PULLUP_ONLY);

#if defined(CONFIG_IDF_TARGET_ESP32S3)
mHostDevice = SPI3_HOST;
#else
mHostDevice = (14 == pin_sclk) ? SPI2_HOST : SPI3_HOST;
#endif

mSpiPatcher = SpiPatcher::getInstance(mHostDevice);

spi_device_interface_config_t devcfg = {
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/Display/epdHal.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ class epdHal: public GxEPD2_HalInterface, public SpiPatcherHandle {
mPinBusy = static_cast<gpio_num_t>(busy);
mSpiSpeed = speed;

#if defined(CONFIG_IDF_TARGET_ESP32S3)
mHostDevice = SPI3_HOST;
#else
mHostDevice = (14 == sclk) ? SPI2_HOST : SPI3_HOST;
#endif

mSpiPatcher = SpiPatcher::getInstance(mHostDevice);

gpio_reset_pin(mPinMosi);
Expand Down

0 comments on commit 9d8ef19

Please sign in to comment.