Skip to content

Commit 5d8994c

Browse files
authored
fix(i2c): Guard sleep retention
Not all chips can restore I2C bus after light sleep
1 parent dd65f0f commit 5d8994c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ esp_err_t i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t frequency) {
123123
bus_config.intr_priority = 0; // auto
124124
bus_config.trans_queue_depth = 0; // only valid in asynchronous transaction, which Arduino does not use
125125
bus_config.flags.enable_internal_pullup = 1;
126+
#if SOC_I2C_SUPPORT_SLEEP_RETENTION
126127
bus_config.flags.allow_pd = 1; // backup/restore the I2C registers before/after entering/exist sleep mode
128+
#endif
127129

128130
ret = i2c_new_master_bus(&bus_config, &bus_handle);
129131
if (ret != ESP_OK) {

0 commit comments

Comments
 (0)