SPI_FLASH_Init();
LCD_Initializtion();
SPI_FLASH_Test();
SSTF016B_Erase( BMP_ADDR/SEC_SIZE , ( BMP_ADDR+sizeof(BMP_DATA) )/SEC_SIZE +1 ); /* D′֮ǰòaÏèË¢3y */
LCD_Clear(Black);
GUI_Text(40,152,"Writing To SPI Flash",White,Black);
df_write_open( BMP_ADDR ); /* òaD′μÄ3õê¼μØÖ· */
for(count=0;count
{
df_write( (uint8_t*)&BMP_DATA[count*255],255);
df_write_close();
}
df_write( (uint8_t*)&BMP_DATA[count*255],sizeof(BMP_DATA)%255);
df_write_close();
/* °ÑD′èëSPI FlashμÄBMPí¼Æ¬êy¾Y¶á3öà′ */
df_read_open( BMP_ADDR ); /* í¼Æ¬μÄ3õê¼μØÖ· μ±Ç°¶áμÄ3õê¼μØÖ·*/
df_read( (uint8_t *)&bmp, sizeof(bmp));/*¶áFLASHoˉê * Input : - buf: ½óêüêy¾YμÄÖ¸Õë y- size: ¶áè¡êy¾YμÄ′óD¡ */
if( (bmp.pic_head[0]=='B') && (bmp.pic_head[1]=='M') ) /* èç1ûêÇBMPí¼Æ¬ */
{
uint16_t tx,ty;
uint8_t buffer[1024];
df_read_seek( BMP_ADDR + ( bmp.pic_data_address_h<<16 | bmp.pic_data_address_l ) ); /* ìø1yÎTóÃμÄêy¾Y */
for(ty=0;ty
{
df_read( &buffer[0] , (bmp.pic_w_l)*3 );/*bmp.pic_w_l ÕÕƬμÄμãêy*/
for(tx=0;tx
{
point.r = *(tx*3 +2+buffer);
point.g = *(tx*3 +1+buffer);
point.b = *(tx*3 +0+buffer);
point.x = tx;
point.y = ty;
LCD_SetPoint(point.x ,319-point.y,RGB565CONVERT(point.r,point.g,point.b));
}
}
}
这个程序很清楚的表明了通过spi的方式对 外部flash sst25vf016b的读写操作,希望对有兴趣的同学有帮助
阅读(2674) | 评论(0) | 转发(1) |