Compiles with IDF5 (#789)

This commit is contained in:
Michael Miller
2024-03-22 11:38:45 -07:00
committed by GitHub
parent d95a8d2522
commit 22746479f6
9 changed files with 47 additions and 33 deletions

View File

@@ -53,12 +53,16 @@ License along with NeoPixel. If not, see
#elif defined(ARDUINO_ARCH_ESP32)
#if !defined(ARDUINO_ESP32C6_DEV) && !defined(ARDUINO_ESP32H2_DEV)
#include "methods/NeoEsp32I2sMethod.h"
#include "methods/NeoEsp32RmtMethod.h"
#include "methods/NeoEspBitBangMethod.h"
#include "methods/DotStarEsp32DmaSpiMethod.h"
#include "methods/NeoEsp32I2sXMethod.h"
#include "methods/NeoEspBitBangMethod.h"
#endif
#elif defined(ARDUINO_ARCH_NRF52840) // must be before __arm__
#include "methods/NeoNrf52xMethod.h"

View File

@@ -59,7 +59,7 @@ public:
ColorObject color;
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
pgm_read_byte(p++); // ignore the first byte
p++; // ignore the first byte
color[V_IC_1] = pgm_read_byte(p++);
color[V_IC_2] = pgm_read_byte(p++);
color[V_IC_3] = pgm_read_byte(p);

View File

@@ -60,7 +60,7 @@ public:
ColorObject color;
const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
pgm_read_byte(p++); // ignore the first byte
p++; // ignore the first byte
color.B = pgm_read_byte(p++);
color.G = pgm_read_byte(p++);
color.R = pgm_read_byte(p);

View File

@@ -14,15 +14,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#if defined(ARDUINO_ARCH_ESP32)
// ESP32 C3 & S3 I2S is not supported yet due to significant changes to interface
#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(ARDUINO_ESP32C3_DEV) && !defined(ARDUINO_ESP32S3_DEV) && !defined(ARDUINO_ESP32C6_DEV) && !defined(ARDUINO_ESP32H2_DEV)
#include "sdkconfig.h" // this sets useful config symbols, like CONFIG_IDF_TARGET_ESP32C3
// ESP32 C3 & S3 I2S is not supported yet due to significant changes to interface
#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
#include <string.h>
#include <stdio.h>
#include "stdlib.h"
@@ -45,18 +41,27 @@
#include "soc/io_mux_reg.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/i2s_struct.h"
#if defined(CONFIG_IDF_TARGET_ESP32)
/* included here for ESP-IDF v4.x compatibility */
#include "soc/dport_reg.h"
#endif
#include "soc/sens_reg.h"
#include "driver/gpio.h"
#include "driver/i2s.h"
#if ESP_IDF_VERSION_MAJOR>=5
#include "rom/gpio.h"
#include "esp_private/periph_ctrl.h"
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32S3)
#include "driver/dac.h"
#endif
#include "Esp32_i2s.h"
#include "esp32-hal.h"
@@ -65,7 +70,7 @@ esp_err_t i2sSetSampleRate(uint8_t bus_num, uint32_t sample_rate, bool parallel_
#define MATRIX_DETACH_OUT_SIG 0x100
#if ESP_IDF_VERSION_MAJOR<=4
#if ESP_IDF_VERSION_MAJOR<=5
#define I2S_BASE_CLK (160000000L)
#endif
@@ -101,14 +106,14 @@ typedef struct
#define I2s_Is_Sending 2
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// (I2S_NUM_MAX == 2)
static i2s_bus_t I2S[I2S_NUM_MAX] =
// (SOC_I2S_NUM == 2)
static i2s_bus_t I2S[SOC_I2S_NUM] =
{
{&I2S0, -1, -1, -1, -1, NULL, NULL, I2S_DMA_BLOCK_COUNT_DEFAULT, I2s_Is_Idle},
{&I2S1, -1, -1, -1, -1, NULL, NULL, I2S_DMA_BLOCK_COUNT_DEFAULT, I2s_Is_Idle}
};
#else
static i2s_bus_t I2S[I2S_NUM_MAX] =
static i2s_bus_t I2S[SOC_I2S_NUM] =
{
{&I2S0, -1, -1, -1, -1, NULL, NULL, I2S_DMA_BLOCK_COUNT_DEFAULT, I2s_Is_Idle}
};
@@ -130,7 +135,7 @@ inline void dmaItemInit(lldesc_t* item, uint8_t* posData, size_t sizeData, lldes
bool i2sInitDmaItems(uint8_t bus_num, uint8_t* data, size_t dataSize, bool parallel_mode, size_t bytes_per_sample)
{
if (bus_num >= I2S_NUM_MAX)
if (bus_num >= SOC_I2S_NUM)
{
return false;
}
@@ -201,7 +206,7 @@ bool i2sInitDmaItems(uint8_t bus_num, uint8_t* data, size_t dataSize, bool paral
bool i2sDeinitDmaItems(uint8_t bus_num)
{
if (bus_num >= I2S_NUM_MAX)
if (bus_num >= SOC_I2S_NUM)
{
return false;
}
@@ -219,7 +224,7 @@ esp_err_t i2sSetClock(uint8_t bus_num,
uint8_t bck,
uint8_t bits)
{
if (bus_num >= I2S_NUM_MAX || div_a > 63 || div_b > 63 || bck > 63)
if (bus_num >= SOC_I2S_NUM || div_a > 63 || div_b > 63 || bck > 63)
{
return ESP_FAIL;
}
@@ -268,7 +273,7 @@ void i2sSetPins(uint8_t bus_num,
int8_t busSampleSize,
bool invert)
{
if (bus_num >= I2S_NUM_MAX)
if (bus_num >= SOC_I2S_NUM)
{
return;
}
@@ -356,7 +361,7 @@ void i2sSetClkWsPins(uint8_t bus_num,
bool invertWs)
{
if (bus_num >= I2S_NUM_MAX)
if (bus_num >= SOC_I2S_NUM)
{
return;
}
@@ -387,7 +392,7 @@ void i2sSetClkWsPins(uint8_t bus_num,
bool i2sWriteDone(uint8_t bus_num)
{
if (bus_num >= I2S_NUM_MAX)
if (bus_num >= SOC_I2S_NUM)
{
return false;
}
@@ -405,7 +410,7 @@ void i2sInit(uint8_t bus_num,
uint8_t* data,
size_t dataSize)
{
if (bus_num >= I2S_NUM_MAX)
if (bus_num >= SOC_I2S_NUM)
{
return;
}
@@ -420,7 +425,7 @@ void i2sInit(uint8_t bus_num,
}
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// (I2S_NUM_MAX == 2)
// (SOC_I2S_NUM == 2)
if (bus_num)
{
periph_module_enable(PERIPH_I2S1_MODULE);
@@ -545,7 +550,7 @@ void i2sInit(uint8_t bus_num,
int i2sIntSource;
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// (I2S_NUM_MAX == 2)
// (SOC_I2S_NUM == 2)
if (bus_num == 1)
{
i2sIntSource = ETS_I2S1_INTR_SOURCE;
@@ -707,7 +712,7 @@ esp_err_t i2sSetSampleRate(uint8_t bus_num,
bool parallel_mode,
size_t bytes_per_sample)
{
if (bus_num >= I2S_NUM_MAX)
if (bus_num >= SOC_I2S_NUM)
{
return ESP_FAIL;
}
@@ -784,7 +789,7 @@ void IRAM_ATTR i2sDmaISR(void* arg)
bool i2sWrite(uint8_t bus_num)
{
if (bus_num >= I2S_NUM_MAX)
if (bus_num >= SOC_I2S_NUM)
{
return false;
}
@@ -913,7 +918,7 @@ void DumpI2s_fifo_conf(const char* label, i2s_dev_t* bus)
bool i2sDump(uint8_t bus_num)
{
if (bus_num >= I2S_NUM_MAX)
if (bus_num >= SOC_I2S_NUM)
{
return false;
}
@@ -1009,7 +1014,7 @@ bool i2sGetClks(uint8_t bus_num,
uint8_t* clkm_div_b,
uint8_t* clkm_div_a)
{
if (bus_num >= I2S_NUM_MAX)
if (bus_num >= SOC_I2S_NUM)
{
return false;
}
@@ -1031,6 +1036,5 @@ bool i2sGetClks(uint8_t bus_num,
}
#endif
#endif // !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
#endif // defined(ARDUINO_ARCH_ESP32)
#endif // defined(ARDUINO_ARCH_ESP32) ** !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)

View File

@@ -32,6 +32,7 @@ License along with NeoPixel. If not, see
extern "C"
{
#include <rom/gpio.h>
#include "Esp32_i2s.h"
}
@@ -313,7 +314,7 @@ typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeed400Kbps, NeoEsp32I2sBusZero, NeoEs
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedApa106, NeoEsp32I2sBusZero, NeoEsp32I2sInverted> NeoEsp32I2s0Apa106InvertedMethod;
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// (I2S_NUM_MAX == 2)
// (SOC_I2S_NUM == 2)
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedWs2812x, NeoEsp32I2sBusOne, NeoEsp32I2sNotInverted> NeoEsp32I2s1Ws2812xMethod;
typedef NeoEsp32I2sMethodBase<NeoEsp32I2sSpeedWs2805, NeoEsp32I2sBusOne, NeoEsp32I2sNotInverted> NeoEsp32I2s1Ws2805Method;

View File

@@ -31,6 +31,7 @@ License along with NeoPixel. If not, see
extern "C"
{
#include <rom/gpio.h>
#include "Esp32_i2s.h"
}

View File

@@ -27,14 +27,13 @@ License along with NeoPixel. If not, see
<http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
#if defined(ARDUINO_ARCH_ESP32) && !defined(ARDUINO_ESP32C6_DEV) && !defined(ARDUINO_ESP32H2_DEV)
#include <Arduino.h>
#include "../NeoSettings.h"
#include "../NeoBusChannel.h"
#include "NeoEsp32RmtMethod.h"
#ifdef ARDUINO_ARCH_ESP32
// translate NeoPixelBuffer into RMT buffer
// this is done on the fly so we don't require a send buffer in raw RMT format
// which would be 32x larger than the primary buffer

View File

@@ -45,6 +45,7 @@ Esp32-hal-rmt.c
extern "C"
{
#include <rom/gpio.h>
#include <driver/rmt.h>
}

View File

@@ -24,10 +24,14 @@ License along with NeoPixel. If not, see
<http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) && !defined(ARDUINO_ESP32C6_DEV) && !defined(ARDUINO_ESP32H2_DEV)
#include <Arduino.h>
#if ESP_IDF_VERSION_MAJOR>=5
#include <soc/gpio_struct.h>
#endif
static inline uint32_t getCycleCount(void)
{
uint32_t ccount;