36#ifndef _DEV_I2C_GPIO_NXP_PCA9539_H
37#define _DEV_I2C_GPIO_NXP_PCA9539_H
55int i2c_dev_register_gpio_nxp_pca9535(
61#define GPIO_NXP_PCA9535_GET_INPUT (I2C_DEV_IO_CONTROL + 0)
63#define GPIO_NXP_PCA9535_GET_OUTPUT (I2C_DEV_IO_CONTROL + 1)
65#define GPIO_NXP_PCA9535_SET_OUTPUT (I2C_DEV_IO_CONTROL + 2)
67#define GPIO_NXP_PCA9535_CLEAR_AND_SET_OUTPUT (I2C_DEV_IO_CONTROL + 3)
69#define GPIO_NXP_PCA9535_GET_POL_INV (I2C_DEV_IO_CONTROL + 4)
71#define GPIO_NXP_PCA9535_SET_POL_INV (I2C_DEV_IO_CONTROL + 5)
73#define GPIO_NXP_PCA9535_GET_CONFIG (I2C_DEV_IO_CONTROL + 6)
75#define GPIO_NXP_PCA9535_SET_CONFIG (I2C_DEV_IO_CONTROL + 7)
77static inline int gpio_nxp_pca9535_get_input(
int fd, uint16_t *val)
79 return ioctl(fd, GPIO_NXP_PCA9535_GET_INPUT, val);
82static inline int gpio_nxp_pca9535_get_output(
int fd, uint16_t *val)
84 return ioctl(fd, GPIO_NXP_PCA9535_GET_OUTPUT, val);
87static inline int gpio_nxp_pca9535_set_output(
int fd, uint16_t val)
89 return ioctl(fd, GPIO_NXP_PCA9535_SET_OUTPUT, (
void *)(uintptr_t) val);
92static inline int gpio_nxp_pca9535_clear_and_set_output(
98 uint32_t clear_and_set = ((uint32_t) set << 16) | (uint32_t) clear;
102 GPIO_NXP_PCA9535_CLEAR_AND_SET_OUTPUT,
103 (
void *)(uintptr_t) clear_and_set
107static inline int gpio_nxp_pca9535_get_polarity_inversion(
112 return ioctl(fd, GPIO_NXP_PCA9535_GET_POL_INV, val);
115static inline int gpio_nxp_pca9535_set_polarity_inversion(
int fd, uint16_t val)
117 return ioctl(fd, GPIO_NXP_PCA9535_SET_POL_INV, (
void *)(uintptr_t) val);
120static inline int gpio_nxp_pca9535_get_config(
int fd, uint16_t *val)
122 return ioctl(fd, GPIO_NXP_PCA9535_GET_CONFIG, val);
125static inline int gpio_nxp_pca9535_set_config(
int fd, uint16_t val)
127 return ioctl(fd, GPIO_NXP_PCA9535_SET_CONFIG, (
void *)(uintptr_t) val);
Inter-Integrated Circuit (I2C) Driver API.