f_close is: 9
测试代码
FATFS *fs[2]; //文件系统相关定义
FATFS fr;
UINT br,bw;
FIL *fsrc;
FIL *fdts;
FRESULT resp; //FatFs通用结果码
下面是实现函数
resp = f_mount(0, fs[0]); //挂载SD卡
printf("f_mount is: %d\r\n",resp);
resp = f_mount(1, fs[1]); //挂载flash卡
printf("f_mount is: %d\r\n",resp);
resp = f_open(fsrc, "0:demo.txt", FA_OPEN_EXISTING | FA_READ);
printf("f_open is: %d\r\n",resp);
resp = f_read(fsrc, SDIO_READ, sizeof(SDIO_READ), &br );
printf("f_read is: %d\r\n",resp);
resp = f_close(fsrc);
printf("f_close is: %d\r\n",resp);
resp = f_open(fdts, "0:test.txt", FA_CREATE_ALWAYS | FA_WRITE);
printf("f_open is: %d\r\n",resp);
resp = f_write(fdts, SDIO_READ, sizeof(SDIO_READ), &bw);
printf("f_write is: %d\r\n",resp);
resp = f_close(fdts);
printf("f_close is: %d\r\n",resp);
大侠们能帮忙看下么?
参考了原子哥的FatFs实验的部分代码,还是不行,至于外挂的FLASH没试