大学生
最后登录1970-1-1
在线时间 小时
注册时间2015-7-30
|
楼主 |
发表于 2016-1-11 18:43:05
|
显示全部楼层
谢谢你,我也自己做了一下。
void Sd_to_Flash(u32 SectorAddr, uint16_t volume_k,uint16_t volume_b,unsigned char *file_name)
{
uint8_t buffer[4096];
uint16_t i=0,j=0;
uint16_t k4=0;
k4 = volume_k / 4;
LCD_DispStr(5, 5, (uint8_t *)"please wait...", RED);
for(i=0;i < k4+1; i++)
{
SPI_FLASH_SectorErase(SectorAddr + 4096*i);
}
if(volume_k > 0)
{
for(i=0; i < volume_k ; i++)
{
GetGBKCode_from_sd(buffer,1024,SectorAddr, file_name);
for(j=0;j<1024;j++)
printf("%c",buffer[j]);
SPI_FLASH_BufferWrite(buffer, SectorAddr, 1024);
SectorAddr +=1024;
}
}
if(volume_b > 0)
{
GetGBKCode_from_sd(buffer,volume_b,SectorAddr, file_name);
for(j=0;j<volume_b;j++)
printf("%c",buffer[j]);
SPI_FLASH_BufferWrite(buffer, SectorAddr, volume_b);
}
LCD_DispStr(5, 5, (uint8_t *)"OK! ", RED);
} |
|