| 
    Zephyr Project API
    3.3.0
    
   A Scalable Open Source RTOS 
   | 
 
Public APIs for GPIO drivers. More...
#include <errno.h>#include <zephyr/sys/__assert.h>#include <zephyr/sys/slist.h>#include <zephyr/types.h>#include <stddef.h>#include <zephyr/device.h>#include <zephyr/dt-bindings/gpio/gpio.h>#include <syscalls/gpio.h>Go to the source code of this file.
Data Structures | |
| struct | gpio_dt_spec | 
| Container for GPIO pin information specified in devicetree.  More... | |
| struct | gpio_driver_config | 
| struct | gpio_driver_data | 
| struct | gpio_callback | 
| GPIO callback structure.  More... | |
Macros | |
| #define | GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, idx) | 
Static initializer for a gpio_dt_spec.  More... | |
| #define | GPIO_DT_SPEC_GET_BY_IDX_OR(node_id, prop, idx, default_value) | 
| Like GPIO_DT_SPEC_GET_BY_IDX(), with a fallback to a default value.  More... | |
| #define | GPIO_DT_SPEC_GET(node_id, prop) GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, 0) | 
| Equivalent to GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, 0).  More... | |
| #define | GPIO_DT_SPEC_GET_OR(node_id, prop, default_value) GPIO_DT_SPEC_GET_BY_IDX_OR(node_id, prop, 0, default_value) | 
| Equivalent to GPIO_DT_SPEC_GET_BY_IDX_OR(node_id, prop, 0, default_value).  More... | |
| #define | GPIO_DT_SPEC_INST_GET_BY_IDX(inst, prop, idx) GPIO_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst), prop, idx) | 
Static initializer for a gpio_dt_spec from a DT_DRV_COMPAT instance's GPIO property at an index.  More... | |
| #define | GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, prop, idx, default_value) | 
Static initializer for a gpio_dt_spec from a DT_DRV_COMPAT instance's GPIO property at an index, with fallback.  More... | |
| #define | GPIO_DT_SPEC_INST_GET(inst, prop) GPIO_DT_SPEC_INST_GET_BY_IDX(inst, prop, 0) | 
| Equivalent to GPIO_DT_SPEC_INST_GET_BY_IDX(inst, prop, 0).  More... | |
| #define | GPIO_DT_SPEC_INST_GET_OR(inst, prop, default_value) GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, prop, 0, default_value) | 
| Equivalent to GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, prop, 0, default_value).  More... | |
| #define | GPIO_MAX_PINS_PER_PORT (sizeof(gpio_port_pins_t) * __CHAR_BIT__) | 
Maximum number of pins that are supported by gpio_port_pins_t.  More... | |
GPIO input/output configuration flags  | |
| #define | GPIO_INPUT (1U << 16) | 
| #define | GPIO_OUTPUT (1U << 17) | 
| #define | GPIO_DISCONNECTED 0 | 
| #define | GPIO_OUTPUT_LOW (GPIO_OUTPUT | GPIO_OUTPUT_INIT_LOW) | 
| #define | GPIO_OUTPUT_HIGH (GPIO_OUTPUT | GPIO_OUTPUT_INIT_HIGH) | 
| #define | GPIO_OUTPUT_INACTIVE | 
| #define | GPIO_OUTPUT_ACTIVE | 
GPIO interrupt configuration flags  | |
The   | |
| #define | GPIO_INT_DISABLE (1U << 21) | 
| #define | GPIO_INT_EDGE_RISING | 
| #define | GPIO_INT_EDGE_FALLING | 
| #define | GPIO_INT_EDGE_BOTH | 
| #define | GPIO_INT_LEVEL_LOW | 
| #define | GPIO_INT_LEVEL_HIGH | 
| #define | GPIO_INT_EDGE_TO_INACTIVE | 
| #define | GPIO_INT_EDGE_TO_ACTIVE | 
| #define | GPIO_INT_LEVEL_INACTIVE | 
| #define | GPIO_INT_LEVEL_ACTIVE | 
Typedefs | |
| typedef uint32_t | gpio_port_pins_t | 
| Identifies a set of pins associated with a port.  More... | |
| typedef uint32_t | gpio_port_value_t | 
| Provides values for a set of pins associated with a port.  More... | |
| typedef uint8_t | gpio_pin_t | 
| Provides a type to hold a GPIO pin index.  More... | |
| typedef uint16_t | gpio_dt_flags_t | 
| Provides a type to hold GPIO devicetree flags.  More... | |
| typedef uint32_t | gpio_flags_t | 
| Provides a type to hold GPIO configuration flags.  More... | |
| typedef void(* | gpio_callback_handler_t) (const struct device *port, struct gpio_callback *cb, gpio_port_pins_t pins) | 
| Define the application callback handler function signature.  More... | |
Functions | |
| static bool | gpio_is_ready_dt (const struct gpio_dt_spec *spec) | 
| Validate that GPIO port is ready.  More... | |
| int | gpio_pin_interrupt_configure (const struct device *port, gpio_pin_t pin, gpio_flags_t flags) | 
| Configure pin interrupt.  More... | |
| static int | gpio_pin_interrupt_configure_dt (const struct gpio_dt_spec *spec, gpio_flags_t flags) | 
Configure pin interrupts from a gpio_dt_spec.  More... | |
| int | gpio_pin_configure (const struct device *port, gpio_pin_t pin, gpio_flags_t flags) | 
| Configure a single pin.  More... | |
| static int | gpio_pin_configure_dt (const struct gpio_dt_spec *spec, gpio_flags_t extra_flags) | 
Configure a single pin from a gpio_dt_spec and some extra flags.  More... | |
| int | gpio_port_get_direction (const struct device *port, gpio_port_pins_t map, gpio_port_pins_t *inputs, gpio_port_pins_t *outputs) | 
| static int | gpio_pin_is_input (const struct device *port, gpio_pin_t pin) | 
Check if pin is configured for input.  More... | |
| static int | gpio_pin_is_input_dt (const struct gpio_dt_spec *spec) | 
Check if a single pin from gpio_dt_spec is configured for input.  More... | |
| static int | gpio_pin_is_output (const struct device *port, gpio_pin_t pin) | 
Check if pin is configured for output.  More... | |
| static int | gpio_pin_is_output_dt (const struct gpio_dt_spec *spec) | 
Check if a single pin from gpio_dt_spec is configured for output.  More... | |
| int | gpio_pin_get_config (const struct device *port, gpio_pin_t pin, gpio_flags_t *flags) | 
| Get a configuration of a single pin.  More... | |
| static int | gpio_pin_get_config_dt (const struct gpio_dt_spec *spec, gpio_flags_t *flags) | 
Get a configuration of a single pin from a gpio_dt_spec.  More... | |
| int | gpio_port_get_raw (const struct device *port, gpio_port_value_t *value) | 
| Get physical level of all input pins in a port.  More... | |
| static int | gpio_port_get (const struct device *port, gpio_port_value_t *value) | 
| Get logical level of all input pins in a port.  More... | |
| int | gpio_port_set_masked_raw (const struct device *port, gpio_port_pins_t mask, gpio_port_value_t value) | 
| Set physical level of output pins in a port.  More... | |
| static int | gpio_port_set_masked (const struct device *port, gpio_port_pins_t mask, gpio_port_value_t value) | 
| Set logical level of output pins in a port.  More... | |
| int | gpio_port_set_bits_raw (const struct device *port, gpio_port_pins_t pins) | 
| Set physical level of selected output pins to high.  More... | |
| static int | gpio_port_set_bits (const struct device *port, gpio_port_pins_t pins) | 
| Set logical level of selected output pins to active.  More... | |
| int | gpio_port_clear_bits_raw (const struct device *port, gpio_port_pins_t pins) | 
| Set physical level of selected output pins to low.  More... | |
| static int | gpio_port_clear_bits (const struct device *port, gpio_port_pins_t pins) | 
| Set logical level of selected output pins to inactive.  More... | |
| int | gpio_port_toggle_bits (const struct device *port, gpio_port_pins_t pins) | 
| Toggle level of selected output pins.  More... | |
| static int | gpio_port_set_clr_bits_raw (const struct device *port, gpio_port_pins_t set_pins, gpio_port_pins_t clear_pins) | 
| Set physical level of selected output pins.  More... | |
| static int | gpio_port_set_clr_bits (const struct device *port, gpio_port_pins_t set_pins, gpio_port_pins_t clear_pins) | 
| Set logical level of selected output pins.  More... | |
| static int | gpio_pin_get_raw (const struct device *port, gpio_pin_t pin) | 
| Get physical level of an input pin.  More... | |
| static int | gpio_pin_get (const struct device *port, gpio_pin_t pin) | 
| Get logical level of an input pin.  More... | |
| static int | gpio_pin_get_dt (const struct gpio_dt_spec *spec) | 
Get logical level of an input pin from a gpio_dt_spec.  More... | |
| static int | gpio_pin_set_raw (const struct device *port, gpio_pin_t pin, int value) | 
| Set physical level of an output pin.  More... | |
| static int | gpio_pin_set (const struct device *port, gpio_pin_t pin, int value) | 
| Set logical level of an output pin.  More... | |
| static int | gpio_pin_set_dt (const struct gpio_dt_spec *spec, int value) | 
Set logical level of a output pin from a gpio_dt_spec.  More... | |
| static int | gpio_pin_toggle (const struct device *port, gpio_pin_t pin) | 
| Toggle pin level.  More... | |
| static int | gpio_pin_toggle_dt (const struct gpio_dt_spec *spec) | 
Toggle pin level from a gpio_dt_spec.  More... | |
| static void | gpio_init_callback (struct gpio_callback *callback, gpio_callback_handler_t handler, gpio_port_pins_t pin_mask) | 
| Helper to initialize a struct gpio_callback properly.  More... | |
| static int | gpio_add_callback (const struct device *port, struct gpio_callback *callback) | 
| Add an application callback.  More... | |
| static int | gpio_remove_callback (const struct device *port, struct gpio_callback *callback) | 
| Remove an application callback.  More... | |
| int | gpio_get_pending_int (const struct device *dev) | 
| Function to get pending interrupts.  More... | |
Public APIs for GPIO drivers.