STemWin是SEGGER公司授权给ST(意法半导体)的。使用ST芯片的用户可以免费使用STemWin。
下F7的CUBE中就有STemWin的目录
我的在F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Middlewares\ST\STemWin
先建立两个工程子目录:
GUI_CONFIG
GUI_LIB
得用个能显示图片的例程就选上次的JPEG,这样图像初始化就省下了
工程路径:
F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Projects\STM32F769I-Discovery\Examples\JPEG\JPEG_DecodingUsingFs_DMA
在GUI_LIB子目录中加入库文件:
STemWin532_CM7_IAR.a
路径:F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Middlewares\ST\STemWin\Lib
在GUI_CONFIG中加入如下:
STM32769I_DISCO_STemWin_Addons_IAR.a
路径F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Projects\STM32F769I-Discovery\Demonstration\STemWin_Addons
GUI_X.c
路径F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Projects\STM32F769I-Discovery\Demonstration\Config
GUIConf.c
路径F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Projects\STM32F769I-Discovery\Demonstration\Config
LCDConf_CmdMode_TE.c
路径:F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Middlewares\ST\STemWin\OS
加完后的情况如下图:
然后在MAIN.c中修改下显示的内容:
- /* Includes ------------------------------------------------------------------*/
- #include "main.h"
- #include "stm32F769i_discovery.h"
- #include "stm32F769i_discovery_ts.h"
- #include "GUI.h"
- /** @addtogroup STM32F7xx_HAL_Examples
- * @{
- */
- /** @addtogroup JPEG_DecodingUsingFs_DMA
- * @{
- */
- /* Private typedef -----------------------------------------------------------*/
- /* Private define ------------------------------------------------------------*/
- #if (JPEG_RGB_FORMAT == JPEG_ARGB8888)
- #define BYTES_PER_PIXEL 4 /* Number of bytes in a pixel */
- #elif (JPEG_RGB_FORMAT == JPEG_RGB888)
- #define BYTES_PER_PIXEL 3 /* Number of bytes in a pixel */
- #elif (JPEG_RGB_FORMAT == JPEG_RGB565)
- #define BYTES_PER_PIXEL 2 /* Number of bytes in a pixel */
- #else
- #error "unknown JPEG_RGB_FORMAT "
- #endif /* JPEG_RGB_FORMAT */
- /* Private macro -------------------------------------------------------------*/
- /* Private variables ---------------------------------------------------------*/
- FATFS SDFatFs; /* File system object for SD card logical drive */
- char SDPath[4]; /* SD card logical drive path */
- FIL JPEG_File; /* File object */
- uint32_t JpegProcessing_End = 0;
- static uint32_t LCD_X_Size = 0;
- JPEG_HandleTypeDef JPEG_Handle;
- static DMA2D_HandleTypeDef DMA2D_Handle;
- static JPEG_ConfTypeDef JPEG_Info;
- /* Private function prototypes -----------------------------------------------*/
- static void SystemClock_Config(void);
- static void LCD_BriefDisplay(void);
- static void LCD_FileErrorDisplay(void);
- static void DMA2D_CopyBuffer(uint32_t *pSrc, uint32_t *pDst, uint16_t x, uint16_t y, uint16_t xsize, uint16_t ysize);
- static void CPU_CACHE_Enable(void);
- extern void LCD_SetUpdateRegion(int idx);
- extern void LCD_ReqTear(void);
- extern void DSI_IRQHandler(void);
- /* Private functions ---------------------------------------------------------*/
- /**
- * [url=home.php?mod=space&uid=247401]@brief[/url] Main program
- * @param None
- * @retval None
- */
- int main(void)
- {
- uint32_t xPos = 0, yPos = 0;
- uint8_t lcd_status = LCD_OK;
-
- /* Enable the CPU Cache */
- CPU_CACHE_Enable();
- /* STM32F7xx HAL library initialization:
- - Configure the Flash ART accelerator on ITCM interface
- - Systick timer is configured by default as source of time base, but user
- can eventually implement his proper time base source (a general purpose
- timer for example or other time source), keeping in mind that Time base
- duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
- handled in milliseconds basis.
- - Set NVIC Group Priority to 4
- - Low Level Initialization
- */
- HAL_Init();
-
- /* Configure the system clock to 200 MHz */
- SystemClock_Config();
- /* Initialize the LED1 (Red LED , set to On when error) */
- BSP_LED_Init(LED1);
- /*##-1- JPEG Initialization ################################################*/
- /* Init The JPEG Look Up Tables used for YCbCr to RGB conversion */ /* Init The JPEG Color Look Up Tables used for YCbCr to RGB conversion */
- JPEG_InitColorTables();
- /* Init the HAL JPEG driver */
- JPEG_Handle.Instance = JPEG;
- HAL_JPEG_Init(&JPEG_Handle);
- /*##-2- LCD Configuration ##################################################*/
- /* Initialize the LCD */
- lcd_status = BSP_LCD_Init();
- if(lcd_status != LCD_OK)
- {
- OnError_Handler();
- }
-
-
- __HAL_RCC_CRC_CLK_ENABLE();
- __HAL_RCC_BKPSRAM_CLK_ENABLE();
- GUI_Init();
-
- GUI_SetLayerVisEx (1, 0);
- GUI_SelectLayer(0);
- GUI_SetBkColor(GUI_BLUE);
- GUI_Clear();
- GUI_DispStringAt(" STM32F769I Discovery",60,40);
- GUI_SetFont(&GUI_Font32B_ASCII);
- GUI_DispStringAt("Hello world! www.21ic.com", 0, 180);
- GUI_SetFont(&GUI_FontD48);
- GUI_DispStringAt("1234567890", 0, 250);
- /* Infinite loop */
- while (1)
- {
- }
- }
最后运行的结果如下:
到此在IAR上STemwin移植成功,至于更多功能,得慢慢体验了。
|