summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-06-18 00:14:21 +1000
committerDamien George <damien@micropython.org>2021-06-18 09:55:22 +1000
commit4eb13c50cd87eff8374b9bffc3d7c15b1bf5e35f (patch)
treeecf66153e6bc2acfea500b7e6fa26922ce1659ca
parentbc7822d8e95c40a9d5e403fd22c82b1bbad53b8b (diff)
esp32/machine_sdcard: Use deinit_p to deinit SD bus in SPI mode.
Fixes issue #7352. Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--ports/esp32/machine_sdcard.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ports/esp32/machine_sdcard.c b/ports/esp32/machine_sdcard.c
index c9a9face7..3f70311f7 100644
--- a/ports/esp32/machine_sdcard.c
+++ b/ports/esp32/machine_sdcard.c
@@ -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;
}