Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Emulated GPIO backend API. More...

Functions

int gpio_emul_input_set_masked (const struct device *port, gpio_port_pins_t pins, gpio_port_value_t values)
 Modify the values of one or more emulated GPIO input pins.
 
static int gpio_emul_input_set (const struct device *port, gpio_pin_t pin, int value)
 Modify the value of one emulated GPIO input pin.
 
int gpio_emul_output_get_masked (const struct device *port, gpio_port_pins_t pins, gpio_port_value_t *values)
 Read the value of one or more emulated GPIO output pins.
 
static int gpio_emul_output_get (const struct device *port, gpio_pin_t pin)
 Read the value of one emulated GPIO output pin.
 
int gpio_emul_flags_get (const struct device *port, gpio_pin_t pin, gpio_flags_t *flags)
 Get flags for a given emulated GPIO pin.
 

Detailed Description

Emulated GPIO backend API.

Behaviour of emulated GPIO is application-defined. As-such, each application may

An example of an appropriate Device Tree overlay file is in tests/drivers/gpio/gpio_basic_api/boards/native_sim.overlay.

An example of registering a callback to emulate "wiring" as well as an example of calling gpio_emul_input_set is in the file tests/drivers/gpio/gpio_basic_api/src/main.c .

Function Documentation

◆ gpio_emul_flags_get()

int gpio_emul_flags_get ( const struct device port,
gpio_pin_t  pin,
gpio_flags_t flags 
)

#include <include/zephyr/drivers/gpio/gpio_emul.h>

Get flags for a given emulated GPIO pin.

For more information on available flags, see GPIO Driver APIs.

Parameters
portThe emulated GPIO port
pinThe pin to retrieve flags for
flagsa pointer to where the flags for pin will be stored
Returns
0 on success
-EINVAL if an invalid argument is provided

◆ gpio_emul_input_set()

static int gpio_emul_input_set ( const struct device port,
gpio_pin_t  pin,
int  value 
)
inlinestatic

#include <include/zephyr/drivers/gpio/gpio_emul.h>

Modify the value of one emulated GPIO input pin.

Parameters
portThe emulated GPIO port
pinThe pin to modify
valueNew values to assign to pin
Returns
0 on success
-EINVAL if an invalid argument is provided

◆ gpio_emul_input_set_masked()

int gpio_emul_input_set_masked ( const struct device port,
gpio_port_pins_t  pins,
gpio_port_value_t  values 
)

#include <include/zephyr/drivers/gpio/gpio_emul.h>

Modify the values of one or more emulated GPIO input pins.

Parameters
portThe emulated GPIO port
pinsThe mask of pins that have changed
valuesNew values to assign to pins
Returns
0 on success
-EINVAL if an invalid argument is provided

◆ gpio_emul_output_get()

static int gpio_emul_output_get ( const struct device port,
gpio_pin_t  pin 
)
inlinestatic

#include <include/zephyr/drivers/gpio/gpio_emul.h>

Read the value of one emulated GPIO output pin.

Parameters
portThe emulated GPIO port
pinThe pin to read
Returns
0 or 1 on success
-EINVAL if an invalid argument is provided

◆ gpio_emul_output_get_masked()

int gpio_emul_output_get_masked ( const struct device port,
gpio_port_pins_t  pins,
gpio_port_value_t values 
)

#include <include/zephyr/drivers/gpio/gpio_emul.h>

Read the value of one or more emulated GPIO output pins.

Parameters
portThe emulated GPIO port
pinsThe mask of pins that have changed
valuesA pointer to where the value of pins will be stored
Returns
0 on success
-EINVAL if an invalid argument is provided