Description
Hardware:
Board: ESP32 Dev Module
Core Installation version: 2.0.1
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Windows 10
Description:
Define the macro CONFIG_DISABLE_HAL_LOCKS in sdkconfig.h as following:
#define CONFIG_DISABLE_HAL_LOCKS 1
It will cause compilation error:
C:\Users\wjf-1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32\esp32-hal-i2c-slave.c: In function 'i2cSlaveDeinit':
C:\Users\wjf-1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32\esp32-hal-i2c-slave.c:363:12: error: 'i2c_slave_struct_t' {aka 'struct i2c_slave_struct_t'} has no member named 'lock'
if(!i2c->lock){
^~
C:\Users\wjf-1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32\esp32-hal-i2c-slave.c: In function 'i2cSlaveWrite':
C:\Users\wjf-1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32\esp32-hal-i2c-slave.c:380:12: error: 'i2c_slave_struct_t' {aka 'struct i2c_slave_struct_t'} has no member named 'lock'
if(!i2c->lock){
^~
So I suggest add conditional compilation as following:
#if !CONFIG_DISABLE_HAL_LOCKS //Line 363
if(!i2c->lock){
log_e("Lock is not initialized! Did you call i2c_slave_init()?");
return ESP_ERR_NO_MEM;
}
#endif
#if !CONFIG_DISABLE_HAL_LOCKS //Line 382
if(!i2c->lock){
log_e("Lock is not initialized! Did you call i2c_slave_init()?");
return ESP_ERR_NO_MEM;
}
#endif