COSA
An Object-Oriented Platform for Arduino Programming
|
#include <PCF8574.hh>
Public Member Functions | |
PCF8574 (uint8_t subaddr=7) | |
bool | data_direction (uint8_t ddr) |
bool | input_pin (uint8_t pin) |
bool | output_pin (uint8_t pin) |
bool | read (uint8_t pin) |
uint8_t | read () |
bool | write (uint8_t pin, uint8_t value) |
bool | write (uint8_t value) |
bool | write (void *buf, size_t size) |
Protected Member Functions | |
PCF8574 (uint8_t addr, uint8_t subaddr) | |
Protected Attributes | |
uint8_t | m_ddr |
uint8_t | m_port |
Static Protected Attributes | |
static const uint8_t | PIN_MASK = 0x07 |
Private Member Functions | |
bool | is_async () const |
void | sync_request () |
void | async_request () |
virtual void | on_completion (uint8_t type, int count) |
Private Attributes | |
uint8_t | m_addr |
bool | m_async |
Driver for the PCF8574/PCF8574A Remote 8-bit I/O expander for I2C-bus with interrupt.
The I/0 expander used for LCD 1602 I2C communication.
Definition at line 49 of file PCF8574.hh.
|
inline |
Construct connection to PCF8574 Remote 8-bit I/O expander with given sub-address.
[in] | subaddr | sub-address (0..7, default 7). |
Definition at line 56 of file PCF8574.hh.
|
inlineprotected |
Construct connection to PCF8574 Remote 8-bit I/O expander with given address.
[in] | addr | bus address. |
[in] | subaddr | device sub address. |
Definition at line 151 of file PCF8574.hh.
bool PCF8574::data_direction | ( | uint8_t | ddr | ) |
Set data direction for port pin P0..P7; 0 for output, 1 for input. Return true if set otherwise false.
[in] | ddr | data direction mask. |
Definition at line 24 of file PCF8574.cpp.
|
inline |
Set given pin as input. Return true if set otherwise false.
[in] | pin | number (0..7). |
Definition at line 75 of file PCF8574.hh.
|
inline |
Set given pin as output. Return true if set otherwise false.
[in] | pin | number (0..7). |
Definition at line 86 of file PCF8574.hh.
|
inline |
Read given pin and return true is set otherwise false.
[in] | pin | number (0..7). |
Definition at line 97 of file PCF8574.hh.
uint8_t PCF8574::read | ( | ) |
Read pins and return current values.
Definition at line 35 of file PCF8574.cpp.
bool PCF8574::write | ( | uint8_t | pin, |
uint8_t | value | ||
) |
Write set given output pin if value is non-zero, otherwise clear. Return true if successful otherwise false.
[in] | pin | number (0..7). |
[in] | value. |
Definition at line 45 of file PCF8574.cpp.
bool PCF8574::write | ( | uint8_t | value | ) |
Write given value to the output pins. Return true if successful otherwise false. Return true if successful otherwise false.
[in] | value. |
Definition at line 59 of file PCF8574.cpp.
bool PCF8574::write | ( | void * | buf, |
size_t | size | ||
) |
Write given values to the output pins. Return true if successful otherwise false. Return true if successful otherwise false.
[in] | buf | pointer to data to write to device. |
[in] | size | of buffer. |
Definition at line 69 of file PCF8574.cpp.
|
protected |
Data Direction Register, 0 = output, 1 = input, default all input.
Definition at line 140 of file PCF8574.hh.
|
protected |
Port Register to mask and maintain output pin values.
Definition at line 143 of file PCF8574.hh.
|
staticprotected |
Pin number mask.
Definition at line 137 of file PCF8574.hh.