Select one of the symbols to view example projects that use it.
 
Outline
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#include "soc/soc_caps.h"
#include "hal/rtc_io_types.h"
#include "driver/gpio.h"
rtc_gpio_is_valid_gpio(gpio_num_t);
#define RTC_GPIO_IS_VALID_GPIO
rtc_io_number_get(gpio_num_t);
rtc_gpio_init(gpio_num_t);
rtc_gpio_deinit(gpio_num_t);
rtc_gpio_get_level(gpio_num_t);
rtc_gpio_set_level(gpio_num_t, uint32_t);
rtc_gpio_set_direction(gpio_num_t, rtc_gpio_mode_t);
rtc_gpio_set_direction_in_sleep(gpio_num_t, rtc_gpio_mode_t);
rtc_gpio_pullup_en(gpio_num_t);
rtc_gpio_pulldown_en(gpio_num_t);
rtc_gpio_pullup_dis(gpio_num_t);
rtc_gpio_pulldown_dis(gpio_num_t);
rtc_gpio_set_drive_capability(gpio_num_t, gpio_drive_cap_t);
rtc_gpio_get_drive_capability(gpio_num_t, gpio_drive_cap_t *);
rtc_gpio_iomux_func_sel(gpio_num_t, int);
rtc_gpio_hold_en(gpio_num_t);
rtc_gpio_hold_dis(gpio_num_t);
rtc_gpio_force_hold_en_all();
rtc_gpio_force_hold_dis_all();
rtc_gpio_isolate(gpio_num_t);
rtc_gpio_wakeup_enable(gpio_num_t, gpio_int_type_t);
rtc_gpio_wakeup_disable(gpio_num_t);
Files
ESP-IDF
components
app_trace
app_update
bootloader_support
bt
cmock
console
cxx
driver
efuse
esp_adc
esp_app_format
esp_bootloader_format
esp_coex
esp_common
esp_driver_ana_cmpr
esp_driver_cam
esp_driver_dac
esp_driver_gpio
include
driver
esp_private
src
esp_driver_gptimer
esp_driver_i2c
esp_driver_i2s
esp_driver_jpeg
esp_driver_ledc
esp_driver_mcpwm
esp_driver_parlio
esp_driver_pcnt
esp_driver_rmt
esp_driver_sdio
esp_driver_sdm
esp_driver_sdmmc
esp_driver_sdspi
esp_driver_spi
esp_driver_tsens
esp_driver_uart
esp_driver_usb_serial_jtag
esp_eth
esp_event
esp_gdbstub
esp_hid
esp_http_client
esp_http_server
esp_https_ota
esp_https_server
esp_hw_support
esp_lcd
esp_local_ctrl
esp_mm
esp_netif
esp_partition
esp_phy
esp_pm
esp_psram
esp_ringbuf
esp_rom
esp_security
esp_system
esp_timer
esp_vfs_console
esp_wifi
esp-tls
espcoredump
hal
heap
http_parser
ieee802154
log
mqtt
newlib
nvs_flash
nvs_sec_provider
openthread
perfmon
protobuf-c
protocomm
pthread
rt
sdmmc
soc
spi_flash
spiffs
tcp_transport
ulp
unity
vfs
wear_levelling
wifi_provisioning
wpa_supplicant
xtensa
examples
lwIP
FreeRTOS
cJSON
mbedTLS
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/esp_driver_gpio/include/driver/rtc_io.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #pragma once #include <stdint.h> #include <stdbool.h> #include "esp_err.h" #include "soc/soc_caps.h" #include "hal/rtc_io_types.h" #include "driver/gpio.h"6 includes #ifdef __cplusplus extern "C" { #endif /** * @brief Determine if the specified GPIO is a valid RTC GPIO. * * @param gpio_num GPIO number * @return true if GPIO is valid for RTC GPIO use. false otherwise. *//* ... */ bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num); #define RTC_GPIO_IS_VALID_GPIO(gpio_num) rtc_gpio_is_valid_gpio(gpio_num) #if SOC_RTCIO_PIN_COUNT > 0 /** * @brief Get RTC IO index number by gpio number. * * @param gpio_num GPIO number * @return * >=0: Index of rtcio. * -1 : The gpio is not rtcio. *//* ... */ int rtc_io_number_get(gpio_num_t gpio_num); /** * @brief Init a GPIO as RTC GPIO * * This function must be called when initializing a pad for an analog function. * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * * @return * - ESP_OK success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_init(gpio_num_t gpio_num); /** * @brief Init a GPIO as digital GPIO * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * * @return * - ESP_OK success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_deinit(gpio_num_t gpio_num); #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED /** * @brief Get the RTC IO input level * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * * @return * - 1 High level * - 0 Low level * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ uint32_t rtc_gpio_get_level(gpio_num_t gpio_num); /** * @brief Set the RTC IO output level * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * @param level output level * * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_set_level(gpio_num_t gpio_num, uint32_t level); /** * @brief RTC GPIO set direction * * Configure RTC GPIO direction, such as output only, input only, * output and input. * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * @param mode GPIO direction * * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_set_direction(gpio_num_t gpio_num, rtc_gpio_mode_t mode); /** * @brief RTC GPIO set direction in deep sleep mode or disable sleep status (default). * In some application scenarios, IO needs to have another states during deep sleep. * * NOTE: ESP32 supports INPUT_ONLY mode. * The rest targets support INPUT_ONLY, OUTPUT_ONLY, INPUT_OUTPUT mode. * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * @param mode GPIO direction * * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_set_direction_in_sleep(gpio_num_t gpio_num, rtc_gpio_mode_t mode); /** * @brief RTC GPIO pullup enable * * This function only works for RTC IOs. In general, call gpio_pullup_en, * which will work both for normal GPIOs and RTC IOs. * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_pullup_en(gpio_num_t gpio_num); /** * @brief RTC GPIO pulldown enable * * This function only works for RTC IOs. In general, call gpio_pulldown_en, * which will work both for normal GPIOs and RTC IOs. * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_pulldown_en(gpio_num_t gpio_num); /** * @brief RTC GPIO pullup disable * * This function only works for RTC IOs. In general, call gpio_pullup_dis, * which will work both for normal GPIOs and RTC IOs. * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_pullup_dis(gpio_num_t gpio_num); /** * @brief RTC GPIO pulldown disable * * This function only works for RTC IOs. In general, call gpio_pulldown_dis, * which will work both for normal GPIOs and RTC IOs. * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_pulldown_dis(gpio_num_t gpio_num); /** * @brief Set RTC GPIO pad drive capability * * @param gpio_num GPIO number, only support output GPIOs * @param strength Drive capability of the pad * * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG Parameter error *//* ... */ esp_err_t rtc_gpio_set_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t strength); /** * @brief Get RTC GPIO pad drive capability * * @param gpio_num GPIO number, only support output GPIOs * @param strength Pointer to accept drive capability of the pad * * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG Parameter error *//* ... */ esp_err_t rtc_gpio_get_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t* strength); /** * @brief Select a RTC IOMUX function for the RTC IO * * @param gpio_num GPIO number * @param func Function to assign to the pin * * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG Parameter error *//* ... */ esp_err_t rtc_gpio_iomux_func_sel(gpio_num_t gpio_num, int func); /* ... */ #endif // SOC_RTCIO_INPUT_OUTPUT_SUPPORTED #if SOC_RTCIO_HOLD_SUPPORTED /** * @brief Enable hold function on an RTC IO pad * * Enabling HOLD function will cause the pad to latch current values of * input enable, output enable, output value, function, drive strength values. * This function is useful when going into light or deep sleep mode to prevent * the pin configuration from changing. * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_hold_en(gpio_num_t gpio_num); /** * @brief Disable hold function on an RTC IO pad * * Disabling hold function will allow the pad receive the values of * input enable, output enable, output value, function, drive strength from * RTC_IO peripheral. * * @param gpio_num GPIO number (e.g. GPIO_NUM_12) * @return * - ESP_OK Success * - ESP_ERR_INVALID_ARG GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_hold_dis(gpio_num_t gpio_num); /** * @brief Enable force hold signal for all RTC IOs * * Each RTC pad has a "force hold" input signal from the RTC controller. * If this signal is set, pad latches current values of input enable, * function, output enable, and other signals which come from the RTC mux. * Force hold signal is enabled before going into deep sleep for pins which * are used for EXT1 wakeup. *//* ... */ esp_err_t rtc_gpio_force_hold_en_all(void); /** * @brief Disable force hold signal for all RTC IOs *//* ... */ esp_err_t rtc_gpio_force_hold_dis_all(void); /* ... */ #endif // SOC_RTCIO_HOLD_SUPPORTED #if SOC_RTCIO_HOLD_SUPPORTED && SOC_RTCIO_INPUT_OUTPUT_SUPPORTED /** * @brief Helper function to disconnect internal circuits from an RTC IO * This function disables input, output, pullup, pulldown, and enables * hold feature for an RTC IO. * Use this function if an RTC IO needs to be disconnected from internal * circuits in deep sleep, to minimize leakage current. * * In particular, for ESP32-WROVER module, call * rtc_gpio_isolate(GPIO_NUM_12) before entering deep sleep, to reduce * deep sleep current. * * @param gpio_num GPIO number (e.g. GPIO_NUM_12). * @return * - ESP_OK on success * - ESP_ERR_INVALID_ARG if GPIO is not an RTC IO *//* ... */ esp_err_t rtc_gpio_isolate(gpio_num_t gpio_num);/* ... */ #endif // SOC_RTCIO_HOLD_SUPPORTED && SOC_RTCIO_INPUT_OUTPUT_SUPPORTED #if SOC_RTCIO_WAKE_SUPPORTED /** * @brief Enable wakeup from sleep mode using specific GPIO * @param gpio_num GPIO number * @param intr_type Wakeup on high level (GPIO_INTR_HIGH_LEVEL) or low level * (GPIO_INTR_LOW_LEVEL) * @return * - ESP_OK on success * - ESP_ERR_INVALID_ARG if gpio_num is not an RTC IO, or intr_type is not * one of GPIO_INTR_HIGH_LEVEL, GPIO_INTR_LOW_LEVEL. *//* ... */ esp_err_t rtc_gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type); /** * @brief Disable wakeup from sleep mode using specific GPIO * @param gpio_num GPIO number * @return * - ESP_OK on success * - ESP_ERR_INVALID_ARG if gpio_num is not an RTC IO *//* ... */ esp_err_t rtc_gpio_wakeup_disable(gpio_num_t gpio_num); /* ... */ #endif // SOC_RTCIO_WAKE_SUPPORTED /* ... */ #endif // SOC_RTCIO_PIN_COUNT > 0 #ifdef __cplusplus }{...} #endif
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.