|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2011-4-18 13:54:11
|
显示全部楼层
拍了张照片,显示的是239×320的图片,显示有问题。如果是240×320则正常。
![](http://cache.amobbs.com/bbs_upload782111/files_38/ourdev_631729G7IL9E.jpg)
(原文件名:未标题-1.jpg)
相关程序:
void lcd_set_window(u_int16 startx,u_int16 starty,u_int16 endx,u_int16 endy)
{
//----- Set GRAM horizontal & vertical start address to startx,starty respectively -----
lcd_set_cursor(startx,starty);
//----- Set the horizontal start address of window -----
lcd_write_reg(R50,startx);
//----- Set the horizontal end address of window -----
lcd_write_reg(R51,endx);
//----- Set the vertical start address of window -----
lcd_write_reg(R52,starty);
//----- Set the vertical address of window -----
lcd_write_reg(R53,endy);
}
void draw_bitmap_inram(u_int16 x1,u_int16 y1,u_int16 x2,u_int16 y2,u_int16 *pic)
{
u_int32 i;
u_int32 size;
u_int16 *adr;
u_int32 remainder;
u_int32 wsize;
//----- word size of bitmap image datas -----
size = (((u_int32)(x2 - x1) + 1) * ((u_int32)(y2 - y1) + 1) * 2);
lcd_write_reg(R03,0x10b0);
lcd_set_window(x1,y1,x2,y2);
lcd_set_cursor(x1,y1);
lcd_gram_access_set(); // Set R22 to Index register,prepare to write GRAM
//----- DMA Transfer -----
if((size / 2) > 0xff00)
{
DMA_Start(0,pic,(u_int16*)LCD_BASE_ADR,0xff00,0x09,FALSE);
//----- the byte size that has been transfered -----DMA一次性最多发0xffff个数据
wsize = ((u_int32)0xff00 << 1);
//----- the word size of remain to be transfered ----
remainder = (size - wsize) / 2;
//----- the address of bitmap image datas remain to be transfered in FROM -----
adr = (u_int16*)((u_int32)pic + (u_int32)wsize);
//----- Transfer bitmap image datas from FROM to LCD GRAM,2byte/per transfer----
DMA_Start(0,adr,(u_int16*)LCD_BASE_ADR,(DWORD)remainder,0x09,FALSE);
}
else
{
DMA_Start(0,pic,(u_int16*)LCD_BASE_ADR,size / 2,0x09,FALSE);
}
// backlight_brightness_set(BACK_LIGHT_CYCLE,BACK_LIGHT_DUTY);
} |
|