PCA95XX is a series of compatible I2C-based GPIO expanders, with common registers on input/output, polarity and configuration. This renames the original PCAL9535A driver to PCA95XX to indicate that it can support this series. Additional features on variants are guarded by kconfigs. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
61 lines
1.1 KiB
C
61 lines
1.1 KiB
C
/*
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @file Header file for the PCA95XX driver.
|
|
*/
|
|
|
|
#ifndef ZEPHYR_DRIVERS_GPIO_GPIO_PCA95XX_H_
|
|
#define ZEPHYR_DRIVERS_GPIO_GPIO_PCA95XX_H_
|
|
|
|
#include <kernel.h>
|
|
|
|
#include <drivers/gpio.h>
|
|
#include <drivers/i2c.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** Configuration data */
|
|
struct gpio_pca95xx_config {
|
|
/** The master I2C device's name */
|
|
const char * const i2c_master_dev_name;
|
|
|
|
/** The slave address of the chip */
|
|
u16_t i2c_slave_addr;
|
|
|
|
u8_t capabilities;
|
|
};
|
|
|
|
/** Store the port 0/1 data for each register pair. */
|
|
union gpio_pca95xx_port_data {
|
|
u16_t all;
|
|
u8_t port[2];
|
|
u8_t byte[2];
|
|
};
|
|
|
|
/** Runtime driver data */
|
|
struct gpio_pca95xx_drv_data {
|
|
/* gpio_driver_data needs to be first */
|
|
struct gpio_driver_data common;
|
|
|
|
/** Master I2C device */
|
|
struct device *i2c_master;
|
|
|
|
struct {
|
|
union gpio_pca95xx_port_data output;
|
|
union gpio_pca95xx_port_data dir;
|
|
union gpio_pca95xx_port_data pud_en;
|
|
union gpio_pca95xx_port_data pud_sel;
|
|
} reg_cache;
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ZEPHYR_DRIVERS_GPIO_GPIO_PCA95XX_H_ */
|