提交 a7a7163e 编写于 作者: M me-no-dev

Limit frequency settings to prevent Interrupt WDT

上级 12d370a1
......@@ -67,8 +67,9 @@ esp_err_t i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t frequency){
}
if(!frequency){
//originally does not change the speed, but getFrequency and setFrequency need to be implemented first.
frequency = 100000;
frequency = 100000UL;
} else if(frequency > 1000000UL){
frequency = 1000000UL;
}
i2c_config_t conf = { };
......@@ -259,6 +260,11 @@ esp_err_t i2cSetClock(uint8_t i2c_num, uint32_t frequency){
ret = ESP_OK;
goto end;
}
if(!frequency){
frequency = 100000UL;
} else if(frequency > 1000000UL){
frequency = 1000000UL;
}
// Freq limitation when using different clock sources
#define I2C_CLK_LIMIT_REF_TICK (1 * 1000 * 1000 / 20) /*!< Limited by REF_TICK, no more than REF_TICK/20*/
#define I2C_CLK_LIMIT_APB (80 * 1000 * 1000 / 20) /*!< Limited by APB, no more than APB/20*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册