Skip to content

Commit

Permalink
ESP-IDF: ESP32P4 support added
Browse files Browse the repository at this point in the history
  • Loading branch information
pstolarz committed Apr 9, 2024
1 parent 7defc55 commit 2181095
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/espidf-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- esp32c3
- esp32c6
- esp32h2
- esp32p4
- esp8266
example:
- DallasTemperature
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ While added the library shall be configured via Mbed native configuration (see
* Arduino ESP8266/ESP-IDF.
* Platform class: `OneWireNg_ArduinoIdfESP8266`.
* Tested on WemOS D1.
* Arduino/ESP-IDF ESP32 (classic, S, C and H families).
* Arduino/ESP-IDF ESP32 (classic, S, C, H and P families).
* Platform class: `OneWireNg_ArduinoIdfESP32`.
* Tested on ESP32-WROOM-32, ESP32-S2-WROVER, ESP32-S3-WROOM-1, ESP32-C3-32S-Kit.
* Arduino/Pico SDK RP2040.
Expand Down
25 changes: 18 additions & 7 deletions src/platform/OneWireNg_ArduinoIdfESP32.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Piotr Stolarz
* Copyright (c) 2022,2024 Piotr Stolarz
* OneWireNg: Arduino 1-wire service library
*
* Distributed under the 2-clause BSD License (the License)
Expand Down Expand Up @@ -40,7 +40,10 @@ static void _pinMode(uint8_t pin, uint8_t mode)
.mode = GPIO_MODE_DISABLE,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_DISABLE
.intr_type = GPIO_INTR_DISABLE,
#if SOC_GPIO_SUPPORT_PIN_HYS_FILTER
.hys_ctrl_mode = GPIO_HYS_SOFT_DISABLE,
#endif
};
conf.mode = (gpio_mode_t)(mode & (__INPUT | __OUTPUT));
if (mode & __PULLUP) {
Expand All @@ -60,15 +63,23 @@ static void _pinMode(uint8_t pin, uint8_t mode)
# define REG_GPIO_MOD_SET_LO GPIO.enable_w1ts.val
# define REG_GPIO_MOD_CLR_LO GPIO.enable_w1tc.val
#else
# define REG_GPIO_IN_LO GPIO.in
# if defined(CONFIG_IDF_TARGET_ESP32P4)
# define REG_GPIO_IN_LO GPIO.in.val
# define REG_GPIO_OUT_SET_LO GPIO.out_w1ts.val
# define REG_GPIO_OUT_CLR_LO GPIO.out_w1tc.val
# define REG_GPIO_MOD_SET_LO GPIO.enable_w1ts.val
# define REG_GPIO_MOD_CLR_LO GPIO.enable_w1tc.val
# else
# define REG_GPIO_IN_LO GPIO.in
# define REG_GPIO_OUT_SET_LO GPIO.out_w1ts
# define REG_GPIO_OUT_CLR_LO GPIO.out_w1tc
# define REG_GPIO_MOD_SET_LO GPIO.enable_w1ts
# define REG_GPIO_MOD_CLR_LO GPIO.enable_w1tc
# endif
# define REG_GPIO_IN_HI GPIO.in1.val
# define REG_GPIO_OUT_SET_LO GPIO.out_w1ts
# define REG_GPIO_OUT_SET_HI GPIO.out1_w1ts.val
# define REG_GPIO_OUT_CLR_LO GPIO.out_w1tc
# define REG_GPIO_OUT_CLR_HI GPIO.out1_w1tc.val
# define REG_GPIO_MOD_SET_LO GPIO.enable_w1ts
# define REG_GPIO_MOD_SET_HI GPIO.enable1_w1ts.val
# define REG_GPIO_MOD_CLR_LO GPIO.enable_w1tc
# define REG_GPIO_MOD_CLR_HI GPIO.enable1_w1tc.val
#endif

Expand Down
5 changes: 3 additions & 2 deletions src/platform/Platform_TimeCritical.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021,2022 Piotr Stolarz
* Copyright (c) 2021,2022,2024 Piotr Stolarz
* OneWireNg: Arduino 1-wire service library
*
* Distributed under the 2-clause BSD License (the License)
Expand All @@ -26,7 +26,8 @@

#if CONFIG_BITBANG_DELAY_CCOUNT
# if defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C3) || \
defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) || \
defined(CONFIG_IDF_TARGET_ESP32P4)
# include "esp_cpu.h"
# include "esp_idf_version.h"
# if (ESP_IDF_VERSION_MAJOR >= 5)
Expand Down

0 comments on commit 2181095

Please sign in to comment.