mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
Merge branch 'bugfix/fix_i2c_master_write_bug' into 'master'
i2c: application can now call `i2c_master_write` for sending a single byte Closes IDF-3518 和 IDFCI-741 See merge request espressif/esp-idf!14273
This commit is contained in:
commit
90f05c42b2
@ -1147,6 +1147,12 @@ esp_err_t i2c_master_write(i2c_cmd_handle_t cmd_handle, const uint8_t *data, siz
|
||||
I2C_CHECK((data != NULL), I2C_ADDR_ERROR_STR, ESP_ERR_INVALID_ARG);
|
||||
I2C_CHECK(cmd_handle != NULL, I2C_CMD_LINK_INIT_ERR_STR, ESP_ERR_INVALID_ARG);
|
||||
|
||||
if (data_len == 1) {
|
||||
/* If data_len if 1, i2c_master_write_byte should have been called,
|
||||
* correct this here. */
|
||||
return i2c_master_write_byte(cmd_handle, *data, ack_en);
|
||||
}
|
||||
|
||||
i2c_cmd_t cmd = {
|
||||
.hw_cmd = {
|
||||
.ack_en = ack_en,
|
||||
|
Loading…
Reference in New Issue
Block a user