#include <pu2clr_mcp23008.h>
◆ setup()
void MCP::setup |
( |
uint8_t |
i2c = 0x20 , |
|
|
uint8_t |
io = GPIO_OUTPUT |
|
) |
| |
Starts the MCP23008.
- Parameters
-
i2c | I2C address (0x20 ~ 0x27) - default 0x20 |
io | If GPIO_OUTPUT (0), all GPIO PINS will configured to output If GPIO_INPUT (255), all GPIO PINS will configured to input
You also can use a bitmask to configure some pins for input and other pins for output. |
◆ setGPIOS()
void MCP::setGPIOS |
( |
uint8_t |
value | ) |
|
Sets a value to the GPIO Register.
- Parameters
-
◆ getRegister()
uint8_t MCP::getRegister |
( |
uint8_t |
reg | ) |
|
Gets the corrent register information.
- Parameters
-
reg | (0x00 ~ 0xA) see MCP23008 registers documentation |
- Returns
- uint8_t current register value
◆ setRegister()
void MCP::setRegister |
( |
uint8_t |
reg, |
|
|
uint8_t |
value |
|
) |
| |
Sets a value to a given register.
- Parameters
-
reg | (0x00 ~ 0xA) see MCP23008 registers documentation |
value | value (8 bits) |
◆ turnGpioOn()
void MCP::turnGpioOn |
( |
uint8_t |
gpio | ) |
|
Turns a given GPIO port on (high level)
- Parameters
-
gpio | the GPIO/PIN number (0-7) |
◆ turnGpioOff()
void MCP::turnGpioOff |
( |
uint8_t |
gpio | ) |
|
Turns a given GPIO port off (low level)
- Parameters
-
gpio | the GPIO/PIN number (0-7) |
◆ pullUpGpioOn()
void MCP::pullUpGpioOn |
( |
uint8_t |
gpio | ) |
|
Turns intenal pull up resistor ON to a given GPIO PIN (high level)
- Parameters
-
gpio | the GPIO/PIN number (0-7) |
◆ pullUpGpioOff()
void MCP::pullUpGpioOff |
( |
uint8_t |
gpio | ) |
|
Turns intenal pull up resistor OFF to a given GPIO PIN (low level)
- Parameters
-
gpio | the GPIO/PIN number (0-7) |
◆ getGPIOS()
uint8_t MCP::getGPIOS |
( |
| ) |
|
|
inline |
Return the current MCP GPIO pin levels.
- Returns
- uint8_t
◆ i2cAddress
uint8_t MCP::i2cAddress = 0x20 |
|
protected |
◆ gpios
The documentation for this class was generated from the following files: