Skip to content

Commit 4eb13c5

Browse files
committed
esp32/machine_sdcard: Use deinit_p to deinit SD bus in SPI mode.
Fixes issue #7352. Signed-off-by: Damien George <[email protected]>
1 parent bc7822d commit 4eb13c5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ports/esp32/machine_sdcard.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,14 @@ STATIC mp_obj_t sd_deinit(mp_obj_t self_in) {
256256
DEBUG_printf("De-init host\n");
257257

258258
if (self->flags & SDCARD_CARD_FLAGS_HOST_INIT_DONE) {
259-
self->host.deinit();
259+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
260+
if (self->host.flags & SDMMC_HOST_FLAG_DEINIT_ARG) {
261+
self->host.deinit_p(self->host.slot);
262+
} else
263+
#endif
264+
{
265+
self->host.deinit();
266+
}
260267
self->flags &= ~SDCARD_CARD_FLAGS_HOST_INIT_DONE;
261268
}
262269

0 commit comments

Comments
 (0)