# include "stm32f10x. H"
# include "./LCD/bsp_ili9341_lcd. H "
# include & lt; stdio.h>
The static void LCD_Test (void);
The static void Delay (__IO uint32_t nCount);
Void Printf_Charater (void);
Int main (void)
{
ILI9341_Init ();//LCD initialization
USART_Config();
While (1)
{
LCD_Test ();
}
}
/* for testing all kinds of LCD function */
Void LCD_Test (void)
{
/* demo shows variable */
The static uint8_t testCNT=0;
Char dispBuff [100].
TestCNT++;
LCD_SetFont (& amp; Font8x16);
LCD_SetColors (RED, BLACK);
ILI9341_Clear (0, 0, LCD_X_LENGTH LCD_Y_LENGTH);/* clear screen, show all black */
/* * * * * * * * show string sample * * * * * * */
ILI9341_DispStringLine_EN (LINE (0), "BH 3.2 _2. 8 inch LCD para:");
ILI9341_DispStringLine_EN (LINE (1), "the Image resolution: 240 x320 px");
ILI9341_DispStringLine_EN (LINE (2), "ILI9341 LCD driver");
ILI9341_DispStringLine_EN (LINE (3), "XPT2046 Touch Pad driver");
/* * * * * * * * show variable sample * * * * * * */
LCD_SetFont (& amp; Font16x24);
LCD_SetTextColor (GREEN);
/* * string using the c standard library variables/
Sprintf (dispBuff, "the Count: % d", testCNT);
LCD_ClearLine (LINE (4));/* clear single line */
/* and then display the string ", so do other variables processing */
ILI9341_DispStringLine_EN (LINE (4), dispBuff);
/* * * * * * * the graphics example * * * * * */
LCD_SetFont (& amp; Font24x32);
Draw a straight line/* */
LCD_ClearLine (LINE (4));/* clear single line */
LCD_SetTextColor (BLUE);
ILI9341_DispStringLine_EN (LINE (4), "the Draw the LINE:");
LCD_SetTextColor (RED);
ILI9341_DrawLine (50170210230);
ILI9341_DrawLine (50200210240);
LCD_SetTextColor (GREEN);
ILI9341_DrawLine (100170200230);
ILI9341_DrawLine (200200220240);
LCD_SetTextColor (BLUE);
ILI9341_DrawLine (110170110230);
ILI9341_DrawLine (130200220240);
Delay (0 XFFFFFF);
ILI9341_Clear (0 16th * 8, LCD_X_LENGTH, LCD_Y_LENGTH - 16 * 8);/* clear screen, show all black */
/* * draw rectangle/
LCD_ClearLine (LINE (4));/* clear single line */
LCD_SetTextColor (BLUE);
ILI9341_DispStringLine_EN (LINE (4), "the Draw the Rect:");
LCD_SetTextColor (RED);
ILI9341_DrawRectangle,30,1 (50200100);
LCD_SetTextColor (GREEN);
ILI9341_DrawRectangle,20,40,0 (160200);
LCD_SetTextColor (BLUE);
ILI9341_DrawRectangle,50,20,1 (170200);
Delay (0 XFFFFFF);
ILI9341_Clear (0 16th * 8, LCD_X_LENGTH, LCD_Y_LENGTH - 16 * 8);/* clear screen, show all black */
The circle is drawn on the/* */
LCD_ClearLine (LINE (4));/* clear single line */
LCD_SetTextColor (BLUE);
ILI9341_DispStringLine_EN (LINE (4), "the Draw Cir:");
LCD_SetTextColor (RED);
ILI9341_DrawCircle,20,0 (100200);
LCD_SetTextColor (GREEN);
ILI9341_DrawCircle,10,1 (100200);
LCD_SetTextColor (BLUE);
ILI9341_DrawCircle,20,0 (140200);
Delay (0 XFFFFFF);
ILI9341_Clear (0 16th * 8, LCD_X_LENGTH, LCD_Y_LENGTH - 16 * 8);/* clear screen, show all black */
}
The static void Delay (__IO uint32_t nCount)
{
For (; NCount!=0; NCount -);
}
CodePudding user response:
Atomic program of serial port 1, and must be initialized, and correct, otherwise is bad! Hopefully it's not like I had made the mistake!!!!!!CodePudding user response:
Because LCD_Init () have pinft serial output ID, if not in the main initialization Uart, or first LCD_Init () after the Uart_Init (), will appear after download without reaction;And initialize the serial port interrupt priority must be set system;