Skip to content

Commit 0d5094d

Browse files
1 parent 46cdfe5 commit 0d5094d

File tree

4 files changed

+190
-24
lines changed

4 files changed

+190
-24
lines changed

examples/PDQgraphicstest/Arduino_GFX_display.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ Arduino_GFX *gfx = new Arduino_ILI9341(bus, TFT_RST, 0 /* rotation */, false /*
9696
// NT39125 LCD 240x376
9797
// Arduino_GFX *gfx = new Arduino_NT39125(bus, TFT_RST, 0 /* rotation */, false /* IPS */, 240, 376, 0, 0, 0, 56);
9898

99-
// NV3007 LCD 142x428
99+
// 1.65"/1.68" NV3007 LCD 142x428
100100
// Arduino_GFX *gfx = new Arduino_NV3007(bus, TFT_RST, 0 /* rotation */, false /* IPS */, 142 /* width */, 428 /* height */, 12 /* col offset 1 */, 0 /* row offset 1 */, 14 /* col offset 2 */, 0 /* row offset 2 */);
101101

102+
// 2.79" NV3007 LCD 142x428
103+
// Arduino_GFX *gfx = new Arduino_NV3007(bus, TFT_RST, 0 /* rotation */, false /* IPS */, 142 /* width */, 428 /* height */, 12 /* col offset 1 */, 0 /* row offset 1 */, 14 /* col offset 2 */, 0 /* row offset 2 */, NV3007_279_init_operations, sizeof(NV3007_279_init_operations));
104+
102105
// NV3041A IPS LCD
103106
// Arduino_GFX *gfx = new Arduino_NV3041A(bus, TFT_RST, 0 /* rotation */, true /* IPS */);
104107

src/Arduino_TFT.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,34 @@ void Arduino_TFT::setRotation(uint8_t r)
149149
Arduino_GFX::setRotation(r);
150150
switch (_rotation)
151151
{
152-
case 5:
152+
case 1:
153+
_xStart = ROW_OFFSET1;
154+
_yStart = COL_OFFSET2;
155+
break;
156+
case 2:
157+
_xStart = COL_OFFSET2;
158+
_yStart = ROW_OFFSET2;
159+
break;
153160
case 3:
154161
_xStart = ROW_OFFSET2;
155162
_yStart = COL_OFFSET1;
156163
break;
157-
case 6:
158-
case 2:
164+
case 4:
159165
_xStart = COL_OFFSET2;
166+
_yStart = ROW_OFFSET1;
167+
break;
168+
case 5:
169+
_xStart = ROW_OFFSET2;
170+
_yStart = COL_OFFSET2;
171+
break;
172+
case 6:
173+
_xStart = COL_OFFSET1;
160174
_yStart = ROW_OFFSET2;
161175
break;
162176
case 7:
163-
case 1:
164177
_xStart = ROW_OFFSET1;
165-
_yStart = COL_OFFSET2;
178+
_yStart = COL_OFFSET1;
166179
break;
167-
case 4:
168180
default: // case 0:
169181
_xStart = COL_OFFSET1;
170182
_yStart = ROW_OFFSET1;

src/display/Arduino_NV3007.cpp

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
Arduino_NV3007::Arduino_NV3007(
55
Arduino_DataBus *bus, int8_t rst, uint8_t r,
66
bool ips, int16_t w, int16_t h,
7-
uint8_t col_offset1, uint8_t row_offset1, uint8_t col_offset2, uint8_t row_offset2)
8-
: Arduino_TFT(bus, rst, r, ips, w, h, col_offset1, row_offset1, col_offset2, row_offset2)
7+
uint8_t col_offset1, uint8_t row_offset1, uint8_t col_offset2, uint8_t row_offset2,
8+
const uint8_t *init_operations, size_t init_operations_len)
9+
: Arduino_TFT(bus, rst, r, ips, w, h, col_offset1, row_offset1, col_offset2, row_offset2),
10+
_init_operations(init_operations), _init_operations_len(init_operations_len)
911
{
1012
}
1113

