liblitesdcard/[spi]sdcard: avoid redundant (re-)initialization
This commit is contained in:
parent
aa0cd21378
commit
9ad45a6932
|
@ -728,7 +728,8 @@ DSTATUS disk_status(uint8_t drv) {
|
|||
|
||||
DSTATUS disk_initialize(uint8_t drv) {
|
||||
if (drv) return STA_NOINIT;
|
||||
sdcardstatus = sdcard_init() ? 0 : STA_NOINIT;
|
||||
if (sdcardstatus)
|
||||
sdcardstatus = sdcard_init() ? 0 : STA_NOINIT;
|
||||
return sdcardstatus;
|
||||
}
|
||||
|
||||
|
|
|
@ -277,8 +277,10 @@ DSTATUS disk_status(uint8_t drv) {
|
|||
|
||||
DSTATUS disk_initialize(uint8_t drv) {
|
||||
if (drv) return STA_NOINIT;
|
||||
spisdcardstatus = spisdcard_init() ? 0 : STA_NOINIT;
|
||||
spisdcard_deselect();
|
||||
if (spisdcardstatus) {
|
||||
spisdcardstatus = spisdcard_init() ? 0 : STA_NOINIT;
|
||||
spisdcard_deselect();
|
||||
}
|
||||
return spisdcardstatus;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue