Skip to content

Commit

Permalink
Add support for Arduino 3 (ESP-IDF 5.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Mar 15, 2024
1 parent 384fec9 commit 1f6c2bf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ jobs:
include:
- platform: espressif32
board: esp32dev
eeprom: true
softwareserial: false
opts:
- platform: espressif32
board: esp32dev
opts: "--project-option 'platform_packages=platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.0-alpha3, platform_packages=platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1'"

steps:
- name: Checkout
Expand All @@ -128,22 +130,22 @@ jobs:
run: platformio platform install ${{ matrix.platform }}

- name: Build Read
run: PLATFORMIO_BUILD_FLAGS="-Wall -Wextra -DMYCILA_JSY_JSON_SUPPORT" platformio ci "examples/Read/Read.ino" -l '.' --project-option="lib_deps=bblanchon/ArduinoJson" -b ${{ matrix.board }}
run: PLATFORMIO_BUILD_FLAGS="-Wall -Wextra -DMYCILA_JSY_JSON_SUPPORT" platformio ci "examples/Read/Read.ino" -l '.' --project-option="lib_deps=bblanchon/ArduinoJson" -b ${{ matrix.board }} ${{ matrix.opts }}

- name: Build ReadAsync
run: PLATFORMIO_BUILD_FLAGS="-Wall -Wextra -DMYCILA_JSY_JSON_SUPPORT" platformio ci "examples/ReadAsync/ReadAsync.ino" -l '.' --project-option="lib_deps=bblanchon/ArduinoJson" -b ${{ matrix.board }}
run: PLATFORMIO_BUILD_FLAGS="-Wall -Wextra -DMYCILA_JSY_JSON_SUPPORT" platformio ci "examples/ReadAsync/ReadAsync.ino" -l '.' --project-option="lib_deps=bblanchon/ArduinoJson" -b ${{ matrix.board }} ${{ matrix.opts }}

- name: Build EnergyReset
run: PLATFORMIO_BUILD_FLAGS="-Wall -Wextra -DMYCILA_JSY_JSON_SUPPORT" platformio ci "examples/EnergyReset/EnergyReset.ino" -l '.' --project-option="lib_deps=bblanchon/ArduinoJson" -b ${{ matrix.board }}
run: PLATFORMIO_BUILD_FLAGS="-Wall -Wextra -DMYCILA_JSY_JSON_SUPPORT" platformio ci "examples/EnergyReset/EnergyReset.ino" -l '.' --project-option="lib_deps=bblanchon/ArduinoJson" -b ${{ matrix.board }} ${{ matrix.opts }}

- name: Build EnergyResetAsync
run: PLATFORMIO_BUILD_FLAGS="-Wall -Wextra -DMYCILA_JSY_JSON_SUPPORT" platformio ci "examples/EnergyResetAsync/EnergyResetAsync.ino" -l '.' --project-option="lib_deps=bblanchon/ArduinoJson" -b ${{ matrix.board }}
run: PLATFORMIO_BUILD_FLAGS="-Wall -Wextra -DMYCILA_JSY_JSON_SUPPORT" platformio ci "examples/EnergyResetAsync/EnergyResetAsync.ino" -l '.' --project-option="lib_deps=bblanchon/ArduinoJson" -b ${{ matrix.board }} ${{ matrix.opts }}

- name: Build SetSpeed
run: PLATFORMIO_BUILD_FLAGS="-Wall -Wextra -DMYCILA_JSY_JSON_SUPPORT" platformio ci "examples/SetSpeed/SetSpeed.ino" -l '.' --project-option="lib_deps=bblanchon/ArduinoJson" -b ${{ matrix.board }}
run: PLATFORMIO_BUILD_FLAGS="-Wall -Wextra -DMYCILA_JSY_JSON_SUPPORT" platformio ci "examples/SetSpeed/SetSpeed.ino" -l '.' --project-option="lib_deps=bblanchon/ArduinoJson" -b ${{ matrix.board }} ${{ matrix.opts }}

- name: Build SimpleEnergyReset
run: platformio ci "examples/SimpleEnergyReset/SimpleEnergyReset.ino" -l '.' -b ${{ matrix.board }}
run: platformio ci "examples/SimpleEnergyReset/SimpleEnergyReset.ino" -l '.' -b ${{ matrix.board }} ${{ matrix.opts }}

- name: Build SimpleSetSpeed
run: platformio ci "examples/SimpleSetSpeed/SimpleSetSpeed.ino" -l '.' -b ${{ matrix.board }}
run: platformio ci "examples/SimpleSetSpeed/SimpleSetSpeed.ino" -l '.' -b ${{ matrix.board }} ${{ matrix.opts }}
7 changes: 5 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ default_envs = esp32
; default_envs = esp32s3box

[env]
; platform = [email protected]
platform = espressif32
platform_packages=
platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.0-alpha3
platform_packages=platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1

build_flags =
-Wall -Wextra
Expand All @@ -35,12 +40,10 @@ monitor_speed = 115200
monitor_filters = esp32_exception_decoder, log2file

[env:esp32]
platform = [email protected]
board = esp32dev
framework = arduino

[env:esp32s3box]
platform = [email protected]
board = esp32s3box
framework = arduino
upload_speed = 115200
10 changes: 10 additions & 0 deletions src/MycilaJSY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@

static const uint8_t JSY_READ_MSG[] = {0x01, 0x03, 0x00, 0x48, 0x00, 0x0E, 0x44, 0x18};

#ifndef GPIO_IS_VALID_OUTPUT_GPIO
#define GPIO_IS_VALID_OUTPUT_GPIO(gpio_num) ((gpio_num >= 0) && \
(((1ULL << (gpio_num)) & SOC_GPIO_VALID_OUTPUT_GPIO_MASK) != 0))
#endif

#ifndef GPIO_IS_VALID_GPIO
#define GPIO_IS_VALID_GPIO(gpio_num) ((gpio_num >= 0) && \
(((1ULL << (gpio_num)) & SOC_GPIO_VALID_GPIO_MASK) != 0))
#endif

void Mycila::JSY::begin(HardwareSerial* serial, const uint8_t jsyRXPin, const uint8_t jsyTXPin, const bool async, uint8_t core, uint32_t stackSize) {
if (_enabled)
return;
Expand Down

0 comments on commit 1f6c2bf

Please sign in to comment.