Skip to content

Commit e7f843b

Browse files
me-no-devdickeyf
andauthored
Fix driver for ESP-IDF v5.0 (#395)
* Migrating rom GPIO include for idf v5 * Add missing includes and build for all targets Fixes: #364 Co-authored-by: Francois Dickey <francois.dickey@solace.com>
1 parent 8fc49c9 commit e7f843b

File tree

6 files changed

+40
-19
lines changed

6 files changed

+40
-19
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,37 @@ on:
88
jobs:
99
build-master:
1010
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
idf_target: ["esp32", "esp32s2", "esp32s3"]
1114
steps:
1215
- name: Checkout repo
1316
uses: actions/checkout@v2
1417
with:
1518
submodules: 'recursive'
1619
- name: esp-idf build
17-
uses: espressif/esp-idf-ci-action@latest
20+
uses: espressif/esp-idf-ci-action@main
1821
with:
22+
target: ${{ matrix.idf_target }}
1923
path: 'examples'
2024

21-
build-release-v4_0:
25+
build-release-v4_4:
26+
name: Build for ${{ matrix.idf_target }} on ${{ matrix.idf_ver }}
2227
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
idf_ver: ["v4.4"]
31+
idf_target: ["esp32", "esp32s2", "esp32s3"]
2332
steps:
2433
- name: Checkout repo
2534
uses: actions/checkout@v2
2635
with:
2736
submodules: 'recursive'
2837
- name: esp-idf build
29-
uses: espressif/esp-idf-ci-action@release-v4.0
38+
uses: espressif/esp-idf-ci-action@main
3039
with:
40+
esp_idf_version: ${{ matrix.idf_ver }}
41+
target: ${{ matrix.idf_target }}
3142
path: 'examples'
3243

3344
build-release-v4_1:
@@ -65,15 +76,3 @@ jobs:
6576
uses: espressif/esp-idf-ci-action@release-v4.3
6677
with:
6778
path: 'examples'
68-
69-
build-release-v3_3:
70-
runs-on: ubuntu-latest
71-
steps:
72-
- name: Checkout repo
73-
uses: actions/checkout@v2
74-
with:
75-
submodules: 'recursive'
76-
- name: esp-idf build
77-
uses: espressif/esp-idf-ci-action@release-v3.3
78-
with:
79-
path: 'examples'

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,12 @@ if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET ST
6363
set(COMPONENT_REQUIRES driver)
6464
set(COMPONENT_PRIV_REQUIRES freertos nvs_flash)
6565

66+
set(min_supported_idf_version "4.2")
67+
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}")
68+
if (idf_version VERSION_GREATER_EQUAL min_supported_idf_version)
69+
list(APPEND COMPONENT_PRIV_REQUIRES esp_timer)
70+
message(WARNING "ESP-IDF version detected: '${idf_version}'.")
71+
endif()
72+
6673
register_component()
6774
endif()

driver/cam_hal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#if (ESP_IDF_VERSION_MAJOR == 3) && (ESP_IDF_VERSION_MINOR == 3)
2222
#include "rom/ets_sys.h"
2323
#else
24+
#include "esp_timer.h"
2425
#if CONFIG_IDF_TARGET_ESP32
2526
#include "esp32/rom/ets_sys.h" // will be removed in idf v5.0
2627
#elif CONFIG_IDF_TARGET_ESP32S2

target/esp32/ll_cam.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ static inline int gpio_ll_get_level(gpio_dev_t *hw, int gpio_num)
3434
#include "xclk.h"
3535
#include "cam_hal.h"
3636

37+
#if (ESP_IDF_VERSION_MAJOR >= 4) && (ESP_IDF_VERSION_MINOR >= 3)
38+
#include "esp_rom_gpio.h"
39+
#endif
40+
3741
#if (ESP_IDF_VERSION_MAJOR >= 5)
3842
#define GPIO_PIN_INTR_POSEDGE GPIO_INTR_POSEDGE
3943
#define GPIO_PIN_INTR_NEGEDGE GPIO_INTR_NEGEDGE
40-
#define gpio_matrix_in(a,b,c) gpio_iomux_in(a,b)
44+
#define gpio_matrix_in(a,b,c) esp_rom_gpio_connect_in_signal(a,b,c)
4145
#endif
4246

4347
static const char *TAG = "esp32 ll_cam";

target/esp32s2/ll_cam.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@
2121
#include "xclk.h"
2222
#include "cam_hal.h"
2323

24+
#if (ESP_IDF_VERSION_MAJOR >= 4) && (ESP_IDF_VERSION_MINOR >= 3)
25+
#include "esp_rom_gpio.h"
26+
#endif
27+
2428
#if (ESP_IDF_VERSION_MAJOR >= 5)
2529
#define GPIO_PIN_INTR_POSEDGE GPIO_INTR_POSEDGE
2630
#define GPIO_PIN_INTR_NEGEDGE GPIO_INTR_NEGEDGE
27-
#define gpio_matrix_in(a,b,c) gpio_iomux_in(a,b)
31+
#define gpio_matrix_in(a,b,c) esp_rom_gpio_connect_in_signal(a,b,c)
32+
#define ets_delay_us(a) esp_rom_delay_us(a)
2833
#endif
2934

3035
static const char *TAG = "s2 ll_cam";

target/esp32s3/ll_cam.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@
2222
#include "soc/gdma_reg.h"
2323
#include "ll_cam.h"
2424
#include "cam_hal.h"
25+
#include "esp_rom_gpio.h"
2526

2627
#if (ESP_IDF_VERSION_MAJOR >= 5)
27-
#define gpio_matrix_in(a,b,c) gpio_iomux_in(a,b)
28-
#define gpio_matrix_out(a,b,c,d) gpio_iomux_out(a,b,c)
28+
#include "soc/gpio_sig_map.h"
29+
#include "soc/gpio_periph.h"
30+
#include "soc/io_mux_reg.h"
31+
#define gpio_matrix_in(a,b,c) esp_rom_gpio_connect_in_signal(a,b,c)
32+
#define gpio_matrix_out(a,b,c,d) esp_rom_gpio_connect_out_signal(a,b,c,d)
33+
#define ets_delay_us(a) esp_rom_delay_us(a)
2934
#endif
3035

3136
static const char *TAG = "s3 ll_cam";

0 commit comments

Comments
 (0)