diff options
author | Damien George <damien.p.george@gmail.com> | 2014-08-26 22:58:54 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-08-26 22:58:54 +0100 |
commit | f05b87bd639ef7dbe14d40c912a802c50a762553 (patch) | |
tree | c05a1d9754863663934da93b6dd0b89700eb9f54 /stmhal/sdcard.c | |
parent | 3b72da674e75863f6e06e987062103dd02d1b6ff (diff) | |
parent | 994bb4a839657c96d71a73a9fce7beac13086dd1 (diff) | |
download | micropython-f05b87bd639ef7dbe14d40c912a802c50a762553.tar.gz micropython-f05b87bd639ef7dbe14d40c912a802c50a762553.zip |
Merge pull request #824 from dhylands/sdcard-power
Fix sdcard_power_on to not do anything if the card is already powered on...
Diffstat (limited to 'stmhal/sdcard.c')
-rw-r--r-- | stmhal/sdcard.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/stmhal/sdcard.c b/stmhal/sdcard.c index 2993773fab..22882ddb60 100644 --- a/stmhal/sdcard.c +++ b/stmhal/sdcard.c @@ -90,6 +90,9 @@ bool sdcard_power_on(void) { if (!sdcard_is_present()) { return false; } + if (sd_handle.Instance) { + return true; + } // SD device interface configuration sd_handle.Instance = SDIO; @@ -120,7 +123,10 @@ error: } void sdcard_power_off(void) { - HAL_SD_DeInit(&sd_handle); + if (!sd_handle.Instance) { + return; + } + HAL_SD_DeInit(&sd_handle); sd_handle.Instance = NULL; } |