i2c: rename read/write register functions (#22905)
This commit is contained in:
parent
e1f59a6efc
commit
a522b1f156
44 changed files with 184 additions and 170 deletions
|
@ -33,13 +33,13 @@ bool mcp23018_set_config(uint8_t slave_addr, mcp23018_port_t port, uint8_t conf)
|
|||
uint8_t cmdDirection = port ? CMD_IODIRB : CMD_IODIRA;
|
||||
uint8_t cmdPullup = port ? CMD_GPPUB : CMD_GPPUA;
|
||||
|
||||
i2c_status_t ret = i2c_writeReg(addr, cmdDirection, &conf, sizeof(conf), TIMEOUT);
|
||||
i2c_status_t ret = i2c_write_register(addr, cmdDirection, &conf, sizeof(conf), TIMEOUT);
|
||||
if (ret != I2C_STATUS_SUCCESS) {
|
||||
dprintf("mcp23018_set_config::directionFAILED::%u\n", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = i2c_writeReg(addr, cmdPullup, &conf, sizeof(conf), TIMEOUT);
|
||||
ret = i2c_write_register(addr, cmdPullup, &conf, sizeof(conf), TIMEOUT);
|
||||
if (ret != I2C_STATUS_SUCCESS) {
|
||||
dprintf("mcp23018_set_config::pullupFAILED::%u\n", ret);
|
||||
return false;
|
||||
|
@ -52,7 +52,7 @@ bool mcp23018_set_output(uint8_t slave_addr, mcp23018_port_t port, uint8_t conf)
|
|||
uint8_t addr = SLAVE_TO_ADDR(slave_addr);
|
||||
uint8_t cmd = port ? CMD_GPIOB : CMD_GPIOA;
|
||||
|
||||
i2c_status_t ret = i2c_writeReg(addr, cmd, &conf, sizeof(conf), TIMEOUT);
|
||||
i2c_status_t ret = i2c_write_register(addr, cmd, &conf, sizeof(conf), TIMEOUT);
|
||||
if (ret != I2C_STATUS_SUCCESS) {
|
||||
dprintf("mcp23018_set_output::FAILED::%u\n", ret);
|
||||
return false;
|
||||
|
@ -65,7 +65,7 @@ bool mcp23018_set_output_all(uint8_t slave_addr, uint8_t confA, uint8_t confB) {
|
|||
uint8_t addr = SLAVE_TO_ADDR(slave_addr);
|
||||
uint8_t conf[2] = {confA, confB};
|
||||
|
||||
i2c_status_t ret = i2c_writeReg(addr, CMD_GPIOA, &conf[0], sizeof(conf), TIMEOUT);
|
||||
i2c_status_t ret = i2c_write_register(addr, CMD_GPIOA, &conf[0], sizeof(conf), TIMEOUT);
|
||||
if (ret != I2C_STATUS_SUCCESS) {
|
||||
dprintf("mcp23018_set_output::FAILED::%u\n", ret);
|
||||
return false;
|
||||
|
@ -78,7 +78,7 @@ bool mcp23018_readPins(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_readReg(addr, cmd, out, sizeof(uint8_t), TIMEOUT);
|
||||
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);
|
||||
return false;
|
||||
|
@ -97,7 +97,7 @@ bool mcp23018_readPins_all(uint8_t slave_addr, uint16_t* out) {
|
|||
|
||||
data16 data = {.u16 = 0};
|
||||
|
||||
i2c_status_t ret = i2c_readReg(addr, CMD_GPIOA, &data.u8[0], sizeof(data), TIMEOUT);
|
||||
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);
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue