Fix Wire.begin causing divide by zero
Fixes: https://github.com/espressif/arduino-esp32/issues/4530
This commit is contained in:
parent
5b5b61c018
commit
a25ccb2ef7
1 changed files with 4 additions and 0 deletions
|
|
@ -1798,6 +1798,10 @@ i2c_t * i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t clk_speed){
|
|||
if(i2c_num >= 2){
|
||||
return NULL;
|
||||
}
|
||||
if(!clk_speed){
|
||||
//originally does not change the speed, but getFrequency and setFrequency need to be implemented first.
|
||||
clk_speed = 100000;
|
||||
}
|
||||
i2c_t * out = NULL;
|
||||
if(i2c_ports[i2c_num] == NULL){
|
||||
out = (i2c_t*)malloc(sizeof(i2c_t));
|
||||
|
|
|
|||
Loading…
Reference in a new issue