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