00001 /* ---------------------------------------------------------------------------- 00002 * SAM Software Package License 00003 * ---------------------------------------------------------------------------- 00004 * Copyright (c) 2014, Atmel Corporation 00005 * 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * 00011 * - Redistributions of source code must retain the above copyright notice, 00012 * this list of conditions and the disclaimer below. 00013 * 00014 * Atmel's name may not be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00020 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00022 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00023 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00024 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00025 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00026 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 * ---------------------------------------------------------------------------- 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 { 00077 uint32_t value; 00078 struct{ 00079 uint8_t byte_8; 00080 uint8_t byte_l6; 00081 uint8_t byte_24; 00082 uint8_t byte_32; 00083 }byte; 00084 struct{ 00085 uint16_t half_word_l; 00086 uint16_t half_word_h; 00087 }half_word; 00088 }union_type; 00089 typedef volatile uint8_t REG8; 00090 00091 typedef uint32_t LcdColor_t; 00092 00093 /*---------------------------------------------------------------------------- 00094 * Marcos 00095 *----------------------------------------------------------------------------*/ 00096 /* Pixel cache used to speed up communication */ 00097 #define LCD_DATA_CACHE_SIZE BOARD_LCD_WIDTH 00098 00099 /*---------------------------------------------------------------------------- 00100 * Function Marcos 00101 *----------------------------------------------------------------------------*/ 00102 #define get_0b_to_8b(x) (((union_type*)&(x))->byte.byte_8) 00103 #define get_8b_to_16b(x) (((union_type*)&(x))->byte.byte_l6) 00104 #define get_16b_to_24b(x) (((union_type*)&(x))->byte.byte_24) 00105 #define get_24b_to_32b(x) (((union_type*)&(x))->byte.byte_32) 00106 00107 #endif /* #ifndef ILI9488 */