Skip to content

Commit cc2e0f2

Browse files
Raffael Rostagnonashif
authored andcommitted
drivers: gpio: esp32c2: Add support
Add gpio support to ESP32C2 and ESP8684 Signed-off-by: Raffael Rostagno <[email protected]>
1 parent 8a48cd1 commit cc2e0f2

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

drivers/gpio/gpio_esp32.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#include <zephyr/device.h>
2121
#include <zephyr/drivers/gpio.h>
2222
#include <zephyr/dt-bindings/gpio/espressif-esp32-gpio.h>
23-
#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32C6)
23+
#if defined(CONFIG_SOC_SERIES_ESP32C2) || \
24+
defined(CONFIG_SOC_SERIES_ESP32C3) || \
25+
defined(CONFIG_SOC_SERIES_ESP32C6)
2426
#include <zephyr/drivers/interrupt_controller/intc_esp32c3.h>
2527
#else
2628
#include <zephyr/drivers/interrupt_controller/intc_esp32.h>
@@ -33,7 +35,15 @@
3335
#include <zephyr/logging/log.h>
3436
LOG_MODULE_REGISTER(gpio_esp32, CONFIG_LOG_DEFAULT_LEVEL);
3537

36-
#ifdef CONFIG_SOC_SERIES_ESP32C3
38+
#ifdef CONFIG_SOC_SERIES_ESP32C2
39+
#define out out.val
40+
#define in in.val
41+
#define out_w1ts out_w1ts.val
42+
#define out_w1tc out_w1tc.val
43+
/* arch_curr_cpu() is not available for riscv based chips */
44+
#define CPU_ID() 0
45+
#define ISR_HANDLER isr_handler_t
46+
#elif CONFIG_SOC_SERIES_ESP32C3
3747
/* gpio structs in esp32c3 series are different from xtensa ones */
3848
#define out out.data
3949
#define in in.data
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
resources {
9+
compatible = "test-gpio-basic-api";
10+
out-gpios = <&gpio0 2 0>;
11+
in-gpios = <&gpio0 3 0>;
12+
};
13+
};

0 commit comments

Comments
 (0)