Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
GPIO Driver Backend API

Data Structures

struct  gpio_driver_api
  Driver Operations GPIO driver operations More...

Typedefs

typedef int(* gpio_api_pin_configure_t) (const struct device *port, gpio_pin_t pin, gpio_flags_t flags)
 Callback API to configure a single pin.
typedef int(* gpio_api_pin_get_config_t) (const struct device *port, gpio_pin_t pin, gpio_flags_t *flags)
 Callback API to get the configuration of a single pin.
typedef int(* gpio_api_port_get_raw_t) (const struct device *port, gpio_port_value_t *value)
 Callback API to get the physical level of all input pins in a port.
typedef int(* gpio_api_port_set_masked_raw_t) (const struct device *port, gpio_port_pins_t mask, gpio_port_value_t value)
 Callback API to set the physical level of selected output pins in a port.
typedef int(* gpio_api_port_set_bits_raw_t) (const struct device *port, gpio_port_pins_t pins)
 Callback API to set the physical level of selected output pins to high.
typedef int(* gpio_api_port_clear_bits_raw_t) (const struct device *port, gpio_port_pins_t pins)
 Callback API to set the physical level of selected output pins to low.
typedef int(* gpio_api_port_toggle_bits_t) (const struct device *port, gpio_port_pins_t pins)
 Callback API to toggle the level of selected output pins.
typedef int(* gpio_api_pin_interrupt_configure_t) (const struct device *port, gpio_pin_t pin, enum gpio_int_mode mode, enum gpio_int_trig trig)
 Callback API to configure a pin interrupt.
typedef int(* gpio_api_manage_callback_t) (const struct device *port, struct gpio_callback *cb, bool set)
 Callback API to add or remove an application callback.
typedef uint32_t(* gpio_api_get_pending_int_t) (const struct device *dev)
 Callback API to get pending interrupts.
typedef int(* gpio_api_port_get_direction_t) (const struct device *port, gpio_port_pins_t map, gpio_port_pins_t *inputs, gpio_port_pins_t *outputs)
 Callback API to get the direction of selected pins in a port.

Enumerations

enum  gpio_int_mode {
  GPIO_INT_MODE_DISABLED = BIT(21) , GPIO_INT_MODE_LEVEL = GPIO_INT_ENABLE , GPIO_INT_MODE_EDGE = GPIO_INT_ENABLE | GPIO_INT_EDGE , GPIO_INT_MODE_DISABLE_ONLY = BIT(21) | GPIO_INT_ENABLE_DISABLE_ONLY ,
  GPIO_INT_MODE_ENABLE_ONLY = GPIO_INT_ENABLE | GPIO_INT_ENABLE_DISABLE_ONLY
}
 Interrupt modes for the pin_interrupt_configure driver operation. More...
enum  gpio_int_trig {
  GPIO_INT_TRIG_LOW = GPIO_INT_LOW_0 , GPIO_INT_TRIG_HIGH = GPIO_INT_HIGH_1 , GPIO_INT_TRIG_BOTH = GPIO_INT_LOW_0 | GPIO_INT_HIGH_1 , GPIO_INT_TRIG_WAKE = GPIO_INT_WAKEUP ,
  GPIO_INT_TRIG_WAKE_LOW = GPIO_INT_LOW_0 | GPIO_INT_WAKEUP , GPIO_INT_TRIG_WAKE_HIGH = GPIO_INT_HIGH_1 | GPIO_INT_WAKEUP , GPIO_INT_TRIG_WAKE_BOTH = GPIO_INT_LOW_0 | GPIO_INT_HIGH_1 | GPIO_INT_WAKEUP
}
 Interrupt triggers for the pin_interrupt_configure driver operation. More...

Detailed Description

This group contains the API type definitions, callback signatures, and other helpers required to implement a GPIO driver.

Typedef Documentation

◆ gpio_api_get_pending_int_t

typedef uint32_t(* gpio_api_get_pending_int_t) (const struct device *dev)

#include <zephyr/drivers/gpio.h>

Callback API to get pending interrupts.

See gpio_get_pending_int() for argument description.

◆ gpio_api_manage_callback_t

typedef int(* gpio_api_manage_callback_t) (const struct device *port, struct gpio_callback *cb, bool set)

#include <zephyr/drivers/gpio.h>

Callback API to add or remove an application callback.

See gpio_add_callback() and gpio_remove_callback() for argument description.

◆ gpio_api_pin_configure_t

typedef int(* gpio_api_pin_configure_t) (const struct device *port, gpio_pin_t pin, gpio_flags_t flags)

#include <zephyr/drivers/gpio.h>

Callback API to configure a single pin.

See gpio_pin_configure() for argument description.

◆ gpio_api_pin_get_config_t

