网站做快捷方式,西安人才网官网,百度一下官网首页百度,精准营销的特征一、相关软件包安装
1、打开cubemx包管理器 2、安装F4软件包 3、安装touchgfx软件包 二、工程配置
1、新建工程 2、sys配置 3、rcc配置 4、crc配置 5、添加touchgfx软件包 6、配置touchgfx软件包 将width和height改为自己屏幕尺寸
7、生成工程 三、代码修改
1、将屏幕相关驱…一、相关软件包安装
1、打开cubemx包管理器 2、安装F4软件包 3、安装touchgfx软件包 二、工程配置
1、新建工程 2、sys配置 3、rcc配置 4、crc配置 5、添加touchgfx软件包 6、配置touchgfx软件包 将width和height改为自己屏幕尺寸
7、生成工程 三、代码修改
1、将屏幕相关驱动加载到工程 2、修改头文件支持c
在头文件中加入
#ifdef __cplusplus
extern C {
#endif#ifdef __cplusplus
}
#endif 3、修改touchgfx源码
a、修改TouchGFXHAL.cpp文件中的void TouchGFXHAL::flushFrameBuffer(const touchgfx::Rect rect)函数将数据刷新到屏幕
void TouchGFXHAL::flushFrameBuffer(const touchgfx::Rect rect)
{volatile uint16_t* buffer getClientFrameBuffer()(rect.y*DISPLAY_WIDTH)rect.x;uint16_t height,i;LCD_Address_Set(rect.x,rect.y,rect.xrect.width-1,rect.yrect.height-1);LCD_WR 1;for(height0;heightrect.height;height){for(i0;irect.width;i){//LCD_Write_HalfWord(buffer[i]);SPI1-DR buffer[i]8; while((SPI1-SR11)0);SPI1-DR (u8)buffer[i]; while((SPI1-SR11)0);}buffer DISPLAY_WIDTH;}}a、修改TouchGFXHAL.cpp文件中的新添加touchgfxTickHandler函数为touchgfx提供时钟。在1ms定时器中调用。提供的时钟为20ms屏幕刷新为50hz。
extern C void touchgfxTickHandler()
{static uint8_t ms 0;static uint8_t isHigh 0;if(isInited){ms;if(ms10){ms 0;isHigh !isHigh;if(isHigh){HAL::getInstance()-vSync();OSWrappers::signalVSync();HAL::getInstance()-swapFrameBuffers();}else{HAL::getInstance()-frontPorchEntered();} }}
} c、在1ms的定时器中调用touchgfxTickHandler函数 四、完整工程下载 完整工程点击我下载