00001 /* ---------------------------------------------------------------------------- */ 00002 /* Atmel Microcontroller Software Support */ 00003 /* SAM Software Package License */ 00004 /* ---------------------------------------------------------------------------- */ 00005 /* Copyright (c) 2015, Atmel Corporation */ 00006 /* */ 00007 /* All rights reserved. */ 00008 /* */ 00009 /* Redistribution and use in source and binary forms, with or without */ 00010 /* modification, are permitted provided that the following condition is met: */ 00011 /* */ 00012 /* - Redistributions of source code must retain the above copyright notice, */ 00013 /* this list of conditions and the disclaimer below. */ 00014 /* */ 00015 /* Atmel's name may not be used to endorse or promote products derived from */ 00016 /* this software without specific prior written permission. */ 00017 /* */ 00018 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ 00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ 00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ 00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ 00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ 00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ 00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ 00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ 00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ 00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00028 /* ---------------------------------------------------------------------------- */ 00029 00030 /** 00031 * \file 00032 * 00033 * Interface of ILI9488 driver. 00034 * 00035 */ 00036 00037 #ifndef _ILI9488_H_ 00038 #define _ILI9488_H_ 00039 00040 /*---------------------------------------------------------------------------- 00041 * Headers 00042 *----------------------------------------------------------------------------*/ 00043 00044 #include "board.h" 00045 00046 #include <stdint.h> 00047 00048 00049 /*---------------------------------------------------------------------------- 00050 * Definitions 00051 *----------------------------------------------------------------------------*/ 00052 00053 #define ILI9488_SPIMODE 0 00054 #define ILI9488_EBIMODE 1 00055 00056 /* ILI9325 ID code */ 00057 #define ILI9488_DEVICE_CODE 0x9488 00058 00059 #define ILI9488_LCD_WIDTH 320 00060 #define ILI9488_LCD_HEIGHT 480 00061 #define ILI9488_SELF_TEST_OK 0xC0 00062 00063 /* EBI chip select for LCD */ 00064 #define SMC_EBI_LCD_CS 3 00065 00066 /*---------------------------------------------------------------------------- 00067 * Types 00068 *----------------------------------------------------------------------------*/ 00069 typedef enum { 00070 AccessInst = 0, 00071 AccessRead, 00072 AccessWrite 00073 } AccessIli_t; 00074 00075 typedef union _union_type { 00076 uint32_t value; 00077 struct { 00078 uint8_t byte_8; 00079 uint8_t byte_l6; 00080 uint8_t byte_24; 00081 uint8_t byte_32; 00082 } byte; 00083 struct { 00084 uint16_t half_word_l; 00085 uint16_t half_word_h; 00086 } half_word; 00087 } union_type; 00088 typedef volatile uint8_t REG8; 00089 00090 typedef uint32_t LcdColor_t; 00091 00092 /*---------------------------------------------------------------------------- 00093 * Marcos 00094 *----------------------------------------------------------------------------*/ 00095 /* Pixel cache used to speed up communication */ 00096 #define LCD_DATA_CACHE_SIZE BOARD_LCD_WIDTH 00097 00098 /*---------------------------------------------------------------------------- 00099 * Function Marcos 00100 *----------------------------------------------------------------------------*/ 00101 #define get_0b_to_8b(x) (((union_type*)&(x))->byte.byte_8) 00102 #define get_8b_to_16b(x) (((union_type*)&(x))->byte.byte_l6) 00103 #define get_16b_to_24b(x) (((union_type*)&(x))->byte.byte_24) 00104 #define get_24b_to_32b(x) (((union_type*)&(x))->byte.byte_32) 00105 00106 #endif /* #ifndef ILI9488 */