typedef int(* gpio_api_pin_get_config_t) (const struct device *port, gpio_pin_t pin, gpio_flags_t *flags)

#include <zephyr/drivers/gpio.h>

Callback API to get the configuration of a single pin.

See gpio_pin_get_config() for argument description.

◆ gpio_api_pin_interrupt_configure_t

typedef int(* gpio_api_pin_interrupt_configure_t) (const struct device *port, gpio_pin_t pin, enum gpio_int_mode mode, enum gpio_int_trig trig)

#include <zephyr/drivers/gpio.h>

Callback API to configure a pin interrupt.

See gpio_pin_interrupt_configure() for argument description, noting that the public GPIO_INT_* flags are decomposed into mode and trig before being passed to the driver.

◆ gpio_api_port_clear_bits_raw_t

typedef int(* gpio_api_port_clear_bits_raw_t) (const struct device *port, gpio_port_pins_t pins)

#include <zephyr/drivers/gpio.h>

Callback API to set the physical level of selected output pins to low.

See gpio_port_clear_bits_raw() for argument description.

◆ gpio_api_port_get_direction_t

typedef int(* gpio_api_port_get_direction_t) (const struct device *port, gpio_port_pins_t map, gpio_port_pins_t *inputs, gpio_port_pins_t *outputs)

#include <zephyr/drivers/gpio.h>

Callback API to get the direction of selected pins in a port.

See gpio_port_get_direction() for argument description.

◆ gpio_api_port_get_raw_t

typedef int(* gpio_api_port_get_raw_t) (const struct device *port, gpio_port_value_t *value)

#include <zephyr/drivers/gpio.h>

Callback API to get the physical level of all input pins in a port.

See gpio_port_get_raw() for argument description.

◆ gpio_api_port_set_bits_raw_t

typedef int(* gpio_api_port_set_bits_raw_t) (const struct device *port, gpio_port_pins_t pins)

#include <zephyr/drivers/gpio.h>

Callback API to set the physical level of selected output pins to high.

See gpio_port_set_bits_raw() for argument description.

◆ gpio_api_port_set_masked_raw_t

typedef int(* gpio_api_port_set_masked_raw_t) (const struct device *port, gpio_port_pins_t mask, gpio_port_value_t value)

#include <zephyr/drivers/gpio.h>

Callback API to set the physical level of selected output pins in a port.

See gpio_port_set_masked_raw() for argument description.

◆ gpio_api_port_toggle_bits_t

typedef int(* gpio_api_port_toggle_bits_t) (const struct device *port, gpio_port_pins_t pins)

#include <zephyr/drivers/gpio.h>

Callback API to toggle the level of selected output pins.

See gpio_port_toggle_bits() for argument description.

Enumeration Type Documentation

◆ gpio_int_mode

#include <zephyr/drivers/gpio.h>

Interrupt modes for the pin_interrupt_configure driver operation.

Used by driver api function pin_interrupt_configure, these are defined in terms of the public flags so we can just mask and pass them through to the driver api.

Enumerator
GPIO_INT_MODE_DISABLED 

Disable pin interrupt.

GPIO_INT_MODE_LEVEL 

Enable level-triggered pin interrupt.

GPIO_INT_MODE_EDGE 

Enable edge-triggered pin interrupt.

GPIO_INT_MODE_DISABLE_ONLY 

Disable a previously configured pin interrupt without deconfiguring it.

Attention
Available only when the following Kconfig option is enabled: CONFIG_GPIO_ENABLE_DISABLE_INTERRUPT.
GPIO_INT_MODE_ENABLE_ONLY 

Re-enable a previously configured pin interrupt.

Attention
Available only when the following Kconfig option is enabled: CONFIG_GPIO_ENABLE_DISABLE_INTERRUPT.

◆ gpio_int_trig

#include <zephyr/drivers/gpio.h>

Interrupt triggers for the pin_interrupt_configure driver operation.

Enumerator
GPIO_INT_TRIG_LOW 

Trigger detection when input state is (or transitions to) physical low.

(Edge Falling or Active Low)

GPIO_INT_TRIG_HIGH 

Trigger detection when input state is (or transitions to) physical high.

(Edge Rising or Active High)

GPIO_INT_TRIG_BOTH 

Trigger detection on pin rising or falling edge.

GPIO_INT_TRIG_WAKE 

Trigger a system wakeup.

GPIO_INT_TRIG_WAKE_LOW 

Trigger a system wakeup when input state is (or transitions to) physical low.

(Edge Falling or Active Low)

GPIO_INT_TRIG_WAKE_HIGH 

Trigger a system wakeup when input state is (or transitions to) physical high.

(Edge Rising or Active High)

GPIO_INT_TRIG_WAKE_BOTH 

Trigger a system wakeup on pin rising or falling edge.