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
29
30
33
34
39
40
41
42
56
57
66
67
70
71
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
174
180
181
182
183
184
185
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
226
227
228
229
230
231
232
233
234
235
236
237
238
239
242
243
246
247
250
/* ... */
#include "nt35510.h"
#include <stdio.h>
#include <stdarg.h>
/* ... */
/* ... */
/* ... */
Includes
/* ... */
/* ... */
/* ... */
Private constants
/* ... */
/* ... */
Private functions
/* ... */
/* ... */
uint8_t NT35510_Init(uint32_t ColorCoding, uint32_t orientation)
{
NT35510_IO_Delay(120);
const uint8_t nt35510_reg[] = {0x55, 0xAA, 0x52, 0x08, 0x01, 0xF0};
const uint8_t nt35510_reg1[] = {0x03, 0x03, 0x03, 0xB0};
const uint8_t nt35510_reg2[] = {0x46, 0x46, 0x46, 0xB6};
const uint8_t nt35510_reg3[] = {0x03, 0x03, 0x03, 0xB1};
const uint8_t nt35510_reg4[] = {0x36, 0x36, 0x36, 0xB7};
const uint8_t nt35510_reg5[] = {0x00, 0x00, 0x02, 0xB2};
const uint8_t nt35510_reg6[] = {0x26, 0x26, 0x26, 0xB8};
const uint8_t nt35510_reg7[] = {0xBF, 0x01};
const uint8_t nt35510_reg8[] = {0x09, 0x09, 0x09, 0xB3};
const uint8_t nt35510_reg9[] = {0x36, 0x36, 0x36, 0xB9};
const uint8_t nt35510_reg10[] = {0x08, 0x08, 0x08, 0xB5};
const uint8_t nt35510_reg12[] = {0x26, 0x26, 0x26, 0xBA};
const uint8_t nt35510_reg13[] = {0x00, 0x80, 0x00, 0xBC};
const uint8_t nt35510_reg14[] = {0x00, 0x80, 0x00, 0xBD};
const uint8_t nt35510_reg15[] = {0x00, 0x50, 0xBE};
const uint8_t nt35510_reg16[] = {0x55, 0xAA, 0x52, 0x08, 0x00, 0xF0};
const uint8_t nt35510_reg17[] = {0xFC, 0x00, 0xB1};
const uint8_t nt35510_reg18[] = {0xB6, 0x03};
const uint8_t nt35510_reg19[] = {0xB5, 0x51};
const uint8_t nt35510_reg20[] = {0x00, 0x00, 0xB7};
const uint8_t nt35510_reg21[] = {0x01, 0x02, 0x02, 0x02, 0xB8};
const uint8_t nt35510_reg22[] = {0x00, 0x00, 0x00, 0xBC};
const uint8_t nt35510_reg23[] = {0x03, 0x00, 0x00, 0xCC};
const uint8_t nt35510_reg24[] = {0xBA, 0x01};
const uint8_t nt35510_madctl_portrait[] = {NT35510_CMD_MADCTL ,0x00};
const uint8_t nt35510_caset_portrait[] = {0x00, 0x00, 0x01, 0xDF ,NT35510_CMD_CASET};
const uint8_t nt35510_raset_portrait[] = {0x00, 0x00, 0x03, 0x1F ,NT35510_CMD_RASET};
const uint8_t nt35510_madctl_landscape[] = {NT35510_CMD_MADCTL, 0x60};
const uint8_t nt35510_caset_landscape[] = {0x00, 0x00, 0x03, 0x1F ,NT35510_CMD_CASET};
const uint8_t nt35510_raset_landscape[] = {0x00, 0x00, 0x01, 0xDF ,NT35510_CMD_RASET};
const uint8_t nt35510_reg26[] = {NT35510_CMD_TEEON, 0x00};
const uint8_t nt35510_reg27[] = {NT35510_CMD_SLPOUT, 0x00};
const uint8_t nt35510_reg30[] = {NT35510_CMD_DISPON, 0x00};
const uint8_t nt35510_reg31[] = {NT35510_CMD_WRDISBV, 0x7F};
const uint8_t nt35510_reg32[] = {NT35510_CMD_WRCTRLD, 0x2C};
const uint8_t nt35510_reg33[] = {NT35510_CMD_WRCABC, 0x02};
const uint8_t nt35510_reg34[] = {NT35510_CMD_WRCABCMB, 0xFF};
const uint8_t nt35510_reg35[] = {NT35510_CMD_RAMWR, 0x00};
const uint8_t nt35510_reg36[] = {NT35510_CMD_COLMOD, NT35510_COLMOD_RGB565};
const uint8_t nt35510_reg37[] = {NT35510_CMD_COLMOD, NT35510_COLMOD_RGB888};
DSI_IO_WriteCmd(5, (uint8_t *)nt35510_reg);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg1);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg2);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg3);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg4);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg5);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg6);
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg7);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg8);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg9);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg10);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg12);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg13);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg14);
DSI_IO_WriteCmd(2, (uint8_t *)nt35510_reg15);
DSI_IO_WriteCmd(5, (uint8_t *)nt35510_reg16);
DSI_IO_WriteCmd(2, (uint8_t *)nt35510_reg17);
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg18);
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg19);
DSI_IO_WriteCmd(2, (uint8_t *)nt35510_reg20);
DSI_IO_WriteCmd(4, (uint8_t *)nt35510_reg21);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg22);
DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg23);
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg24);
DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg26);
DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg37);
NT35510_IO_Delay(200);
if(orientation == NT35510_ORIENTATION_PORTRAIT)
{
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_madctl_portrait);
DSI_IO_WriteCmd(4, (uint8_t *)nt35510_caset_portrait);
DSI_IO_WriteCmd(4, (uint8_t *)nt35510_raset_portrait);
}if (orientation == NT35510_ORIENTATION_PORTRAIT) { ... }
else
{
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_madctl_landscape);
DSI_IO_WriteCmd(4, (uint8_t *)nt35510_caset_landscape);
DSI_IO_WriteCmd(4, (uint8_t *)nt35510_raset_landscape);
}else { ... }
DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg27);
NT35510_IO_Delay(120);
switch(ColorCoding)
{
case NT35510_FORMAT_RBG565 :
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg36);
break;case NT35510_FORMAT_RBG565 :
case NT35510_FORMAT_RGB888 :
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg37);
break;case NT35510_FORMAT_RGB888 :
default :
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg37);
break;default
}switch (ColorCoding) { ... }
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg31);
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg32);
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg33);
DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg34);
DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg30);
DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg35);
return 0;
}{ ... }
/* ... */
uint8_t NT35510_DeInit(void)
{
const uint8_t nt35510_reg30b[] = {NT35510_CMD_DISPOFF, 0x00};
const uint8_t nt35510_reg27b[] = {NT35510_CMD_SLPIN, 0x00};
DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg30b);
NT35510_IO_Delay(120);
DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg27b);
return 0;
}{ ... }
/* ... */
/* ... */
/* ... */
Exported functions