Bridle API 4.1.99
A Zephyr based application framework
Loading...
Searching...
No Matches
gpio_pca9555_regrst.c File Reference

Driver for an PCA9555 I2C-based GPIO controller (w/regrst) More...

#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/init.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/sys/util.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/gpio/gpio_utils.h>
#include <zephyr/logging/log.h>

Data Structures

struct  gpio_pca9555_regrst_config
 Configuration data. More...
 
struct  gpio_pca9555_regrst_drv_data
 Runtime driver data. More...
 

Macros

#define DT_DRV_COMPAT   nxp_pca9555_regrst
 
#define LOG_LEVEL   CONFIG_GPIO_LOG_LEVEL
 
#define REG_INPUT_PORT0   0x00
 
#define REG_INPUT_PORT1   0x01
 
#define REG_OUTPUT_PORT0   0x02
 
#define REG_OUTPUT_PORT1   0x03
 
#define REG_OUTPUT_DFLT   0xFFFF
 
#define REG_POL_INV_PORT0   0x04
 
#define REG_POL_INV_PORT1   0x05
 
#define REG_POL_INV_DFLT   0x0000
 
#define REG_CONF_PORT0   0x06
 
#define REG_CONG_PORT1   0x07
 
#define REG_CONG_DFLT   0xFFFF
 
#define PCA_HAS_INTERRUPT   BIT(1)
 
#define PCA_HAS_RST_DFLTS   BIT(7)
 
#define GPIO_PCA9555_REGRST_DEVICE_INSTANCE(inst)
 

Functions

 LOG_MODULE_REGISTER (gpio_pca9555_regrst)
 
static int read_port_regs (const struct device *dev, uint8_t reg, uint16_t *cache, uint16_t *buf)
 Read both port 0 and port 1 registers of certain register function.
 
static int write_port_regs (const struct device *dev, uint8_t reg, uint16_t *cache, uint16_t value)
 Write both port 0 and port 1 registers of certain register function.
 
static int update_input_regs (const struct device *dev, uint16_t *buf)
 
static int update_output_regs (const struct device *dev, uint16_t value)
 
static int update_direction_regs (const struct device *dev, uint16_t value)
 
static int setup_pin_dir (const struct device *dev, uint32_t pin, int flags)
 Setup the pin direction (input or output)
 
static int gpio_pca9555_regrst_config (const struct device *dev, gpio_pin_t pin, gpio_flags_t flags)
 Configure pin or port.
 
static int gpio_pca9555_regrst_port_get_raw (const struct device *dev, uint32_t *value)
 
static int gpio_pca9555_regrst_port_set_masked_raw (const struct device *dev, uint32_t mask, uint32_t value)
 
static int gpio_pca9555_regrst_port_set_bits_raw (const struct device *dev, uint32_t mask)
 
static int gpio_pca9555_regrst_port_clear_bits_raw (const struct device *dev, uint32_t mask)
 
static int gpio_pca9555_regrst_port_toggle_bits (const struct device *dev, uint32_t mask)
 
static int gpio_pca9555_regrst_pin_interrupt_configure (const struct device *dev, gpio_pin_t pin, enum gpio_int_mode mode, enum gpio_int_trig trig)
 
static int gpio_pca9555_regrst_reset_defaults (const struct device *dev)
 Reset defaults function of PCA9555.
 
static int gpio_pca9555_regrst_init (const struct device *dev)
 Initialization function of PCA9555.
 

Variables

static const struct gpio_driver_api gpio_pca9555_regrst_drv_api_funcs
 

Detailed Description

Driver for an PCA9555 I2C-based GPIO controller (w/regrst)

Macro Definition Documentation

◆ DT_DRV_COMPAT

#define DT_DRV_COMPAT   nxp_pca9555_regrst

◆ LOG_LEVEL

#define LOG_LEVEL   CONFIG_GPIO_LOG_LEVEL

Function Documentation

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( gpio_pca9555_regrst  )