1
0
Fork 0

Update GPIO expander API naming (#23375)

This commit is contained in:
Ryan 2024-03-30 03:57:21 +11:00 committed by GitHub
parent e891109c4e
commit d0cf7b8519
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 44 additions and 30 deletions

View file

@ -74,20 +74,20 @@ bool mcp23018_set_output_all(uint8_t slave_addr, uint8_t confA, uint8_t confB) {
return true;
}
bool mcp23018_readPins(uint8_t slave_addr, mcp23018_port_t port, uint8_t* out) {
bool mcp23018_read_pins(uint8_t slave_addr, mcp23018_port_t port, uint8_t* out) {
uint8_t addr = SLAVE_TO_ADDR(slave_addr);
uint8_t cmd = port ? CMD_GPIOB : CMD_GPIOA;
i2c_status_t ret = i2c_read_register(addr, cmd, out, sizeof(uint8_t), TIMEOUT);
if (ret != I2C_STATUS_SUCCESS) {
dprintf("mcp23018_readPins::FAILED::%u\n", ret);
dprintf("mcp23018_read_pins::FAILED::%u\n", ret);
return false;
}
return true;
}
bool mcp23018_readPins_all(uint8_t slave_addr, uint16_t* out) {
bool mcp23018_read_pins_all(uint8_t slave_addr, uint16_t* out) {
uint8_t addr = SLAVE_TO_ADDR(slave_addr);
typedef union {
@ -99,7 +99,7 @@ bool mcp23018_readPins_all(uint8_t slave_addr, uint16_t* out) {
i2c_status_t ret = i2c_read_register(addr, CMD_GPIOA, &data.u8[0], sizeof(data), TIMEOUT);
if (ret != I2C_STATUS_SUCCESS) {
dprintf("mcp23018_readPins::FAILED::%u\n", ret);
dprintf("mcp23018_read_pins_all::FAILED::%u\n", ret);
return false;
}