BeRTOS
|
00001 00041 #ifndef DRV_PCF8574_H 00042 #define DRV_PCF8574_H 00043 00044 #include "cfg/cfg_i2c.h" 00045 00046 #include <cfg/compiler.h> 00047 00048 #include <drv/i2c.h> 00049 00050 #if COMPILER_C99 00051 #define pcf8574_init(...) PP_CAT(pcf8574_init ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__) 00052 #define pcf8574_get(...) PP_CAT(pcf8574_get ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__) 00053 #define pcf8574_put(...) PP_CAT(pcf8574_put ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__) 00054 #else 00055 #define pcf8574_init(args...) PP_CAT(pcf8574_init ## _, COUNT_PARMS(args)) (args) 00056 #define pcf8574_get(args...) PP_CAT(pcf8574_get ## _, COUNT_PARMS(args)) (args) 00057 #define pcf8574_put(args...) PP_CAT(pcf8574_put ## _, COUNT_PARMS(args)) (args) 00058 #endif 00059 00060 typedef uint8_t pcf8574_addr; 00061 00065 typedef struct Pcf8574 00066 { 00067 pcf8574_addr addr; 00068 } Pcf8574; 00069 00070 #define PCF8574ID 0x40 ///< I2C address 00071 00076 int pcf8574_get_2(I2c *i2c, Pcf8574 *pcf); 00077 00082 bool pcf8574_put_3(I2c *i2c, Pcf8574 *pcf, uint8_t data); 00083 00088 bool pcf8574_init_3(I2c *i2c, Pcf8574 *pcf, pcf8574_addr addr); 00089 00090 #if !CONFIG_I2C_DISABLE_OLD_API 00091 00092 DEPRECATED INLINE int pcf8574_get_1(Pcf8574 *pcf) 00093 { 00094 return pcf8574_get_2(&local_i2c_old_api, pcf); 00095 } 00096 00097 DEPRECATED INLINE bool pcf8574_put_2(Pcf8574 *pcf, uint8_t data) 00098 { 00099 return pcf8574_put_3(&local_i2c_old_api, pcf, data); 00100 } 00101 00102 DEPRECATED INLINE bool pcf8574_init_2(Pcf8574 *pcf, pcf8574_addr addr) 00103 { 00104 return pcf8574_init_3(&local_i2c_old_api, pcf, addr); 00105 } 00106 #endif /* !CONFIG_I2C_DISABLE_OLD_API */ 00107 00108 #endif /* DRV_PCF8574_H */