drivers: gpio_pca95xx: use I2C burst write
Use I2C burst write to write 2 bytes to each pair of registers instead of 2 separate transactions of writing 1 byte. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
eafd0d9d21
commit
74e6795f6a
1 changed files with 2 additions and 6 deletions
|
@ -113,16 +113,12 @@ static int write_port_regs(struct device *dev, u8_t reg,
|
|||
"0x%X", i2c_addr, reg, buf->byte[0], (reg + 1),
|
||||
buf->byte[1]);
|
||||
|
||||
ret = i2c_reg_write_byte(i2c_master, i2c_addr, reg, buf->byte[0]);
|
||||
ret = i2c_burst_write(i2c_master, i2c_addr, reg, buf->byte, 2);
|
||||
if (ret) {
|
||||
LOG_ERR("PCA95XX[0x%X]: error writing to register 0x%X "
|
||||
"(%d)", i2c_addr, reg, ret);
|
||||
}
|
||||
ret = i2c_reg_write_byte(i2c_master, i2c_addr, reg+1, buf->byte[1]);
|
||||
if (ret) {
|
||||
LOG_ERR("PCA95XX[0x%X]: error writing to register 0x%X "
|
||||
"(%d)", i2c_addr, reg, ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue