Skip to content

Commit

Permalink
esp32/machine_sdcard: Use deinit_p to deinit SD bus in SPI mode.
Browse files Browse the repository at this point in the history
Fixes issue #7352.

Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Jun 17, 2021
1 parent bc7822d commit 4eb13c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ports/esp32/machine_sdcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,14 @@ STATIC mp_obj_t sd_deinit(mp_obj_t self_in) {
DEBUG_printf("De-init host\n");

if (self->flags & SDCARD_CARD_FLAGS_HOST_INIT_DONE) {
self->host.deinit();
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
if (self->host.flags & SDMMC_HOST_FLAG_DEINIT_ARG) {
self->host.deinit_p(self->host.slot);
} else
#endif
{
self->host.deinit();
}
self->flags &= ~SDCARD_CARD_FLAGS_HOST_INIT_DONE;
}

Expand Down

0 comments on commit 4eb13c5

Please sign in to comment.