@@ -44,16 +46,28 @@ void Arduino_NV3007::setRotation(uint8_t r)
4446
switch (_rotation)
4547
{
4648
case 1:
47-
r = 0x70;
48-
break;
49+
r = NV3007_MADCTL_MX | NV3007_MADCTL_MV | NV3007_MADCTL_RGB;
50+
break;
4951
case 2:
50-
r = 0xC0;
51-
break;
52+
r = NV3007_MADCTL_MX | NV3007_MADCTL_MY | NV3007_MADCTL_RGB;
53+
break;
5254
case 3:
53-
r = 0xA0;
54-
break;
55+
r = NV3007_MADCTL_MY | NV3007_MADCTL_MV | NV3007_MADCTL_RGB;
56+
break;
57+
case 4:
58+
r = NV3007_MADCTL_MX | NV3007_MADCTL_RGB;
59+
break;
60+
case 5:
61+
r = NV3007_MADCTL_MX | NV3007_MADCTL_MY | NV3007_MADCTL_MV | NV3007_MADCTL_RGB;
62+
break;
63+
case 6:
64+
r = NV3007_MADCTL_MY | NV3007_MADCTL_RGB;
65+
break;
66+
case 7:
67+
r = NV3007_MADCTL_MV | NV3007_MADCTL_RGB;
68+
break;
5569
default: // case 0:
56-
r = 0x00;
70+
r = NV3007_MADCTL_RGB;
5771
break;
5872
}
5973
_bus->beginWrite();
@@ -95,7 +109,7 @@ void Arduino_NV3007::tftInit()
95109
// Software Rest
96110
}
97111

98-
_bus->batchOperation(NV3007_init_operations, sizeof(NV3007_init_operations));
112+
_bus->batchOperation(_init_operations, _init_operations_len);
99113

100114
invertDisplay(false);
101115
}

src/display/Arduino_NV3007.h

Lines changed: 144 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
#ifndef _ARDUINO_NV3007_H_
2-
#define _ARDUINO_NV3007_H_
1+
#pragma once
32

4-
#include <Arduino.h>
5-
#include <Print.h>
63
#include "./Arduino_GFX.h"
74
#include "../Arduino_TFT.h"
85

@@ -28,6 +25,12 @@
2825

2926
#define NV3007_MADCTL 0x36
3027

