Zephyr Project API 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
gpio_utils.h File Reference

Header file for GPIO utility functions. More...

#include <stdbool.h>
#include <stdint.h>
#include <errno.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/sys/slist.h>
#include <zephyr/tracing/tracing.h>

Go to the source code of this file.

Macros

#define GPIO_PORT_PIN_MASK_FROM_NGPIOS(ngpios)    ((gpio_port_pins_t)(((uint64_t)1 << (ngpios)) - 1U))
 Makes a bitmask of allowed GPIOs from a number of GPIOs.
 
#define GPIO_PORT_PIN_MASK_FROM_DT_NODE(node_id)    GPIO_DT_PORT_PIN_MASK_NGPIOS_EXC(node_id, DT_PROP(node_id, ngpios))
 Makes a bitmask of allowed GPIOs from the "gpio-reserved-ranges" and "ngpios" DT properties values.
 
#define GPIO_PORT_PIN_MASK_FROM_DT_INST(inst)    GPIO_PORT_PIN_MASK_FROM_DT_NODE(DT_DRV_INST(inst))
 Make a bitmask of allowed GPIOs from a DT_DRV_COMPAT instance's GPIO "gpio-reserved-ranges" and "ngpios" DT properties values.
 

Functions

static int gpio_manage_callback (sys_slist_t *callbacks, struct gpio_callback *callback, bool set)
 Generic function to insert or remove a callback from a callback list.
 
static void gpio_fire_callbacks (sys_slist_t *list, const struct device *port, uint32_t pins)
 Generic function to go through and fire callback from a callback list.
 

Detailed Description

Header file for GPIO utility functions.