博士
最后登录1970-1-1
在线时间 小时
注册时间2015-3-6
|
发表于 2015-5-18 17:09:44
|
显示全部楼层
/**
******************************************************************************
* @file main.c
* @author fire
* @version V1.0
* @date 2013-xx-xx
* @brief òo¾§ÏÔê¾ÖDÎÄ
******************************************************************************
* @attention
*
* êμÑéƽì¨:ò°»e iSO STM32 ¿a·¢°å
* ÂÛì3 :http://www.firebbs.cn
* ìÔ±| :http://firestm32.taobao.com
*
******************************************************************************
*/
#include "stm32f10x.h"
#include "bsp_usart1.h"
#include "bsp_ili9341_lcd.h"
#include "bsp_sdfs_app.h"
#include "ff.h"
FIL fnew; /* file objects */
FRESULT res;
UINT br, bw; /* File R/W count */
BYTE buffer[4096]={0}; /* file copy buffer */
BYTE textFileBuffer[] = "Welcome to use Wildfire iso stm32 Development Board today is a good day";
/*
* òaÏëÖDÎÄÏÔê¾3é1|
* Dè°Ñ×Ö¿a¿½±′μ½sd¿¨éÏ£¬è»oó°Ñsd¿¨2åμ½¿a·¢°åμÄ¿¨2ÛéÏ
*/
int main(void)
{
LCD_Init();
LCD_Clear(0, 0, 240, 320, BACKGROUND);
/* USART1 config */
USART1_Config();
printf("\r\n this is a fatfs test demo \r\n");
/* 3õê¼»ˉsd¿¨ÎļtÏμí3£¬òòÎaoo×ÖμÄ×Ö¿a·ÅÔúáËsd¿¨àïÃæ */
Sd_fs_init();
res = f_open(&fnew, "0:newfile.txt", FA_CREATE_ALWAYS | FA_WRITE );
if ( res == FR_OK )
{
res = f_write(&fnew, textFileBuffer, sizeof(textFileBuffer), &bw);
f_close(&fnew);
}
res = f_open(&fnew, "0:newfile.txt", FA_OPEN_EXISTING | FA_READ);
res = f_read(&fnew, buffer, sizeof(buffer), &br);
printf("\r\n %s ", buffer);
/* Close open files */
f_close(&fnew);
LCD_DispStr(5, 5, (uint8_t *)"fatfs init success", RED);
LCD_DispStr(5, 25, (uint8_t *)"insure the sdcard has insert......", RED);
LCD_DispStrCH(50, 50, (uint8_t *)"ò°»e¿a·¢°å", RED);
LCD_DispEnCh(30, 90, "Welcome to use ò°»e ISO Stm32 ¿a·¢°å bigo------", RED);
while(1);
}
|
|