Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e5bd18d

Browse filesBrowse files
authored
Fix I2C Scan for S2 and C3 (espressif#5528)
Thanks @chegewara I2C Scan was failing because i2c_master_write does not accept size of 0. This change checks and skips that call if no length is provided (usually when scanning)
1 parent a4118ea commit e5bd18d
Copy full SHA for e5bd18d

File tree

Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed

‎cores/esp32/esp32-hal-i2c.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-i2c.c
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,11 +1844,13 @@ i2c_t * i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t clk_speed){
18441844
}
18451845

18461846
i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis){
1847-
esp_err_t ret = ESP_OK;
1847+
esp_err_t ret = ESP_OK;
18481848
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
18491849
i2c_master_start(cmd);
18501850
i2c_master_write_byte(cmd, (address << 1) | I2C_MASTER_WRITE, ACK_CHECK_EN);
1851-
i2c_master_write(cmd, buff, size, ACK_CHECK_EN);
1851+
if(size){
1852+
i2c_master_write(cmd, buff, size, ACK_CHECK_EN);
1853+
}
18521854
//if send stop?
18531855
i2c_master_stop(cmd);
18541856
ret = i2c_master_cmd_begin(i2c->num, cmd, timeOutMillis / portTICK_RATE_MS);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.