feat: SPI flash driver (#4012)

Co-authored-by: Richard Li <richard.li@ces.hk>
This commit is contained in:
Raphael Coeffic
2023-10-13 19:51:11 +10:00
committed by GitHub
co-authored by Richard Li
parent 7400a598a1
commit cb16786a74
17 changed files with 1977 additions and 31 deletions
+15
View File
@@ -58,6 +58,21 @@ int fatfsRegisterDriver(const diskio_driver_t* drv, uint8_t lun)
return 1;
}
void fatfsUnregisterDrivers()
{
for (uint8_t i = 0; i < _fatfs_n_drives; i++) {
auto& drive = _fatfs_drives[i];
if (drive.initialized) {
disk_ioctl(i, CTRL_SYNC, 0);
if (drive.drv->deinit) {
drive.drv->deinit(drive.lun);
}
drive.initialized = false;
}
}
_fatfs_n_drives = 0;
}
const diskio_driver_t* fatfsGetDriver(uint8_t pdrv)
{
if (pdrv >= _fatfs_n_drives) {