Headers for emWin lib
Dependents: DISCO-F746NG_rtos_test
emWin_header/GUIDRV_Generic.h@0:1bf8f02b0770, 2016-03-26 (annotated)
- Committer:
- redbird
- Date:
- Sat Mar 26 22:49:50 2016 +0000
- Revision:
- 0:1bf8f02b0770
new code integration
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
redbird | 0:1bf8f02b0770 | 1 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 2 | * SEGGER Microcontroller GmbH & Co. KG * |
redbird | 0:1bf8f02b0770 | 3 | * Solutions for real time microcontroller applications * |
redbird | 0:1bf8f02b0770 | 4 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 5 | * * |
redbird | 0:1bf8f02b0770 | 6 | * (c) 1996 - 2014 SEGGER Microcontroller GmbH & Co. KG * |
redbird | 0:1bf8f02b0770 | 7 | * * |
redbird | 0:1bf8f02b0770 | 8 | * Internet: www.segger.com Support: support@segger.com * |
redbird | 0:1bf8f02b0770 | 9 | * * |
redbird | 0:1bf8f02b0770 | 10 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 11 | |
redbird | 0:1bf8f02b0770 | 12 | ** emWin V5.24 - Graphical user interface for embedded applications ** |
redbird | 0:1bf8f02b0770 | 13 | All Intellectual Property rights in the Software belongs to SEGGER. |
redbird | 0:1bf8f02b0770 | 14 | emWin is protected by international copyright laws. Knowledge of the |
redbird | 0:1bf8f02b0770 | 15 | source code may not be used to write a similar product. This file may |
redbird | 0:1bf8f02b0770 | 16 | only be used in accordance with the following terms: |
redbird | 0:1bf8f02b0770 | 17 | |
redbird | 0:1bf8f02b0770 | 18 | The software has been licensed to NXP Semiconductors USA, Inc. whose |
redbird | 0:1bf8f02b0770 | 19 | registered office is situated at 411 E. Plumeria Drive, San Jose, |
redbird | 0:1bf8f02b0770 | 20 | CA 95134, USA solely for the purposes of creating libraries for |
redbird | 0:1bf8f02b0770 | 21 | NXPs M0, M3/M4 and ARM7/9 processor-based devices, sublicensed and |
redbird | 0:1bf8f02b0770 | 22 | distributed under the terms and conditions of the NXP End User License |
redbird | 0:1bf8f02b0770 | 23 | Agreement. |
redbird | 0:1bf8f02b0770 | 24 | Full source code is available at: www.segger.com |
redbird | 0:1bf8f02b0770 | 25 | |
redbird | 0:1bf8f02b0770 | 26 | We appreciate your understanding and fairness. |
redbird | 0:1bf8f02b0770 | 27 | ---------------------------------------------------------------------- |
redbird | 0:1bf8f02b0770 | 28 | File : GUIDRV_Generic.h |
redbird | 0:1bf8f02b0770 | 29 | Purpose : Adapter to be able to use the display drivers with simple |
redbird | 0:1bf8f02b0770 | 30 | bus interface from emWin V4.18 |
redbird | 0:1bf8f02b0770 | 31 | ---------------------------END-OF-HEADER------------------------------ |
redbird | 0:1bf8f02b0770 | 32 | */ |
redbird | 0:1bf8f02b0770 | 33 | |
redbird | 0:1bf8f02b0770 | 34 | #include "LCD_ConfDefaults.h" |
redbird | 0:1bf8f02b0770 | 35 | |
redbird | 0:1bf8f02b0770 | 36 | #if defined(LCD_CONTROLLER) |
redbird | 0:1bf8f02b0770 | 37 | |
redbird | 0:1bf8f02b0770 | 38 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 39 | * |
redbird | 0:1bf8f02b0770 | 40 | * Defines |
redbird | 0:1bf8f02b0770 | 41 | * |
redbird | 0:1bf8f02b0770 | 42 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 43 | */ |
redbird | 0:1bf8f02b0770 | 44 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 45 | * |
redbird | 0:1bf8f02b0770 | 46 | * Remap old configuration macros to static data |
redbird | 0:1bf8f02b0770 | 47 | */ |
redbird | 0:1bf8f02b0770 | 48 | #define LCD_XSIZE _xSize |
redbird | 0:1bf8f02b0770 | 49 | #define LCD_YSIZE _ySize |
redbird | 0:1bf8f02b0770 | 50 | #define LCD_VXSIZE _vxSize |
redbird | 0:1bf8f02b0770 | 51 | #define LCD_VYSIZE _vySize |
redbird | 0:1bf8f02b0770 | 52 | #define LCD_XSIZE_PHYS _xSizePhys |
redbird | 0:1bf8f02b0770 | 53 | #define LCD_YSIZE_PHYS _ySizePhys |
redbird | 0:1bf8f02b0770 | 54 | #define LCD_NUM_COLORS _NumColors |
redbird | 0:1bf8f02b0770 | 55 | |
redbird | 0:1bf8f02b0770 | 56 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 57 | * |
redbird | 0:1bf8f02b0770 | 58 | * Required renaming operations |
redbird | 0:1bf8f02b0770 | 59 | */ |
redbird | 0:1bf8f02b0770 | 60 | #define LCD_On LCD_L0_On |
redbird | 0:1bf8f02b0770 | 61 | #define LCD_Off LCD_L0_Off |
redbird | 0:1bf8f02b0770 | 62 | |
redbird | 0:1bf8f02b0770 | 63 | #ifdef __cplusplus |
redbird | 0:1bf8f02b0770 | 64 | extern "C" { |
redbird | 0:1bf8f02b0770 | 65 | #endif |
redbird | 0:1bf8f02b0770 | 66 | |
redbird | 0:1bf8f02b0770 | 67 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 68 | * |
redbird | 0:1bf8f02b0770 | 69 | * Prototypes of LCD_L0_xxx - functions |
redbird | 0:1bf8f02b0770 | 70 | */ |
redbird | 0:1bf8f02b0770 | 71 | void LCD_L0_SetPixelIndex(int x, int y, int PixelIndex); |
redbird | 0:1bf8f02b0770 | 72 | unsigned LCD_L0_GetPixelIndex(int x, int y); |
redbird | 0:1bf8f02b0770 | 73 | void LCD_L0_XorPixel (int x, int y); |
redbird | 0:1bf8f02b0770 | 74 | void LCD_L0_DrawHLine (int x0, int y, int x1); |
redbird | 0:1bf8f02b0770 | 75 | void LCD_L0_DrawVLine (int x, int y0, int y1); |
redbird | 0:1bf8f02b0770 | 76 | void LCD_L0_FillRect (int x0, int y0, int x1, int y1); |
redbird | 0:1bf8f02b0770 | 77 | void LCD_L0_DrawBitmap (int x0, int y0, int xsize, int ysize, int BitsPerPixel, int BytesPerLine, const U8 * pData, int Diff, const LCD_PIXELINDEX * pTrans); |
redbird | 0:1bf8f02b0770 | 78 | void LCD_L0_SetOrg (int x, int y); |
redbird | 0:1bf8f02b0770 | 79 | void LCD_L0_On (void); |
redbird | 0:1bf8f02b0770 | 80 | void LCD_L0_Off (void); |
redbird | 0:1bf8f02b0770 | 81 | int LCD_L0_Init (void); |
redbird | 0:1bf8f02b0770 | 82 | void LCD_L0_SetLUTEntry (U8 Pos, LCD_COLOR Color); |
redbird | 0:1bf8f02b0770 | 83 | void (* LCD_L0_GetDevFunc (int Index))(void); |
redbird | 0:1bf8f02b0770 | 84 | |
redbird | 0:1bf8f02b0770 | 85 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 86 | * |
redbird | 0:1bf8f02b0770 | 87 | * Prototypes of SIM_xxx - functions |
redbird | 0:1bf8f02b0770 | 88 | */ |
redbird | 0:1bf8f02b0770 | 89 | void SIM_SetVRAMSize(int LayerIndex, int xSize, int ySize); |
redbird | 0:1bf8f02b0770 | 90 | |
redbird | 0:1bf8f02b0770 | 91 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 92 | * |
redbird | 0:1bf8f02b0770 | 93 | * Static data |
redbird | 0:1bf8f02b0770 | 94 | * |
redbird | 0:1bf8f02b0770 | 95 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 96 | */ |
redbird | 0:1bf8f02b0770 | 97 | static int _xSize; |
redbird | 0:1bf8f02b0770 | 98 | static int _ySize; |
redbird | 0:1bf8f02b0770 | 99 | static int _vxSize; |
redbird | 0:1bf8f02b0770 | 100 | static int _vySize; |
redbird | 0:1bf8f02b0770 | 101 | static int _xSizePhys; |
redbird | 0:1bf8f02b0770 | 102 | static int _ySizePhys; |
redbird | 0:1bf8f02b0770 | 103 | static int _NumColors; |
redbird | 0:1bf8f02b0770 | 104 | |
redbird | 0:1bf8f02b0770 | 105 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 106 | * |
redbird | 0:1bf8f02b0770 | 107 | * Static code |
redbird | 0:1bf8f02b0770 | 108 | * |
redbird | 0:1bf8f02b0770 | 109 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 110 | */ |
redbird | 0:1bf8f02b0770 | 111 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 112 | * |
redbird | 0:1bf8f02b0770 | 113 | * __SetPixelIndex |
redbird | 0:1bf8f02b0770 | 114 | */ |
redbird | 0:1bf8f02b0770 | 115 | static void __SetPixelIndex(GUI_DEVICE * pDevice, int x, int y, int PixelIndex) { |
redbird | 0:1bf8f02b0770 | 116 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 117 | LCD_L0_SetPixelIndex(x, y, PixelIndex); |
redbird | 0:1bf8f02b0770 | 118 | } |
redbird | 0:1bf8f02b0770 | 119 | |
redbird | 0:1bf8f02b0770 | 120 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 121 | * |
redbird | 0:1bf8f02b0770 | 122 | * __GetPixelIndex |
redbird | 0:1bf8f02b0770 | 123 | */ |
redbird | 0:1bf8f02b0770 | 124 | static unsigned int __GetPixelIndex(GUI_DEVICE * pDevice, int x, int y) { |
redbird | 0:1bf8f02b0770 | 125 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 126 | return LCD_L0_GetPixelIndex(x, y); |
redbird | 0:1bf8f02b0770 | 127 | } |
redbird | 0:1bf8f02b0770 | 128 | |
redbird | 0:1bf8f02b0770 | 129 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 130 | * |
redbird | 0:1bf8f02b0770 | 131 | * __XorPixel |
redbird | 0:1bf8f02b0770 | 132 | */ |
redbird | 0:1bf8f02b0770 | 133 | static void __XorPixel(GUI_DEVICE * pDevice, int x, int y) { |
redbird | 0:1bf8f02b0770 | 134 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 135 | LCD_L0_XorPixel(x, y); |
redbird | 0:1bf8f02b0770 | 136 | } |
redbird | 0:1bf8f02b0770 | 137 | |
redbird | 0:1bf8f02b0770 | 138 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 139 | * |
redbird | 0:1bf8f02b0770 | 140 | * __DrawHLine |
redbird | 0:1bf8f02b0770 | 141 | */ |
redbird | 0:1bf8f02b0770 | 142 | static void __DrawHLine(GUI_DEVICE * pDevice, int x0, int y, int x1) { |
redbird | 0:1bf8f02b0770 | 143 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 144 | LCD_L0_DrawHLine(x0, y, x1); |
redbird | 0:1bf8f02b0770 | 145 | } |
redbird | 0:1bf8f02b0770 | 146 | |
redbird | 0:1bf8f02b0770 | 147 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 148 | * |
redbird | 0:1bf8f02b0770 | 149 | * __DrawVLine, not optimized |
redbird | 0:1bf8f02b0770 | 150 | */ |
redbird | 0:1bf8f02b0770 | 151 | static void __DrawVLine(GUI_DEVICE * pDevice, int x, int y0, int y1) { |
redbird | 0:1bf8f02b0770 | 152 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 153 | LCD_L0_DrawVLine(x, y0, y1); |
redbird | 0:1bf8f02b0770 | 154 | } |
redbird | 0:1bf8f02b0770 | 155 | |
redbird | 0:1bf8f02b0770 | 156 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 157 | * |
redbird | 0:1bf8f02b0770 | 158 | * __FillRect |
redbird | 0:1bf8f02b0770 | 159 | */ |
redbird | 0:1bf8f02b0770 | 160 | static void __FillRect(GUI_DEVICE * pDevice, int x0, int y0, int x1, int y1) { |
redbird | 0:1bf8f02b0770 | 161 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 162 | LCD_L0_FillRect(x0, y0, x1, y1); |
redbird | 0:1bf8f02b0770 | 163 | } |
redbird | 0:1bf8f02b0770 | 164 | |
redbird | 0:1bf8f02b0770 | 165 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 166 | * |
redbird | 0:1bf8f02b0770 | 167 | * __DrawBitmap |
redbird | 0:1bf8f02b0770 | 168 | */ |
redbird | 0:1bf8f02b0770 | 169 | static void __DrawBitmap(GUI_DEVICE * pDevice, int x0, int y0, |
redbird | 0:1bf8f02b0770 | 170 | int xSize, int ySize, |
redbird | 0:1bf8f02b0770 | 171 | int BitsPerPixel, |
redbird | 0:1bf8f02b0770 | 172 | int BytesPerLine, |
redbird | 0:1bf8f02b0770 | 173 | const U8 * pData, int Diff, |
redbird | 0:1bf8f02b0770 | 174 | const LCD_PIXELINDEX * pTrans) { |
redbird | 0:1bf8f02b0770 | 175 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 176 | LCD_L0_DrawBitmap(x0, y0, xSize, ySize, BitsPerPixel, BytesPerLine, pData, Diff, pTrans); |
redbird | 0:1bf8f02b0770 | 177 | } |
redbird | 0:1bf8f02b0770 | 178 | |
redbird | 0:1bf8f02b0770 | 179 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 180 | * |
redbird | 0:1bf8f02b0770 | 181 | * __SetOrg |
redbird | 0:1bf8f02b0770 | 182 | */ |
redbird | 0:1bf8f02b0770 | 183 | static void __SetOrg(GUI_DEVICE * pDevice, int x, int y) { |
redbird | 0:1bf8f02b0770 | 184 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 185 | LCD_L0_SetOrg(x, y); |
redbird | 0:1bf8f02b0770 | 186 | } |
redbird | 0:1bf8f02b0770 | 187 | |
redbird | 0:1bf8f02b0770 | 188 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 189 | * |
redbird | 0:1bf8f02b0770 | 190 | * _SetVSize |
redbird | 0:1bf8f02b0770 | 191 | */ |
redbird | 0:1bf8f02b0770 | 192 | static void _SetVSize(GUI_DEVICE * pDevice, int xSize, int ySize) { |
redbird | 0:1bf8f02b0770 | 193 | LCD_VXSIZE = xSize; |
redbird | 0:1bf8f02b0770 | 194 | LCD_VYSIZE = ySize; |
redbird | 0:1bf8f02b0770 | 195 | #if defined(WIN32) | defined(LCD_SIMCONTROLLER) |
redbird | 0:1bf8f02b0770 | 196 | SIM_SetVRAMSize(pDevice->LayerIndex, xSize, ySize); |
redbird | 0:1bf8f02b0770 | 197 | #else |
redbird | 0:1bf8f02b0770 | 198 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 199 | #endif |
redbird | 0:1bf8f02b0770 | 200 | } |
redbird | 0:1bf8f02b0770 | 201 | |
redbird | 0:1bf8f02b0770 | 202 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 203 | * |
redbird | 0:1bf8f02b0770 | 204 | * _SetSize |
redbird | 0:1bf8f02b0770 | 205 | */ |
redbird | 0:1bf8f02b0770 | 206 | static void _SetSize(GUI_DEVICE * pDevice, int xSize, int ySize) { |
redbird | 0:1bf8f02b0770 | 207 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 208 | LCD_XSIZE = xSize; |
redbird | 0:1bf8f02b0770 | 209 | LCD_YSIZE = ySize; |
redbird | 0:1bf8f02b0770 | 210 | #if (LCD_SWAP_XY) |
redbird | 0:1bf8f02b0770 | 211 | _xSizePhys = ySize; |
redbird | 0:1bf8f02b0770 | 212 | _ySizePhys = xSize; |
redbird | 0:1bf8f02b0770 | 213 | #else |
redbird | 0:1bf8f02b0770 | 214 | _xSizePhys = xSize; |
redbird | 0:1bf8f02b0770 | 215 | _ySizePhys = ySize; |
redbird | 0:1bf8f02b0770 | 216 | #endif |
redbird | 0:1bf8f02b0770 | 217 | } |
redbird | 0:1bf8f02b0770 | 218 | |
redbird | 0:1bf8f02b0770 | 219 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 220 | * |
redbird | 0:1bf8f02b0770 | 221 | * __ReadRect |
redbird | 0:1bf8f02b0770 | 222 | */ |
redbird | 0:1bf8f02b0770 | 223 | static void __ReadRect(GUI_DEVICE * pDevice, int x0, int y0, int x1, int y1, LCD_PIXELINDEX * pBuffer) { |
redbird | 0:1bf8f02b0770 | 224 | void (* pfReadRect)(int, int, int, int, LCD_PIXELINDEX *); |
redbird | 0:1bf8f02b0770 | 225 | |
redbird | 0:1bf8f02b0770 | 226 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 227 | pfReadRect = (void (*)(int, int, int, int, LCD_PIXELINDEX *))LCD_L0_GetDevFunc(LCD_DEVFUNC_READRECT); |
redbird | 0:1bf8f02b0770 | 228 | pfReadRect(x0, y0, x1, y1, pBuffer); |
redbird | 0:1bf8f02b0770 | 229 | } |
redbird | 0:1bf8f02b0770 | 230 | |
redbird | 0:1bf8f02b0770 | 231 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 232 | * |
redbird | 0:1bf8f02b0770 | 233 | * _GetReadRect |
redbird | 0:1bf8f02b0770 | 234 | */ |
redbird | 0:1bf8f02b0770 | 235 | static void (* _GetReadRect(void))(void) { |
redbird | 0:1bf8f02b0770 | 236 | if (LCD_L0_GetDevFunc(LCD_DEVFUNC_READRECT)) { |
redbird | 0:1bf8f02b0770 | 237 | return (void (*)(void))__ReadRect; |
redbird | 0:1bf8f02b0770 | 238 | } |
redbird | 0:1bf8f02b0770 | 239 | return NULL; |
redbird | 0:1bf8f02b0770 | 240 | } |
redbird | 0:1bf8f02b0770 | 241 | |
redbird | 0:1bf8f02b0770 | 242 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 243 | * |
redbird | 0:1bf8f02b0770 | 244 | * __ControlCache |
redbird | 0:1bf8f02b0770 | 245 | */ |
redbird | 0:1bf8f02b0770 | 246 | static int __ControlCache(GUI_DEVICE * pDevice, int Cmd) { |
redbird | 0:1bf8f02b0770 | 247 | int (* pfControlCache)(int); |
redbird | 0:1bf8f02b0770 | 248 | |
redbird | 0:1bf8f02b0770 | 249 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 250 | pfControlCache = (int (*)(int))LCD_L0_GetDevFunc(LCD_DEVFUNC_CONTROLCACHE); |
redbird | 0:1bf8f02b0770 | 251 | return pfControlCache(Cmd); |
redbird | 0:1bf8f02b0770 | 252 | } |
redbird | 0:1bf8f02b0770 | 253 | |
redbird | 0:1bf8f02b0770 | 254 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 255 | * |
redbird | 0:1bf8f02b0770 | 256 | * _GetControlCache |
redbird | 0:1bf8f02b0770 | 257 | */ |
redbird | 0:1bf8f02b0770 | 258 | static void (* _GetControlCache(void))(void) { |
redbird | 0:1bf8f02b0770 | 259 | if (LCD_L0_GetDevFunc(LCD_DEVFUNC_CONTROLCACHE)) { |
redbird | 0:1bf8f02b0770 | 260 | return (void (*)(void))__ControlCache; |
redbird | 0:1bf8f02b0770 | 261 | } |
redbird | 0:1bf8f02b0770 | 262 | return NULL; |
redbird | 0:1bf8f02b0770 | 263 | } |
redbird | 0:1bf8f02b0770 | 264 | |
redbird | 0:1bf8f02b0770 | 265 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 266 | * |
redbird | 0:1bf8f02b0770 | 267 | * __Refresh |
redbird | 0:1bf8f02b0770 | 268 | */ |
redbird | 0:1bf8f02b0770 | 269 | static void __Refresh(GUI_DEVICE * pDevice) { |
redbird | 0:1bf8f02b0770 | 270 | void (* pfRefresh)(void); |
redbird | 0:1bf8f02b0770 | 271 | |
redbird | 0:1bf8f02b0770 | 272 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 273 | pfRefresh = (void (*)(void))LCD_L0_GetDevFunc(LCD_DEVFUNC_REFRESH); |
redbird | 0:1bf8f02b0770 | 274 | pfRefresh(); |
redbird | 0:1bf8f02b0770 | 275 | } |
redbird | 0:1bf8f02b0770 | 276 | |
redbird | 0:1bf8f02b0770 | 277 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 278 | * |
redbird | 0:1bf8f02b0770 | 279 | * _GetRefresh |
redbird | 0:1bf8f02b0770 | 280 | */ |
redbird | 0:1bf8f02b0770 | 281 | static void (* _GetRefresh(void))(void) { |
redbird | 0:1bf8f02b0770 | 282 | if (LCD_L0_GetDevFunc(LCD_DEVFUNC_REFRESH)) { |
redbird | 0:1bf8f02b0770 | 283 | return (void (*)(void))__Refresh; |
redbird | 0:1bf8f02b0770 | 284 | } |
redbird | 0:1bf8f02b0770 | 285 | return NULL; |
redbird | 0:1bf8f02b0770 | 286 | } |
redbird | 0:1bf8f02b0770 | 287 | |
redbird | 0:1bf8f02b0770 | 288 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 289 | * |
redbird | 0:1bf8f02b0770 | 290 | * _Init |
redbird | 0:1bf8f02b0770 | 291 | */ |
redbird | 0:1bf8f02b0770 | 292 | static int _Init(GUI_DEVICE * pDevice) { |
redbird | 0:1bf8f02b0770 | 293 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 294 | return LCD_L0_Init(); |
redbird | 0:1bf8f02b0770 | 295 | } |
redbird | 0:1bf8f02b0770 | 296 | |
redbird | 0:1bf8f02b0770 | 297 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 298 | * |
redbird | 0:1bf8f02b0770 | 299 | * __GetDevFunc |
redbird | 0:1bf8f02b0770 | 300 | */ |
redbird | 0:1bf8f02b0770 | 301 | static void (* __GetDevFunc(GUI_DEVICE ** ppDevice, int Index))(void) { |
redbird | 0:1bf8f02b0770 | 302 | GUI_USE_PARA(ppDevice); |
redbird | 0:1bf8f02b0770 | 303 | switch (Index) { |
redbird | 0:1bf8f02b0770 | 304 | case LCD_DEVFUNC_CONTROLCACHE: |
redbird | 0:1bf8f02b0770 | 305 | return _GetControlCache(); |
redbird | 0:1bf8f02b0770 | 306 | case LCD_DEVFUNC_REFRESH: |
redbird | 0:1bf8f02b0770 | 307 | return _GetRefresh(); |
redbird | 0:1bf8f02b0770 | 308 | case LCD_DEVFUNC_READRECT: |
redbird | 0:1bf8f02b0770 | 309 | return _GetReadRect(); |
redbird | 0:1bf8f02b0770 | 310 | case LCD_DEVFUNC_SET_VSIZE: |
redbird | 0:1bf8f02b0770 | 311 | return (void (*)(void))_SetVSize; |
redbird | 0:1bf8f02b0770 | 312 | case LCD_DEVFUNC_SET_SIZE: |
redbird | 0:1bf8f02b0770 | 313 | return (void (*)(void))_SetSize; |
redbird | 0:1bf8f02b0770 | 314 | case LCD_DEVFUNC_INIT: |
redbird | 0:1bf8f02b0770 | 315 | return (void (*)(void))_Init; |
redbird | 0:1bf8f02b0770 | 316 | default: |
redbird | 0:1bf8f02b0770 | 317 | return (void (*)(void))LCD_L0_GetDevFunc(Index); |
redbird | 0:1bf8f02b0770 | 318 | } |
redbird | 0:1bf8f02b0770 | 319 | } |
redbird | 0:1bf8f02b0770 | 320 | |
redbird | 0:1bf8f02b0770 | 321 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 322 | * |
redbird | 0:1bf8f02b0770 | 323 | * __GetDevProp |
redbird | 0:1bf8f02b0770 | 324 | */ |
redbird | 0:1bf8f02b0770 | 325 | static I32 __GetDevProp(GUI_DEVICE * pDevice, int Index) { |
redbird | 0:1bf8f02b0770 | 326 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 327 | switch (Index) { |
redbird | 0:1bf8f02b0770 | 328 | case LCD_DEVCAP_XSIZE: |
redbird | 0:1bf8f02b0770 | 329 | return LCD_XSIZE; |
redbird | 0:1bf8f02b0770 | 330 | case LCD_DEVCAP_YSIZE: |
redbird | 0:1bf8f02b0770 | 331 | return LCD_YSIZE; |
redbird | 0:1bf8f02b0770 | 332 | case LCD_DEVCAP_VXSIZE: |
redbird | 0:1bf8f02b0770 | 333 | return LCD_VXSIZE; |
redbird | 0:1bf8f02b0770 | 334 | case LCD_DEVCAP_VYSIZE: |
redbird | 0:1bf8f02b0770 | 335 | return LCD_VYSIZE; |
redbird | 0:1bf8f02b0770 | 336 | case LCD_DEVCAP_BITSPERPIXEL: |
redbird | 0:1bf8f02b0770 | 337 | return LCD_BITSPERPIXEL; |
redbird | 0:1bf8f02b0770 | 338 | case LCD_DEVCAP_NUMCOLORS: |
redbird | 0:1bf8f02b0770 | 339 | return 1 << LCD_BITSPERPIXEL; |
redbird | 0:1bf8f02b0770 | 340 | case LCD_DEVCAP_XMAG: |
redbird | 0:1bf8f02b0770 | 341 | return 1; |
redbird | 0:1bf8f02b0770 | 342 | case LCD_DEVCAP_YMAG: |
redbird | 0:1bf8f02b0770 | 343 | return 1; |
redbird | 0:1bf8f02b0770 | 344 | case LCD_DEVCAP_MIRROR_X: |
redbird | 0:1bf8f02b0770 | 345 | return LCD_MIRROR_X; |
redbird | 0:1bf8f02b0770 | 346 | case LCD_DEVCAP_MIRROR_Y: |
redbird | 0:1bf8f02b0770 | 347 | return LCD_MIRROR_Y; |
redbird | 0:1bf8f02b0770 | 348 | case LCD_DEVCAP_SWAP_XY: |
redbird | 0:1bf8f02b0770 | 349 | return LCD_SWAP_XY; |
redbird | 0:1bf8f02b0770 | 350 | case LCD_DEVCAP_SWAP_RB: |
redbird | 0:1bf8f02b0770 | 351 | return LCD_SWAP_RB; |
redbird | 0:1bf8f02b0770 | 352 | } |
redbird | 0:1bf8f02b0770 | 353 | return -1; |
redbird | 0:1bf8f02b0770 | 354 | } |
redbird | 0:1bf8f02b0770 | 355 | |
redbird | 0:1bf8f02b0770 | 356 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 357 | * |
redbird | 0:1bf8f02b0770 | 358 | * __GetDevData |
redbird | 0:1bf8f02b0770 | 359 | */ |
redbird | 0:1bf8f02b0770 | 360 | static void * __GetDevData(GUI_DEVICE * pDevice, int Index) { |
redbird | 0:1bf8f02b0770 | 361 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 362 | #if GUI_SUPPORT_MEMDEV |
redbird | 0:1bf8f02b0770 | 363 | switch (Index) { |
redbird | 0:1bf8f02b0770 | 364 | case LCD_DEVDATA_MEMDEV: |
redbird | 0:1bf8f02b0770 | 365 | #if (LCD_BITSPERPIXEL == 1) |
redbird | 0:1bf8f02b0770 | 366 | return (void *)&GUI_MEMDEV_DEVICE_1; |
redbird | 0:1bf8f02b0770 | 367 | #elif (LCD_BITSPERPIXEL <= 8) |
redbird | 0:1bf8f02b0770 | 368 | return (void *)&GUI_MEMDEV_DEVICE_8; |
redbird | 0:1bf8f02b0770 | 369 | #elif (LCD_BITSPERPIXEL <= 16) |
redbird | 0:1bf8f02b0770 | 370 | return (void *)&GUI_MEMDEV_DEVICE_16; |
redbird | 0:1bf8f02b0770 | 371 | #else |
redbird | 0:1bf8f02b0770 | 372 | return (void *)&GUI_MEMDEV_DEVICE_32; |
redbird | 0:1bf8f02b0770 | 373 | #endif |
redbird | 0:1bf8f02b0770 | 374 | } |
redbird | 0:1bf8f02b0770 | 375 | #else |
redbird | 0:1bf8f02b0770 | 376 | GUI_USE_PARA(Index); |
redbird | 0:1bf8f02b0770 | 377 | #endif |
redbird | 0:1bf8f02b0770 | 378 | return NULL; |
redbird | 0:1bf8f02b0770 | 379 | } |
redbird | 0:1bf8f02b0770 | 380 | |
redbird | 0:1bf8f02b0770 | 381 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 382 | * |
redbird | 0:1bf8f02b0770 | 383 | * __GetRect |
redbird | 0:1bf8f02b0770 | 384 | */ |
redbird | 0:1bf8f02b0770 | 385 | static void __GetRect(GUI_DEVICE * pDevice, LCD_RECT * pRect) { |
redbird | 0:1bf8f02b0770 | 386 | GUI_USE_PARA(pDevice); |
redbird | 0:1bf8f02b0770 | 387 | pRect->x0 = 0; |
redbird | 0:1bf8f02b0770 | 388 | pRect->y0 = 0; |
redbird | 0:1bf8f02b0770 | 389 | pRect->x1 = LCD_VXSIZE - 1; |
redbird | 0:1bf8f02b0770 | 390 | pRect->y1 = LCD_VYSIZE - 1; |
redbird | 0:1bf8f02b0770 | 391 | } |
redbird | 0:1bf8f02b0770 | 392 | |
redbird | 0:1bf8f02b0770 | 393 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 394 | * |
redbird | 0:1bf8f02b0770 | 395 | * Public data |
redbird | 0:1bf8f02b0770 | 396 | * |
redbird | 0:1bf8f02b0770 | 397 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 398 | */ |
redbird | 0:1bf8f02b0770 | 399 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 400 | * |
redbird | 0:1bf8f02b0770 | 401 | * GUI_DEVICE_API structure |
redbird | 0:1bf8f02b0770 | 402 | */ |
redbird | 0:1bf8f02b0770 | 403 | const GUI_DEVICE_API DISPLAY_DRIVER_API = { |
redbird | 0:1bf8f02b0770 | 404 | // |
redbird | 0:1bf8f02b0770 | 405 | // Data |
redbird | 0:1bf8f02b0770 | 406 | // |
redbird | 0:1bf8f02b0770 | 407 | DEVICE_CLASS_DRIVER, |
redbird | 0:1bf8f02b0770 | 408 | // |
redbird | 0:1bf8f02b0770 | 409 | // Drawing functions |
redbird | 0:1bf8f02b0770 | 410 | // |
redbird | 0:1bf8f02b0770 | 411 | __DrawBitmap, |
redbird | 0:1bf8f02b0770 | 412 | __DrawHLine, |
redbird | 0:1bf8f02b0770 | 413 | __DrawVLine, |
redbird | 0:1bf8f02b0770 | 414 | __FillRect, |
redbird | 0:1bf8f02b0770 | 415 | __GetPixelIndex, |
redbird | 0:1bf8f02b0770 | 416 | __SetPixelIndex, |
redbird | 0:1bf8f02b0770 | 417 | __XorPixel, |
redbird | 0:1bf8f02b0770 | 418 | // |
redbird | 0:1bf8f02b0770 | 419 | // Set origin |
redbird | 0:1bf8f02b0770 | 420 | // |
redbird | 0:1bf8f02b0770 | 421 | __SetOrg, |
redbird | 0:1bf8f02b0770 | 422 | // |
redbird | 0:1bf8f02b0770 | 423 | // Request information |
redbird | 0:1bf8f02b0770 | 424 | // |
redbird | 0:1bf8f02b0770 | 425 | __GetDevFunc, |
redbird | 0:1bf8f02b0770 | 426 | __GetDevProp, |
redbird | 0:1bf8f02b0770 | 427 | __GetDevData, |
redbird | 0:1bf8f02b0770 | 428 | __GetRect, |
redbird | 0:1bf8f02b0770 | 429 | }; |
redbird | 0:1bf8f02b0770 | 430 | |
redbird | 0:1bf8f02b0770 | 431 | #ifdef __cplusplus |
redbird | 0:1bf8f02b0770 | 432 | } |
redbird | 0:1bf8f02b0770 | 433 | #endif |
redbird | 0:1bf8f02b0770 | 434 | |
redbird | 0:1bf8f02b0770 | 435 | #endif |
redbird | 0:1bf8f02b0770 | 436 | |
redbird | 0:1bf8f02b0770 | 437 | /*************************** End of file ****************************/ |