Paparazzi UAS
v5.15_devel-230-gc96ce27
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 | pca95x4 |
PCA95X4 structure. More... | |
Macros | |
#define | PCA95X4_DEFAULT_ADDRESS 0x40 |
#define | PCA95X4_INPUT_REG (0x00) |
#define | PCA95X4_OUTPUT_REG (0x01) |
#define | PCA95X4_POL_REG (0x02) |
#define | PCA95X4_CONFIG_REG (0x03) |
#define | PCA95X4_P0 (1 << 0) |
#define | PCA95X4_P1 (1 << 1) |
#define | PCA95X4_P2 (1 << 2) |
#define | PCA95X4_P3 (1 << 3) |
#define | PCA95X4_P4 (1 << 4) |
#define | PCA95X4_P5 (1 << 5) |
#define | PCA95X4_P6 (1 << 6) |
#define | PCA95X4_P7 (1 << 7) |
#define | PCA95X4_CLEAR_ALL 0x00 |
Functions | |
void | pca95x4_init (struct pca95x4 *dev, struct i2c_periph *i2c_p, uint8_t addr) |
Init PCA95X4. More... | |
bool | pca95x4_configure (struct pca95x4 *dev, uint8_t val, bool blocking) |
Configure PCA95X4. More... | |
bool | pca95x4_set_output (struct pca95x4 *dev, uint8_t mask, bool blocking) |
Set output value. More... | |
Driver for the 8-bit I/O expander based on i2c.
Definition in file pca95x4.h.
struct pca95x4 |
Data Fields | ||
---|---|---|
struct i2c_periph * | i2c_p | |
struct i2c_transaction | i2c_trans |
#define PCA95X4_CONFIG_REG (0x03) |
Definition at line 38 of file pca95x4.h.
Referenced by pca95x4_configure().
#define PCA95X4_DEFAULT_ADDRESS 0x40 |
Definition at line 33 of file pca95x4.h.
Referenced by multi_ranger_init().
#define PCA95X4_OUTPUT_REG (0x01) |
Definition at line 36 of file pca95x4.h.
Referenced by pca95x4_set_output().
Configure PCA95X4.
[in] | dev | address to pca95x4 device |
[in] | val | value to write to confi register |
[in] | blocking | true for blocking i2c transaction |
Definition at line 42 of file pca95x4.c.
References i2c_transaction::buf, i2c_blocking_transmit(), pca95x4::i2c_p, pca95x4::i2c_trans, i2c_transmit(), I2CTransDone, I2CTransFailed, I2CTransSuccess, PCA95X4_CONFIG_REG, i2c_transaction::slave_addr, i2c_transaction::status, and val.
Referenced by multi_ranger_init(), and multi_ranger_periodic().
void pca95x4_init | ( | struct pca95x4 * | dev, |
struct i2c_periph * | i2c_p, | ||
uint8_t | addr | ||
) |
Init PCA95X4.
[in] | dev | address to pca95x4 device |
[in] | i2c_p | addres of i2c bus |
[in] | addr | i2c address |
Definition at line 30 of file pca95x4.c.
References pca95x4::i2c_p, pca95x4::i2c_trans, I2CTransDone, i2c_transaction::slave_addr, and i2c_transaction::status.
Referenced by multi_ranger_init().
Set output value.
[in] | dev | address to pca95x4 device |
[in] | mask | output pins to set |
[in] | blocking | true for blocking i2c transaction |
Definition at line 60 of file pca95x4.c.
References i2c_transaction::buf, i2c_blocking_transmit(), pca95x4::i2c_p, pca95x4::i2c_trans, i2c_transmit(), I2CTransDone, I2CTransFailed, I2CTransSuccess, PCA95X4_OUTPUT_REG, i2c_transaction::slave_addr, and i2c_transaction::status.
Referenced by multi_ranger_init(), and multi_ranger_periodic().