Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:22:44

0001 /* ---------------------------------------------------------------------------- */
0002 /*                  Atmel Microcontroller Software Support                      */
0003 /*                       SAM Software Package License                           */
0004 /* ---------------------------------------------------------------------------- */
0005 /* Copyright (c) 2015, Atmel Corporation                                        */
0006 /*                                                                              */
0007 /* All rights reserved.                                                         */
0008 /*                                                                              */
0009 /* Redistribution and use in source and binary forms, with or without           */
0010 /* modification, are permitted provided that the following condition is met:    */
0011 /*                                                                              */
0012 /* - Redistributions of source code must retain the above copyright notice,     */
0013 /* this list of conditions and the disclaimer below.                            */
0014 /*                                                                              */
0015 /* Atmel's name may not be used to endorse or promote products derived from     */
0016 /* this software without specific prior written permission.                     */
0017 /*                                                                              */
0018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
0019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
0020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
0021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
0022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
0023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
0024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
0025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
0026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
0027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
0028 /* ---------------------------------------------------------------------------- */
0029 
0030 /**
0031  * \file
0032  *
0033  * Interface of ILI9488 driver.
0034  *
0035  */
0036 
0037 #ifndef _ILI9488_H_
0038 #define _ILI9488_H_
0039 
0040 /*----------------------------------------------------------------------------
0041  *        Headers
0042  *----------------------------------------------------------------------------*/
0043 
0044 #include "board.h"
0045 
0046 #include <stdint.h>
0047 
0048 
0049 /*----------------------------------------------------------------------------
0050  *        Definitions
0051  *----------------------------------------------------------------------------*/
0052 
0053 #define ILI9488_SPIMODE        0
0054 #define ILI9488_EBIMODE        1
0055 
0056 /* ILI9325 ID code */
0057 #define ILI9488_DEVICE_CODE    0x9488
0058 
0059 #define ILI9488_LCD_WIDTH       320
0060 #define ILI9488_LCD_HEIGHT      480
0061 #define ILI9488_SELF_TEST_OK    0xC0
0062 
0063 /* EBI chip select for LCD */
0064 #define SMC_EBI_LCD_CS          3
0065 
0066 /*----------------------------------------------------------------------------
0067  *        Types
0068  *----------------------------------------------------------------------------*/
0069 typedef enum {
0070     AccessInst = 0,
0071     AccessRead,
0072     AccessWrite
0073 } AccessIli_t;
0074 
0075 typedef union _union_type {
0076     uint32_t value;
0077     struct {
0078         uint8_t byte_8;
0079         uint8_t byte_l6;
0080         uint8_t byte_24;
0081         uint8_t byte_32;
0082     } byte;
0083     struct {
0084         uint16_t half_word_l;
0085         uint16_t half_word_h;
0086     } half_word;
0087 } union_type;
0088 typedef volatile uint8_t REG8;
0089 
0090 typedef uint32_t LcdColor_t;
0091 
0092 /*----------------------------------------------------------------------------
0093  *        Marcos
0094  *----------------------------------------------------------------------------*/
0095 /* Pixel cache used to speed up communication */
0096 #define LCD_DATA_CACHE_SIZE         BOARD_LCD_WIDTH
0097 
0098 /*----------------------------------------------------------------------------
0099  *        Function Marcos
0100  *----------------------------------------------------------------------------*/
0101 #define get_0b_to_8b(x)             (((union_type*)&(x))->byte.byte_8)
0102 #define get_8b_to_16b(x)            (((union_type*)&(x))->byte.byte_l6)
0103 #define get_16b_to_24b(x)           (((union_type*)&(x))->byte.byte_24)
0104 #define get_24b_to_32b(x)           (((union_type*)&(x))->byte.byte_32)
0105 
0106 #endif /* #ifndef ILI9488 */