fix SPI assignment across generations
This commit is contained in:
parent
b086c6ace6
commit
a56d5adb77
@ -9,13 +9,10 @@ SemaphoreHandle_t paramLock = NULL;
|
|||||||
} while (xSemaphoreTake(paramLock, portMAX_DELAY) != pdPASS)
|
} while (xSemaphoreTake(paramLock, portMAX_DELAY) != pdPASS)
|
||||||
#define SPI_PARAM_UNLOCK() xSemaphoreGive(paramLock)
|
#define SPI_PARAM_UNLOCK() xSemaphoreGive(paramLock)
|
||||||
|
|
||||||
// as Espressif confused the hell out of everyone we need to swap the selected SPI PHY here
|
// for ESP32 this is the so-called HSPI
|
||||||
// as for newer generations NRF24 is exactly on the other SPI Interface and we get a collision
|
// for ESP32-S2/S3/C3 this nomenclature does not really exist anymore,
|
||||||
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
// it is simply the first externally usable hardware SPI master controller
|
||||||
#define SPI_CMT SPI3_HOST
|
|
||||||
#else
|
|
||||||
#define SPI_CMT SPI2_HOST
|
#define SPI_CMT SPI2_HOST
|
||||||
#endif
|
|
||||||
|
|
||||||
spi_device_handle_t spi_reg, spi_fifo;
|
spi_device_handle_t spi_reg, spi_fifo;
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,14 @@
|
|||||||
#include "SunPosition.h"
|
#include "SunPosition.h"
|
||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
|
|
||||||
|
// the NRF shall use the second externally usable HW SPI controller
|
||||||
|
// for ESP32 that is the so-called VSPI, for ESP32-S2/S3/C3 it is now called implicitly
|
||||||
|
// HSPI, as it has shifted places for these chip generations
|
||||||
|
// for all generations, this is equivalent to SPI3_HOST in the lower level driver
|
||||||
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
||||||
#define VSPI FSPI
|
#define SPI_NRF HSPI
|
||||||
|
#else
|
||||||
|
#define SPI_NRF VSPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
InverterSettingsClass InverterSettings;
|
InverterSettingsClass InverterSettings;
|
||||||
@ -27,7 +33,7 @@ void InverterSettingsClass::init()
|
|||||||
Hoymiles.init();
|
Hoymiles.init();
|
||||||
|
|
||||||
if (PinMapping.isValidNrf24Config()) {
|
if (PinMapping.isValidNrf24Config()) {
|
||||||
SPIClass* spiClass = new SPIClass(VSPI);
|
SPIClass* spiClass = new SPIClass(SPI_NRF);
|
||||||
spiClass->begin(pin.nrf24_clk, pin.nrf24_miso, pin.nrf24_mosi, pin.nrf24_cs);
|
spiClass->begin(pin.nrf24_clk, pin.nrf24_miso, pin.nrf24_mosi, pin.nrf24_cs);
|
||||||
Hoymiles.initNRF(spiClass, pin.nrf24_en, pin.nrf24_irq);
|
Hoymiles.initNRF(spiClass, pin.nrf24_en, pin.nrf24_irq);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user