mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-07-15 08:32:42 +08:00
Fix bug of not being able to send a single Byte with i2c_master_write
Signed-off-by: XiongYu <xiongyu@espressif.com> Merges https://github.com/espressif/ESP8266_RTOS_SDK/pull/343
This commit is contained in:
@ -500,7 +500,7 @@ static void i2c_master_cmd_begin_static(i2c_port_t i2c_num)
|
||||
i2c_master_set_dc(i2c_num, i2c_last_state[i2c_num]->sda, 0);
|
||||
|
||||
for (i = 7; i >= 0; i--) {
|
||||
if (cmd->byte_num == 1) {
|
||||
if (cmd->byte_num == 1 && cmd->data == NULL) {
|
||||
dat = (cmd->byte_cmd) >> i;
|
||||
} else {
|
||||
dat = ((uint8_t) * (cmd->data + len)) >> i;
|
||||
@ -615,4 +615,4 @@ esp_err_t i2c_master_cmd_begin(i2c_port_t i2c_num, i2c_cmd_handle_t cmd_handle,
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user