Zephyr API Documentation  3.0.0
A Scalable Open Source RTOS
3.0.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gpio_esp32.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: Apache-2.0
3 */
4
5#include <devicetree.h>
6
7#ifndef ZEPHYR_INCLUDE_DRIVERS_GPIO_GPIO_ESP32_H_
8#define ZEPHYR_INCLUDE_DRIVERS_GPIO_GPIO_ESP32_H_
9
10static const char *gpio_esp32_get_gpio_for_pin(int pin)
11{
12 if (pin < 32) {
13#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay)
14 return DT_LABEL(DT_INST(0, espressif_esp32_gpio));
15#else
16 return NULL;
17#endif
18 }
19
20#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay)
21 return DT_LABEL(DT_INST(1, espressif_esp32_gpio));
22#else
23 return NULL;
24#endif
25}
26
27#endif /* ZEPHYR_INCLUDE_DRIVERS_GPIO_GPIO_ESP32_H_ */
Devicetree main header.
static const char * gpio_esp32_get_gpio_for_pin(int pin)
Definition: gpio_esp32.h:10
#define DT_INST(inst, compat)
Get a node identifier for an instance of a compatible.
Definition: devicetree.h:305
#define DT_LABEL(node_id)
Equivalent to DT_PROP(node_id, label)
Definition: devicetree.h:660