WordPress网站修改东莞快速网站制作哪家强
WordPress网站修改,东莞快速网站制作哪家强,国内贸易平台,帮做简历哪个网站好本篇讲述驱动LCD显示。 一.原理 开发板使用204*240 RGB LCD。原理如下 二.代码准备 1.GPIO引脚配置如下#xff0c;主要是复位引脚、背光引脚、电源控制引脚。 2.LCD FMC接口配置 至此#xff0c;实现硬件引脚配置。后面以STM32Cube MCU Packages安装包下的BSP库为…本篇讲述驱动LCD显示。一.原理开发板使用204*240 RGB LCD。原理如下二.代码准备1.GPIO引脚配置如下主要是复位引脚、背光引脚、电源控制引脚。2.LCD FMC接口配置至此实现硬件引脚配置。后面以STM32Cube MCU Packages安装包下的BSP库为基础代码展开。3.LCD初始化。在SystemHardwareInit函数内实现包含GPIO引脚初始化与设置复制staticvoidSystemHardwareInit(void){/*......*/LCD_UTILS_Drv_t lcdDrv;/* Set UTIL_LCD functions */lcdDrv.DrawBitmap BSP_LCD_DrawBitmap;lcdDrv.FillRGBRect BSP_LCD_FillRGBRect;lcdDrv.DrawHLine BSP_LCD_DrawHLine;lcdDrv.DrawVLine BSP_LCD_DrawVLine;lcdDrv.FillRect BSP_LCD_FillRect;lcdDrv.GetPixel BSP_LCD_ReadPixel;lcdDrv.SetPixel BSP_LCD_WritePixel;lcdDrv.GetXSize BSP_LCD_GetXSize;lcdDrv.GetYSize BSP_LCD_GetYSize;lcdDrv.SetLayer BSP_LCD_SetActiveLayer;lcdDrv.GetFormat BSP_LCD_GetFormat;UTIL_LCD_SetFuncDriver(lcdDrv);/* Clear the LCD */UTIL_LCD_Clear(UTIL_LCD_COLOR_WHITE);/* Set the display on */if(BSP_LCD_DisplayOn(0) ! BSP_ERROR_NONE){Error_Handler();}}4.LCD刷屏显示红、绿、蓝复制UTIL_LCD_FillRect(0, 0, 240, 240, UTIL_LCD_COLOR_RED);HAL_Delay(1000);UTIL_LCD_FillRect(0, 0, 240, 240, UTIL_LCD_COLOR_GREEN);HAL_Delay(1000);UTIL_LCD_FillRect(0, 0, 240, 240, UTIL_LCD_COLOR_BLUE);HAL_Delay(1000);5.LCD显示字符串复制UTIL_LCD_SetFont(Font16);/* Set the LCD Text Color */UTIL_LCD_SetBackColor(UTIL_LCD_COLOR_LIGHTMAGENTA);UTIL_LCD_SetTextColor(UTIL_LCD_COLOR_BLUE);UTIL_LCD_FillRect(0,0,240,30, UTIL_LCD_COLOR_LIGHTMAGENTA);/* Display LCD messages */UTIL_LCD_DisplayStringAt(0,10, (uint8_t*)STM32L562E-DK Board, CENTER_MODE);6.LCD显示图像(1)制作200*200像素图片使用Image2Lcd工具加载设置如下图所示生成图像数组。(2)编写画图函数复制voidLCD_ShowPicture(uint16_tx,uint16_ty,uint16_tcolumn,uint16_trow,uint32_t*pic){uint16_tm,h;uint32_t*data(uint32_t*)pic;for(h0y;hrowy;h)//60{for(m0x;mcolumnx;m)//180{// LCD_Fast_DrawPoint(m,h,*data);UTIL_LCD_SetPixel(m,h,*data);}}}7.main函数复制intmain(void){/* STM32L5xx HAL library initialization:- Systick timer is configured by default as source of time base, but usercan eventually implement his proper time base source (a general purposetimer for example or other time source), keeping in mind that Time baseduration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined andhandled in milliseconds basis.- Set NVIC Group Priority to 3- Low Level Initialization*/HAL_Init();/* Configure the System clock to have a frequency of 110 MHz */SystemClock_Config();/* For better performances, enable the instruction cache in 1-way direct mapped mode */HAL_ICACHE_ConfigAssociativityMode(ICACHE_1WAY);if(HAL_ICACHE_Enable() ! HAL_OK){/* Initialization Error */Error_Handler();}/* System common Hardware components initialization (Leds, button, joystick and LCD) */SystemHardwareInit();UTIL_LCD_FillRect(0,0,240,240, UTIL_LCD_COLOR_RED);HAL_Delay(5000);UTIL_LCD_FillRect(0,0,240,240, UTIL_LCD_COLOR_GREEN);HAL_Delay(5000);UTIL_LCD_FillRect(0,0,240,240, UTIL_LCD_COLOR_BLUE);HAL_Delay(5000);/* Clear the LCD */UTIL_LCD_Clear(UTIL_LCD_COLOR_WHITE);UTIL_LCD_SetFont(Font16);/* Set the LCD Text Color */UTIL_LCD_SetBackColor(UTIL_LCD_COLOR_WHITE);UTIL_LCD_SetTextColor(UTIL_LCD_COLOR_BLACK);//UTIL_LCD_COLOR_BLACK//UTIL_LCD_COLOR_BLUE// UTIL_LCD_FillRect(0, 0, 240, 30, UTIL_LCD_COLOR_LIGHTMAGENTA);/* Display LCD messages */UTIL_LCD_DisplayStringAt(0,10, (uint8_t*)STM32L562E-DK Board, CENTER_MODE);// UTIL_LCD_SetBackColor(UTIL_LCD_COLOR_LIGHTMAGENTA);// UTIL_LCD_FillRect(0, 18, 240, 19, UTIL_LCD_COLOR_LIGHTMAGENTA);UTIL_LCD_DrawHLine(0,25,240,UTIL_LCD_COLOR_LIGHTMAGENTA);//UTIL_LCD_DrawBitmap(0, 0, (uint8_t *)gImage_1);LCD_ShowPicture(20,40,200,200,(uint32_t*)gImage_1);HAL_Delay(100);/* Infinite loop */while(1){}}三.测试编译烧录后。LCD分别显示红绿蓝刷品显示字符串及图像。效果如下。ps资源图片。---------------------作者dirty123链接https://bbs.21ic.com/forum.php?modviewthreadtid3435986来源21ic.com此文章已获得原创/原创奖标签著作权归21ic所有任何人未经允许禁止转载。