damon zhang / Mbed OS rt1050_emwin_gui_demo
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers emwin_support.h Source File

emwin_support.h

00001 /*
00002  * The Clear BSD License
00003  * Copyright (c) 2016, Freescale Semiconductor, Inc.
00004  * Copyright 2016-2017 NXP
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without modification,
00008  * are permitted (subject to the limitations in the disclaimer below) provided
00009  *  that the following conditions are met:
00010  *
00011  * o Redistributions of source code must retain the above copyright notice, this list
00012  *   of conditions and the following disclaimer.
00013  *
00014  * o Redistributions in binary form must reproduce the above copyright notice, this
00015  *   list of conditions and the following disclaimer in the documentation and/or
00016  *   other materials provided with the distribution.
00017  *
00018  * o Neither the name of the copyright holder nor the names of its
00019  *   contributors may be used to endorse or promote products derived from this
00020  *   software without specific prior written permission.
00021  *
00022  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
00023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00024  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00025  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00026  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00027  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00028  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00030  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00031  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00032  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  */
00034 
00035 #ifndef _EMWIN_SUPPORT_H_
00036 #define _EMWIN_SUPPORT_H_
00037 
00038 /* Macros for the LCD controller. */
00039 #define APP_ELCDIF LCDIF
00040 
00041 #define APP_IMG_HEIGHT 272
00042 #define APP_IMG_WIDTH 480
00043 #define APP_HSW 41
00044 #define APP_HFP 4
00045 #define APP_HBP 8
00046 #define APP_VSW 10
00047 #define APP_VFP 4
00048 #define APP_VBP 2
00049 #define APP_POL_FLAGS \
00050     (kELCDIF_DataEnableActiveHigh | kELCDIF_VsyncActiveLow | kELCDIF_HsyncActiveLow | kELCDIF_DriveDataOnRisingClkEdge)
00051 
00052 /* Display. */
00053 #define LCD_DISP_GPIO GPIO1
00054 #define LCD_DISP_GPIO_PIN 2
00055 /* Back light. */
00056 #define LCD_BL_GPIO GPIO2
00057 #define LCD_BL_GPIO_PIN 31
00058 
00059 /* Macros for the touch touch controller. */
00060 #define BOARD_TOUCH_I2C LPI2C1
00061 
00062 /* Select USB1 PLL (480 MHz) as master lpi2c clock source */
00063 #define LPI2C_CLOCK_SOURCE_SELECT (0U)
00064 /* Clock divider for master lpi2c clock source */
00065 #define LPI2C_CLOCK_SOURCE_DIVIDER (5U)
00066 
00067 #define BOARD_TOUCH_I2C_CLOCK_FREQ ((CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8) / (LPI2C_CLOCK_SOURCE_DIVIDER + 1U))
00068 #define BOARD_TOUCH_I2C_BAUDRATE 100000U
00069 
00070 #define LPI2C_DATA_LENGTH 32U
00071 
00072 #define LPI2C_MASTER_IRQ LPI2C1_IRQn
00073 #define LPI2C_MASTER_IRQHandler LPI2C1_IRQHandler
00074 #define BOARD_TOUCH_INT_PORT PORTA
00075 #define BOARD_TOUCH_INT_PIN 2
00076 
00077 #define BOARD_LCD_READABLE 1
00078 
00079 #define LCD_WIDTH 480
00080 #define LCD_HEIGHT 272
00081 #define LCD_BITS_PER_PIXEL 8
00082 #define LCD_BYTES_PER_PIXEL (LCD_BITS_PER_PIXEL / 8)
00083 
00084 /* Color depth dependent definitions */
00085 #if LCD_BITS_PER_PIXEL == 8
00086 #define DISPLAY_DRIVER GUIDRV_LIN_8
00087 #define COLOR_CONVERSION GUICC_0
00088 #define ELCDIF_PIXEL_FORMAT kELCDIF_PixelFormatRAW8
00089 #define APP_LCDIF_DATA_BUS kELCDIF_DataBus8Bit
00090 #elif LCD_BITS_PER_PIXEL == 16
00091 #define DISPLAY_DRIVER GUIDRV_LIN_16
00092 #define COLOR_CONVERSION GUICC_M565
00093 #define ELCDIF_PIXEL_FORMAT kELCDIF_PixelFormatRGB565
00094 #define APP_LCDIF_DATA_BUS kELCDIF_DataBus16Bit
00095 #else
00096 #define DISPLAY_DRIVER GUIDRV_LIN_32
00097 #define COLOR_CONVERSION GUICC_M8888I
00098 #define ELCDIF_PIXEL_FORMAT kELCDIF_PixelFormatXRGB8888
00099 #define APP_LCDIF_DATA_BUS kELCDIF_DataBus16Bit
00100 #endif
00101 
00102 /* Define scale factors */
00103 #define GUI_SCALE_FACTOR 0.8
00104 #define GUI_SCALE_FACTOR_X 1.5
00105 #define GUI_SCALE_FACTOR_Y 1.1
00106 
00107 /* Use larger fonts */
00108 #define GUI_NORMAL_FONT (&GUI_Font24_ASCII)
00109 #define GUI_LARGE_FONT (&GUI_Font32B_ASCII)
00110 
00111 #define GUI_BUFFERS 2
00112 #define GUI_NUMBYTES 20000U /*! Amount of memory assigned to the emWin library */
00113 
00114 #define FRAME_BUFFER_ALIGN 64
00115 
00116 #define VRAM_SIZE (LCD_HEIGHT * LCD_WIDTH * LCD_BYTES_PER_PIXEL)
00117 
00118 extern int BOARD_Touch_Poll(void);
00119 
00120 #endif