Skip to content

Commit 4af95f1

Browse files
committed
atmel-samd: Ensure sdioio.SDCard pins are released
1 parent 8e83f36 commit 4af95f1

File tree

1 file changed

+6
-2
lines changed
  • ports/atmel-samd/common-hal/sdioio

1 file changed

+6
-2
lines changed

ports/atmel-samd/common-hal/sdioio/SDCard.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ CLK PA21 PCC_D? (D32) BROWN
114114
gpio_set_pin_pull_mode(functions[i]->pin,
115115
(i == 1 || i == 5) ? GPIO_PULL_OFF : GPIO_PULL_UP);
116116
gpio_set_pin_function(functions[i]->pin, GPIO_PIN_FUNCTION_SDIO);
117-
118-
common_hal_never_reset_pin(functions[i]->obj);
119117
}
120118

121119
self->num_data = num_data;
@@ -145,6 +143,12 @@ CLK PA21 PCC_D? (D32) BROWN
145143
}
146144

147145
if (result != SD_MMC_OK) {
146+
for (size_t i = 0; i < MP_ARRAY_SIZE(functions); i++) {
147+
if (!functions[i]->obj) {
148+
break;
149+
}
150+
reset_pin_number(functions[i]->obj->number);
151+
}
148152
mp_raise_OSError_msg_varg(translate("%q failure: %d"), MP_QSTR_sd_mmc_check, (int)result);
149153
}
150154
// sd_mmc_get_capacity() is in KiB, but our "capacity" is in 512-byte blocks

0 commit comments

Comments
 (0)