|
VitroIO SDK
Software development kit for Vitro Shard.
|
#include <io_expander.h>
Public Member Functions | |
| IOExpander (PinName sda_pin, PinName scl_pin) | |
| Creates instance of IOExpander class. More... | |
| ~IOExpander () | |
| Destructor for IOExpander class. More... | |
| int | configurePort (int address, uint8_t port_number, char config) |
| Function configures IOs direction of port to output or input state. Each IO of given port can be configured independently. More... | |
| int | readInputPort (int address, uint8_t port_number, char *portState) |
| Function reads state of given input port. More... | |
| int | writeOutputPort (int address, uint8_t port_number, char data) |
| Function writes state to given output port. More... | |
| vitroio::sdk::impl::IOExpander::IOExpander | ( | PinName | sda_pin, |
| PinName | scl_pin | ||
| ) |
Creates instance of IOExpander class.
| sda_pin | SDA pin of I2C. |
| scl_pin | SCL pin of I2C. |
| vitroio::sdk::impl::IOExpander::~IOExpander | ( | ) |
Destructor for IOExpander class.
| int vitroio::sdk::impl::IOExpander::configurePort | ( | int | address, |
| uint8_t | port_number, | ||
| char | config | ||
| ) |
Function configures IOs direction of port to output or input state. Each IO of given port can be configured independently.
| address | I2C address of IO Expander. |
| port_number | Port number which will be configured. This variable can only take value 0x00 or 0x01. |
| config | Direction of each IO in configured port. 0 means output, 1 means input. |
| int vitroio::sdk::impl::IOExpander::readInputPort | ( | int | address, |
| uint8_t | port_number, | ||
| char * | portState | ||
| ) |
Function reads state of given input port.
| address | I2C address of IO Expander. |
| port_number | Port number which will be read. This variable can only take value 0x00 or 0x01. |
| portState | If read successfully, this variable contains state of each input of read port. |
| int vitroio::sdk::impl::IOExpander::writeOutputPort | ( | int | address, |
| uint8_t | port_number, | ||
| char | data | ||
| ) |
Function writes state to given output port.
| address | I2C address of IO Expander. |
| port_number | Port number which will be written. This variable can only take value 0x00 or 0x01. |
| data | Data which will be written to port. Each bit corresponds to an output IO number. |