Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MEMDEV_MemDev.c
00001 /********************************************************************* 00002 * SEGGER Microcontroller GmbH * 00003 * Solutions for real time microcontroller applications * 00004 ********************************************************************** 00005 * * 00006 * (c) 1996 - 2018 SEGGER Microcontroller GmbH * 00007 * * 00008 * Internet: www.segger.com Support: support@segger.com * 00009 * * 00010 ********************************************************************** 00011 00012 ** emWin V5.48 - Graphical user interface for embedded applications ** 00013 All Intellectual Property rights in the Software belongs to SEGGER. 00014 emWin is protected by international copyright laws. Knowledge of the 00015 source code may not be used to write a similar product. This file may 00016 only be used in accordance with the following terms: 00017 00018 The software has been licensed to Cypress Semiconductor Corporation, 00019 whose registered office is situated at 198 Champion Ct. San Jose, CA 00020 95134 USA solely for the purposes of creating libraries for Cypress 00021 PSoC3 and PSoC5 processor-based devices, sublicensed and distributed 00022 under the terms and conditions of the Cypress End User License 00023 Agreement. 00024 Full source code is available at: www.segger.com 00025 00026 We appreciate your understanding and fairness. 00027 ---------------------------------------------------------------------- 00028 Licensing information 00029 Licensor: SEGGER Microcontroller Systems LLC 00030 Licensed to: Cypress Semiconductor Corp, 198 Champion Ct., San Jose, CA 95134, USA 00031 Licensed SEGGER software: emWin 00032 License number: GUI-00319 00033 License model: Services and License Agreement, signed June 10th, 2009 00034 Licensed platform: Any Cypress platform (Initial targets are: PSoC3, PSoC5) 00035 ---------------------------------------------------------------------- 00036 Support and Update Agreement (SUA) 00037 SUA period: 2009-06-12 - 2022-07-27 00038 Contact to extend SUA: sales@segger.com 00039 ---------------------------------------------------------------------- 00040 File : MEMDEV_MemDev.c 00041 Purpose : Simple demo shows the use of memory devices 00042 Requirements: WindowManager - ( ) 00043 MemoryDevices - (x) 00044 AntiAliasing - ( ) 00045 VNC-Server - ( ) 00046 PNG-Library - ( ) 00047 TrueTypeFonts - ( ) 00048 ---------------------------------------------------------------------- 00049 */ 00050 00051 #include "GUI.h" 00052 00053 /********************************************************************* 00054 * 00055 * Defines 00056 * 00057 ********************************************************************** 00058 */ 00059 // 00060 // Recommended memory to run the sample with adequate performance 00061 // 00062 #define RECOMMENDED_MEMORY (1024L * 30) 00063 00064 /******************************************************************* 00065 * 00066 * static variables 00067 * 00068 ******************************************************************** 00069 */ 00070 static GUI_RECT Rect = {0, 130, 100, 180}; 00071 00072 /******************************************************************* 00073 * 00074 * static code 00075 * 00076 ******************************************************************** 00077 */ 00078 /******************************************************************* 00079 * 00080 * _Draw 00081 */ 00082 static void _Draw(int Delay) { 00083 GUI_SetPenSize(5); 00084 GUI_SetColor(GUI_RED); 00085 GUI_DrawLine(Rect.x0 + 3, Rect.y0 + 3, Rect.x1 - 3, Rect.y1 - 3); 00086 GUI_Delay(Delay); 00087 GUI_SetColor(GUI_GREEN); 00088 GUI_DrawLine(Rect.x0 + 3, Rect.y1 - 3, Rect.x1 - 3, Rect.y0 + 3); 00089 GUI_Delay(Delay); 00090 GUI_SetColor(GUI_WHITE); 00091 GUI_SetFont(&GUI_FontComic24B_ASCII); 00092 GUI_SetTextMode(GUI_TM_TRANS); 00093 GUI_DispStringInRect("Closed", &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER); 00094 GUI_Delay(Delay); 00095 } 00096 00097 /******************************************************************* 00098 * 00099 * _DemoMemDev 00100 */ 00101 static void _DemoMemDev(void) { 00102 GUI_MEMDEV_Handle hMem; 00103 int i; 00104 00105 GUI_SetBkColor(GUI_BLACK); 00106 GUI_Clear(); 00107 GUI_SetColor(GUI_WHITE); 00108 GUI_SetFont(&GUI_Font24_ASCII); 00109 GUI_DispStringHCenterAt("MEMDEV_MemDev - Sample", 160, 5); 00110 GUI_SetFont(&GUI_Font8x16); 00111 GUI_DispStringHCenterAt("Shows the advantage of using a\nmemorydevice", 160,50); 00112 GUI_SetFont(&GUI_Font8_1); 00113 GUI_DispStringHCenterAt("Draws the picture\nwithout a\nmemory device", 50, 90); 00114 GUI_DispStringHCenterAt("Draws the picture\nusing a\nmemory device", 270, 90); 00115 // 00116 // Create the memory device 00117 // 00118 hMem = GUI_MEMDEV_Create(Rect.x0, Rect.y0, Rect.x1 - Rect.x0, Rect.y1 - Rect.y0); 00119 // 00120 //Routes the drawing operations to the memory device 00121 // 00122 GUI_MEMDEV_Select(hMem); 00123 _Draw(0); 00124 // 00125 // Routes the drawing operations to the LCD 00126 // 00127 GUI_MEMDEV_Select(0); 00128 while (1) { 00129 for (i = 0; i < 3; i++) { 00130 GUI_Delay(250); 00131 GUI_ClearRect(LCD_GetXSize() - Rect.x1, Rect.y0, LCD_GetXSize(), Rect.y1); 00132 GUI_Delay(250); 00133 GUI_MEMDEV_CopyToLCDAt(hMem, LCD_GetXSize() - Rect.x1, Rect.y0); 00134 } 00135 GUI_Delay(500); 00136 // 00137 // Uses no memory device 00138 // 00139 _Draw(400); 00140 GUI_Delay(400); 00141 GUI_ClearRect(0, 130, 319, 219); 00142 } 00143 } 00144 00145 /********************************************************************* 00146 * 00147 * Public code 00148 * 00149 ********************************************************************** 00150 */ 00151 /********************************************************************* 00152 * 00153 * MainTask 00154 */ 00155 void MainTask(void) { 00156 GUI_Init(); 00157 // 00158 // Check if recommended memory for the sample is available 00159 // 00160 if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { 00161 GUI_ErrorOut("Not enough memory available."); 00162 return; 00163 } 00164 _DemoMemDev(); 00165 } 00166 00167 /*************************** End of file ****************************/ 00168
Generated on Thu Jul 14 2022 12:58:41 by
