Arduino-TWI
Two-Wire Interface (TWI) library for Arduino
PCF8574A Class Reference

#include <PCF8574.h>

Inheritance diagram for PCF8574A:
Inheritance graph
Collaboration diagram for PCF8574A:
Collaboration graph

Public Member Functions

 PCF8574A (TWI &twi, uint8_t subaddr=7)
 
uint8_t ddr ()
 
void ddr (uint8_t ddr)
 
uint8_t read ()
 
uint8_t port ()
 
void write (uint8_t value)
 
void write (void *buf, size_t size)
 

Protected Member Functions

int read (void *buf, size_t count)
 
int write (const void *buf, size_t count)
 
int write (iovec_t *vp)
 
bool acquire ()
 
bool release ()
 

Protected Attributes

uint8_t m_ddr
 
uint8_t m_port
 
TWIm_twi
 
uint8_t m_addr
 

Detailed Description

Definition at line 236 of file PCF8574.h.

Constructor & Destructor Documentation

PCF8574A::PCF8574A ( TWI twi,
uint8_t  subaddr = 7 
)
inline

Construct connection to PCF8574A Remote 8-bit I/O expander with given sub-address.

Parameters
[in]twibus manager.
[in]subaddrsub-address (0..7, default 7).

Definition at line 244 of file PCF8574.h.

Member Function Documentation

bool TWI::Device::acquire ( )
inlineinherited

Start transaction. Return true(1) if successful otherwise false(0).

Returns
bool.

Definition at line 52 of file TWI.h.

uint8_t PCF8574::ddr ( )
inlineinherited

Get data direction for port; 0 for output, 1 for input.

Returns
data direction.

Definition at line 64 of file PCF8574.h.

void PCF8574::ddr ( uint8_t  ddr)
inlineinherited

Set data direction for port pin P0..P7; 0 for output, 1 for input.

Parameters
[in]ddrdata direction mask.

Definition at line 73 of file PCF8574.h.

uint8_t PCF8574::port ( )
inlineinherited

Get data port values.

Returns
port value.

Definition at line 99 of file PCF8574.h.

int TWI::Device::read ( void *  buf,
size_t  count 
)
inlineinherited

Read data from device to given buffer.

Parameters
[in]bufbuffer pointer.
[in]countbuffer size in bytes.
Returns
number of bytes read or negative error code.

Definition at line 73 of file TWI.h.

uint8_t PCF8574::read ( )
inlineinherited

Read pins and return current values.

Returns
input pin values.

Definition at line 86 of file PCF8574.h.

bool TWI::Device::release ( )
inlineinherited

Stop transaction. Return true(1) if successful otherwise false(0).

Returns
bool.

Definition at line 62 of file TWI.h.

int TWI::Device::write ( const void *  buf,
size_t  count 
)
inlineinherited

Write data from the given buffer to device.

Parameters
[in]bufbuffer pointer.
[in]countbuffer size in bytes.
Returns
number of bytes written or negative error code.

Definition at line 84 of file TWI.h.

int TWI::Device::write ( iovec_t *  vp)
inlineinherited

Write data to device with from given io vector.

Parameters
[in]vpio vector pointer.
Returns
number of bytes written or negative error code.

Definition at line 94 of file TWI.h.

void PCF8574::write ( uint8_t  value)
inlineinherited

Write given value to the output pins.

Parameters
[in]valueto write to port.

Definition at line 108 of file PCF8574.h.

void PCF8574::write ( void *  buf,
size_t  size 
)
inlineinherited

Write given values to the output pins.

Parameters
[in]bufpointer to data to write to device.
[in]sizeof buffer.

Definition at line 121 of file PCF8574.h.

Member Data Documentation

uint8_t TWI::Device::m_addr
protectedinherited

Device address.

Definition at line 104 of file TWI.h.

uint8_t PCF8574::m_ddr
protectedinherited

Data Direction Register, 0 = output, 1 = input.

Definition at line 217 of file PCF8574.h.

uint8_t PCF8574::m_port
protectedinherited

Port Register to mask and maintain output pin values.

Definition at line 220 of file PCF8574.h.

TWI& TWI::Device::m_twi
protectedinherited

Two-Wire Interface Manager.

Definition at line 101 of file TWI.h.


The documentation for this class was generated from the following file: