Andrew Reed / Mbed OS CITY1082-i2c_master_wifi_mqtt
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WIDGET_SimpleProgbar.c Source File

WIDGET_SimpleProgbar.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        : WIDGET_SimpleProgbar.c
00041 Purpose     : Demonstrates the use of the PROGBAR widget
00042 Requirements: WindowManager - (x)
00043               MemoryDevices - ( )
00044               AntiAliasing  - ( )
00045               VNC-Server    - ( )
00046               PNG-Library   - ( )
00047               TrueTypeFonts - ( )
00048 ----------------------------------------------------------------------
00049 */
00050 
00051 #include "GUI.h"
00052 #include "PROGBAR.h"
00053 
00054 /*********************************************************************
00055 *
00056 *       Defines
00057 *
00058 **********************************************************************
00059 */
00060 //
00061 // Recommended memory to run the sample with adequate performance
00062 //
00063 #define RECOMMENDED_MEMORY (1024L * 5)
00064 
00065 /*******************************************************************
00066 *
00067 *       static code
00068 *
00069 ********************************************************************
00070 */
00071 /*******************************************************************
00072 *
00073 *        _DemoProgBar
00074 */
00075 static void _DemoProgBar(void) {
00076   PROGBAR_Handle ahProgBar;
00077   int i;
00078 
00079   GUI_SetFont(&GUI_Font8x16);
00080   GUI_DispStringAt("Progress bar", 100,80);
00081   /* Create progress bar */  
00082   ahProgBar = PROGBAR_Create(100, 100, 100, 20, WM_CF_SHOW);
00083   GUI_Delay (500);
00084   /* Modify progress bar */
00085   for (i = 0; i <= 100; i++) {
00086     PROGBAR_SetValue(ahProgBar, i);
00087     GUI_Delay(10);
00088   }
00089   GUI_Delay (400);
00090   /* Delete progress bar */  
00091   WM_DeleteWindow(ahProgBar);
00092   GUI_ClearRect(0, 50, 319, 239);
00093   GUI_Delay(750);
00094 }
00095 
00096 /*********************************************************************
00097 *
00098 *       Public code
00099 *
00100 **********************************************************************
00101 */
00102 /*********************************************************************
00103 *
00104 *       MainTask
00105 */
00106 void MainTask(void) {
00107   GUI_Init();
00108   //
00109   // Check if recommended memory for the sample is available
00110   //
00111   if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
00112     GUI_ErrorOut("Not enough memory available."); 
00113     return;
00114   }
00115   GUI_SetBkColor(GUI_BLACK);
00116   GUI_Clear();
00117   GUI_SetColor(GUI_WHITE);
00118   GUI_SetFont(&GUI_Font24_ASCII);
00119   GUI_DispStringHCenterAt("WIDGET_SimpleProgbar - Sample", 160, 5);
00120   while(1) {
00121     _DemoProgBar();
00122   }
00123 }
00124 
00125 /*************************** End of file ****************************/
00126