I2C bus upgrade (#432)
This commit is contained in:
parent
d100f42b1f
commit
b83c2629b9
56 changed files with 909 additions and 804 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <i2c/i2c.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
@ -19,7 +20,7 @@ extern "C"
|
|||
* \param addr I2C register address (0b0100<A2><A1><A0> for PCF8574)
|
||||
* \return 8-bit GPIO port value
|
||||
*/
|
||||
uint8_t pcf8574_port_read(uint8_t addr);
|
||||
uint8_t pcf8574_port_read(i2c_dev_t* dev);
|
||||
|
||||
/**
|
||||
* \brief Continiously read GPIO port values to buffer
|
||||
|
@ -28,14 +29,14 @@ uint8_t pcf8574_port_read(uint8_t addr);
|
|||
* @param len Buffer length
|
||||
* @return Number of bytes read
|
||||
*/
|
||||
size_t pcf8574_port_read_buf(uint8_t addr, void *buf, size_t len);
|
||||
size_t pcf8574_port_read_buf(i2c_dev_t* dev, void *buf, size_t len);
|
||||
|
||||
/**
|
||||
* \brief Write value to GPIO port
|
||||
* \param addr I2C register address (0b0100<A2><A1><A0> for PCF8574)
|
||||
* \param value GPIO port value
|
||||
*/
|
||||
void pcf8574_port_write(uint8_t addr, uint8_t value);
|
||||
void pcf8574_port_write(const i2c_dev_t* dev, uint8_t value);
|
||||
|
||||
/**
|
||||
* \brief Continiously write GPIO values to GPIO port
|
||||
|
@ -44,7 +45,7 @@ void pcf8574_port_write(uint8_t addr, uint8_t value);
|
|||
* @param len Buffer length
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
size_t pcf8574_port_write_buf(uint8_t addr, void *buf, size_t len);
|
||||
size_t pcf8574_port_write_buf(const i2c_dev_t* dev, void *buf, size_t len);
|
||||
|
||||
/**
|
||||
* \brief Read input value of a GPIO pin
|
||||
|
@ -52,7 +53,7 @@ size_t pcf8574_port_write_buf(uint8_t addr, void *buf, size_t len);
|
|||
* \param num pin number (0..7)
|
||||
* \return GPIO pin value
|
||||
*/
|
||||
bool pcf8574_gpio_read(uint8_t addr, uint8_t num);
|
||||
bool pcf8574_gpio_read(i2c_dev_t* dev, uint8_t num);
|
||||
|
||||
/**
|
||||
* \brief Set GPIO pin output
|
||||
|
@ -62,7 +63,7 @@ bool pcf8574_gpio_read(uint8_t addr, uint8_t num);
|
|||
* \param num pin number (0..7)
|
||||
* \param value true for high level
|
||||
*/
|
||||
void pcf8574_gpio_write(uint8_t addr, uint8_t num, bool value);
|
||||
void pcf8574_gpio_write(i2c_dev_t* dev, uint8_t num, bool value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue