新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 將FATFS移植STM32RBT6遇到的掛載不成功和返回值問題(2)

將FATFS移植STM32RBT6遇到的掛載不成功和返回值問題(2)

作者: 時間:2016-11-27 來源:網(wǎng)絡(luò) 收藏

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卡的總?cè)萘亢褪S嗳萘?br /> DebugOut(0,"總?cè)萘浚?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 下一頁

評論


技術(shù)專區(qū)

關(guān)閉