BeRTOS
Functions
pcf8574.c File Reference

PCF8574 i2c port expander driver. More...

#include "pcf8574.h"
#include "cfg/cfg_i2c.h"
#include <cfg/module.h>
#include <drv/i2c.h>

Go to the source code of this file.

Functions

int pcf8574_get_2 (I2c *i2c, Pcf8574 *pcf)
 Read PCF8574 pcf bit status.
bool pcf8574_put_3 (I2c *i2c, Pcf8574 *pcf, uint8_t data)
 Write to PCF8574 pcf port data.
bool pcf8574_init_3 (I2c *i2c, Pcf8574 *pcf, pcf8574_addr addr)
 Init a PCF8574 on the bus with addr addr.

Detailed Description

PCF8574 i2c port expander driver.

This driver controls the PCF8574. The PCF8574 is an 8bit i2c port expander. You can read/write 8 pins through an i2c bus. The pins are quasi-bidirectionals, this mean that without the need of a direction register you can use each pin as input or output, see datasheet on how this is achieved.

Author:
Francesco Sacchi <batt@develer.com>

Definition in file pcf8574.c.


Function Documentation

int pcf8574_get_2 ( I2c *  i2c,
Pcf8574 pcf 
)

Read PCF8574 pcf bit status.

Returns:
the pins status or EOF on errors.

Definition at line 58 of file pcf8574.c.

bool pcf8574_init_3 ( I2c *  i2c,
Pcf8574 pcf,
pcf8574_addr  addr 
)

Init a PCF8574 on the bus with addr addr.

Returns:
true if device is found, false otherwise.

Definition at line 89 of file pcf8574.c.

bool pcf8574_put_3 ( I2c *  i2c,
Pcf8574 pcf,
uint8_t  data 
)

Write to PCF8574 pcf port data.

Returns:
true if ok, false on errors.

Definition at line 74 of file pcf8574.c.