NXP
/
rt1050_emwin_gui_demo
RT1050 GUI demo using emWin library
emwin/emWin_header/GUIDRV_IST3088_Private.h@0:dd702039127a, 2018-09-20 (annotated)
- 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?
User | Revision | Line number | New 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 : GUIDRV_IST3088_Private.h |
alejandroRL | 0:dd702039127a | 40 | Purpose : Interface definition for GUIDRV_IST3088 driver |
alejandroRL | 0:dd702039127a | 41 | ---------------------------END-OF-HEADER------------------------------ |
alejandroRL | 0:dd702039127a | 42 | */ |
alejandroRL | 0:dd702039127a | 43 | |
alejandroRL | 0:dd702039127a | 44 | #include "GUIDRV_IST3088.h" |
alejandroRL | 0:dd702039127a | 45 | #include "GUIDRV_NoOpt_1_8.h" |
alejandroRL | 0:dd702039127a | 46 | |
alejandroRL | 0:dd702039127a | 47 | #ifndef GUIDRV_IST3088_PRIVATE_H |
alejandroRL | 0:dd702039127a | 48 | #define GUIDRV_IST3088_PRIVATE_H |
alejandroRL | 0:dd702039127a | 49 | |
alejandroRL | 0:dd702039127a | 50 | #if defined(__cplusplus) |
alejandroRL | 0:dd702039127a | 51 | extern "C" { /* Make sure we have C-declarations in C++ programs */ |
alejandroRL | 0:dd702039127a | 52 | #endif |
alejandroRL | 0:dd702039127a | 53 | |
alejandroRL | 0:dd702039127a | 54 | // |
alejandroRL | 0:dd702039127a | 55 | // Use unique context identified |
alejandroRL | 0:dd702039127a | 56 | // |
alejandroRL | 0:dd702039127a | 57 | #define DRIVER_CONTEXT DRIVER_CONTEXT_IST3088 |
alejandroRL | 0:dd702039127a | 58 | |
alejandroRL | 0:dd702039127a | 59 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 60 | * |
alejandroRL | 0:dd702039127a | 61 | * Types |
alejandroRL | 0:dd702039127a | 62 | * |
alejandroRL | 0:dd702039127a | 63 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 64 | */ |
alejandroRL | 0:dd702039127a | 65 | typedef struct DRIVER_CONTEXT DRIVER_CONTEXT; |
alejandroRL | 0:dd702039127a | 66 | |
alejandroRL | 0:dd702039127a | 67 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 68 | * |
alejandroRL | 0:dd702039127a | 69 | * MANAGE_VRAM_CONTEXT |
alejandroRL | 0:dd702039127a | 70 | */ |
alejandroRL | 0:dd702039127a | 71 | typedef struct { |
alejandroRL | 0:dd702039127a | 72 | // |
alejandroRL | 0:dd702039127a | 73 | // Function pointers for writing to display controller |
alejandroRL | 0:dd702039127a | 74 | // |
alejandroRL | 0:dd702039127a | 75 | void (* pfManagePixel) (DRIVER_CONTEXT * pContext, int * px, int * py); |
alejandroRL | 0:dd702039127a | 76 | void (* pfManageRect) (DRIVER_CONTEXT * pContext, int * px0, int * py0, int * px1, int * py1); |
alejandroRL | 0:dd702039127a | 77 | void (* pfAddDirtyPixelPhys)(DRIVER_CONTEXT * pContext, int x, int y); |
alejandroRL | 0:dd702039127a | 78 | void (* pfAddDirtyRectPhys) (DRIVER_CONTEXT * pContext, int x0, int y0, int x1, int y1); |
alejandroRL | 0:dd702039127a | 79 | void (* pfAddDirtyPixel) (DRIVER_CONTEXT * pContext, int x, int y); |
alejandroRL | 0:dd702039127a | 80 | void (* pfAddDirtyRect) (DRIVER_CONTEXT * pContext, int x0, int y0, int x1, int y1); |
alejandroRL | 0:dd702039127a | 81 | LCD_PIXELINDEX (* pfGetPixelIndexPhys)(DRIVER_CONTEXT * pContext, int x, int y); |
alejandroRL | 0:dd702039127a | 82 | void (* pfSetPixelIndexPhys)(DRIVER_CONTEXT * pContext, int x, int y, LCD_PIXELINDEX ColorIndex); |
alejandroRL | 0:dd702039127a | 83 | void (* pfXorPixelIndexPhys)(DRIVER_CONTEXT * pContext, int x, int y); |
alejandroRL | 0:dd702039127a | 84 | LCD_PIXELINDEX (* pfGetPixelIndex) (DRIVER_CONTEXT * pContext, int x, int y); |
alejandroRL | 0:dd702039127a | 85 | void (* pfSetPixelIndex) (DRIVER_CONTEXT * pContext, int x, int y, LCD_PIXELINDEX ColorIndex); |
alejandroRL | 0:dd702039127a | 86 | void (* pfXorPixelIndex) (DRIVER_CONTEXT * pContext, int x, int y); |
alejandroRL | 0:dd702039127a | 87 | void (* pfFlush) (DRIVER_CONTEXT * pContext); |
alejandroRL | 0:dd702039127a | 88 | } MANAGE_VMEM_API; |
alejandroRL | 0:dd702039127a | 89 | |
alejandroRL | 0:dd702039127a | 90 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 91 | * |
alejandroRL | 0:dd702039127a | 92 | * DRIVER_CONTEXT |
alejandroRL | 0:dd702039127a | 93 | */ |
alejandroRL | 0:dd702039127a | 94 | struct DRIVER_CONTEXT { |
alejandroRL | 0:dd702039127a | 95 | // |
alejandroRL | 0:dd702039127a | 96 | // Common data |
alejandroRL | 0:dd702039127a | 97 | // |
alejandroRL | 0:dd702039127a | 98 | int xSize, ySize; |
alejandroRL | 0:dd702039127a | 99 | int vxSize, vySize; |
alejandroRL | 0:dd702039127a | 100 | int Orientation; |
alejandroRL | 0:dd702039127a | 101 | // |
alejandroRL | 0:dd702039127a | 102 | // Cache management |
alejandroRL | 0:dd702039127a | 103 | // |
alejandroRL | 0:dd702039127a | 104 | GUI_RECT rDirty; |
alejandroRL | 0:dd702039127a | 105 | // |
alejandroRL | 0:dd702039127a | 106 | // Accelerators for calculation |
alejandroRL | 0:dd702039127a | 107 | // |
alejandroRL | 0:dd702039127a | 108 | int ShortsPerLine; |
alejandroRL | 0:dd702039127a | 109 | int BitsPerPixel; |
alejandroRL | 0:dd702039127a | 110 | // |
alejandroRL | 0:dd702039127a | 111 | // VRAM |
alejandroRL | 0:dd702039127a | 112 | // |
alejandroRL | 0:dd702039127a | 113 | U16 * pVMEM; |
alejandroRL | 0:dd702039127a | 114 | // |
alejandroRL | 0:dd702039127a | 115 | // Pointer to driver internal initialization routine |
alejandroRL | 0:dd702039127a | 116 | // |
alejandroRL | 0:dd702039127a | 117 | void (* pfInit) (GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 118 | void (* pfCheck)(GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 119 | // |
alejandroRL | 0:dd702039127a | 120 | // API-Tables |
alejandroRL | 0:dd702039127a | 121 | // |
alejandroRL | 0:dd702039127a | 122 | MANAGE_VMEM_API ManageVMEM_API; // Memory management |
alejandroRL | 0:dd702039127a | 123 | GUI_PORT_API HW_API; // Hardware routines |
alejandroRL | 0:dd702039127a | 124 | }; |
alejandroRL | 0:dd702039127a | 125 | |
alejandroRL | 0:dd702039127a | 126 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 127 | * |
alejandroRL | 0:dd702039127a | 128 | * LOG2PHYS_xxx |
alejandroRL | 0:dd702039127a | 129 | */ |
alejandroRL | 0:dd702039127a | 130 | #define LOG2PHYS_X ( x ) |
alejandroRL | 0:dd702039127a | 131 | #define LOG2PHYS_X_OX (pContext->xSize - x - 1) |
alejandroRL | 0:dd702039127a | 132 | #define LOG2PHYS_X_OY ( x ) |
alejandroRL | 0:dd702039127a | 133 | #define LOG2PHYS_X_OXY (pContext->xSize - x - 1) |
alejandroRL | 0:dd702039127a | 134 | #define LOG2PHYS_X_OS ( y ) |
alejandroRL | 0:dd702039127a | 135 | #define LOG2PHYS_X_OSX (pContext->ySize - y - 1) |
alejandroRL | 0:dd702039127a | 136 | #define LOG2PHYS_X_OSY ( y ) |
alejandroRL | 0:dd702039127a | 137 | #define LOG2PHYS_X_OSXY (pContext->ySize - y - 1) |
alejandroRL | 0:dd702039127a | 138 | |
alejandroRL | 0:dd702039127a | 139 | #define LOG2PHYS_Y ( y ) |
alejandroRL | 0:dd702039127a | 140 | #define LOG2PHYS_Y_OX ( y ) |
alejandroRL | 0:dd702039127a | 141 | #define LOG2PHYS_Y_OY (pContext->ySize - y - 1) |
alejandroRL | 0:dd702039127a | 142 | #define LOG2PHYS_Y_OXY (pContext->ySize - y - 1) |
alejandroRL | 0:dd702039127a | 143 | #define LOG2PHYS_Y_OS ( x ) |
alejandroRL | 0:dd702039127a | 144 | #define LOG2PHYS_Y_OSX ( x ) |
alejandroRL | 0:dd702039127a | 145 | #define LOG2PHYS_Y_OSY (pContext->xSize - x - 1) |
alejandroRL | 0:dd702039127a | 146 | #define LOG2PHYS_Y_OSXY (pContext->xSize - x - 1) |
alejandroRL | 0:dd702039127a | 147 | |
alejandroRL | 0:dd702039127a | 148 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 149 | * |
alejandroRL | 0:dd702039127a | 150 | * _SetPixelIndex_##EXT |
alejandroRL | 0:dd702039127a | 151 | */ |
alejandroRL | 0:dd702039127a | 152 | #define DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ |
alejandroRL | 0:dd702039127a | 153 | static void _SetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y, LCD_PIXELINDEX PixelIndex) { \ |
alejandroRL | 0:dd702039127a | 154 | DRIVER_CONTEXT * pContext; \ |
alejandroRL | 0:dd702039127a | 155 | \ |
alejandroRL | 0:dd702039127a | 156 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; \ |
alejandroRL | 0:dd702039127a | 157 | _SetPixelIndex(pContext, X_PHYS, Y_PHYS, PixelIndex); \ |
alejandroRL | 0:dd702039127a | 158 | } |
alejandroRL | 0:dd702039127a | 159 | |
alejandroRL | 0:dd702039127a | 160 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 161 | * |
alejandroRL | 0:dd702039127a | 162 | * _GetPixelIndex_##EXT |
alejandroRL | 0:dd702039127a | 163 | */ |
alejandroRL | 0:dd702039127a | 164 | #define DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ |
alejandroRL | 0:dd702039127a | 165 | static LCD_PIXELINDEX _GetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y) { \ |
alejandroRL | 0:dd702039127a | 166 | DRIVER_CONTEXT * pContext; \ |
alejandroRL | 0:dd702039127a | 167 | LCD_PIXELINDEX PixelIndex; \ |
alejandroRL | 0:dd702039127a | 168 | \ |
alejandroRL | 0:dd702039127a | 169 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; \ |
alejandroRL | 0:dd702039127a | 170 | PixelIndex = _GetPixelIndex(pContext, X_PHYS, Y_PHYS); \ |
alejandroRL | 0:dd702039127a | 171 | return PixelIndex; \ |
alejandroRL | 0:dd702039127a | 172 | } |
alejandroRL | 0:dd702039127a | 173 | |
alejandroRL | 0:dd702039127a | 174 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 175 | * |
alejandroRL | 0:dd702039127a | 176 | * _GetDevProp_##EXT |
alejandroRL | 0:dd702039127a | 177 | */ |
alejandroRL | 0:dd702039127a | 178 | #define DEFINE_GETDEVPROP(EXT, MX, MY, SWAP) \ |
alejandroRL | 0:dd702039127a | 179 | static I32 _GetDevProp_##EXT(GUI_DEVICE * pDevice, int Index) { \ |
alejandroRL | 0:dd702039127a | 180 | switch (Index) { \ |
alejandroRL | 0:dd702039127a | 181 | case LCD_DEVCAP_MIRROR_X: return MX; \ |
alejandroRL | 0:dd702039127a | 182 | case LCD_DEVCAP_MIRROR_Y: return MY; \ |
alejandroRL | 0:dd702039127a | 183 | case LCD_DEVCAP_SWAP_XY: return SWAP; \ |
alejandroRL | 0:dd702039127a | 184 | } \ |
alejandroRL | 0:dd702039127a | 185 | return _GetDevProp(pDevice, Index); \ |
alejandroRL | 0:dd702039127a | 186 | } |
alejandroRL | 0:dd702039127a | 187 | |
alejandroRL | 0:dd702039127a | 188 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 189 | * |
alejandroRL | 0:dd702039127a | 190 | * DEFINE_FUNCTIONS |
alejandroRL | 0:dd702039127a | 191 | */ |
alejandroRL | 0:dd702039127a | 192 | #define DEFINE_FUNCTIONS(EXT, X_PHYS, Y_PHYS, MX, MY, SWAP) \ |
alejandroRL | 0:dd702039127a | 193 | DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ |
alejandroRL | 0:dd702039127a | 194 | DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ |
alejandroRL | 0:dd702039127a | 195 | DEFINE_GETDEVPROP(EXT, MX, MY, SWAP) \ |
alejandroRL | 0:dd702039127a | 196 | DEFINE_GUI_DEVICE_API(EXT) |
alejandroRL | 0:dd702039127a | 197 | |
alejandroRL | 0:dd702039127a | 198 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 199 | * |
alejandroRL | 0:dd702039127a | 200 | * Private functions |
alejandroRL | 0:dd702039127a | 201 | * |
alejandroRL | 0:dd702039127a | 202 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 203 | */ |
alejandroRL | 0:dd702039127a | 204 | void (*GUIDRV__IST3088_GetDevFunc(GUI_DEVICE ** ppDevice, int Index))(void); |
alejandroRL | 0:dd702039127a | 205 | void GUIDRV__IST3088_SetOrg (GUI_DEVICE * pDevice, int x, int y); |
alejandroRL | 0:dd702039127a | 206 | I32 GUIDRV__IST3088_GetDevProp(GUI_DEVICE * pDevice, int Index); |
alejandroRL | 0:dd702039127a | 207 | void GUIDRV__IST3088_GetRect (GUI_DEVICE * pDevice, LCD_RECT * pRect); |
alejandroRL | 0:dd702039127a | 208 | |
alejandroRL | 0:dd702039127a | 209 | #if defined(__cplusplus) |
alejandroRL | 0:dd702039127a | 210 | } |
alejandroRL | 0:dd702039127a | 211 | #endif |
alejandroRL | 0:dd702039127a | 212 | |
alejandroRL | 0:dd702039127a | 213 | #endif |
alejandroRL | 0:dd702039127a | 214 | |
alejandroRL | 0:dd702039127a | 215 | /*************************** End of file ****************************/ |