STM32F765@216MHz flash STemWin Demo [code] [video]
[Copy link]
This post was last edited by Kεnny on 2019-2-22 10:13 This article is public from "STM32F765@216MHz output I2S test ES9023P audio listening experience " link (https://en.eeworld.com/bbs/thread-1069926-1-1.html) The author's development board uses STM32F765VIT6@216MHz, and can use STemWin for free. As for what STemWin is, it is the ST authorized version of emWin, and the predecessor of emWin is the ancient ucGUI. Speaking of ucGUI, we have to talk about the porting of ucGUI, just like talking about high-end computer software, we have to talk about how to install and uninstall it. The steps are as follows: (1) Prepare the ucGUI source code, copy the ./Start/GUI directory, the ./Start/Config directory, and the ./Sample/GUIDemo directory to the project directory, and copy the two files GUI_X.c and GUI_X_Touch.c in the ./Sample/GUI_X directory to the Config directory to get the following structure: (2) Configure the parameters in LCDConf.h and GUIConf.h, and redefine the LCD_INIT_CONTROLLER() macro. (3) Implement the LCD_L0_SetPixelIndex() and LCD_L0_GetPixelIndex() methods in LCDDummy.c, and increase the variable OS_TimeMS in GUI_X.c by 1ms. Now ucGUI can run! (4) Optimization: Optimizing LCD_L0_XorPixel(), LCD_L0_DrawHLine(), LCD_L0_DrawVLine(), and LCD_L0_FillRect() can significantly improve the screen refresh speed (5) Support TouchPanel: Based on this project, enable the GUI_SUPPORT_TOUCH macro in GUIConf.h, and implement the GUI_TOUCH_X_MeasureX() and GUI_X_Touch_X_MeasureX() in GUI_X_Touch.c. The GUI_TOUCH_X_MeasureY() method configures the calibration parameters such as GUI_TOUCH_AD_LEFT in GUITouchConf.h, and refreshes GUI_TOUCH_Exec() and GUI_Exec() regularly /****************************************************************************************/ We have gone off topic, let's get back to the topic, let's talk about the porting of STemWin. To put it bluntly, it is similar to ucGUI. Steps: (1) Prepare a copy of the STemWin source code and create the following directory: Copy all the files in the ./inc directory in the source code to the inc directory, Copy the files in the ./Config directory, such as the files selected in the figure below, to the Config directory, and rename LCDConf_FlexColor_Template.c and LCDConf_FlexColor_Template.h to LCDConf.c and LCDConf.h:
Copy STemWin540_CM7_Keil.lib from the ./Lib directory to the lib directory, because the author of this article uses Keil, not OS, and no optimization. Copy GUI_X.c from the ./OS directory to the os directory. To the ST Cube package, find a STemWin application and copy the entire /GUIDemo from the directory to the project directory. (2) Change the GUI_NUMBYTES macro in GUIConf.c to a smaller size. The author changed it to 110Kbyte, originally 2Mbyte. Check in GUIConf.h that all macros are enabled. 402871 (3) LCDConf.c configures the macros XSIZE_PHYS and YSIZE_PHYS to actual physical pixels. The author uses a 320*240 TFT and changes them to 320 and 240; rewrites the LCD_X_Config() method and adds the driver function to initialize the LCD in LCD_X_DisplayDriver() (note to add the header file), deletes other useless ones, and the compilation macro #ifndef LCDCONF_H in LCDConf.h does not need to be changed. (4) Here comes the key point. In GUIDRV_Template.c, implement _SetPixelIndex() and _GetPixelIndex(). Optimizing _XorPixel(), _FillRect(), _DrawHLine(), _DrawVLine(), and _DrawBitLine16BPP() can significantly improve the screen refresh speed. GUIDRV_Template.h can remain unchanged. Increase the variable OS_TimeMS in GUI_X.c by 1ms. So far, the Demo can be run in main() (5) Support TouchPanel: Create a new C file in the Config directory and give it a random name. The author named itGUI_X_Touch.c. Include "GUI.h", and implement the GUI_TOUCH_X_MeasureX() and GUI_TOUCH_X_MeasureY() methods. And refresh GUI_TOUCH_Exec() regularly. Remember to refresh GUI_TOUCH_Exec() after initializing the GUI. If you refresh it without initializing the GUI, it will crash. This is because C does not support object-oriented encapsulation, which requires us to strictly encode state machines. Global variables are everywhere and readability is poor. (6) In GUIDemo.h, Configure of modules to be used, select the Demo module you like, and run GUIDEMO_Main() in main(). [Finally, you need to enable CRC check before running STemWin, otherwise it will not start.] The author's STM32F765@216MHz development board, LCD driver is ssd1289, TP chip is xpt2046, running STemWin to flash Demo effect: If you can't watch the video, please copy the link to view it separately (http://v.youku.com/v_show/id_XNDA3MjE0ODc2MA==.html?x&sharefrom=android&sharekey=37b6469da8c81ab492547be5ab6f27398) The author did not use OS, and used the standard HAL project established by CubeMX. As usual, I offer it to you for your use: [Attachment, project compression package, copy the link to open it to download ] https://en.eeworld.com/bbs/forum.php?mod=attachment&aid=NDAyODczfGJiMWI0ODcxYjIzNGJhZTk5MmI1ZmI1YjhiODQ0MzUzfDE3MzE2NzgyNDU%3D&request=yes&_f=.7z This content is originally created by Kεnny, a netizen of EEWORLD forum. If you want to reprint or use it for commercial purposes, you need to obtain the author's consent and indicate the source.
|