|
VSF Documented
|
#include "../vsf_espidf_cfg.h"#include "driver/gpio.h"#include "hal/driver/driver.h"#include "kernel/vsf_kernel.h"#include "hal/utilities/io_mapper/vsf_io_mapper.h"#include <string.h>Data Structures | |
| struct | gpio_isr_entry_t |
Functions | |
| esp_err_t | gpio_config (const gpio_config_t *config) |
| Apply a bulk configuration to every pin listed in config->pin_bit_mask. | |
| esp_err_t | gpio_reset_pin (gpio_num_t gpio_num) |
| Reset a single pin to a safe post-boot state (input, no pull, no interrupt). | |
| esp_err_t | gpio_set_direction (gpio_num_t gpio_num, gpio_mode_t mode) |
| Set the direction of a single pin. | |
| esp_err_t | gpio_set_pull_mode (gpio_num_t gpio_num, gpio_pull_mode_t pull) |
| Set the pull mode of a single pin. | |
| esp_err_t | gpio_set_level (gpio_num_t gpio_num, uint32_t level) |
| Set the output level of a single pin (0 = low, non-zero = high). | |
| int | gpio_get_level (gpio_num_t gpio_num) |
| Read the input level of a single pin (0 or 1). | |
| esp_err_t | gpio_pullup_en (gpio_num_t gpio_num) |
| Shortcut pull-up/pull-down enable/disable APIs. | |
| esp_err_t | gpio_pullup_dis (gpio_num_t gpio_num) |
| esp_err_t | gpio_pulldown_en (gpio_num_t gpio_num) |
| esp_err_t | gpio_pulldown_dis (gpio_num_t gpio_num) |
| esp_err_t | gpio_set_intr_type (gpio_num_t gpio_num, gpio_int_type_t intr_type) |
| Configure the edge/level that generates an external interrupt on the pin. This does NOT enable the interrupt by itself – call gpio_intr_enable() afterwards. | |
| esp_err_t | gpio_intr_enable (gpio_num_t gpio_num) |
| Per-pin interrupt arm/disarm. | |
| esp_err_t | gpio_intr_disable (gpio_num_t gpio_num) |
| esp_err_t | gpio_install_isr_service (int intr_alloc_flags) |
| Install the shim's per-pin ISR dispatcher. | |
| void | gpio_uninstall_isr_service (void) |
| Release the per-pin ISR dispatcher. | |
| esp_err_t | gpio_isr_handler_add (gpio_num_t gpio_num, gpio_isr_t isr_handler, void *args) |
| Attach a per-pin callback under the ISR service. | |
| esp_err_t | gpio_isr_handler_remove (gpio_num_t gpio_num) |
| Detach a per-pin callback previously registered with gpio_isr_handler_add(). | |
| esp_err_t | gpio_isr_register (void(*fn)(void *), void *arg, int intr_alloc_flags, gpio_isr_handle_t *handle) |
| esp_err_t | gpio_wakeup_enable (gpio_num_t gpio_num, gpio_int_type_t intr_type) |
| Accepted for source compatibility. Returns ESP_ERR_NOT_SUPPORTED unless the underlying board enables the corresponding low-power feature – which the shim cannot probe. | |
| esp_err_t | gpio_wakeup_disable (gpio_num_t gpio_num) |
| esp_err_t gpio_config | ( | const gpio_config_t * | config | ) |
Apply a bulk configuration to every pin listed in config->pin_bit_mask.
| ESP_OK | success |
| ESP_ERR_INVALID_ARG | config is NULL or the mask selects a pin that does not exist in the current io_mapper |
| esp_err_t gpio_reset_pin | ( | gpio_num_t | gpio_num | ) |
Reset a single pin to a safe post-boot state (input, no pull, no interrupt).
| esp_err_t gpio_set_direction | ( | gpio_num_t | gpio_num, |
| gpio_mode_t | mode | ||
| ) |
Set the direction of a single pin.
| esp_err_t gpio_set_pull_mode | ( | gpio_num_t | gpio_num, |
| gpio_pull_mode_t | pull | ||
| ) |
Set the pull mode of a single pin.
| esp_err_t gpio_set_level | ( | gpio_num_t | gpio_num, |
| uint32_t | level | ||
| ) |
Set the output level of a single pin (0 = low, non-zero = high).
| int gpio_get_level | ( | gpio_num_t | gpio_num | ) |
Read the input level of a single pin (0 or 1).
| esp_err_t gpio_pullup_en | ( | gpio_num_t | gpio_num | ) |
Shortcut pull-up/pull-down enable/disable APIs.
| esp_err_t gpio_pullup_dis | ( | gpio_num_t | gpio_num | ) |
| esp_err_t gpio_pulldown_en | ( | gpio_num_t | gpio_num | ) |
| esp_err_t gpio_pulldown_dis | ( | gpio_num_t | gpio_num | ) |
| esp_err_t gpio_set_intr_type | ( | gpio_num_t | gpio_num, |
| gpio_int_type_t | intr_type | ||
| ) |
Configure the edge/level that generates an external interrupt on the pin. This does NOT enable the interrupt by itself – call gpio_intr_enable() afterwards.
| esp_err_t gpio_intr_enable | ( | gpio_num_t | gpio_num | ) |
Per-pin interrupt arm/disarm.
| esp_err_t gpio_intr_disable | ( | gpio_num_t | gpio_num | ) |
| esp_err_t gpio_install_isr_service | ( | int | intr_alloc_flags | ) |
Install the shim's per-pin ISR dispatcher.
Mirrors the ESP-IDF "ISR service" concept: a single central IRQ handler fans out to per-pin callbacks registered via gpio_isr_handler_add(). Must be called once before any _add/_remove call.
| intr_alloc_flags | accepted for source compatibility and otherwise ignored (VSF routes every EXTI through the same HAL priority level chosen by the board). |
| ESP_OK | success or already installed |
| ESP_ERR_NO_MEM | handler table could not be allocated |
| ESP_ERR_INVALID_STATE | VSF io_mapper reports zero ports |
| void gpio_uninstall_isr_service | ( | void | ) |
Release the per-pin ISR dispatcher.
All registered per-pin callbacks are dropped; per-port EXTI handlers are disabled in the underlying HAL driver.
| esp_err_t gpio_isr_handler_add | ( | gpio_num_t | gpio_num, |
| gpio_isr_t | isr_handler, | ||
| void * | args | ||
| ) |
Attach a per-pin callback under the ISR service.
| ESP_OK | success |
| ESP_ERR_INVALID_STATE | the ISR service has not been installed |
| ESP_ERR_INVALID_ARG | gpio_num is out of range or isr_handler is NULL |
| esp_err_t gpio_isr_handler_remove | ( | gpio_num_t | gpio_num | ) |
Detach a per-pin callback previously registered with gpio_isr_handler_add().
| esp_err_t gpio_isr_register | ( | void(*)(void *) | fn, |
| void * | arg, | ||
| int | intr_alloc_flags, | ||
| gpio_isr_handle_t * | handle | ||
| ) |
| esp_err_t gpio_wakeup_enable | ( | gpio_num_t | gpio_num, |
| gpio_int_type_t | intr_type | ||
| ) |
Accepted for source compatibility. Returns ESP_ERR_NOT_SUPPORTED unless the underlying board enables the corresponding low-power feature – which the shim cannot probe.
| esp_err_t gpio_wakeup_disable | ( | gpio_num_t | gpio_num | ) |
| bool installed |
| uint16_t pins_per_port |
1 << port_bits_log2
| uint16_t total_pins |
port_num * pins_per_port
| gpio_isr_entry_t* table |