Encapsulate a PCF8575 device.
More...
#include <PCF8575.h>
|
| | PCF8575 (uint8_t address) |
| | Class constructor. More...
|
| |
|
virtual | ~PCF8575 () |
| | Class instance destructor.
|
| |
| void | init (gpio_num_t sdaPin=I2C::DEFAULT_SDA_PIN, gpio_num_t clkPin=I2C::DEFAULT_CLK_PIN) |
| | Initialize the PCF8575 device. More...
|
| |
| uint16_t | read () |
| | Read all the input bits from the device. More...
|
| |
| bool | readBit (uint16_t bit) |
| | Read the logic level on a given pin. More...
|
| |
| void | setInvert (bool value) |
| | Invert the bit values. Normally setting a pin's value to 1 means that a high signal is generated and a 0 means a low signal is generated. Setting the inversion to true, inverts that meaning. More...
|
| |
| void | write (uint16_t value) |
| | Set the output values of the device. More...
|
| |
| void | writeBit (uint16_t bit, bool value) |
| | Change the output value of a specific pin. More...
|
| |
Encapsulate a PCF8575 device.
The PCF8575 is a 16 bit GPIO expander attached to I2C. It can read and write 16 bits of data and hence has 16 pins that can be used for input or output.
- See Also
- PCF8575 home page
| PCF8575::PCF8575 |
( |
uint8_t |
address | ) |
|
Class constructor.
The address is the address of the device on the I2C bus. This is the value 0x20 plus the value of the device input pins A0, A1 and A2. This means that the address should be between 0x20 and 0x27.
- Parameters
-
| [in] | address | The I2C address of the device on the I2C bus. |
Initialize the PCF8575 device.
- Parameters
-
| [in] | sdaPin | The pin to use for the I2C SDA functions. |
| [in] | clkPin | The pin to use for the I2C CLK functions. |
| uint16_t PCF8575::read |
( |
| ) |
|
Read all the input bits from the device.
- Returns
- A 16 bit value representing the values on each of the input pins.
| bool PCF8575::readBit |
( |
uint16_t |
bit | ) |
|
Read the logic level on a given pin.
- Parameters
-
| [in] | bit | The input pin of the device to read. Values are 0-15. |
- Returns
- True if the pin is high, false otherwise. Undefined if there is no signal on the pin.
| void PCF8575::setInvert |
( |
bool |
value | ) |
|
Invert the bit values. Normally setting a pin's value to 1 means that a high signal is generated and a 0 means a low signal is generated. Setting the inversion to true, inverts that meaning.
- Parameters
-
| [in] | value | True if we wish to invert the signals and false otherwise. |
| void PCF8575::write |
( |
uint16_t |
value | ) |
|
Set the output values of the device.
- Parameters
-
| [in] | value | The bit pattern to set on the output. |
| void PCF8575::writeBit |
( |
uint16_t |
bit, |
|
|
bool |
value |
|
) |
| |
Change the output value of a specific pin.
The other bits beyond the one setting retain their values from the previous call to write() or previous calls to writeBit().
- Parameters
-
| [in] | bit | The pin to have its value changed. The pin may be 0-15. |
| [in] | value | The logic level to appear on the identified output pin. |
The documentation for this class was generated from the following files: