X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fpcf8574.h;h=dd33ed4aef0a92afde518ca8b41df857ed4b1ef5;hb=024bf80e5f29e4de00d0813d23a4d3b67245ead7;hp=fa327e28deb6d7e4b033b03965e64beb8861203a;hpb=e2238a91f56b0d4f79b39e51b2823f555f0ad7e6;p=bertos.git diff --git a/bertos/drv/pcf8574.h b/bertos/drv/pcf8574.h index fa327e28..dd33ed4a 100644 --- a/bertos/drv/pcf8574.h +++ b/bertos/drv/pcf8574.h @@ -41,6 +41,8 @@ #ifndef DRV_PCF8574_H #define DRV_PCF8574_H +#include "cfg/cfg_i2c.h" + #include #include @@ -67,13 +69,40 @@ typedef struct Pcf8574 #define PCF8574ID 0x40 ///< I2C address -DEPRECATED int pcf8574_get_1(Pcf8574 *pcf); -DEPRECATED bool pcf8574_put_2(Pcf8574 *pcf, uint8_t data); -DEPRECATED bool pcf8574_init_2(Pcf8574 *pcf, pcf8574_addr addr); - - +/** + * Read PCF8574 \a pcf bit status. + * \return the pins status or EOF on errors. + */ int pcf8574_get_2(I2c *i2c, Pcf8574 *pcf); + +/** + * Write to PCF8574 \a pcf port \a data. + * \return true if ok, false on errors. + */ bool pcf8574_put_3(I2c *i2c, Pcf8574 *pcf, uint8_t data); + +/** + * Init a PCF8574 on the bus with addr \a addr. + * \return true if device is found, false otherwise. + */ bool pcf8574_init_3(I2c *i2c, Pcf8574 *pcf, pcf8574_addr addr); +#if !CONFIG_I2C_DISABLE_OLD_API + +DEPRECATED INLINE int pcf8574_get_1(Pcf8574 *pcf) +{ + return pcf8574_get_2(&local_i2c_old_api, pcf); +} + +DEPRECATED INLINE bool pcf8574_put_2(Pcf8574 *pcf, uint8_t data) +{ + return pcf8574_put_3(&local_i2c_old_api, pcf, data); +} + +DEPRECATED INLINE bool pcf8574_init_2(Pcf8574 *pcf, pcf8574_addr addr) +{ + return pcf8574_init_3(&local_i2c_old_api, pcf, addr); +} +#endif /* !CONFIG_I2C_DISABLE_OLD_API */ + #endif /* DRV_PCF8574_H */