Skip to content

Commit

Permalink
fix Arduino30 for old working NeoPixel boards
Browse files Browse the repository at this point in the history
  • Loading branch information
Staars committed Aug 14, 2023
1 parent 7f1c4c8 commit 50d983d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 8 deletions.
11 changes: 10 additions & 1 deletion lib/lib_basic/NeoPixelBus/src/internal/Esp32_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "soc/io_mux_reg.h"
#if ESP_IDF_VERSION_MAJOR>=5
#include "soc/rtc_cntl_periph.h"
#include "soc/periph_defs.h"
#else
#include "soc/rtc_cntl_reg.h"
#include "soc/sens_reg.h"
Expand All @@ -60,7 +61,7 @@
#include "Esp32_i2s.h"
#include "esp32-hal.h"

#if ESP_IDF_VERSION_MAJOR<=4
#if ESP_IDF_VERSION_MAJOR<=4 || ESP_IDF_VERSION_MAJOR>=5
#define I2S_BASE_CLK (160000000L)
#endif

Expand Down Expand Up @@ -99,7 +100,11 @@ typedef struct {
int8_t in;
uint32_t rate;
intr_handle_t isr_handle;
#if ESP_IDF_VERSION_MAJOR >= 5
QueueHandle_t tx_queue;
#else
xQueueHandle tx_queue;
#endif

uint8_t* silence_buf;
size_t silence_len;
Expand All @@ -116,6 +121,10 @@ typedef struct {
#define I2s_Is_Pending 1
#define I2s_Is_Sending 2

#if ESP_IDF_VERSION_MAJOR >= 5
#define I2S_NUM_MAX I2S_NUM_AUTO // not 100% correct
#endif

static uint8_t i2s_silence_buf[I2S_DMA_SILENCE_SIZE] = { 0 };

#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
Expand Down
1 change: 1 addition & 0 deletions lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32I2sMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern "C"
{
#include <Arduino.h>
#include "Esp32_i2s.h"
#include "rom/gpio.h"
}

const uint16_t c_dmaBytesPerPixelBytes = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ License along with NeoPixel. If not, see
// ESP32C3 I2S is not supported yet
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6)

#include "soc/gpio_periph.h"
static inline uint32_t getCycleCount(void)
{
uint32_t ccount;
Expand Down
5 changes: 5 additions & 0 deletions lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ uint32_t analogGetTimerFrequency(uint8_t timer);

#define ESPhttpUpdate httpUpdate

#if ESP_IDF_VERSION_MAJOR >= 5
#include "rom/ets_sys.h"
#else
#define os_delay_us ets_delay_us
#endif

// Serial minimal type to hold the config
typedef int SerConfu8;
//typedef int SerialConfig; // Will be replaced enum in esp32_hal-uart.h (#7926)
Expand Down
6 changes: 1 addition & 5 deletions platformio_tasmota_core3_env.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

[core32]
; *** Uncomment the line below to use Arduino Core 3.0 !!
;platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5
platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5


[esp32_arduino30]
Expand All @@ -37,7 +37,6 @@ monitor_filters = esp32_exception_decoder
lib_extra_dirs = lib/lib_ssl, lib/lib_basic, lib/libesp32
lib_ignore = ESP Mail Client
IRremoteESP8266
NeoPixelBus
MFRC522
universal display Library
ESP8266Audio
Expand All @@ -53,7 +52,6 @@ monitor_filters = esp32_exception_decoder
lib_extra_dirs = lib/lib_ssl, lib/lib_basic, lib/libesp32
lib_ignore = ESP Mail Client
IRremoteESP8266
NeoPixelBus
MFRC522
universal display Library
ESP8266Audio
Expand All @@ -69,7 +67,6 @@ monitor_filters = esp32_exception_decoder
lib_extra_dirs = lib/lib_ssl, lib/lib_basic, lib/libesp32
lib_ignore = ESP Mail Client
IRremoteESP8266
NeoPixelBus
MFRC522
universal display Library
ESP8266Audio
Expand Down Expand Up @@ -111,7 +108,6 @@ lib_extra_dirs = lib/lib_ssl, lib/lib_basic, lib/libesp32
lib_ignore =
ESP Mail Client
IRremoteESP8266
NeoPixelBus
MFRC522
universal display Library
ESP8266Audio
Expand Down
4 changes: 2 additions & 2 deletions tasmota/include/tasmota_configurations_ESP32.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@
#undef USE_SONOFF_D1 // Disable support for Sonoff D1 Dimmer (+0k7 code)
#undef USE_SHELLY_DIMMER // Disable support for Shelly Dimmer (+3k code)

#undef USE_LIGHT // Disable support for lights
#undef USE_WS2812
#define USE_LIGHT // Disable support for lights
#define USE_WS2812

#define USE_DS18x20 // Enable DS18x20 sensor

Expand Down
8 changes: 8 additions & 0 deletions tasmota/tasmota_xlgt_light/xlgt_02_my92x1.ino
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@ struct MY92X1 {
uint8_t model = 0;
} My92x1;

#if ESP_IDF_VERSION_MAJOR >= 5
#include "rom/ets_sys.h"
#ifndef os_delay_us
#define os_delay_us ets_delay_us
#endif //os_delay_us
#else
extern "C" {
void os_delay_us(unsigned int);
}
#endif


void LightDiPulse(uint8_t times)
{
Expand Down

0 comments on commit 50d983d

Please sign in to comment.