|
Open Model Railroad Network (OpenMRN)
|
#include "freertos_drivers/common/GpioWrapper.hxx"#include "freertos_drivers/esp32/Esp32AdcOneShot.hxx"#include "os/Gpio.hxx"#include "utils/logging.h"#include "utils/macros.h"#include <driver/gpio.h>#include <esp_rom_gpio.h>#include <soc/gpio_struct.h>Go to the source code of this file.
Classes | |
| class | Esp32Gpio< PIN_NUM, INVERTED > |
| Defines a GPIO output pin. More... | |
| struct | GpioOutputPin< Base, SAFE_VALUE, INVERT > |
| Parametric GPIO output class. More... | |
| struct | GpioOutputSafeLow< Defs > |
| Defines a GPIO output pin, initialized to be an output pin with low level. More... | |
| struct | GpioOutputSafeLowInvert< Defs > |
| Defines a GPIO output pin, initialized to be an output pin with low level. More... | |
| struct | GpioOutputSafeHigh< Defs > |
| Defines a GPIO output pin, initialized to be an output pin with high level. More... | |
| struct | GpioOutputSafeHighInvert< Defs > |
| Defines a GPIO output pin, initialized to be an output pin with high level. More... | |
| struct | GpioInputPin< Base, ACTIVE_HIGH > |
| Parametric GPIO input class. More... | |
| struct | GpioInputNP< Defs > |
| Defines a GPIO input pin. More... | |
| struct | GpioInputPU< Defs > |
| Defines a GPIO input pin with pull-up. More... | |
| struct | GpioInputPD< Defs > |
| Defines a GPIO input pin with pull-down enabled. More... | |
| struct | GpioInputPUPD< Defs > |
| Defines a GPIO input pin with pull-up and pull-down enabled. More... | |
Macros | |
| #define | IS_GPIO_OUTPUT(pin) |
| Helper macro to test if a pin has been configured for output. | |
| #define | GPIO_PIN(NAME, BaseClass, NUM) |
| Helper macro for defining GPIO pins on the ESP32. | |
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Helper declarations for using GPIO pins via the ESP-IDF APIs.
Definition in file Esp32Gpio.hxx.
| #define GPIO_PIN | ( | NAME, | |
| BaseClass, | |||
| NUM | |||
| ) |
Helper macro for defining GPIO pins on the ESP32.
| NAME | is the basename of the declaration. For NAME==FOO the macro declared FOO_Pin as a structure on which the read-write functions will be available. |
| BaseClass | is the initialization structure, such as LedPin, or GpioOutputSafeHigh or GpioOutputSafeLow. |
| NUM | is the pin number, such as 3 (see below for usable range). |
There are multiple variations available for the ESP32: ESP32, WROVER, WROVER-B, PICO, ESP32-Solo, ESP32-S2, ESP32-C3. Each of these have slight differences in the available pins.
ESP32: Valid pin range is 0..39 with the following restrictions:
ESP32-PICO-D4: Nearly the same as ESP32 but with the following differences:
ESP32-PICO-V3: Nearly the same as ESP32-PICO-D4 with the following differences:
ESP32-WROVER and WROVER-B: Nearly the same as ESP32 but with the following differences:
ESP32-S2: Valid pin range is 0..46 with the following notes:
ESP32-C3: Valid pin range is 0..21 with the following notes:
ESP8685: This is an ESP32-C3 in a smaller package without SPI pins exposed.
ESP32-S3: Valid pin range is 0..48 with the following notes:
Pins marked as having a pull-up or pull-down resistor are typically 10kOhm.
Any pins marked as a bootstrap pin can alter the behavior of the ESP32 if they are not in the default/expected state on startup. Consult the schematic and/or datasheet for more details.
The built in pull-up/pull-down resistor for all ESP32 variants are typically 45kOhm.
SoC datasheet references: ESP32: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf ESP32-WROVER: https://www.espressif.com/sites/default/files/documentation/esp32-wrover_datasheet_en.pdf ESP32-WROVER-B: https://www.espressif.com/sites/default/files/documentation/esp32-wrover-b_datasheet_en.pdf ESP32-PICO-D4: https://www.espressif.com/sites/default/files/documentation/esp32-pico-d4_datasheet_en.pdf ESP32-PICO-V3: https://www.espressif.com/sites/default/files/documentation/esp32-pico-v3_datasheet_en.pdf ESP32-S2: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf ESP32-S2-WROVER: https://www.espressif.com/sites/default/files/documentation/esp32-s2-wrover_esp32-s2-wrover-i_datasheet_en.pdf ESP32-C3: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf ESP32-S3: https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf ESP8685: https://www.espressif.com/sites/default/files/documentation/esp8685_datasheet_en.pdf
SoC technical references: ESP32: https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf ESP32-S2: https://www.espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf ESP32-C3: https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf ESP32-S3: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf
Module schematic references: DevKitC v4: https://dl.espressif.com/dl/schematics/esp32_devkitc_v4-sch-20180607a.pdf DevKitC v2: https://dl.espressif.com/dl/schematics/ESP32-Core-Board-V2_sch.pdf WROVER KIT v4.1: https://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_V4_1.pdf WROVER KIT v3: https://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-3.pdf WROVER KIT v2: https://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-2.pdf WROVER KIT v1: https://dl.espressif.com/dl/schematics/ESP32-DevKitJ-v1_sch.pdf PICO KIT v4.1: https://dl.espressif.com/dl/schematics/esp32-pico-kit-v4.1_schematic.pdf PICO KIT v3: https://dl.espressif.com/dl/schematics/esp32-pico-kit-v3_schematic.pdf ESP32-S2-Saola-1: https://dl.espressif.com/dl/schematics/ESP32-S2-SAOLA-1_V1.1_schematics.pdf ESP32-S2-Kaluga-1: https://dl.espressif.com/dl/schematics/ESP32-S2-Kaluga-1_V1_3_SCH_20200526A.pdf ESP32-C3-DevKitM-1: https://dl.espressif.com/dl/schematics/SCH_ESP32-C3-DEVKITM-1_V1_20200915A.pdf
NOTE: The WROVER KIT v1 is also known as DevKitJ and is RED colored PCB that supports both WROVER and WROOM-32 modules.
Example: GPIO_PIN(FOO, GpioOutputSafeLow, 3); ... FOO_Pin::set(true);
Definition at line 558 of file Esp32Gpio.hxx.
| #define IS_GPIO_OUTPUT | ( | pin | ) |
Helper macro to test if a pin has been configured for output.
This is necessary since ESP-IDF does not expose gpio_get_direction(pin).
Definition at line 59 of file Esp32Gpio.hxx.