Skip to content

Commit a25ccb2

Browse files
committed
Fix Wire.begin causing divide by zero
Fixes: espressif#4530
1 parent 5b5b61c commit a25ccb2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cores/esp32/esp32-hal-i2c.c

+4
Original file line numberDiff line numberDiff line change
@@ -1798,6 +1798,10 @@ i2c_t * i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t clk_speed){
17981798
if(i2c_num >= 2){
17991799
return NULL;
18001800
}
1801+
if(!clk_speed){
1802+
//originally does not change the speed, but getFrequency and setFrequency need to be implemented first.
1803+
clk_speed = 100000;
1804+
}
18011805
i2c_t * out = NULL;
18021806
if(i2c_ports[i2c_num] == NULL){
18031807
out = (i2c_t*)malloc(sizeof(i2c_t));

0 commit comments

Comments
 (0)