fix(i2c): Fix some issue in programming guide,

Closes https://github.com/espressif/esp-idf/issues/14794
This commit is contained in:
C.S.M
2024-11-06 14:54:37 +08:00
parent 0a098f49d4
commit 280b3d9e62
2 changed files with 2 additions and 2 deletions

View File

@@ -393,7 +393,7 @@ Please note that no STOP condition bit is inserted between the write and read op
};
i2c_master_dev_handle_t dev_handle;
ESP_ERROR_CHECK(i2c_master_bus_add_device(I2C_PORT_NUM_0, &dev_cfg, &dev_handle));
ESP_ERROR_CHECK(i2c_master_bus_add_device(bus_handle, &dev_cfg, &dev_handle));
uint8_t buf[20] = {0x20};
uint8_t buffer[2];
ESP_ERROR_CHECK(i2c_master_transmit_receive(dev_handle, buf, sizeof(buf), buffer, 2, -1));

View File

@@ -393,7 +393,7 @@ I2C 主机写入后读取
};
i2c_master_dev_handle_t dev_handle;
ESP_ERROR_CHECK(i2c_master_bus_add_device(I2C_PORT_NUM_0, &dev_cfg, &dev_handle));
ESP_ERROR_CHECK(i2c_master_bus_add_device(bus_handle, &dev_cfg, &dev_handle));
uint8_t buf[20] = {0x20};
uint8_t buffer[2];
ESP_ERROR_CHECK(i2c_master_transmit_receive(dev_handle, buf, sizeof(buf), buffer, 2, -1));