/**************************************************************************************************** //=========================================电源接线================================================// // LCD模块 STM32单片机 // VCC 接 DC5V/3.3V //电源 // GND 接 GND //电源地 //=======================================液晶屏数据线接线==========================================// //本模块默认数据总线类型为SPI总线 // LCD模块 STM32单片机 // SDA 接 PB15 //液晶屏SPI总线数据写信号 //=======================================液晶屏控制线接线==========================================// // LCD模块 STM32单片机 // LED 接 PB9 //液晶屏背光控制信号,如果不需要控制,接5V或3.3V // SCK 接 PB13 //液晶屏SPI总线时钟信号 // A0 接 PB10 //液晶屏数据/命令控制信号 // RESET 接 PB12 //液晶屏复位控制信号 // CS 接 PB11 //液晶屏片选控制信号 //=========================================触摸屏触接线=========================================// //如果模块不带触摸功能或者带有触摸功能,但是不需要触摸功能,则不需要进行触摸屏接线 // LCD模块 STM32单片机 // T_IRQ 接 PC10 //触摸屏触摸中断信号 // T_DO 接 PC2 //触摸屏SPI总线读信号 // T_DIN 接 PC3 //触摸屏SPI总线写信号 // T_CS 接 PC13 //触摸屏片选控制信号 // T_CLK 接 PC0 //触摸屏SPI总线时钟信号 **************************************************************************************************/ /* @attention * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, QD electronic SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. **************************************************************************************************/ #include "lcd.h" #include "gui.h" #include "test.h" #include "pic.h" #include "main.h" //========================variable==========================// uint16_t ColorTab[5]={RED,GREEN,BLUE,YELLOW,BRED};//定义颜色数组 //=====================end of variable======================// /***************************************************************************** * @name :void DrawTestPage(uint8_t *str) * @date :2018-08-09 * @function :Drawing test interface * @parameters :str:the start address of the Chinese and English strings * @retvalue :None ******************************************************************************/ void DrawTestPage(uint8_t *str) { //绘制固定栏up LCD_Clear(WHITE); LCD_Fill(0,0,lcddev.width,20,BLUE); //绘制固定栏down LCD_Fill(0,lcddev.height-20,lcddev.width,lcddev.height,BLUE); POINT_COLOR=WHITE; Gui_StrCenter(0,2,WHITE,BLUE,str,16,1);//居中显示 Gui_StrCenter(0,lcddev.height-18,WHITE,BLUE,"www.lcdwiki.com",16,1);//居中显示 //绘制测试区域 //LCD_Fill(0,20,lcddev.width,lcddev.height-20,WHITE); } /***************************************************************************** * @name :void main_test(void) * @date :2018-08-09 * @function :Drawing the main Interface of the Comprehensive Test Program * @parameters :None * @retvalue :None ******************************************************************************/ void main_test(void) { DrawTestPage("综合测试程序"); Gui_StrCenter(0,23,RED,BLUE,"全动电子",16,1);//居中显示 Gui_StrCenter(0,40,RED,BLUE,"综合测试程序",16,1);//居中显示 Gui_StrCenter(0,57,GREEN,BLUE,"1.8\" ST7735S",16,1);//居中显示 Gui_StrCenter(0,74,GREEN,BLUE,"128X160",16,1);//居中显示 Gui_StrCenter(0,91,BLUE,BLUE,"2018-08-22",16,1);//居中显示 HAL_Delay(1500); HAL_Delay(1500); } /***************************************************************************** * @name :void Test_Color(void) * @date :2018-08-09 * @function :Color fill test(white,black,red,green,blue) * @parameters :None * @retvalue :None ******************************************************************************/ void Test_Color(void) { //DrawTestPage("测试1:纯色填充测试"); LCD_Fill(0,0,lcddev.width,lcddev.height,WHITE); Show_Str(20,30,BLUE,YELLOW,"BL Test",16,1);HAL_Delay(800); LCD_Fill(0,0,lcddev.width,lcddev.height,RED); Show_Str(20,30,BLUE,YELLOW,"RED ",16,1);HAL_Delay(800); LCD_Fill(0,0,lcddev.width,lcddev.height,GREEN); Show_Str(20,30,BLUE,YELLOW,"GREEN ",16,1);HAL_Delay(800); LCD_Fill(0,0,lcddev.width,lcddev.height,BLUE); Show_Str(20,30,RED,YELLOW,"BLUE ",16,1);HAL_Delay(800); } /***************************************************************************** * @name :void Test_FillRec(void) * @date :2018-08-09 * @function :Rectangular display and fill test Display red,green,blue,yellow,pink rectangular boxes in turn, 1500 milliseconds later, Fill the rectangle in red,green,blue,yellow and pink in turn * @parameters :None * @retvalue :None ******************************************************************************/ void Test_FillRec(void) { uint8_t i=0; DrawTestPage("GUI矩形填充测试"); LCD_Fill(0,20,lcddev.width,lcddev.height-20,WHITE); for (i=0; i<5; i++) { POINT_COLOR=ColorTab[i]; LCD_DrawRectangle(lcddev.width/2-40+(i*16),lcddev.height/2-40+(i*13),lcddev.width/2-40+(i*16)+30,lcddev.height/2-40+(i*13)+30); } HAL_Delay(1500); LCD_Fill(0,20,lcddev.width,lcddev.height-20,WHITE); for (i=0; i<5; i++) { POINT_COLOR=ColorTab[i]; LCD_DrawFillRectangle(lcddev.width/2-40+(i*16),lcddev.height/2-40+(i*13),lcddev.width/2-40+(i*16)+30,lcddev.height/2-40+(i*13)+30); } HAL_Delay(1500); } /***************************************************************************** * @name :void Test_Circle(void) * @date :2018-08-09 * @function :circular display and fill test Display red,green,blue,yellow,pink circular boxes in turn, 1500 milliseconds later, Fill the circular in red,green,blue,yellow and pink in turn * @parameters :None * @retvalue :None ******************************************************************************/ void Test_Circle(void) { uint8_t i=0; DrawTestPage("GUI画圆填充测试"); LCD_Fill(0,20,lcddev.width,lcddev.height-20,WHITE); for (i=0; i<5; i++) gui_circle(lcddev.width/2-40+(i*15),lcddev.height/2-25+(i*13),ColorTab[i],15,0); HAL_Delay(1500); LCD_Fill(0,20,lcddev.width,lcddev.height-20,WHITE); for (i=0; i<5; i++) gui_circle(lcddev.width/2-40+(i*15),lcddev.height/2-25+(i*13),ColorTab[i],15,1); HAL_Delay(1500); } /***************************************************************************** * @name :void English_Font_test(void) * @date :2018-08-09 * @function :English display test * @parameters :None * @retvalue :None ******************************************************************************/ void English_Font_test(void) { DrawTestPage("英文显示测试"); Show_Str(10,22,BLUE,YELLOW,"6X12:abcdefgh01234567",12,0); Show_Str(10,34,BLUE,YELLOW,"6X12:ABCDEFGH01234567",12,1); Show_Str(10,47,BLUE,YELLOW,"6X12:~!@#$%^&*()_+{}:",12,0); Show_Str(10,60,BLUE,YELLOW,"8X16:abcde01234",16,0); Show_Str(10,76,BLUE,YELLOW,"8X16:ABCDE01234",16,1); Show_Str(10,92,BLUE,YELLOW,"8X16:~!@#$%^&*()",16,0); HAL_Delay(1200); } /***************************************************************************** * @name :void Test_Triangle(void) * @date :2018-08-09 * @function :triangle display and fill test Display red,green,blue,yellow,pink triangle boxes in turn, 1500 milliseconds later, Fill the triangle in red,green,blue,yellow and pink in turn * @parameters :None * @retvalue :None ******************************************************************************/ void Test_Triangle(void) { uint8_t i=0; DrawTestPage("GUI Tri填充测试"); LCD_Fill(0,20,lcddev.width,lcddev.height-20,WHITE); for(i=0;i<5;i++) { POINT_COLOR=ColorTab[i]; Draw_Triangel(lcddev.width/2-40+(i*15),lcddev.height/2-12+(i*11),lcddev.width/2-25-1+(i*15),lcddev.height/2-12-26-1+(i*11),lcddev.width/2-10-1+(i*15),lcddev.height/2-12+(i*11)); } HAL_Delay(1500); LCD_Fill(0,20,lcddev.width,lcddev.height-20,WHITE); for(i=0;i<5;i++) { POINT_COLOR=ColorTab[i]; Fill_Triangel(lcddev.width/2-40+(i*15),lcddev.height/2-12+(i*11),lcddev.width/2-25-1+(i*15),lcddev.height/2-12-26-1+(i*11),lcddev.width/2-10-1+(i*15),lcddev.height/2-12+(i*11)); } HAL_Delay(1500); } /***************************************************************************** * @name :void Chinese_Font_test(void) * @date :2018-08-09 * @function :chinese display test * @parameters :None * @retvalue :None ******************************************************************************/ void Chinese_Font_test(void) { DrawTestPage("中文显示测试"); Show_Str(10,25,BLUE,YELLOW,"16X16:全动电子欢迎",16,0); Show_Str(10,45,BLUE,YELLOW,"24X24:中文测试",24,1); Show_Str(10,70,BLUE,YELLOW,"32X32:字体测试",32,1); HAL_Delay(1200); } /***************************************************************************** * @name :void Pic_test(void) * @date :2018-08-09 * @function :picture display test * @parameters :None * @retvalue :None ******************************************************************************/ void Pic_test(void) { DrawTestPage("图片显示测试"); //LCD_Fill(0,20,lcddev.width,lcddev.height-20,WHITE); Gui_Drawbmp16(20,30,gImage_qq); Show_Str(20+12,75,BLUE,YELLOW,"QQ",16,1); Gui_Drawbmp16(70,30,gImage_qq); Show_Str(70+12,75,BLUE,YELLOW,"QQ",16,1); // Gui_Drawbmp16(150,30,gImage_qq); // Show_Str(150+12,75,BLUE,YELLOW,"QQ",16,1); HAL_Delay(1200); } /***************************************************************************** * @name :void Rotate_Test(void) * @date :2018-08-09 * @function :rotate test * @parameters :None * @retvalue :None ******************************************************************************/ void Rotate_Test(void) { uint8_t i=0; uint8_t *Direction[4]={"Rotation:0","Rotation:90","Rotation:180","Rotation:270"}; for(i=0;i<4;i++) { LCD_direction(i); DrawTestPage("屏幕旋转测试"); Show_Str(20,30,BLUE,YELLOW,Direction[i],16,1); Gui_Drawbmp16(30,50,gImage_qq); HAL_Delay(1000);HAL_Delay(1000); } LCD_direction(USE_HORIZONTAL); }