VSF Documented
Data Structures | Functions
driver_gpio_port.c File Reference
#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)
 

Function Documentation

◆ gpio_config()

esp_err_t gpio_config ( const gpio_config_t config)

Apply a bulk configuration to every pin listed in config->pin_bit_mask.

Return values
ESP_OKsuccess
ESP_ERR_INVALID_ARGconfig is NULL or the mask selects a pin that does not exist in the current io_mapper

◆ gpio_reset_pin()

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).

◆ gpio_set_direction()

esp_err_t gpio_set_direction ( gpio_num_t  gpio_num,
gpio_mode_t  mode 
)

Set the direction of a single pin.

◆ gpio_set_pull_mode()

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.

◆ gpio_set_level()

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).

◆ gpio_get_level()

int gpio_get_level ( gpio_num_t  gpio_num)

Read the input level of a single pin (0 or 1).

◆ gpio_pullup_en()

esp_err_t gpio_pullup_en ( gpio_num_t  gpio_num)

Shortcut pull-up/pull-down enable/disable APIs.

◆ gpio_pullup_dis()

esp_err_t gpio_pullup_dis ( gpio_num_t  gpio_num)

◆ gpio_pulldown_en()

esp_err_t gpio_pulldown_en ( gpio_num_t  gpio_num)

◆ gpio_pulldown_dis()

esp_err_t gpio_pulldown_dis ( gpio_num_t  gpio_num)

◆ gpio_set_intr_type()

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.

◆ gpio_intr_enable()

esp_err_t gpio_intr_enable ( gpio_num_t  gpio_num)

Per-pin interrupt arm/disarm.

◆ gpio_intr_disable()

esp_err_t gpio_intr_disable ( gpio_num_t  gpio_num)

◆ gpio_install_isr_service()

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.

Parameters
intr_alloc_flagsaccepted for source compatibility and otherwise ignored (VSF routes every EXTI through the same HAL priority level chosen by the board).
Return values
ESP_OKsuccess or already installed
ESP_ERR_NO_MEMhandler table could not be allocated
ESP_ERR_INVALID_STATEVSF io_mapper reports zero ports

◆ gpio_uninstall_isr_service()

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.

◆ gpio_isr_handler_add()

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.

Return values
ESP_OKsuccess
ESP_ERR_INVALID_STATEthe ISR service has not been installed
ESP_ERR_INVALID_ARGgpio_num is out of range or isr_handler is NULL

◆ gpio_isr_handler_remove()

esp_err_t gpio_isr_handler_remove ( gpio_num_t  gpio_num)

Detach a per-pin callback previously registered with gpio_isr_handler_add().

◆ gpio_isr_register()

esp_err_t gpio_isr_register ( void(*)(void *)  fn,
void *  arg,
int  intr_alloc_flags,
gpio_isr_handle_t handle 
)

◆ gpio_wakeup_enable()

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.

◆ gpio_wakeup_disable()

esp_err_t gpio_wakeup_disable ( gpio_num_t  gpio_num)

Variable Documentation

◆ installed

bool installed

◆ pins_per_port

uint16_t pins_per_port

1 << port_bits_log2

◆ total_pins

uint16_t total_pins

port_num * pins_per_port

◆ table

Generated from commit: vsfteam/vsf@015f4d1