File espos_gpio_in.h¶
FileList > espos_sensors > include > espos_gpio_in.h
Go to the source code of this file
#include <stdbool.h>#include <stdint.h>#include "esp_err.h"
Public Types¶
| Type | Name |
|---|---|
| enum | espos_gpio_edge_t |
| typedef void(* | espos_gpio_isr_cb_t Call cb from the GPIO ISR on every matching edge. |
| enum | espos_gpio_pull_t |
Public Functions¶
| Type | Name |
|---|---|
| bool | espos_gpio_in_level (int gpio) Current level, after invert . |
| esp_err_t | espos_gpio_in_open (int gpio, espos_gpio_pull_t pull, bool invert) Configure a pin as an input. |
| esp_err_t | espos_gpio_in_unwatch (int gpio) |
| esp_err_t | espos_gpio_in_watch (int gpio, espos_gpio_edge_t edge, espos_gpio_isr_cb_t cb, void * arg) |
| bool | espos_gpio_out_get (int gpio) |
| esp_err_t | espos_gpio_out_open (int gpio, bool invert, bool initial) Configure a pin as an output and drive it. |
| esp_err_t | espos_gpio_out_set (int gpio, bool on) |
Public Types Documentation¶
enum espos_gpio_edge_t¶
enum espos_gpio_edge_t {
ESPOS_GPIO_EDGE_ANY = 0,
ESPOS_GPIO_EDGE_RISING,
ESPOS_GPIO_EDGE_FALLING
};
typedef espos_gpio_isr_cb_t¶
Call cb from the GPIO ISR on every matching edge.
cb runs in interrupt context: no logging, no allocation, no blocking, no FreeRTOS call that is not the FromISR one. Post to a Mailbox (the C++ GpioChange node does exactly this) or set a flag, and return.
The ISR service is installed on the first watch and shared with anything else in the firmware that uses per-pin GPIO interrupts.
enum espos_gpio_pull_t¶
Public Functions Documentation¶
function espos_gpio_in_level¶
Current level, after invert .
function espos_gpio_in_open¶
Configure a pin as an input.
invert reports a closed switch as true when the wiring is active-low, which is nearly every real switch: the internal pull-up holds the pin high and the switch pulls it down. Getting this into the driver rather than into every caller's !level is worth the field.
function espos_gpio_in_unwatch¶
function espos_gpio_in_watch¶
esp_err_t espos_gpio_in_watch (
int gpio,
espos_gpio_edge_t edge,
espos_gpio_isr_cb_t cb,
void * arg
)
function espos_gpio_out_get¶
function espos_gpio_out_open¶
Configure a pin as an output and drive it.
invert flips the sense, for a relay board that switches on a low.
function espos_gpio_out_set¶
The documentation for this class was generated from the following file espos_sensors/include/espos_gpio_in.h