This paragraph is to explain how users can display a picture stored in an external SPI Flash.
Function:
LT768_DMA_24bit_Block(
unsigned char SCS, //CS of the SPI Flash -> SCS:0 or SCS:1
unsigned char Clk, //SPI Clock = System Clock / {(Clk+1) * 2} -> usually set to 0
unsigned short X1, //Start location of the picture on the LCD, left-top X coordinate
unsigned short Y1, //Start location of the picture on the LCD, left-top Y coordinate
unsigned short X_W, //Transfering Data Width
unsigned short Y_H, //Transfering Data height
unsigned short P_W, //Picture width
unsigned long Addr //Picture address in the SPI Flash
)
Example: To display an 1024x600 picture of 16bit color depths onto the LCD.
#include LT768.h
#include LT768_Lib.h
//Define Resolution
#define LCD_XSIZE_TFT 1024
#define LCD_YSIZE_TFT 600
//Define layers of the SDRAM in LT768x
#define layer1_start_addr 0
#define layer2_start_addr LCD_XSIZE_TFT*LCD_YSIZE_TFT*2
#define layer3_start_addr LCD_XSIZE_TFT*LCD_YSIZE_TFT*2*2
#define layer4_start_addr LCD_XSIZE_TFT*LCD_YSIZE_TFT*2*3
#define layer5_start_addr LCD_XSIZE_TFT*LCD_YSIZE_TFT*2*4
#define layer6_start_addr LCD_XSIZE_TFT*LCD_YSIZE_TFT*2*5
#define layer7_start_addr LCD_XSIZE_TFT*LCD_YSIZE_TFT*2*6
//Define picture address in the flash
#define Picture_1_Addr 0
int main(void)
{
LT768_Init(); //Initialize LT768x
Display_ON();
//Setting for the Display and the SRAM ///
Select_Main_Window_16bpp(); //Set the color depth
Main_Image_Start_Address(layer1_start_addr); //Set the start address of the
//LT768x SRAM
Main_Image_Width(LCD_XSIZE_TFT); //Set the width of the main window
Main_Image_Start_XY(0, 0); //Set the start coordinate of the
//main window
//Set the start address of the SRAM for programming the data from flash
Canvas_Image_Start_address(layer1_start_addr);
Canvas_Image_width(LCD_XSIZE_TFT); //Set the designated width of the
//SRAM
Active_Window_XY(0,0); //Set the start coordinate of the
//working area
Active_Window_WH(LCD_XSIZE_TFT, LCD_YSIZE_TFT); //Set the width and height of the
//working area
//End of Setting for the Display and the SRAM
//Display a picture stored in the external flash
LT768_DMA_24bit_Block(1, 0, 0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, LCD_XSIZE_TFT, Picture_1_Addr);
}
Running result: