X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fpcf8574.h;h=bf2f8e5ea5df254da2a4bbda9d3f343f2790695e;hb=39184f9b190fdcfec2f17aad6f0de8b2edf04a02;hp=0eab5c3966ed89634d33c95941aa55bd71fac062;hpb=37efb5bdc0504ab6df2e8db0635c9c6f7477e23e;p=bertos.git diff --git a/bertos/drv/pcf8574.h b/bertos/drv/pcf8574.h index 0eab5c39..bf2f8e5e 100644 --- a/bertos/drv/pcf8574.h +++ b/bertos/drv/pcf8574.h @@ -32,7 +32,6 @@ * * \brief PCF8574 i2c port expander driver. * - * \version $Id: ft245rl.c 22301 2008-09-09 16:53:17Z batt $ * \author Francesco Sacchi * * $WIZ$ module_name = "pcf8574" @@ -42,8 +41,22 @@ #ifndef DRV_PCF8574_H #define DRV_PCF8574_H +#include "cfg/cfg_i2c.h" + #include +#include + +#if COMPILER_C99 + #define pcf8574_init(...) PP_CAT(pcf8574_init ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__) + #define pcf8574_get(...) PP_CAT(pcf8574_get ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__) + #define pcf8574_put(...) PP_CAT(pcf8574_put ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__) +#else + #define pcf8574_init(args...) PP_CAT(pcf8574_init ## _, COUNT_PARMS(args)) (args) + #define pcf8574_get(args...) PP_CAT(pcf8574_get ## _, COUNT_PARMS(args)) (args) + #define pcf8574_put(args...) PP_CAT(pcf8574_put ## _, COUNT_PARMS(args)) (args) +#endif + typedef uint8_t pcf8574_addr; /** @@ -56,8 +69,16 @@ typedef struct Pcf8574 #define PCF8574ID 0x40 ///< I2C address -int pcf8574_get(Pcf8574 *pcf); -bool pcf8574_put(Pcf8574 *pcf, uint8_t data); -bool pcf8574_init(Pcf8574 *pcf, pcf8574_addr addr); +#if !CONFIG_I2C_DISABLE_OLD_API + +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); +#endif /* !CONFIG_I2C_DISABLE_OLD_API */ + + +int pcf8574_get_2(I2c *i2c, Pcf8574 *pcf); +bool pcf8574_put_3(I2c *i2c, Pcf8574 *pcf, uint8_t data); +bool pcf8574_init_3(I2c *i2c, Pcf8574 *pcf, pcf8574_addr addr); #endif /* DRV_PCF8574_H */