NXP
/
rt1050_emwin_gui_demo
RT1050 GUI demo using emWin library
Diff: emwin/emWin_header/GUIDRV_S1D13748_Private.h
- Revision:
- 0:dd702039127a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emwin/emWin_header/GUIDRV_S1D13748_Private.h Thu Sep 20 19:16:34 2018 +0000 @@ -0,0 +1,217 @@ +/********************************************************************* +* SEGGER Microcontroller GmbH & Co. KG * +* Solutions for real time microcontroller applications * +********************************************************************** +* * +* (c) 1996 - 2016 SEGGER Microcontroller GmbH & Co. KG * +* * +* Internet: www.segger.com Support: support@segger.com * +* * +********************************************************************** + +** emWin V5.38 - Graphical user interface for embedded applications ** +All Intellectual Property rights in the Software belongs to SEGGER. +emWin is protected by international copyright laws. Knowledge of the +source code may not be used to write a similar product. This file may +only be used in accordance with the following terms: + +The software has been licensed to NXP Semiconductors USA, Inc. whose +registered office is situated at 411 E. Plumeria Drive, San Jose, +CA 95134, USA solely for the purposes of creating libraries for +NXPs M0, M3/M4 and ARM7/9 processor-based devices, sublicensed and +distributed under the terms and conditions of the NXP End User License +Agreement. +Full source code is available at: www.segger.com + +We appreciate your understanding and fairness. +---------------------------------------------------------------------- +Licensing information + +Licensor: SEGGER Microcontroller Systems LLC +Licensed to: NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA +Licensed SEGGER software: emWin +License number: GUI-00186 +License model: emWin License Agreement, dated August 20th 2011 +Licensed product: - +Licensed platform: NXP's ARM 7/9, Cortex-M0,M3,M4 +Licensed number of seats: - +---------------------------------------------------------------------- +File : GUIDRV_S1D13748_Private.h +Purpose : Interface definition for GUIDRV_S1D13748 driver +---------------------------END-OF-HEADER------------------------------ +*/ + +#include "GUIDRV_S1D13748.h" +#include "GUIDRV_NoOpt_1_8.h" + +#ifndef GUIDRV_S1D13748_PRIVATE_H +#define GUIDRV_S1D13748_PRIVATE_H + +#if defined(__cplusplus) +extern "C" { /* Make sure we have C-declarations in C++ programs */ +#endif + +/********************************************************************* +* +* Defines +* +********************************************************************** +*/ +#ifndef LCD_WRITE_BUFFER_SIZE + #define LCD_WRITE_BUFFER_SIZE 500 +#endif + +/********************************************************************* +* +* Types +* +********************************************************************** +*/ +typedef struct DRIVER_CONTEXT DRIVER_CONTEXT; + +/********************************************************************* +* +* MANAGE_VMEM_API +*/ +typedef struct { + // + // Private function pointers + // + void (* pfSetAddrR) (DRIVER_CONTEXT * pContext, int x, int y); // Sets the address to be read + void (* pfSetAddrW) (DRIVER_CONTEXT * pContext, int x, int y); // Sets the address to be written + void (* pfSetRectR) (DRIVER_CONTEXT * pContext, int x0, int y0, int x1, int y1); // Sets the rectangular area to be read + void (* pfSetRectW) (DRIVER_CONTEXT * pContext, int x0, int y0, int x1, int y1); // Sets the rectangular area to be written + void (* pfFlushBuffer)(DRIVER_CONTEXT * pContext); // Sends remaining data of the write buffer to the controller + void (* pfWriteData) (DRIVER_CONTEXT * pContext, U16 Data); // Writes one 16 bit data item using the write buffer + void (* pfWriteDataM) (DRIVER_CONTEXT * pContext, U16 Data, U32 NumPixels); // Writes a number of items of the same color using the write buffer + void (* pfWriteDataMP)(DRIVER_CONTEXT * pContext, U16 const * pData, U32 NumPixels); // Writes data using the write buffer +} MANAGE_VMEM_API; + +/********************************************************************* +* +* DRIVER_CONTEXT +*/ +struct DRIVER_CONTEXT { + // + // Common data + // + int xSize, ySize; + int vxSize, vySize; + int xPos, yPos; + int MemSize; + int SwapXY; + int XOff; + U32 BufferOffset; + int NumBytesInBuffer; + int IsVisible; + // + // Driver specific data + // + int WriteBufferSize; + int UseLayer; + // + // Accelerators for calculation + // + int BitsPerPixel; + // + // VRAM + // + U16 * pWriteBuffer; + U16 * pWrite; + // + // API-Tables + // + MANAGE_VMEM_API ManageVMEM_API; // Memory management + GUI_PORT_API HW_API; // Hardware routines +}; + +/********************************************************************* +* +* LOG2PHYS_xxx +*/ +#define LOG2PHYS_X ( x ) +#define LOG2PHYS_X_OX (pContext->xSize - x - 1) +#define LOG2PHYS_X_OY ( x ) +#define LOG2PHYS_X_OXY (pContext->xSize - x - 1) +#define LOG2PHYS_X_OS ( y ) +#define LOG2PHYS_X_OSX (pContext->ySize - y - 1) +#define LOG2PHYS_X_OSY ( y ) +#define LOG2PHYS_X_OSXY (pContext->ySize - y - 1) + +#define LOG2PHYS_Y ( y ) +#define LOG2PHYS_Y_OX ( y ) +#define LOG2PHYS_Y_OY (pContext->ySize - y - 1) +#define LOG2PHYS_Y_OXY (pContext->ySize - y - 1) +#define LOG2PHYS_Y_OS ( x ) +#define LOG2PHYS_Y_OSX ( x ) +#define LOG2PHYS_Y_OSY (pContext->xSize - x - 1) +#define LOG2PHYS_Y_OSXY (pContext->xSize - x - 1) + +/********************************************************************* +* +* _SetPixelIndex_##EXT +*/ +#define DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ +static void _SetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y, LCD_PIXELINDEX PixelIndex) { \ + DRIVER_CONTEXT * pContext; \ + \ + pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; \ + _SetPixelIndex(pContext, X_PHYS, Y_PHYS, PixelIndex); \ +} + +/********************************************************************* +* +* _GetPixelIndex_##EXT +*/ +#define DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ +static LCD_PIXELINDEX _GetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y) { \ + DRIVER_CONTEXT * pContext; \ + LCD_PIXELINDEX PixelIndex; \ + \ + pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; \ + PixelIndex = _GetPixelIndex(pContext, X_PHYS, Y_PHYS); \ + return PixelIndex; \ +} + +/********************************************************************* +* +* _GetDevProp_##EXT +*/ +#define DEFINE_GETDEVPROP(EXT, MX, MY, SWAP) \ +static I32 _GetDevProp_##EXT(GUI_DEVICE * pDevice, int Index) { \ + switch (Index) { \ + case LCD_DEVCAP_MIRROR_X: return MX; \ + case LCD_DEVCAP_MIRROR_Y: return MY; \ + case LCD_DEVCAP_SWAP_XY: return SWAP; \ + } \ + return _GetDevProp(pDevice, Index); \ +} + +/********************************************************************* +* +* DEFINE_FUNCTIONS +*/ +#define DEFINE_FUNCTIONS(EXT, X_PHYS, Y_PHYS, MX, MY, SWAP) \ + DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ + DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ + DEFINE_GETDEVPROP(EXT, MX, MY, SWAP) \ + DEFINE_GUI_DEVICE_API(EXT) + +/********************************************************************* +* +* Private functions +* +********************************************************************** +*/ +void (*GUIDRV__S1D13748_GetDevFunc(GUI_DEVICE ** ppDevice, int Index))(void); +void GUIDRV__S1D13748_SetOrg (GUI_DEVICE * pDevice, int x, int y); +I32 GUIDRV__S1D13748_GetDevProp(GUI_DEVICE * pDevice, int Index); +void GUIDRV__S1D13748_GetRect (GUI_DEVICE * pDevice, LCD_RECT * pRect); + +#if defined(__cplusplus) +} +#endif + +#endif /* GUIDRV_S1D13748_PRIVATE_H */ + +/*************************** End of file ****************************/