Skip to content

Commit 4ec67fc

Browse files
committed
Upgrade to Arduino ESP32 Core version 3.0+
1 parent e920c21 commit 4ec67fc

File tree

7 files changed

+25
-14
lines changed

7 files changed

+25
-14
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## 0.14.0
44

5+
### Board Changes
6+
7+
- ESP32 Boards
8+
- Now based on (and requires) the 3.0+ version of the ESP32 Arduino Core.
9+
- Infrared output functionality temporarily disabled, until IR library is compatible with 3.0
10+
511
### New Peripherals
612

713
- ADS1100 Analog-to-Digital Converter:

DEPS_CLI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ arduino-cli core install arduino:sam
1616
arduino-cli core install arduino:samd
1717
arduino-cli core install arduino:renesas_uno
1818
arduino-cli core install esp8266:esp8266
19-
arduino-cli core install esp32:esp32
19+
arduino-cli core install esp32:esp32@3.0.3
2020
arduino-cli core install rp2040:rp2040
2121
arduino-cli lib install Servo
2222
arduino-cli lib install Ethernet
@@ -71,7 +71,7 @@ arduino-cli lib install "Adafruit NeoPixel"
7171
arduino-cli config init
7272
arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
7373
arduino-cli core update-index
74-
arduino-cli core install esp32:esp32
74+
arduino-cli core install esp32:esp32@3.0.3
7575
arduino-cli lib install ESP32Servo
7676
arduino-cli lib install [email protected]
7777
arduino-cli lib install "Adafruit NeoPixel"

DEPS_IDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ All platforms will require libraries to be installed. To install a library do th
3333
Arduino SAMD Boards (32-bits ARM Cortex-M0+)
3434
Arduino UNO R4 Boards
3535
ESP8266 Boards
36-
ESP32 Boards
36+
ESP32 Boards @ v3.0.3
3737
Raspberry Pi Pico/RP2040
3838
````
3939
* Libraries:
@@ -104,7 +104,7 @@ All platforms will require libraries to be installed. To install a library do th
104104
````
105105
* Boards (latest version unless specified):
106106
````
107-
ESP32 Boards
107+
ESP32 Boards @ v3.0.3
108108
````
109109
* Libraries (latest version unless specified):
110110
````

lib/denko_cli/targets.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ class DenkoCLI::Generator
2424
ra4m1: STANDARD_PACKAGES - [:ir_out, :led_array],
2525

2626
# ESP8266 + ESP32 use a different IR library.
27+
# Temporarily disabled on ESP32 until library catches up with 3.0+ ESP32 Arduino core.
2728
esp8266: STANDARD_PACKAGES - [:ir_out] + [:ir_out_esp],
28-
esp32: STANDARD_PACKAGES - [:ir_out] + [:ir_out_esp],
29+
esp32: STANDARD_PACKAGES - [:ir_out],
2930

3031
# RP2040 can't use WS2812 yet.
3132
rp2040: STANDARD_PACKAGES - [:led_array],

src/lib/Denko.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,11 @@ void Denko::setRegisterDivider() {
319319
// Set the analog write resolution.
320320
void Denko::setAnalogWriteResolution() {
321321
#ifdef WRITE_RESOLUTION_SETTER
322-
analogWriteResolution(val);
322+
#ifdef ESP32
323+
esp32AnalogWRes = val;
324+
#else
325+
analogWriteResolution(val);
326+
#endif
323327
#endif
324328
}
325329

@@ -335,7 +339,7 @@ void Denko::setAnalogReadResolution() {
335339
// Use a different blocking microsecond delay on different platforms.
336340
void Denko::microDelay(uint32_t microseconds){
337341
#if defined(ESP32)
338-
ets_delay_us(microseconds);
342+
esp_rom_delay_us(microseconds);
339343
#else
340344
delayMicroseconds(microseconds);
341345
#endif

src/lib/Denko.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class Denko {
6666
byte assignLEDC(byte channel, byte pin);
6767
void releaseLEDC(byte p);
6868
void clearLedcChannels();
69+
uint8_t esp32AnalogWRes = 8;
6970
#endif
7071

7172
//

src/lib/DenkoCoreIO.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void Denko::dWrite(byte p, byte v, boolean echo) {
8989
#if defined(SOC_DAC_SUPPORTED)
9090
dacDisable(p);
9191
#endif
92-
ledcDetachPin(p);
92+
ledcDetach(p);
9393
#endif
9494

9595
if (v == 0) {
@@ -117,9 +117,9 @@ void Denko::pwmWrite(byte p, int v, boolean echo) {
117117
byte channel = ledcChannel(p);
118118

119119
// Reattach the pin in case dWrite detached it.
120-
ledcAttachPin(p, channel);
120+
ledcAttachChannel(p, 1000, esp32AnalogWRes, channel);
121121

122-
ledcWrite(channel, v);
122+
ledcWrite(p, v);
123123
#else
124124
analogWrite(p,v);
125125
#endif
@@ -158,8 +158,7 @@ byte Denko::assignLEDC(byte channel, byte p){
158158
// First 8 channels: up to 40Mhz @ 16-bits
159159
// Last 8 channels: up to 500kHz @ 13-bits
160160
// Just use similar settings to ATmega for now.
161-
ledcSetup(channel, 1000, 8);
162-
ledcAttachPin(p, channel);
161+
ledcAttachChannel(p, 1000, esp32AnalogWRes, channel);
163162

164163
// Save the pin and mark it as in use.
165164
ledcPins[channel][0] = 1;
@@ -170,7 +169,7 @@ byte Denko::assignLEDC(byte channel, byte p){
170169
// Release a LEDC channel when done with it.
171170
void Denko::releaseLEDC(byte p){
172171
// Detach the pin from the channel.
173-
ledcDetachPin(p);
172+
ledcDetach(p);
174173

175174
// Mark any channel associated with the pin as unused.
176175
for (int i = LEDC_CHANNEL_COUNT -1; i > 0; i--){
@@ -182,7 +181,7 @@ void Denko::releaseLEDC(byte p){
182181
void Denko::clearLedcChannels(){
183182
for (int i = LEDC_CHANNEL_COUNT -1; i > 0; i--){
184183
// Stop the channel if it was still enabled.
185-
if (ledcPins[i][0] != 0) ledcDetachPin(ledcPins[i][1]);
184+
if (ledcPins[i][0] != 0) ledcDetach(ledcPins[i][1]);
186185

187186
// Mark the channel as unused.
188187
ledcPins[i][0] = 0;

0 commit comments

Comments
 (0)