1 | /* ---------------------------------------------------------------------------- */ |
---|
2 | /* Atmel Microcontroller Software Support */ |
---|
3 | /* SAM Software Package License */ |
---|
4 | /* ---------------------------------------------------------------------------- */ |
---|
5 | /* Copyright (c) 2015, Atmel Corporation */ |
---|
6 | /* */ |
---|
7 | /* All rights reserved. */ |
---|
8 | /* */ |
---|
9 | /* Redistribution and use in source and binary forms, with or without */ |
---|
10 | /* modification, are permitted provided that the following condition is met: */ |
---|
11 | /* */ |
---|
12 | /* - Redistributions of source code must retain the above copyright notice, */ |
---|
13 | /* this list of conditions and the disclaimer below. */ |
---|
14 | /* */ |
---|
15 | /* Atmel's name may not be used to endorse or promote products derived from */ |
---|
16 | /* this software without specific prior written permission. */ |
---|
17 | /* */ |
---|
18 | /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ |
---|
19 | /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ |
---|
20 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ |
---|
21 | /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ |
---|
22 | /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ |
---|
23 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ |
---|
24 | /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ |
---|
25 | /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ |
---|
26 | /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ |
---|
27 | /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
---|
28 | /* ---------------------------------------------------------------------------- */ |
---|
29 | |
---|
30 | /** |
---|
31 | * \file |
---|
32 | * |
---|
33 | * Interface of ILI9488 driver. |
---|
34 | * |
---|
35 | */ |
---|
36 | |
---|
37 | #ifndef _ILI9488_H_ |
---|
38 | #define _ILI9488_H_ |
---|
39 | |
---|
40 | /*---------------------------------------------------------------------------- |
---|
41 | * Headers |
---|
42 | *----------------------------------------------------------------------------*/ |
---|
43 | |
---|
44 | #include "board.h" |
---|
45 | |
---|
46 | #include <stdint.h> |
---|
47 | |
---|
48 | |
---|
49 | /*---------------------------------------------------------------------------- |
---|
50 | * Definitions |
---|
51 | *----------------------------------------------------------------------------*/ |
---|
52 | |
---|
53 | #define ILI9488_SPIMODE 0 |
---|
54 | #define ILI9488_EBIMODE 1 |
---|
55 | |
---|
56 | /* ILI9325 ID code */ |
---|
57 | #define ILI9488_DEVICE_CODE 0x9488 |
---|
58 | |
---|
59 | #define ILI9488_LCD_WIDTH 320 |
---|
60 | #define ILI9488_LCD_HEIGHT 480 |
---|
61 | #define ILI9488_SELF_TEST_OK 0xC0 |
---|
62 | |
---|
63 | /* EBI chip select for LCD */ |
---|
64 | #define SMC_EBI_LCD_CS 3 |
---|
65 | |
---|
66 | /*---------------------------------------------------------------------------- |
---|
67 | * Types |
---|
68 | *----------------------------------------------------------------------------*/ |
---|
69 | typedef enum { |
---|
70 | AccessInst = 0, |
---|
71 | AccessRead, |
---|
72 | AccessWrite |
---|
73 | } AccessIli_t; |
---|
74 | |
---|
75 | typedef union _union_type { |
---|
76 | uint32_t value; |
---|
77 | struct { |
---|
78 | uint8_t byte_8; |
---|
79 | uint8_t byte_l6; |
---|
80 | uint8_t byte_24; |
---|
81 | uint8_t byte_32; |
---|
82 | } byte; |
---|
83 | struct { |
---|
84 | uint16_t half_word_l; |
---|
85 | uint16_t half_word_h; |
---|
86 | } half_word; |
---|
87 | } union_type; |
---|
88 | typedef volatile uint8_t REG8; |
---|
89 | |
---|
90 | typedef uint32_t LcdColor_t; |
---|
91 | |
---|
92 | /*---------------------------------------------------------------------------- |
---|
93 | * Marcos |
---|
94 | *----------------------------------------------------------------------------*/ |
---|
95 | /* Pixel cache used to speed up communication */ |
---|
96 | #define LCD_DATA_CACHE_SIZE BOARD_LCD_WIDTH |
---|
97 | |
---|
98 | /*---------------------------------------------------------------------------- |
---|
99 | * Function Marcos |
---|
100 | *----------------------------------------------------------------------------*/ |
---|
101 | #define get_0b_to_8b(x) (((union_type*)&(x))->byte.byte_8) |
---|
102 | #define get_8b_to_16b(x) (((union_type*)&(x))->byte.byte_l6) |
---|
103 | #define get_16b_to_24b(x) (((union_type*)&(x))->byte.byte_24) |
---|
104 | #define get_24b_to_32b(x) (((union_type*)&(x))->byte.byte_32) |
---|
105 | |
---|
106 | #endif /* #ifndef ILI9488 */ |
---|