RT1050 GUI demo using emWin library

Committer:
alejandroRL
Date:
Thu Sep 20 19:16:34 2018 +0000
Revision:
0:dd702039127a
emWin GUI Demo for RT1050

Who changed what in which revision?

UserRevisionLine numberNew contents of line
alejandroRL 0:dd702039127a 1 /*********************************************************************
alejandroRL 0:dd702039127a 2 * SEGGER Microcontroller GmbH & Co. KG *
alejandroRL 0:dd702039127a 3 * Solutions for real time microcontroller applications *
alejandroRL 0:dd702039127a 4 **********************************************************************
alejandroRL 0:dd702039127a 5 * *
alejandroRL 0:dd702039127a 6 * (c) 1996 - 2016 SEGGER Microcontroller GmbH & Co. KG *
alejandroRL 0:dd702039127a 7 * *
alejandroRL 0:dd702039127a 8 * Internet: www.segger.com Support: support@segger.com *
alejandroRL 0:dd702039127a 9 * *
alejandroRL 0:dd702039127a 10 **********************************************************************
alejandroRL 0:dd702039127a 11
alejandroRL 0:dd702039127a 12 ** emWin V5.38 - Graphical user interface for embedded applications **
alejandroRL 0:dd702039127a 13 All Intellectual Property rights in the Software belongs to SEGGER.
alejandroRL 0:dd702039127a 14 emWin is protected by international copyright laws. Knowledge of the
alejandroRL 0:dd702039127a 15 source code may not be used to write a similar product. This file may
alejandroRL 0:dd702039127a 16 only be used in accordance with the following terms:
alejandroRL 0:dd702039127a 17
alejandroRL 0:dd702039127a 18 The software has been licensed to NXP Semiconductors USA, Inc. whose
alejandroRL 0:dd702039127a 19 registered office is situated at 411 E. Plumeria Drive, San Jose,
alejandroRL 0:dd702039127a 20 CA 95134, USA solely for the purposes of creating libraries for
alejandroRL 0:dd702039127a 21 NXPs M0, M3/M4 and ARM7/9 processor-based devices, sublicensed and
alejandroRL 0:dd702039127a 22 distributed under the terms and conditions of the NXP End User License
alejandroRL 0:dd702039127a 23 Agreement.
alejandroRL 0:dd702039127a 24 Full source code is available at: www.segger.com
alejandroRL 0:dd702039127a 25
alejandroRL 0:dd702039127a 26 We appreciate your understanding and fairness.
alejandroRL 0:dd702039127a 27 ----------------------------------------------------------------------
alejandroRL 0:dd702039127a 28 Licensing information
alejandroRL 0:dd702039127a 29
alejandroRL 0:dd702039127a 30 Licensor: SEGGER Microcontroller Systems LLC
alejandroRL 0:dd702039127a 31 Licensed to: NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA
alejandroRL 0:dd702039127a 32 Licensed SEGGER software: emWin
alejandroRL 0:dd702039127a 33 License number: GUI-00186
alejandroRL 0:dd702039127a 34 License model: emWin License Agreement, dated August 20th 2011
alejandroRL 0:dd702039127a 35 Licensed product: -
alejandroRL 0:dd702039127a 36 Licensed platform: NXP's ARM 7/9, Cortex-M0,M3,M4
alejandroRL 0:dd702039127a 37 Licensed number of seats: -
alejandroRL 0:dd702039127a 38 ----------------------------------------------------------------------
alejandroRL 0:dd702039127a 39 File : SEGGER.h
alejandroRL 0:dd702039127a 40 Purpose : Global types etc & general purpose utility functions
alejandroRL 0:dd702039127a 41 Revision: $Rev: 6176 $
alejandroRL 0:dd702039127a 42 ---------------------------END-OF-HEADER------------------------------
alejandroRL 0:dd702039127a 43 */
alejandroRL 0:dd702039127a 44
alejandroRL 0:dd702039127a 45 #ifndef SEGGER_H // Guard against multiple inclusion
alejandroRL 0:dd702039127a 46 #define SEGGER_H
alejandroRL 0:dd702039127a 47
alejandroRL 0:dd702039127a 48 #include <stdarg.h>
alejandroRL 0:dd702039127a 49 #include "Global.h" // Type definitions: U8, U16, U32, I8, I16, I32
alejandroRL 0:dd702039127a 50
alejandroRL 0:dd702039127a 51 #if defined(__cplusplus)
alejandroRL 0:dd702039127a 52 extern "C" { /* Make sure we have C-declarations in C++ programs */
alejandroRL 0:dd702039127a 53 #endif
alejandroRL 0:dd702039127a 54
alejandroRL 0:dd702039127a 55 /*********************************************************************
alejandroRL 0:dd702039127a 56 *
alejandroRL 0:dd702039127a 57 * Keywords/specifiers
alejandroRL 0:dd702039127a 58 *
alejandroRL 0:dd702039127a 59 **********************************************************************
alejandroRL 0:dd702039127a 60 */
alejandroRL 0:dd702039127a 61
alejandroRL 0:dd702039127a 62 #ifndef INLINE
alejandroRL 0:dd702039127a 63 #ifdef _WIN32
alejandroRL 0:dd702039127a 64 //
alejandroRL 0:dd702039127a 65 // Microsoft VC6 and newer.
alejandroRL 0:dd702039127a 66 // Force inlining without cost checking.
alejandroRL 0:dd702039127a 67 //
alejandroRL 0:dd702039127a 68 #define INLINE __forceinline
alejandroRL 0:dd702039127a 69 #else
alejandroRL 0:dd702039127a 70 #if (defined(__GNUC__))
alejandroRL 0:dd702039127a 71 //
alejandroRL 0:dd702039127a 72 // Force inlining with GCC
alejandroRL 0:dd702039127a 73 //
alejandroRL 0:dd702039127a 74 #define INLINE inline __attribute__((always_inline))
alejandroRL 0:dd702039127a 75 #elif (defined(__ICCARM__) || defined(__CC_ARM) || defined(__RX) || defined(__ICCRX__))
alejandroRL 0:dd702039127a 76 //
alejandroRL 0:dd702039127a 77 // Other known compilers.
alejandroRL 0:dd702039127a 78 //
alejandroRL 0:dd702039127a 79 #define INLINE inline
alejandroRL 0:dd702039127a 80 #else
alejandroRL 0:dd702039127a 81 //
alejandroRL 0:dd702039127a 82 // Unknown compilers.
alejandroRL 0:dd702039127a 83 //
alejandroRL 0:dd702039127a 84 #define INLINE
alejandroRL 0:dd702039127a 85 #endif
alejandroRL 0:dd702039127a 86 #endif
alejandroRL 0:dd702039127a 87 #endif
alejandroRL 0:dd702039127a 88
alejandroRL 0:dd702039127a 89 /*********************************************************************
alejandroRL 0:dd702039127a 90 *
alejandroRL 0:dd702039127a 91 * Function-like macros
alejandroRL 0:dd702039127a 92 *
alejandroRL 0:dd702039127a 93 **********************************************************************
alejandroRL 0:dd702039127a 94 */
alejandroRL 0:dd702039127a 95
alejandroRL 0:dd702039127a 96 #define SEGGER_COUNTOF(a) (sizeof((a))/sizeof((a)[0]))
alejandroRL 0:dd702039127a 97 #define SEGGER_MIN(a,b) (((a) < (b)) ? (a) : (b))
alejandroRL 0:dd702039127a 98 #define SEGGER_MAX(a,b) (((a) > (b)) ? (a) : (b))
alejandroRL 0:dd702039127a 99
alejandroRL 0:dd702039127a 100 #ifndef SEGGER_USE_PARA // Some compiler complain about unused parameters.
alejandroRL 0:dd702039127a 101 #define SEGGER_USE_PARA(Para) (void)Para // This works for most compilers.
alejandroRL 0:dd702039127a 102 #endif
alejandroRL 0:dd702039127a 103
alejandroRL 0:dd702039127a 104 /*********************************************************************
alejandroRL 0:dd702039127a 105 *
alejandroRL 0:dd702039127a 106 * Defines
alejandroRL 0:dd702039127a 107 *
alejandroRL 0:dd702039127a 108 **********************************************************************
alejandroRL 0:dd702039127a 109 */
alejandroRL 0:dd702039127a 110
alejandroRL 0:dd702039127a 111 #define SEGGER_PRINTF_FLAG_ADJLEFT (1 << 0)
alejandroRL 0:dd702039127a 112 #define SEGGER_PRINTF_FLAG_SIGNFORCE (1 << 1)
alejandroRL 0:dd702039127a 113 #define SEGGER_PRINTF_FLAG_SIGNSPACE (1 << 2)
alejandroRL 0:dd702039127a 114 #define SEGGER_PRINTF_FLAG_PRECEED (1 << 3)
alejandroRL 0:dd702039127a 115 #define SEGGER_PRINTF_FLAG_ZEROPAD (1 << 4)
alejandroRL 0:dd702039127a 116 #define SEGGER_PRINTF_FLAG_NEGATIVE (1 << 5)
alejandroRL 0:dd702039127a 117
alejandroRL 0:dd702039127a 118 /*********************************************************************
alejandroRL 0:dd702039127a 119 *
alejandroRL 0:dd702039127a 120 * Types
alejandroRL 0:dd702039127a 121 *
alejandroRL 0:dd702039127a 122 **********************************************************************
alejandroRL 0:dd702039127a 123 */
alejandroRL 0:dd702039127a 124
alejandroRL 0:dd702039127a 125 typedef struct {
alejandroRL 0:dd702039127a 126 char* pBuffer;
alejandroRL 0:dd702039127a 127 int BufferSize;
alejandroRL 0:dd702039127a 128 int Cnt;
alejandroRL 0:dd702039127a 129 } SEGGER_BUFFER_DESC;
alejandroRL 0:dd702039127a 130
alejandroRL 0:dd702039127a 131 typedef struct {
alejandroRL 0:dd702039127a 132 int CacheLineSize; // 0: No Cache. Most Systems such as ARM9 use a 32 bytes cache line size.
alejandroRL 0:dd702039127a 133 void (*pfDMB) (void); // Optional DMB function for Data Memory Barrier to make sure all memory operations are completed.
alejandroRL 0:dd702039127a 134 void (*pfClean) (void *p, unsigned NumBytes); // Optional clean function for cached memory.
alejandroRL 0:dd702039127a 135 void (*pfInvalidate)(void *p, unsigned NumBytes); // Optional invalidate function for cached memory.
alejandroRL 0:dd702039127a 136 } SEGGER_CACHE_CONFIG;
alejandroRL 0:dd702039127a 137
alejandroRL 0:dd702039127a 138 typedef struct SEGGER_SNPRINTF_CONTEXT_struct SEGGER_SNPRINTF_CONTEXT;
alejandroRL 0:dd702039127a 139
alejandroRL 0:dd702039127a 140 struct SEGGER_SNPRINTF_CONTEXT_struct {
alejandroRL 0:dd702039127a 141 void* pContext; // Application specific context.
alejandroRL 0:dd702039127a 142 SEGGER_BUFFER_DESC* pBufferDesc; // Buffer descriptor to use for output.
alejandroRL 0:dd702039127a 143 void (*pfFlush)(SEGGER_SNPRINTF_CONTEXT* pContext); // Callback executed once the buffer is full. Callback decides if the buffer gets cleared to store more or not.
alejandroRL 0:dd702039127a 144 };
alejandroRL 0:dd702039127a 145
alejandroRL 0:dd702039127a 146 typedef struct {
alejandroRL 0:dd702039127a 147 void (*pfStoreChar) (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, char c);
alejandroRL 0:dd702039127a 148 int (*pfPrintUnsigned) (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, U32 v, unsigned Base, char Flags, int Width, int Precision);
alejandroRL 0:dd702039127a 149 int (*pfPrintInt) (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, I32 v, unsigned Base, char Flags, int Width, int Precision);
alejandroRL 0:dd702039127a 150 } SEGGER_PRINTF_API;
alejandroRL 0:dd702039127a 151
alejandroRL 0:dd702039127a 152 typedef void (*SEGGER_pFormatter)(SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, const SEGGER_PRINTF_API* pApi, va_list* pParamList, char Lead, int Width, int Precision);
alejandroRL 0:dd702039127a 153
alejandroRL 0:dd702039127a 154 typedef struct SEGGER_PRINTF_FORMATTER {
alejandroRL 0:dd702039127a 155 struct SEGGER_PRINTF_FORMATTER* pNext; // Pointer to next formatter.
alejandroRL 0:dd702039127a 156 SEGGER_pFormatter pfFormatter; // Formatter function.
alejandroRL 0:dd702039127a 157 char Specifier; // Format specifier.
alejandroRL 0:dd702039127a 158 } SEGGER_PRINTF_FORMATTER;
alejandroRL 0:dd702039127a 159
alejandroRL 0:dd702039127a 160 /*********************************************************************
alejandroRL 0:dd702039127a 161 *
alejandroRL 0:dd702039127a 162 * Utility functions
alejandroRL 0:dd702039127a 163 *
alejandroRL 0:dd702039127a 164 **********************************************************************
alejandroRL 0:dd702039127a 165 */
alejandroRL 0:dd702039127a 166
alejandroRL 0:dd702039127a 167 void SEGGER_ARM_memcpy(void* pDest, const void* pSrc, int NumBytes);
alejandroRL 0:dd702039127a 168 void SEGGER_memcpy (void* pDest, const void* pSrc, int NumBytes);
alejandroRL 0:dd702039127a 169 void SEGGER_memxor (void* pDest, const void* pSrc, unsigned NumBytes);
alejandroRL 0:dd702039127a 170
alejandroRL 0:dd702039127a 171 void SEGGER_StoreChar (SEGGER_BUFFER_DESC* pBufferDesc, char c);
alejandroRL 0:dd702039127a 172 void SEGGER_PrintUnsigned(SEGGER_BUFFER_DESC* pBufferDesc, U32 v, unsigned Base, int Precision);
alejandroRL 0:dd702039127a 173 void SEGGER_PrintInt (SEGGER_BUFFER_DESC* pBufferDesc, I32 v, unsigned Base, int Precision);
alejandroRL 0:dd702039127a 174 int SEGGER_snprintf (char* pBuffer, int BufferSize, const char* sFormat, ...);
alejandroRL 0:dd702039127a 175 int SEGGER_vsnprintf (char* pBuffer, int BufferSize, const char* sFormat, va_list ParamList);
alejandroRL 0:dd702039127a 176 int SEGGER_vsnprintfEx (SEGGER_SNPRINTF_CONTEXT* pContext, const char* sFormat, va_list ParamList);
alejandroRL 0:dd702039127a 177
alejandroRL 0:dd702039127a 178 int SEGGER_PRINTF_AddFormatter (SEGGER_PRINTF_FORMATTER* pFormatter, SEGGER_pFormatter pfFormatter, char c);
alejandroRL 0:dd702039127a 179 void SEGGER_PRINTF_AddDoubleFormatter(void);
alejandroRL 0:dd702039127a 180 void SEGGER_PRINTF_AddIPFormatter (void);
alejandroRL 0:dd702039127a 181 void SEGGER_PRINTF_AddHTMLFormatter (void);
alejandroRL 0:dd702039127a 182
alejandroRL 0:dd702039127a 183 #if defined(__cplusplus)
alejandroRL 0:dd702039127a 184 } /* Make sure we have C-declarations in C++ programs */
alejandroRL 0:dd702039127a 185 #endif
alejandroRL 0:dd702039127a 186
alejandroRL 0:dd702039127a 187 #endif // Avoid multiple inclusion
alejandroRL 0:dd702039127a 188
alejandroRL 0:dd702039127a 189 /*************************** End of file ****************************/