|
@@ -58,7 +58,7 @@ void CLCD::FontMetrics::load(const uint8_t font) {
|
58
|
58
|
uint16_t CLCD::FontMetrics::get_text_width(const char *str, size_t n) const {
|
59
|
59
|
uint16_t width = 0;
|
60
|
60
|
const uint8_t *p = (const uint8_t *) str;
|
61
|
|
- for(;;) {
|
|
61
|
+ for (;;) {
|
62
|
62
|
const uint8_t val = *p++; n--;
|
63
|
63
|
if (!val || n == 0) break;
|
64
|
64
|
width += val < 128 ? char_widths[val] : 0;
|
|
@@ -69,7 +69,7 @@ uint16_t CLCD::FontMetrics::get_text_width(const char *str, size_t n) const {
|
69
|
69
|
uint16_t CLCD::FontMetrics::get_text_width(progmem_str str, size_t n) const {
|
70
|
70
|
uint16_t width = 0;
|
71
|
71
|
const uint8_t *p = (const uint8_t *) str;
|
72
|
|
- for(;;) {
|
|
72
|
+ for (;;) {
|
73
|
73
|
const uint8_t val = pgm_read_byte(p++); n--;
|
74
|
74
|
if (!val || n == 0) break;
|
75
|
75
|
width += val < 128 ? char_widths[val] : 0;
|
|
@@ -79,7 +79,7 @@ uint16_t CLCD::FontMetrics::get_text_width(progmem_str str, size_t n) const {
|
79
|
79
|
|
80
|
80
|
/************************** HOST COMMAND FUNCTION *********************************/
|
81
|
81
|
|
82
|
|
-void CLCD::host_cmd (unsigned char host_command, unsigned char byte2) { // Sends 24-Bit Host Command to LCD
|
|
82
|
+void CLCD::host_cmd(unsigned char host_command, unsigned char byte2) { // Sends 24-Bit Host Command to LCD
|
83
|
83
|
if (host_command != FTDI::ACTIVE) {
|
84
|
84
|
host_command |= 0x40;
|
85
|
85
|
}
|
|
@@ -92,7 +92,7 @@ void CLCD::host_cmd (unsigned char host_command, unsigned char byte2) { // Send
|
92
|
92
|
|
93
|
93
|
/************************** MEMORY READ FUNCTIONS *********************************/
|
94
|
94
|
|
95
|
|
-void CLCD::spi_read_addr (uint32_t reg_address) {
|
|
95
|
+void CLCD::spi_read_addr(uint32_t reg_address) {
|
96
|
96
|
spi_send((reg_address >> 16) & 0x3F); // Address [21:16]
|
97
|
97
|
spi_send((reg_address >> 8 ) & 0xFF); // Address [15:8]
|
98
|
98
|
spi_send((reg_address >> 0) & 0xFF); // Address [7:0]
|
|
@@ -100,7 +100,7 @@ void CLCD::spi_read_addr (uint32_t reg_address) {
|
100
|
100
|
}
|
101
|
101
|
|
102
|
102
|
// Write 4-Byte Address, Read Multiple Bytes
|
103
|
|
-void CLCD::mem_read_bulk (uint32_t reg_address, uint8_t *data, uint16_t len) {
|
|
103
|
+void CLCD::mem_read_bulk(uint32_t reg_address, uint8_t *data, uint16_t len) {
|
104
|
104
|
spi_ftdi_select();
|
105
|
105
|
spi_read_addr(reg_address);
|
106
|
106
|
spi_read_bulk (data, len);
|
|
@@ -108,7 +108,7 @@ void CLCD::mem_read_bulk (uint32_t reg_address, uint8_t *data, uint16_t len) {
|
108
|
108
|
}
|
109
|
109
|
|
110
|
110
|
// Write 4-Byte Address, Read 1-Byte Data
|
111
|
|
-uint8_t CLCD::mem_read_8 (uint32_t reg_address) {
|
|
111
|
+uint8_t CLCD::mem_read_8(uint32_t reg_address) {
|
112
|
112
|
spi_ftdi_select();
|
113
|
113
|
spi_read_addr(reg_address);
|
114
|
114
|
uint8_t r_data = spi_read_8();
|
|
@@ -117,7 +117,7 @@ uint8_t CLCD::mem_read_8 (uint32_t reg_address) {
|
117
|
117
|
}
|
118
|
118
|
|
119
|
119
|
// Write 4-Byte Address, Read 2-Bytes Data
|
120
|
|
-uint16_t CLCD::mem_read_16 (uint32_t reg_address) {
|
|
120
|
+uint16_t CLCD::mem_read_16(uint32_t reg_address) {
|
121
|
121
|
using namespace SPI::least_significant_byte_first;
|
122
|
122
|
spi_ftdi_select();
|
123
|
123
|
spi_read_addr(reg_address);
|
|
@@ -127,7 +127,7 @@ uint16_t CLCD::mem_read_16 (uint32_t reg_address) {
|
127
|
127
|
}
|
128
|
128
|
|
129
|
129
|
// Write 4-Byte Address, Read 4-Bytes Data
|
130
|
|
-uint32_t CLCD::mem_read_32 (uint32_t reg_address) {
|
|
130
|
+uint32_t CLCD::mem_read_32(uint32_t reg_address) {
|
131
|
131
|
using namespace SPI::least_significant_byte_first;
|
132
|
132
|
spi_ftdi_select();
|
133
|
133
|
spi_read_addr(reg_address);
|
|
@@ -147,14 +147,14 @@ static inline uint8_t reverse_byte(uint8_t a) {
|
147
|
147
|
}
|
148
|
148
|
static inline uint8_t xbm_write(const uint8_t *p) {return reverse_byte(pgm_read_byte(p));}
|
149
|
149
|
|
150
|
|
-void CLCD::spi_write_addr (uint32_t reg_address) {
|
|
150
|
+void CLCD::spi_write_addr(uint32_t reg_address) {
|
151
|
151
|
spi_send((reg_address >> 16) | 0x80); // Address [21:16]
|
152
|
152
|
spi_send((reg_address >> 8 ) & 0xFF); // Address [15:8]
|
153
|
153
|
spi_send((reg_address >> 0) & 0xFF); // Address [7:0]
|
154
|
154
|
}
|
155
|
155
|
|
156
|
156
|
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from RAM
|
157
|
|
-void CLCD::mem_write_bulk (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) {
|
|
157
|
+void CLCD::mem_write_bulk(uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) {
|
158
|
158
|
spi_ftdi_select();
|
159
|
159
|
spi_write_addr(reg_address);
|
160
|
160
|
spi_write_bulk<ram_write>(data, len, padding);
|
|
@@ -162,7 +162,7 @@ void CLCD::mem_write_bulk (uint32_t reg_address, const void *data, uint16_t len,
|
162
|
162
|
}
|
163
|
163
|
|
164
|
164
|
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM
|
165
|
|
-void CLCD::mem_write_bulk (uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding) {
|
|
165
|
+void CLCD::mem_write_bulk(uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding) {
|
166
|
166
|
spi_ftdi_select();
|
167
|
167
|
spi_write_addr(reg_address);
|
168
|
168
|
spi_write_bulk<pgm_write>(str, len, padding);
|
|
@@ -170,7 +170,7 @@ void CLCD::mem_write_bulk (uint32_t reg_address, progmem_str str, uint16_t len,
|
170
|
170
|
}
|
171
|
171
|
|
172
|
172
|
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM
|
173
|
|
-void CLCD::mem_write_pgm (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) {
|
|
173
|
+void CLCD::mem_write_pgm(uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) {
|
174
|
174
|
spi_ftdi_select();
|
175
|
175
|
spi_write_addr(reg_address);
|
176
|
176
|
spi_write_bulk<pgm_write>(data, len, padding);
|
|
@@ -178,7 +178,7 @@ void CLCD::mem_write_pgm (uint32_t reg_address, const void *data, uint16_t len,
|
178
|
178
|
}
|
179
|
179
|
|
180
|
180
|
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM, reversing bytes (suitable for loading XBM images)
|
181
|
|
-void CLCD::mem_write_xbm (uint32_t reg_address, progmem_str data, uint16_t len, uint8_t padding) {
|
|
181
|
+void CLCD::mem_write_xbm(uint32_t reg_address, progmem_str data, uint16_t len, uint8_t padding) {
|
182
|
182
|
spi_ftdi_select();
|
183
|
183
|
spi_write_addr(reg_address);
|
184
|
184
|
spi_write_bulk<xbm_write>(data, len, padding);
|
|
@@ -186,7 +186,7 @@ void CLCD::mem_write_xbm (uint32_t reg_address, progmem_str data, uint16_t len,
|
186
|
186
|
}
|
187
|
187
|
|
188
|
188
|
// Write 3-Byte Address, Write 1-Byte Data
|
189
|
|
-void CLCD::mem_write_8 (uint32_t reg_address, uint8_t data) {
|
|
189
|
+void CLCD::mem_write_8(uint32_t reg_address, uint8_t data) {
|
190
|
190
|
spi_ftdi_select();
|
191
|
191
|
spi_write_addr(reg_address);
|
192
|
192
|
spi_write_8(data);
|
|
@@ -194,16 +194,16 @@ void CLCD::mem_write_8 (uint32_t reg_address, uint8_t data) {
|
194
|
194
|
}
|
195
|
195
|
|
196
|
196
|
// Write 3-Byte Address, Write 2-Bytes Data
|
197
|
|
-void CLCD::mem_write_16 (uint32_t reg_address, uint16_t data) {
|
|
197
|
+void CLCD::mem_write_16(uint32_t reg_address, uint16_t data) {
|
198
|
198
|
using namespace SPI::least_significant_byte_first;
|
199
|
199
|
spi_ftdi_select();
|
200
|
200
|
spi_write_addr(reg_address);
|
201
|
|
- spi_write_32(data);
|
|
201
|
+ spi_write_16(data);
|
202
|
202
|
spi_ftdi_deselect();
|
203
|
203
|
}
|
204
|
204
|
|
205
|
205
|
// Write 3-Byte Address, Write 4-Bytes Data
|
206
|
|
-void CLCD::mem_write_32 (uint32_t reg_address, uint32_t data) {
|
|
206
|
+void CLCD::mem_write_32(uint32_t reg_address, uint32_t data) {
|
207
|
207
|
using namespace SPI::least_significant_byte_first;
|
208
|
208
|
spi_ftdi_select();
|
209
|
209
|
spi_write_addr(reg_address);
|
|
@@ -281,7 +281,7 @@ void CLCD::CommandFifo::text(int16_t x, int16_t y, int16_t font, uint16_t optio
|
281
|
281
|
}
|
282
|
282
|
|
283
|
283
|
// This sends the a toggle command to the command preprocessor, must be followed by str()
|
284
|
|
-void CLCD::CommandFifo::toggle (int16_t x, int16_t y, int16_t w, int16_t font, uint16_t options, bool state) {
|
|
284
|
+void CLCD::CommandFifo::toggle(int16_t x, int16_t y, int16_t w, int16_t font, uint16_t options, bool state) {
|
285
|
285
|
struct {
|
286
|
286
|
int32_t type = CMD_TOGGLE;
|
287
|
287
|
int16_t x;
|
|
@@ -303,7 +303,7 @@ void CLCD::CommandFifo::toggle (int16_t x, int16_t y, int16_t w, int16_t font, u
|
303
|
303
|
}
|
304
|
304
|
|
305
|
305
|
// This sends the a keys command to the command preprocessor, must be followed by str()
|
306
|
|
-void CLCD::CommandFifo::keys (int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t options) {
|
|
306
|
+void CLCD::CommandFifo::keys(int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t options) {
|
307
|
307
|
struct {
|
308
|
308
|
int32_t type = CMD_KEYS;
|
309
|
309
|
int16_t x;
|
|
@@ -324,7 +324,7 @@ void CLCD::CommandFifo::keys (int16_t x, int16_t y, int16_t w, int16_t h, int16_
|
324
|
324
|
cmd( &cmd_data, sizeof(cmd_data) );
|
325
|
325
|
}
|
326
|
326
|
|
327
|
|
-void CLCD::CommandFifo::clock (int16_t x, int16_t y, int16_t r, uint16_t options, int16_t h, int16_t m, int16_t s, int16_t ms)
|
|
327
|
+void CLCD::CommandFifo::clock(int16_t x, int16_t y, int16_t r, uint16_t options, int16_t h, int16_t m, int16_t s, int16_t ms)
|
328
|
328
|
{
|
329
|
329
|
struct {
|
330
|
330
|
int32_t type = CMD_CLOCK;
|
|
@@ -350,7 +350,7 @@ void CLCD::CommandFifo::clock (int16_t x, int16_t y, int16_t r, uint16_t options
|
350
|
350
|
cmd( &cmd_data, sizeof(cmd_data) );
|
351
|
351
|
}
|
352
|
352
|
|
353
|
|
-void CLCD::CommandFifo::gauge (int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range)
|
|
353
|
+void CLCD::CommandFifo::gauge(int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range)
|
354
|
354
|
{
|
355
|
355
|
struct {
|
356
|
356
|
int32_t type = CMD_GAUGE;
|
|
@@ -376,7 +376,7 @@ void CLCD::CommandFifo::gauge (int16_t x, int16_t y, int16_t r, uint16_t options
|
376
|
376
|
cmd( &cmd_data, sizeof(cmd_data) );
|
377
|
377
|
}
|
378
|
378
|
|
379
|
|
-void CLCD::CommandFifo::dial (int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t val)
|
|
379
|
+void CLCD::CommandFifo::dial(int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t val)
|
380
|
380
|
{
|
381
|
381
|
struct {
|
382
|
382
|
int32_t type = CMD_DIAL;
|
|
@@ -396,7 +396,7 @@ void CLCD::CommandFifo::dial (int16_t x, int16_t y, int16_t r, uint16_t options,
|
396
|
396
|
cmd( &cmd_data, sizeof(cmd_data) );
|
397
|
397
|
}
|
398
|
398
|
|
399
|
|
-void CLCD::CommandFifo::scrollbar (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t size, uint16_t range) {
|
|
399
|
+void CLCD::CommandFifo::scrollbar(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t size, uint16_t range) {
|
400
|
400
|
struct {
|
401
|
401
|
int32_t type = CMD_SCROLLBAR;
|
402
|
402
|
int16_t x;
|
|
@@ -421,7 +421,7 @@ void CLCD::CommandFifo::scrollbar (int16_t x, int16_t y, int16_t w, int16_t h, u
|
421
|
421
|
cmd( &cmd_data, sizeof(cmd_data) );
|
422
|
422
|
}
|
423
|
423
|
|
424
|
|
-void CLCD::CommandFifo::progress (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range) {
|
|
424
|
+void CLCD::CommandFifo::progress(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range) {
|
425
|
425
|
struct {
|
426
|
426
|
int32_t type = CMD_PROGRESS;
|
427
|
427
|
int16_t x;
|
|
@@ -444,7 +444,7 @@ void CLCD::CommandFifo::progress (int16_t x, int16_t y, int16_t w, int16_t h, ui
|
444
|
444
|
cmd( &cmd_data, sizeof(cmd_data) );
|
445
|
445
|
}
|
446
|
446
|
|
447
|
|
-void CLCD::CommandFifo::slider (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range) {
|
|
447
|
+void CLCD::CommandFifo::slider(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range) {
|
448
|
448
|
struct {
|
449
|
449
|
int32_t type = CMD_SLIDER;
|
450
|
450
|
int16_t x;
|
|
@@ -467,7 +467,7 @@ void CLCD::CommandFifo::slider (int16_t x, int16_t y, int16_t w, int16_t h, uint
|
467
|
467
|
cmd( &cmd_data, sizeof(cmd_data) );
|
468
|
468
|
}
|
469
|
469
|
|
470
|
|
-void CLCD::CommandFifo::gradient (int16_t x0, int16_t y0, uint32_t rgb0, int16_t x1, int16_t y1, uint32_t rgb1) {
|
|
470
|
+void CLCD::CommandFifo::gradient(int16_t x0, int16_t y0, uint32_t rgb0, int16_t x1, int16_t y1, uint32_t rgb1) {
|
471
|
471
|
struct {
|
472
|
472
|
int32_t type = CMD_GRADIENT;
|
473
|
473
|
int16_t x0;
|
|
@@ -488,7 +488,7 @@ void CLCD::CommandFifo::gradient (int16_t x0, int16_t y0, uint32_t rgb0, int16_t
|
488
|
488
|
cmd( &cmd_data, sizeof(cmd_data) );
|
489
|
489
|
}
|
490
|
490
|
|
491
|
|
-void CLCD::CommandFifo::number (int16_t x, int16_t y, int16_t font, uint16_t options, int32_t n) {
|
|
491
|
+void CLCD::CommandFifo::number(int16_t x, int16_t y, int16_t font, uint16_t options, int32_t n) {
|
492
|
492
|
struct {
|
493
|
493
|
int32_t type = CMD_NUMBER;
|
494
|
494
|
int16_t x;
|
|
@@ -507,7 +507,7 @@ void CLCD::CommandFifo::number (int16_t x, int16_t y, int16_t font, uint16_t opt
|
507
|
507
|
cmd( &cmd_data, sizeof(cmd_data) );
|
508
|
508
|
}
|
509
|
509
|
|
510
|
|
-void CLCD::CommandFifo::memzero (uint32_t ptr, uint32_t size) {
|
|
510
|
+void CLCD::CommandFifo::memzero(uint32_t ptr, uint32_t size) {
|
511
|
511
|
struct {
|
512
|
512
|
uint32_t type = CMD_MEMZERO;
|
513
|
513
|
uint32_t ptr;
|
|
@@ -520,7 +520,7 @@ void CLCD::CommandFifo::memzero (uint32_t ptr, uint32_t size) {
|
520
|
520
|
cmd( &cmd_data, sizeof(cmd_data) );
|
521
|
521
|
}
|
522
|
522
|
|
523
|
|
-void CLCD::CommandFifo::memset (uint32_t ptr, uint32_t val, uint32_t size) {
|
|
523
|
+void CLCD::CommandFifo::memset(uint32_t ptr, uint32_t val, uint32_t size) {
|
524
|
524
|
struct {
|
525
|
525
|
uint32_t type = CMD_MEMSET;
|
526
|
526
|
uint32_t ptr;
|
|
@@ -535,7 +535,7 @@ void CLCD::CommandFifo::memset (uint32_t ptr, uint32_t val, uint32_t size) {
|
535
|
535
|
cmd( &cmd_data, sizeof(cmd_data) );
|
536
|
536
|
}
|
537
|
537
|
|
538
|
|
-void CLCD::CommandFifo::memcpy (uint32_t dst, uint32_t src, uint32_t size) {
|
|
538
|
+void CLCD::CommandFifo::memcpy(uint32_t dst, uint32_t src, uint32_t size) {
|
539
|
539
|
struct {
|
540
|
540
|
uint32_t type = CMD_MEMCPY;
|
541
|
541
|
uint32_t dst;
|
|
@@ -550,7 +550,7 @@ void CLCD::CommandFifo::memcpy (uint32_t dst, uint32_t src, uint32_t size) {
|
550
|
550
|
cmd( &cmd_data, sizeof(cmd_data) );
|
551
|
551
|
}
|
552
|
552
|
|
553
|
|
-void CLCD::CommandFifo::memcrc (uint32_t ptr, uint32_t num, uint32_t result) {
|
|
553
|
+void CLCD::CommandFifo::memcrc(uint32_t ptr, uint32_t num, uint32_t result) {
|
554
|
554
|
struct {
|
555
|
555
|
uint32_t type = CMD_MEMCRC;
|
556
|
556
|
uint32_t ptr;
|
|
@@ -565,7 +565,7 @@ void CLCD::CommandFifo::memcrc (uint32_t ptr, uint32_t num, uint32_t result) {
|
565
|
565
|
cmd( &cmd_data, sizeof(cmd_data) );
|
566
|
566
|
}
|
567
|
567
|
|
568
|
|
-void CLCD::CommandFifo::memwrite (uint32_t ptr, uint32_t value) {
|
|
568
|
+void CLCD::CommandFifo::memwrite(uint32_t ptr, uint32_t value) {
|
569
|
569
|
struct {
|
570
|
570
|
uint32_t type = CMD_MEMWRITE;
|
571
|
571
|
uint32_t ptr;
|
|
@@ -580,7 +580,7 @@ void CLCD::CommandFifo::memwrite (uint32_t ptr, uint32_t value) {
|
580
|
580
|
cmd( &cmd_data, sizeof(cmd_data) );
|
581
|
581
|
}
|
582
|
582
|
|
583
|
|
-void CLCD::CommandFifo::append (uint32_t ptr, uint32_t size) {
|
|
583
|
+void CLCD::CommandFifo::append(uint32_t ptr, uint32_t size) {
|
584
|
584
|
struct {
|
585
|
585
|
uint32_t type = CMD_APPEND;
|
586
|
586
|
uint32_t ptr;
|
|
@@ -593,7 +593,7 @@ void CLCD::CommandFifo::append (uint32_t ptr, uint32_t size) {
|
593
|
593
|
cmd( &cmd_data, sizeof(cmd_data) );
|
594
|
594
|
}
|
595
|
595
|
|
596
|
|
-void CLCD::CommandFifo::inflate (uint32_t ptr) {
|
|
596
|
+void CLCD::CommandFifo::inflate(uint32_t ptr) {
|
597
|
597
|
struct {
|
598
|
598
|
uint32_t type = CMD_INFLATE;
|
599
|
599
|
uint32_t ptr;
|
|
@@ -604,7 +604,7 @@ void CLCD::CommandFifo::inflate (uint32_t ptr) {
|
604
|
604
|
cmd( &cmd_data, sizeof(cmd_data) );
|
605
|
605
|
}
|
606
|
606
|
|
607
|
|
-void CLCD::CommandFifo::getptr (uint32_t result) {
|
|
607
|
+void CLCD::CommandFifo::getptr(uint32_t result) {
|
608
|
608
|
struct {
|
609
|
609
|
uint32_t type = CMD_GETPTR;
|
610
|
610
|
uint32_t result;
|
|
@@ -696,7 +696,7 @@ void CLCD::CommandFifo::loadimage(uint32_t ptr, uint32_t options) {
|
696
|
696
|
cmd( &cmd_data, sizeof(cmd_data) );
|
697
|
697
|
}
|
698
|
698
|
|
699
|
|
-void CLCD::CommandFifo::getprops (uint32_t ptr, uint32_t width, uint32_t height) {
|
|
699
|
+void CLCD::CommandFifo::getprops(uint32_t ptr, uint32_t width, uint32_t height) {
|
700
|
700
|
struct {
|
701
|
701
|
uint32_t type = CMD_GETPROPS;
|
702
|
702
|
uint32_t ptr;
|
|
@@ -735,7 +735,7 @@ void CLCD::CommandFifo::rotate(int32_t a) {
|
735
|
735
|
cmd( &cmd_data, sizeof(cmd_data) );
|
736
|
736
|
}
|
737
|
737
|
|
738
|
|
-void CLCD::CommandFifo::translate (int32_t tx, int32_t ty) {
|
|
738
|
+void CLCD::CommandFifo::translate(int32_t tx, int32_t ty) {
|
739
|
739
|
struct {
|
740
|
740
|
uint32_t type = CMD_TRANSLATE;
|
741
|
741
|
int32_t tx;
|
|
@@ -749,7 +749,7 @@ void CLCD::CommandFifo::translate (int32_t tx, int32_t ty) {
|
749
|
749
|
}
|
750
|
750
|
|
751
|
751
|
#if FTDI_API_LEVEL >= 810
|
752
|
|
-void CLCD::CommandFifo::setbase (uint8_t base) {
|
|
752
|
+void CLCD::CommandFifo::setbase(uint8_t base) {
|
753
|
753
|
struct {
|
754
|
754
|
int32_t type = CMD_SETBASE;
|
755
|
755
|
uint32_t base;
|
|
@@ -855,7 +855,7 @@ void CLCD::CommandFifo::playvideo(uint32_t options) {
|
855
|
855
|
#endif
|
856
|
856
|
|
857
|
857
|
#if FTDI_API_LEVEL >= 810
|
858
|
|
-void CLCD::CommandFifo::setrotate (uint8_t rotation) {
|
|
858
|
+void CLCD::CommandFifo::setrotate(uint8_t rotation) {
|
859
|
859
|
struct {
|
860
|
860
|
uint32_t type = CMD_SETROTATE;
|
861
|
861
|
uint32_t rotation;
|
|
@@ -868,7 +868,7 @@ void CLCD::CommandFifo::setrotate (uint8_t rotation) {
|
868
|
868
|
#endif
|
869
|
869
|
|
870
|
870
|
#if FTDI_API_LEVEL >= 810
|
871
|
|
-void CLCD::CommandFifo::romfont (uint8_t font, uint8_t romslot) {
|
|
871
|
+void CLCD::CommandFifo::romfont(uint8_t font, uint8_t romslot) {
|
872
|
872
|
struct {
|
873
|
873
|
uint32_t type = CMD_ROMFONT;
|
874
|
874
|
uint32_t font;
|
|
@@ -1054,18 +1054,12 @@ void CLCD::init() {
|
1054
|
1054
|
spi_init(); // Set Up I/O Lines for SPI and FT800/810 Control
|
1055
|
1055
|
ftdi_reset(); // Power down/up the FT8xx with the apropriate delays
|
1056
|
1056
|
|
1057
|
|
- if (Use_Crystal == 1) {
|
1058
|
|
- host_cmd(CLKEXT, 0);
|
1059
|
|
- }
|
1060
|
|
- else {
|
1061
|
|
- host_cmd(CLKINT, 0);
|
1062
|
|
- }
|
1063
|
|
-
|
|
1057
|
+ host_cmd(Use_Crystal ? CLKEXT : CLKINT, 0);
|
1064
|
1058
|
host_cmd(FTDI::ACTIVE, 0); // Activate the System Clock
|
1065
|
1059
|
|
1066
|
1060
|
/* read the device-id until it returns 0x7c or times out, should take less than 150ms */
|
1067
|
1061
|
uint8_t counter;
|
1068
|
|
- for(counter = 0; counter < 250; counter++) {
|
|
1062
|
+ for (counter = 0; counter < 250; counter++) {
|
1069
|
1063
|
uint8_t device_id = mem_read_8(REG::ID); // Read Device ID, Should Be 0x7C;
|
1070
|
1064
|
if (device_id == 0x7c) {
|
1071
|
1065
|
#if ENABLED(TOUCH_UI_DEBUG)
|
|
@@ -1073,9 +1067,9 @@ void CLCD::init() {
|
1073
|
1067
|
#endif
|
1074
|
1068
|
break;
|
1075
|
1069
|
}
|
1076
|
|
- else {
|
|
1070
|
+ else
|
1077
|
1071
|
delay(1);
|
1078
|
|
- }
|
|
1072
|
+
|
1079
|
1073
|
if (counter == 249) {
|
1080
|
1074
|
#if ENABLED(TOUCH_UI_DEBUG)
|
1081
|
1075
|
SERIAL_ECHO_START();
|
|
@@ -1130,7 +1124,7 @@ void CLCD::init() {
|
1130
|
1124
|
|
1131
|
1125
|
mem_write_8(REG::PCLK, Pclk); // Turns on Clock by setting PCLK Register to the value necessary for the module
|
1132
|
1126
|
|
1133
|
|
- mem_write_16(REG::PWM_HZ, 0x00FA);
|
|
1127
|
+ mem_write_16(REG::PWM_HZ, ENABLED(LCD_FYSETC_TFT81050) ? 0x2710 : 0x00FA);
|
1134
|
1128
|
|
1135
|
1129
|
// Turning off dithering seems to help prevent horizontal line artifacts on certain colors
|
1136
|
1130
|
mem_write_8(REG::DITHER, 0);
|