新闻中心

EEPW首页>嵌入式系统>设计应用> 将FATFS移植STM32RBT6遇到的挂载不成功和返回值问题(2)

将FATFS移植STM32RBT6遇到的挂载不成功和返回值问题(2)

作者: 时间:2016-11-27 来源:网络 收藏

FRESULT res;
u32 nCapacity;
char buffer[512];
int main(void)
{
u32 total,free;
BspInit();
res= SD_Init();

if(res==0)
{

DebugOut(0, "sd卡初始化成功!");
}

res= f_mount(&fs,(TCHAR*)1,1); /* Mount a logical drive */;
//f_mkfs(0,1,4096);
res=exf_getfree("0:",&nCapacity,&free);//得到SD卡的总容量和剩余容量
DebugOut(0,"总容量:%dKB,剩余容量:%dKB",nCapacity,free);
res=f_open(&file, "0:/test.txt", FA_OPEN_EXISTING|FA_READ);
res=f_read (
&file, /* Pointer to the file object */
buffer,/* Pointer to data buffer */
512,/* Number of bytes to read */
&br/* Pointer to number of bytes read */
) ;
DebugOut(0,"buffer:%s",buffer);
res= f_mount(NULL,(TCHAR*)1,1);
while(1);


}


上一页 1 2 下一页

评论


技术专区

关闭