|
@@ -128,7 +128,7 @@ static esp_err_t i2c_write_reg(uint8_t reg, uint8_t val) {
|
|
|
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
|
|
|
i2c_master_start(cmd);
|
|
|
|
|
|
- i2c_master_write_byte(cmd, i2c_addr | I2C_MASTER_WRITE, I2C_MASTER_NACK);
|
|
|
+ i2c_master_write_byte(cmd, (i2c_addr << 1) | I2C_MASTER_WRITE, I2C_MASTER_NACK);
|
|
|
i2c_master_write_byte(cmd, reg, I2C_MASTER_NACK);
|
|
|
i2c_master_write_byte(cmd, val, I2C_MASTER_NACK);
|
|
|
|
|
@@ -153,11 +153,11 @@ static uint8_t i2c_read_reg(uint8_t reg) {
|
|
|
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
|
|
|
i2c_master_start(cmd);
|
|
|
|
|
|
- i2c_master_write_byte(cmd, i2c_addr | I2C_MASTER_WRITE, I2C_MASTER_NACK);
|
|
|
+ i2c_master_write_byte(cmd, (i2c_addr << 1) | I2C_MASTER_WRITE, I2C_MASTER_NACK);
|
|
|
i2c_master_write_byte(cmd, reg, I2C_MASTER_NACK);
|
|
|
|
|
|
i2c_master_start(cmd);
|
|
|
- i2c_master_write_byte(cmd, i2c_addr | I2C_MASTER_READ, I2C_MASTER_NACK);
|
|
|
+ i2c_master_write_byte(cmd, (i2c_addr << 1) | I2C_MASTER_READ, I2C_MASTER_NACK);
|
|
|
i2c_master_read_byte(cmd, &data, I2C_MASTER_NACK);
|
|
|
|
|
|
i2c_master_stop(cmd);
|