Remove from wizart i2c backend selection. Add deprecate switch to disable old i2c...
[bertos.git] / bertos / drv / pcf8574.c
index 3c9ba4d2b201efd7a8706506ffa3b924a4434281..a94b2b7d432015cd8163d1faa6b1f95a269f021c 100644 (file)
 
 #include "pcf8574.h"
 
+#include "cfg/cfg_i2c.h"
+
 #include <cfg/module.h>
 
 #include <drv/i2c.h>
 
-/**
- * Read PCF8574 \a pcf bit status.
- * \return the pins status or EOF on errors.
- */
-int pcf8574_get_1(Pcf8574 *pcf)
+#if !CONFIG_I2C_DISABLE_OLD_API
+
+INLINE int pcf8574_get_priv(Pcf8574 *pcf)
 {
        if (!i2c_start_r(PCF8574ID | ((pcf->addr << 1) & 0xF7)))
                return EOF;
@@ -68,6 +68,15 @@ int pcf8574_get_1(Pcf8574 *pcf)
        return data;
 }
 
+/**
+ * Read PCF8574 \a pcf bit status.
+ * \return the pins status or EOF on errors.
+ */
+int pcf8574_get_1(Pcf8574 *pcf)
+{
+       return pcf8574_get_priv(pcf);
+}
+
 /**
  * Write to PCF8574 \a pcf port \a data.
  * \return true if ok, false on errors.
@@ -87,9 +96,9 @@ bool pcf8574_init_2(Pcf8574 *pcf, pcf8574_addr addr)
 {
        MOD_CHECK(i2c);
        pcf->addr = addr;
-       return pcf8574_get(pcf) != EOF;
+       return pcf8574_get_priv(pcf) != EOF;
 }
-
+#endif /* !CONFIG_I2C_DISABLE_OLD_API */
 
 
 /*