23 #ifndef _DEV_I2C_GPIO_NXP_PCA9539_H 24 #define _DEV_I2C_GPIO_NXP_PCA9539_H 42 int i2c_dev_register_gpio_nxp_pca9535(
48 #define GPIO_NXP_PCA9535_GET_INPUT (I2C_DEV_IO_CONTROL + 0) 50 #define GPIO_NXP_PCA9535_GET_OUTPUT (I2C_DEV_IO_CONTROL + 1) 52 #define GPIO_NXP_PCA9535_SET_OUTPUT (I2C_DEV_IO_CONTROL + 2) 54 #define GPIO_NXP_PCA9535_CLEAR_AND_SET_OUTPUT (I2C_DEV_IO_CONTROL + 3) 56 #define GPIO_NXP_PCA9535_GET_POL_INV (I2C_DEV_IO_CONTROL + 4) 58 #define GPIO_NXP_PCA9535_SET_POL_INV (I2C_DEV_IO_CONTROL + 5) 60 #define GPIO_NXP_PCA9535_GET_CONFIG (I2C_DEV_IO_CONTROL + 6) 62 #define GPIO_NXP_PCA9535_SET_CONFIG (I2C_DEV_IO_CONTROL + 7) 64 static inline int gpio_nxp_pca9535_get_input(
int fd, uint16_t *val)
66 return ioctl(fd, GPIO_NXP_PCA9535_GET_INPUT, val);
69 static inline int gpio_nxp_pca9535_get_output(
int fd, uint16_t *val)
71 return ioctl(fd, GPIO_NXP_PCA9535_GET_OUTPUT, val);
74 static inline int gpio_nxp_pca9535_set_output(
int fd, uint16_t val)
76 return ioctl(fd, GPIO_NXP_PCA9535_SET_OUTPUT, (
void *)(uintptr_t) val);
79 static inline int gpio_nxp_pca9535_clear_and_set_output(
85 uint32_t clear_and_set = ((uint32_t)
set << 16) | (uint32_t) clear;
89 GPIO_NXP_PCA9535_CLEAR_AND_SET_OUTPUT,
90 (
void *)(uintptr_t) clear_and_set
94 static inline int gpio_nxp_pca9535_get_polarity_inversion(
99 return ioctl(fd, GPIO_NXP_PCA9535_GET_POL_INV, val);
102 static inline int gpio_nxp_pca9535_set_polarity_inversion(
int fd, uint16_t val)
104 return ioctl(fd, GPIO_NXP_PCA9535_SET_POL_INV, (
void *)(uintptr_t) val);
107 static inline int gpio_nxp_pca9535_get_config(
int fd, uint16_t *val)
109 return ioctl(fd, GPIO_NXP_PCA9535_GET_CONFIG, val);
112 static inline int gpio_nxp_pca9535_set_config(
int fd, uint16_t val)
114 return ioctl(fd, GPIO_NXP_PCA9535_SET_CONFIG, (
void *)(uintptr_t) val);
Inter-Integrated Circuit (I2C) Driver API.