中级会员
- 积分
- 365
- 金钱
- 365
- 注册时间
- 2018-3-21
- 在线时间
- 64 小时
|
楼主 |
发表于 2022-7-23 11:05:01
|
显示全部楼层
if((FATFS_LinkDriver(&SDRAMDISK_Driver, RAMpath) == 0) && (FATFS_LinkDriver(&SD_Driver, SDpath) == 0))
{
/*##-2- Register the file system object to the FatFs module ##############*/
res1 = f_mount(&RAMFatFs, (TCHAR const*)RAMpath, 0);
res2 = f_mount(&SDFatFs, (TCHAR const*)SDpath, 0);
if((res1 != FR_OK) || (res2 != FR_OK))
{
/* FatFs Initialization Error */
Error_Handler();
}
else
{
/*##-3- Create a FAT file system (format) on the logical drives ########*/
/* WARNING: Formatting the uSD card will delete all content on the device */
res1 = f_mkfs((TCHAR const*)RAMpath, 0, 0);
res2 = f_mkfs((TCHAR const*)SDpath, 0, 0);
if((res1 != FR_OK) || (res2 != FR_OK))
{
/* FatFs Format Error */
Error_Handler();
}
else
{
/*##-4- Create and Open new text file objects with write access ######*/
res1 = f_open(&RAMFile, "0:STM32.TXT", FA_CREATE_ALWAYS | FA_WRITE);
res2 = f_open(&SDFile, "1:STM32.TXT", FA_CREATE_ALWAYS | FA_WRITE);
这个是官方多个文件系统的例子,最后f_open 的时候是通过 "0:STM32.TXT"和 "1:STM32.TXT"来区分操作的么,那么初始化的时候char RAMpath[4], SDpath[4]; /* RAM disk and SD card logical drives paths */这个的定义意义在哪呢 |
|