X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fpcf8574.c;h=7c5cf164b30b132c3c86c647a526566fd5a22ce6;hb=1c11ac0ab0636d07db3899b02c5d89e2d0b020bc;hp=3c9ba4d2b201efd7a8706506ffa3b924a4434281;hpb=e2238a91f56b0d4f79b39e51b2823f555f0ad7e6;p=bertos.git diff --git a/bertos/drv/pcf8574.c b/bertos/drv/pcf8574.c index 3c9ba4d2..7c5cf164 100644 --- a/bertos/drv/pcf8574.c +++ b/bertos/drv/pcf8574.c @@ -45,57 +45,12 @@ #include "pcf8574.h" +#include "cfg/cfg_i2c.h" + #include #include -/** - * Read PCF8574 \a pcf bit status. - * \return the pins status or EOF on errors. - */ -int pcf8574_get_1(Pcf8574 *pcf) -{ - if (!i2c_start_r(PCF8574ID | ((pcf->addr << 1) & 0xF7))) - return EOF; - - int data; - - if (!i2c_recv(&data, 1)) - data = EOF; - - i2c_stop(); - - return data; -} - -/** - * Write to PCF8574 \a pcf port \a data. - * \return true if ok, false on errors. - */ -bool pcf8574_put_2(Pcf8574 *pcf, uint8_t data) -{ - bool res = i2c_start_w(PCF8574ID | ((pcf->addr << 1) & 0xF7)) && i2c_put(data); - i2c_stop(); - return res; -} - -/** - * Init a PCF8574 on the bus with addr \a addr. - * \return true if device is found, false otherwise. - */ -bool pcf8574_init_2(Pcf8574 *pcf, pcf8574_addr addr) -{ - MOD_CHECK(i2c); - pcf->addr = addr; - return pcf8574_get(pcf) != EOF; -} - - - -/* - * New API - */ - /** * Read PCF8574 \a pcf bit status. * \return the pins status or EOF on errors.