This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
ili9340.h
134 lines (103 loc) · 3.33 KB
/
ili9340.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**
This file is part of FORTMAX.
FORTMAX is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FORTMAX is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FORTMAX. If not, see <http://www.gnu.org/licenses/>.
Copyright: Martin K. Schröder (info@fortmax.se) 2014
Credits: Adafruit for original setup code
*/
#pragma once
#include <avr/pgmspace.h>
#define ILI9340_TFTWIDTH 240
#define ILI9340_TFTHEIGHT 320
#define ILI9340_NOP 0x00
#define ILI9340_SWRESET 0x01
#define ILI9340_RDDID 0x04
#define ILI9340_RDDST 0x09
#define ILI9340_SLPIN 0x10
#define ILI9340_SLPOUT 0x11
#define ILI9340_PTLON 0x12
#define ILI9340_NORON 0x13
#define ILI9340_RDMODE 0x0A
#define ILI9340_RDMADCTL 0x0B
#define ILI9340_RDPIXFMT 0x0C
#define ILI9340_RDIMGFMT 0x0A
#define ILI9340_RDSELFDIAG 0x0F
#define ILI9340_INVOFF 0x20
#define ILI9340_INVON 0x21
#define ILI9340_GAMMASET 0x26
#define ILI9340_DISPOFF 0x28
#define ILI9340_DISPON 0x29
#define ILI9340_CASET 0x2A
#define ILI9340_PASET 0x2B
#define ILI9340_RAMWR 0x2C
#define ILI9340_RAMRD 0x2E
#define ILI9340_PTLAR 0x30
#define ILI9340_MADCTL 0x36
#define ILI9340_MADCTL_MY 0x80
#define ILI9340_MADCTL_MX 0x40
#define ILI9340_MADCTL_MV 0x20
#define ILI9340_MADCTL_ML 0x10
#define ILI9340_MADCTL_RGB 0x00
#define ILI9340_MADCTL_BGR 0x08
#define ILI9340_MADCTL_MH 0x04
#define ILI9340_PIXFMT 0x3A
#define ILI9340_FRMCTR1 0xB1
#define ILI9340_FRMCTR2 0xB2
#define ILI9340_FRMCTR3 0xB3
#define ILI9340_INVCTR 0xB4
#define ILI9340_DFUNCTR 0xB6
#define ILI9340_PWCTR1 0xC0
#define ILI9340_PWCTR2 0xC1
#define ILI9340_PWCTR3 0xC2
#define ILI9340_PWCTR4 0xC3
#define ILI9340_PWCTR5 0xC4
#define ILI9340_VMCTR1 0xC5
#define ILI9340_VMCTR2 0xC7
#define ILI9340_RDID1 0xDA
#define ILI9340_RDID2 0xDB
#define ILI9340_RDID3 0xDC
#define ILI9340_RDID4 0xDD
#define ILI9340_GMCTRP1 0xE0
#define ILI9340_GMCTRN1 0xE1
/*
#define ILI9340_PWCTR6 0xFC
*/
// Color definitions
#define ILI9340_BLACK 0x0000
#define ILI9340_BLUE 0x001F
#define ILI9340_RED 0xF800
#define ILI9340_GREEN 0x07E0
#define ILI9340_CYAN 0x07FF
#define ILI9340_MAGENTA 0xF81F
#define ILI9340_YELLOW 0xFFE0
#define ILI9340_WHITE 0xFFFF
#ifdef __cplusplus
extern "C" {
#endif
void ili9340_init(void);
void ili9340_drawFastVLine(int16_t x, int16_t y, int16_t h,
uint16_t color);
void ili9340_drawFastHLine(int16_t x, int16_t y, int16_t h,
uint16_t color);
void ili9340_setRotation(uint8_t m) ;
void ili9340_drawString(uint16_t x, uint16_t y, const char *text);
void ili9340_drawChar(uint16_t x, uint16_t y, uint8_t c);
void ili9340_setBackColor(uint16_t col);
void ili9340_setFrontColor(uint16_t col);
void ili9340_fillRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h,
uint16_t color);
void ili9340_setScrollStart(uint16_t start);
void ili9340_setScrollMargins(uint16_t top, uint16_t bottom);
uint16_t ili9340_width(void);
uint16_t ili9340_height(void);
#ifdef __cplusplus
}
#endif