Template for working forward

Dependencies:   mbed PinDetect

Committer:
reedas
Date:
Tue Nov 19 10:04:48 2019 +0000
Revision:
1:402b32a1025f
Basic Hello World tft display library program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
reedas 1:402b32a1025f 1 /*********************************************************************
reedas 1:402b32a1025f 2 * SEGGER Microcontroller GmbH *
reedas 1:402b32a1025f 3 * Solutions for real time microcontroller applications *
reedas 1:402b32a1025f 4 **********************************************************************
reedas 1:402b32a1025f 5 * *
reedas 1:402b32a1025f 6 * (c) 1996 - 2018 SEGGER Microcontroller GmbH *
reedas 1:402b32a1025f 7 * *
reedas 1:402b32a1025f 8 * Internet: www.segger.com Support: support@segger.com *
reedas 1:402b32a1025f 9 * *
reedas 1:402b32a1025f 10 **********************************************************************
reedas 1:402b32a1025f 11
reedas 1:402b32a1025f 12 ** emWin V5.48 - Graphical user interface for embedded applications **
reedas 1:402b32a1025f 13 All Intellectual Property rights in the Software belongs to SEGGER.
reedas 1:402b32a1025f 14 emWin is protected by international copyright laws. Knowledge of the
reedas 1:402b32a1025f 15 source code may not be used to write a similar product. This file may
reedas 1:402b32a1025f 16 only be used in accordance with the following terms:
reedas 1:402b32a1025f 17
reedas 1:402b32a1025f 18 The software has been licensed to Cypress Semiconductor Corporation,
reedas 1:402b32a1025f 19 whose registered office is situated at 198 Champion Ct. San Jose, CA
reedas 1:402b32a1025f 20 95134 USA solely for the purposes of creating libraries for Cypress
reedas 1:402b32a1025f 21 PSoC3 and PSoC5 processor-based devices, sublicensed and distributed
reedas 1:402b32a1025f 22 under the terms and conditions of the Cypress End User License
reedas 1:402b32a1025f 23 Agreement.
reedas 1:402b32a1025f 24 Full source code is available at: www.segger.com
reedas 1:402b32a1025f 25
reedas 1:402b32a1025f 26 We appreciate your understanding and fairness.
reedas 1:402b32a1025f 27 ----------------------------------------------------------------------
reedas 1:402b32a1025f 28 Licensing information
reedas 1:402b32a1025f 29 Licensor: SEGGER Microcontroller Systems LLC
reedas 1:402b32a1025f 30 Licensed to: Cypress Semiconductor Corp, 198 Champion Ct., San Jose, CA 95134, USA
reedas 1:402b32a1025f 31 Licensed SEGGER software: emWin
reedas 1:402b32a1025f 32 License number: GUI-00319
reedas 1:402b32a1025f 33 License model: Services and License Agreement, signed June 10th, 2009
reedas 1:402b32a1025f 34 Licensed platform: Any Cypress platform (Initial targets are: PSoC3, PSoC5)
reedas 1:402b32a1025f 35 ----------------------------------------------------------------------
reedas 1:402b32a1025f 36 Support and Update Agreement (SUA)
reedas 1:402b32a1025f 37 SUA period: 2009-06-12 - 2022-07-27
reedas 1:402b32a1025f 38 Contact to extend SUA: sales@segger.com
reedas 1:402b32a1025f 39 ----------------------------------------------------------------------
reedas 1:402b32a1025f 40 File : GUI_X_Mbed.c
reedas 1:402b32a1025f 41 Purpose : Config / System dependent externals for GUI
reedas 1:402b32a1025f 42 ---------------------------END-OF-HEADER------------------------------
reedas 1:402b32a1025f 43 */
reedas 1:402b32a1025f 44
reedas 1:402b32a1025f 45 #include <stdio.h>
reedas 1:402b32a1025f 46 #include "mbed.h"
reedas 1:402b32a1025f 47
reedas 1:402b32a1025f 48 extern "C" {
reedas 1:402b32a1025f 49 #include "GUI.h"
reedas 1:402b32a1025f 50 }
reedas 1:402b32a1025f 51
reedas 1:402b32a1025f 52 /*********************************************************************
reedas 1:402b32a1025f 53 *
reedas 1:402b32a1025f 54 * Global data
reedas 1:402b32a1025f 55 */
reedas 1:402b32a1025f 56
reedas 1:402b32a1025f 57 Ticker emwin_ticker;
reedas 1:402b32a1025f 58 Mutex emwin_mutex;
reedas 1:402b32a1025f 59 volatile GUI_TIMER_TIME timeMS = 0;
reedas 1:402b32a1025f 60
reedas 1:402b32a1025f 61 /*********************************************************************
reedas 1:402b32a1025f 62 *
reedas 1:402b32a1025f 63 * Public code
reedas 1:402b32a1025f 64 *
reedas 1:402b32a1025f 65 **********************************************************************
reedas 1:402b32a1025f 66 */
reedas 1:402b32a1025f 67 /*********************************************************************
reedas 1:402b32a1025f 68 *
reedas 1:402b32a1025f 69 * Timing:
reedas 1:402b32a1025f 70 * GUI_X_GetTime()
reedas 1:402b32a1025f 71 * GUI_X_Delay(int)
reedas 1:402b32a1025f 72
reedas 1:402b32a1025f 73 Some timing dependent routines require a GetTime
reedas 1:402b32a1025f 74 and delay function. Default time unit (tick), normally is
reedas 1:402b32a1025f 75 1 ms.
reedas 1:402b32a1025f 76 */
reedas 1:402b32a1025f 77
reedas 1:402b32a1025f 78 GUI_TIMER_TIME GUI_X_GetTime(void)
reedas 1:402b32a1025f 79 {
reedas 1:402b32a1025f 80 return timeMS;
reedas 1:402b32a1025f 81 }
reedas 1:402b32a1025f 82
reedas 1:402b32a1025f 83 void GUI_X_Delay(int ms)
reedas 1:402b32a1025f 84 {
reedas 1:402b32a1025f 85 wait_ms(ms);
reedas 1:402b32a1025f 86 }
reedas 1:402b32a1025f 87
reedas 1:402b32a1025f 88 /*********************************************************************
reedas 1:402b32a1025f 89 *
reedas 1:402b32a1025f 90 * GUI_X_ExecIdle()
reedas 1:402b32a1025f 91 *
reedas 1:402b32a1025f 92 */
reedas 1:402b32a1025f 93 void GUI_X_ExecIdle(void)
reedas 1:402b32a1025f 94 {
reedas 1:402b32a1025f 95 wait_ms(1);
reedas 1:402b32a1025f 96 }
reedas 1:402b32a1025f 97
reedas 1:402b32a1025f 98 /*********************************************************************
reedas 1:402b32a1025f 99 *
reedas 1:402b32a1025f 100 * Multitasking:
reedas 1:402b32a1025f 101 *
reedas 1:402b32a1025f 102 * GUI_X_InitOS()
reedas 1:402b32a1025f 103 * GUI_X_GetTaskId()
reedas 1:402b32a1025f 104 * GUI_X_Lock()
reedas 1:402b32a1025f 105 * GUI_X_Unlock()
reedas 1:402b32a1025f 106 *
reedas 1:402b32a1025f 107 * Note:
reedas 1:402b32a1025f 108 * The following routines are required only if emWin is used in a
reedas 1:402b32a1025f 109 * true multi task environment, which means you have more than one
reedas 1:402b32a1025f 110 * thread using the emWin API.
reedas 1:402b32a1025f 111 * In this case the
reedas 1:402b32a1025f 112 * #define GUI_OS 1
reedas 1:402b32a1025f 113 * needs to be in GUIConf.h
reedas 1:402b32a1025f 114 */
reedas 1:402b32a1025f 115 void GUI_X_InitOS(void) {}
reedas 1:402b32a1025f 116 void GUI_X_Unlock(void) { emwin_mutex.unlock(); }
reedas 1:402b32a1025f 117 void GUI_X_Lock(void) { emwin_mutex.lock(); }
reedas 1:402b32a1025f 118 U32 GUI_X_GetTaskId(void) { return 0; }
reedas 1:402b32a1025f 119
reedas 1:402b32a1025f 120 /*********************************************************************
reedas 1:402b32a1025f 121 *
reedas 1:402b32a1025f 122 * Logging: OS dependent
reedas 1:402b32a1025f 123
reedas 1:402b32a1025f 124 Note:
reedas 1:402b32a1025f 125 Logging is used in higher debug levels only. The typical target
reedas 1:402b32a1025f 126 build does not use logging and does therefor not require any of
reedas 1:402b32a1025f 127 the logging routines below. For a release build without logging
reedas 1:402b32a1025f 128 the routines below may be eliminated to save some space.
reedas 1:402b32a1025f 129 (If the linker is not function aware and eliminates unreferenced
reedas 1:402b32a1025f 130 functions automatically)
reedas 1:402b32a1025f 131
reedas 1:402b32a1025f 132 */
reedas 1:402b32a1025f 133
reedas 1:402b32a1025f 134 void GUI_X_Log (const char *s) { GUI_USE_PARA(s); }
reedas 1:402b32a1025f 135 void GUI_X_Warn (const char *s) { GUI_USE_PARA(s); }
reedas 1:402b32a1025f 136 void GUI_X_ErrorOut(const char *s) { GUI_USE_PARA(s); }
reedas 1:402b32a1025f 137
reedas 1:402b32a1025f 138 void ticker_handler(void)
reedas 1:402b32a1025f 139 {
reedas 1:402b32a1025f 140 timeMS++;
reedas 1:402b32a1025f 141 }
reedas 1:402b32a1025f 142
reedas 1:402b32a1025f 143 /*********************************************************************
reedas 1:402b32a1025f 144 *
reedas 1:402b32a1025f 145 * GUI_X_Init()
reedas 1:402b32a1025f 146 *
reedas 1:402b32a1025f 147 * Note:
reedas 1:402b32a1025f 148 * This routine is called from GUI_Init() in any case whether there
reedas 1:402b32a1025f 149 * is an RTOS or not. You can use it for additional initializations
reedas 1:402b32a1025f 150 * needed.
reedas 1:402b32a1025f 151 */
reedas 1:402b32a1025f 152
reedas 1:402b32a1025f 153 void GUI_X_Init(void)
reedas 1:402b32a1025f 154 {
reedas 1:402b32a1025f 155 emwin_ticker.attach(&ticker_handler, 0.001);
reedas 1:402b32a1025f 156 }
reedas 1:402b32a1025f 157
reedas 1:402b32a1025f 158 /*************************** End of file ****************************/