28+
#define NV3007_MADCTL_MY 0x80
29+
#define NV3007_MADCTL_MX 0x40
30+
#define NV3007_MADCTL_MV 0x20
31+
#define NV3007_MADCTL_ML 0x10
32+
#define NV3007_MADCTL_RGB 0x00
33+
3134
static const uint8_t NV3007_init_operations[] = {
3235
BEGIN_WRITE,
3336

@@ -174,13 +177,146 @@ static const uint8_t NV3007_init_operations[] = {
174177

175178
DELAY, 150};
176179

180+
static const uint8_t NV3007_279_init_operations[] = {
181+
BEGIN_WRITE,
182+
183+
WRITE_C8_D8, 0xff, 0xa5,
184+
WRITE_C8_D8, 0x9a, 0x08,
185+
WRITE_C8_D8, 0x9b, 0x08,
186+
WRITE_C8_D8, 0x9c, 0xb0,
187+
WRITE_C8_D8, 0x9d, 0x16,
188+
WRITE_C8_D8, 0x9e, 0xc4,
189+
WRITE_C8_D16, 0x8f, 0x55, 0x04,
190+
WRITE_C8_D8, 0x84, 0x90,
191+
WRITE_C8_D8, 0x83, 0x7b,
192+
WRITE_C8_D8, 0x85, 0x33,
193+
WRITE_C8_D8, 0x60, 0x00,
194+
WRITE_C8_D8, 0x70, 0x00,
195+
WRITE_C8_D8, 0x61, 0x02,
196+
WRITE_C8_D8, 0x71, 0x02,
197+
WRITE_C8_D8, 0x62, 0x04,
198+
WRITE_C8_D8, 0x72, 0x04,
199+
WRITE_C8_D8, 0x6c, 0x29,
200+
WRITE_C8_D8, 0x7c, 0x29,
201+
WRITE_C8_D8, 0x6d, 0x31,
202+
WRITE_C8_D8, 0x7d, 0x31,
203+
WRITE_C8_D8, 0x6e, 0x0f,
204+
WRITE_C8_D8, 0x7e, 0x0f,
205+
WRITE_C8_D8, 0x66, 0x21,
206+
WRITE_C8_D8, 0x76, 0x21,
207+
WRITE_C8_D8, 0x68, 0x3A,
208+
WRITE_C8_D8, 0x78, 0x3A,
209+
WRITE_C8_D8, 0x63, 0x07,
210+
WRITE_C8_D8, 0x73, 0x07,
211+
WRITE_C8_D8, 0x64, 0x05,
212+
WRITE_C8_D8, 0x74, 0x05,
213+
WRITE_C8_D8, 0x65, 0x02,
214+
WRITE_C8_D8, 0x75, 0x02,
215+
WRITE_C8_D8, 0x67, 0x23,
216+
WRITE_C8_D8, 0x77, 0x23,
217+
WRITE_C8_D8, 0x69, 0x08,
218+
WRITE_C8_D8, 0x79, 0x08,
219+
WRITE_C8_D8, 0x6a, 0x13,
220+
WRITE_C8_D8, 0x7a, 0x13,
221+
WRITE_C8_D8, 0x6b, 0x13,
222+
WRITE_C8_D8, 0x7b, 0x13,
223+
WRITE_C8_D8, 0x6f, 0x00,
224+
WRITE_C8_D8, 0x7f, 0x00,
225+
WRITE_C8_D8, 0x50, 0x00,
226+
WRITE_C8_D8, 0x52, 0xd6,
227+
WRITE_C8_D8, 0x53, 0x08,
228+
WRITE_C8_D8, 0x54, 0x08,
229+
WRITE_C8_D8, 0x55, 0x1e,
230+
WRITE_C8_D8, 0x56, 0x1c,
231+
232+
WRITE_COMMAND_8, 0xa0,
233+
WRITE_BYTES, 3, 0x2b, 0x24, 0x00,
234+
235+
WRITE_C8_D8, 0xa1, 0x87,
236+
WRITE_C8_D8, 0xa2, 0x86,
237+
WRITE_C8_D8, 0xa5, 0x00,
238+
WRITE_C8_D8, 0xa6, 0x00,
239+
WRITE_C8_D8, 0xa7, 0x00,
240+
WRITE_C8_D8, 0xa8, 0x36,
241+
WRITE_C8_D8, 0xa9, 0x7e,
242+
WRITE_C8_D8, 0xaa, 0x7e,
243+
WRITE_C8_D8, 0xB9, 0x85,
244+
WRITE_C8_D8, 0xBA, 0x84,
245+
WRITE_C8_D8, 0xBB, 0x83,
246+
WRITE_C8_D8, 0xBC, 0x82,
247+
WRITE_C8_D8, 0xBD, 0x81,
248+
WRITE_C8_D8, 0xBE, 0x80,
249+
WRITE_C8_D8, 0xBF, 0x01,
250+
WRITE_C8_D8, 0xC0, 0x02,
251+
WRITE_C8_D8, 0xc1, 0x00,
252+
WRITE_C8_D8, 0xc2, 0x00,
253+
WRITE_C8_D8, 0xc3, 0x00,
254+
WRITE_C8_D8, 0xc4, 0x33,
255+
WRITE_C8_D8, 0xc5, 0x7e,
256+
WRITE_C8_D8, 0xc6, 0x7e,
257+
WRITE_C8_D16, 0xC8, 0x33, 0x33,
258+
WRITE_C8_D8, 0xC9, 0x68,
259+
WRITE_C8_D8, 0xCA, 0x69,
260+
WRITE_C8_D8, 0xCB, 0x6a,
261+
WRITE_C8_D8, 0xCC, 0x6b,
262+
WRITE_C8_D16, 0xCD, 0x33, 0x33,
263+
WRITE_C8_D8, 0xCE, 0x6c,
264+
WRITE_C8_D8, 0xCF, 0x6d,
265+
WRITE_C8_D8, 0xD0, 0x6e,
266+
WRITE_C8_D8, 0xD1, 0x6f,
267+
WRITE_C8_D16, 0xAB, 0x03, 0x67,
268+
WRITE_C8_D16, 0xAC, 0x03, 0x6b,
269+
WRITE_C8_D16, 0xAD, 0x03, 0x68,
270+
WRITE_C8_D16, 0xAE, 0x03, 0x6c,
271+
WRITE_C8_D8, 0xb3, 0x00,
272+
WRITE_C8_D8, 0xb4, 0x00,
273+
WRITE_C8_D8, 0xb5, 0x00,
274+
WRITE_C8_D8, 0xB6, 0x32,
275+
WRITE_C8_D8, 0xB7, 0x7e,
276+
WRITE_C8_D8, 0xB8, 0x7e,
277+
WRITE_C8_D8, 0xe0, 0x00,
278+
WRITE_C8_D16, 0xe1, 0x03, 0x0f,
279+
WRITE_C8_D8, 0xe2, 0x04,
280+
WRITE_C8_D8, 0xe3, 0x01,
281+
WRITE_C8_D8, 0xe4, 0x0e,
282+
WRITE_C8_D8, 0xe5, 0x01,
283+
WRITE_C8_D8, 0xe6, 0x19,
284+
WRITE_C8_D8, 0xe7, 0x10,
285+
WRITE_C8_D8, 0xe8, 0x10,
286+
WRITE_C8_D8, 0xea, 0x12,
287+
WRITE_C8_D8, 0xeb, 0xd0,
288+
WRITE_C8_D8, 0xec, 0x04,
289+
WRITE_C8_D8, 0xed, 0x07,
290+
WRITE_C8_D8, 0xee, 0x07,
291+
WRITE_C8_D8, 0xef, 0x09,
292+
WRITE_C8_D8, 0xf0, 0xd0,
293+
WRITE_C8_D8, 0xf1, 0x0e,
294+
WRITE_C8_D8, 0xF9, 0x17,
295+
296+
WRITE_COMMAND_8, 0xf2,
297+
WRITE_BYTES, 4, 0x2c, 0x1b, 0x0b, 0x20,
298+
299+
WRITE_C8_D8, 0xe9, 0x29,
300+
WRITE_C8_D8, 0xec, 0x04,
301+
WRITE_C8_D8, 0x35, 0x00,
302+
WRITE_C8_D16, 0x44, 0x00, 0x10,
303+
WRITE_C8_D8, 0x46, 0x10,
304+
WRITE_C8_D8, 0xff, 0x00,
305+
WRITE_C8_D8, 0x3a, 0x05,
306+
307+
WRITE_COMMAND_8, NV3007_SLPOUT,
308+
DELAY, 120,
309+
WRITE_COMMAND_8, NV3007_DISPON,
310+
END_WRITE};
311+
177312
class Arduino_NV3007 : public Arduino_TFT
178313
{
179314
public:
180315
Arduino_NV3007(
181316
Arduino_DataBus *bus, int8_t rst = GFX_NOT_DEFINED, uint8_t r = 0,
182317
bool ips = false, int16_t w = NV3007_TFTWIDTH, int16_t h = NV3007_TFTHEIGHT,
183-
uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0);
318+
uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0,
319+
const uint8_t *init_operations = NV3007_init_operations, size_t init_operations_len = sizeof(NV3007_init_operations));
184320

185321
bool begin(int32_t speed = GFX_NOT_DEFINED) override;
186322
void writeAddrWindow(int16_t x, int16_t y, uint16_t w, uint16_t h) override;
@@ -193,6 +329,7 @@ class Arduino_NV3007 : public Arduino_TFT
193329
void tftInit() override;
194330

195331
private:
196-
};
332+
const uint8_t *_init_operations;
333+
size_t _init_operations_len;
197334

198-
#endif
335+
};

0 commit comments

Comments
 (0)