VitroIO SDK
Software development kit for Vitro Shard.
Loading...
Searching...
No Matches
io_expander.h
Go to the documentation of this file.
1#ifndef IO_EXPANDER_H
2#define IO_EXPANDER_H
3
4#include <mbed.h>
5#include <vitroio-sdk/debug.h>
7
8#define IOEXPANDER_CMD_READ_0 0x00
9#define IOEXPANDER_CMD_READ_1 0x01
10#define IOEXPANDER_CMD_WRITE_0 0x02
11#define IOEXPANDER_CMD_WRITE_1 0x03
12#define IOEXPANDER_CMD_CONFIGURE_0 0x06
13#define IOEXPANDER_CMD_CONFIGURE_1 0x07
14
15namespace vitroio
16{
17
18namespace sdk
19{
20
21namespace impl
22{
23
25public:
26
34 IOExpander(PinName sda_pin, PinName scl_pin);
35
40
55 int configurePort(int address, uint8_t port_number, char config);
56
69 int readInputPort(int address, uint8_t port_number, char *portState);
70
83 int writeOutputPort(int address, uint8_t port_number, char data);
84
85private:
86 I2C* i2c_;
87};
88
89} // namespace impl
90
91} // namespace sdk
92
93} // namespace vitroio
94#endif // IO_EXPANDER_H
Definition: io_expander.h:24
~IOExpander()
Destructor for IOExpander class.
int writeOutputPort(int address, uint8_t port_number, char data)
Function writes state to given output port.
int readInputPort(int address, uint8_t port_number, char *portState)
Function reads state of given input port.
IOExpander(PinName sda_pin, PinName scl_pin)
Creates instance of IOExpander class.
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 conf...
The file contains constants of vitro-shard-sdk for user usage.
The file defines debug macros.
The namespace contains all of components of vitro-shard-sdk and components based on the sdk....
Definition: can_layer.h:9