开发板:esp-32
问题描述:
在使用ESP32做主机写从机时,当从机地址是正确的时候能够正常写入,但是当从机地址不对时
Code: Select all
i2c_master_cmd_begin()
例如下面函数将SHT30_SENSOR_ADDR改成0x45还是能返回ESP_OK
Code: Select all
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (SHT30_SENSOR_ADDR << 1) | WRITE_BIT, ACK_EN); // Write Address 0x44
i2c_master_write_byte(cmd, MSB, ACK_EN);
i2c_master_write_byte(cmd, LSB, ACK_EN);
i2c_master_stop(cmd);
esp_err_t ret = i2c_master_cmd_begin(I2C_MASTER_NUM, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
return ret;