Skip to content

Commit dcf9c9e

Browse files
author
scpcom
committed
LCD: add LCD_WritePictureLE
1 parent 05e7ace commit dcf9c9e

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

libraries/LCD/src/lcd.c

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ void LCD_ShowNum1(u16 x,u16 y,float num,u8 len,u16 color)
832832

833833

834834
/******************************************************************************
835-
Function description: display 16bit (RGB565) picture buffer
835+
Function description: display 16bit (RGB565 big endian) picture buffer
836836
Entry data: x1, y2 starting point coordinates
837837
x2, y2 terminating coordinates
838838
Return value: None
@@ -851,23 +851,38 @@ void LCD_WritePicture(u16 x1,u16 y1,u16 x2,u16 y2, unsigned char* img)
851851
}
852852

853853
/******************************************************************************
854-
Function description: display 160x40 16bit (RGB565) picture
854+
Function description: display 160x40 16bit (RGB565 big endian) picture
855855
Entry data: x, y starting point coordinates
856856
Return value: None
857857
******************************************************************************/
858858
void LCD_ShowPicture(u16 x1,u16 y1,u16 x2,u16 y2)
859859
{
860-
LCD_WritePicture(x1,y1,x2,y2,&image);
860+
LCD_WritePicture(x1,y1,x2,y2,(unsigned char*)&image);
861861
}
862862

863-
void LCD_ShowLogo(void)
863+
/******************************************************************************
864+
Function description: display 16bit (RGB565 little endian) picture buffer
865+
Entry data: x1, y2 starting point coordinates
866+
x2, y2 terminating coordinates
867+
Return value: None
868+
******************************************************************************/
869+
void LCD_WritePictureLE(u16 x1,u16 y1,u16 x2,u16 y2, unsigned char* img)
864870
{
865871
int i;
866-
LCD_Address_Set(0,0,159,75);
867-
for(i=0;i<25600;i++)
872+
u16 w = x2-x1+1;
873+
u16 h = y2-y1+1;
874+
int s = w*h*2;
875+
LCD_Address_Set(x1,y1,x2,y2);
876+
for(i=0;i<s;i+=2)
868877
{
869-
LCD_WR_DATA8(logo_bmp[i]);
870-
}
878+
LCD_WR_DATA8(img[i+1]);
879+
LCD_WR_DATA8(img[i]);
880+
}
881+
}
882+
883+
void LCD_ShowLogo(void)
884+
{
885+
LCD_WritePictureLE(0,0,159,75,(unsigned char*)&logo_bmp);
871886
}
872887

873888
void LCD_SetRotation(u8 rotation)

libraries/LCD/src/lcd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ u32 mypow(u8 m,u8 n);
117117
void LCD_ShowNum(u16 x,u16 y,u16 num,u8 len,u16 color);
118118
void LCD_ShowNum1(u16 x,u16 y,float num,u8 len,u16 color);
119119
void LCD_WritePicture(u16 x1,u16 y1,u16 x2,u16 y2, unsigned char* img);
120+
void LCD_WritePictureLE(u16 x1,u16 y1,u16 x2,u16 y2, unsigned char* img);
120121
void LCD_ShowPicture(u16 x1,u16 y1,u16 x2,u16 y2);
121122
void LCD_ShowLogo(void);
122123
void LCD_SetRotation(u8 rotation);

0 commit comments

Comments
 (0)