Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the 8-bit I/O expander based on i2c. More...
Go to the source code of this file.
Data Structures | |
struct | pca95xx |
PCA95XX structure. More... | |
Macros | |
#define | PCA95XX_DEFAULT_ADDRESS 0x40 |
#define | PCA95XX_INPUT_REG (0x00) |
#define | PCA95XX_OUTPUT_REG (0x01) |
#define | PCA95XX_POL_REG (0x02) |
#define | PCA95XX_CONFIG_REG (0x03) |
#define | PCA95XX_P0 (1 << 0) |
#define | PCA95XX_P1 (1 << 1) |
#define | PCA95XX_P2 (1 << 2) |
#define | PCA95XX_P3 (1 << 3) |
#define | PCA95XX_P4 (1 << 4) |
#define | PCA95XX_P5 (1 << 5) |
#define | PCA95XX_P6 (1 << 6) |
#define | PCA95XX_P7 (1 << 7) |
#define | PCA95XX_CLEAR_ALL 0x00 |
Functions | |
void | pca95xx_init (struct pca95xx *dev, struct i2c_periph *i2c_p, uint8_t addr) |
Init PCA95XX. More... | |
bool | pca95xx_configure (struct pca95xx *dev, uint8_t val, bool blocking) |
Configure PCA95XX. More... | |
bool | pca95xx_set_output (struct pca95xx *dev, uint8_t mask, bool blocking) |
Set output value. More... | |
bool | pca95xx_get_input (struct pca95xx *dev, uint8_t mask, uint8_t *result) |
Get input value. More... | |
Driver for the 8-bit I/O expander based on i2c.
Definition in file pca95xx.h.
struct pca95xx |
Data Fields | ||
---|---|---|
struct i2c_periph * | i2c_p | |
struct i2c_transaction | i2c_trans |
Configure PCA95XX.
[in] | dev | address to pca95xx device |
[in] | val | value to write to confi register |
[in] | blocking | true for blocking i2c transaction |
Definition at line 42 of file pca95xx.c.
References blocking, dev, i2c_blocking_transmit(), i2c_transmit(), I2CTransDone, I2CTransFailed, I2CTransSuccess, PCA95XX_CONFIG_REG, and val.
Referenced by gpio_ext_pca95xx_lazy_init(), gpio_ext_pca95xx_setup_input(), gpio_ext_pca95xx_setup_output(), multi_ranger_init(), and multi_ranger_periodic().
Get input value.
[in] | dev | address to pca95xx device |
[in] | mask | input pins |
[out] | input | register with mask applied Note: always blocking |
Definition at line 78 of file pca95xx.c.
References dev, i2c_blocking_transceive(), I2CTransDone, I2CTransFailed, I2CTransSuccess, and PCA95XX_INPUT_REG.
Referenced by gpio_ext_pca95xx_get().
void pca95xx_init | ( | struct pca95xx * | dev, |
struct i2c_periph * | i2c_p, | ||
uint8_t | addr | ||
) |
Init PCA95XX.
[in] | dev | address to pca95xx device |
[in] | i2c_p | addres of i2c bus |
[in] | addr | i2c address |
Definition at line 30 of file pca95xx.c.
References dev, and I2CTransDone.
Referenced by gpio_ext_pca95xx_lazy_init(), and multi_ranger_init().
Set output value.
[in] | dev | address to pca95xx device |
[in] | mask | output pins to set |
[in] | blocking | true for blocking i2c transaction |
Definition at line 60 of file pca95xx.c.
References blocking, dev, i2c_blocking_transmit(), i2c_transmit(), I2CTransDone, I2CTransFailed, I2CTransSuccess, and PCA95XX_OUTPUT_REG.
Referenced by gpio_ext_pca95xx_clear(), gpio_ext_pca95xx_set(), multi_ranger_init(), and multi_ranger_periodic().