McMajan Library Pack  v 2.00
Improve your Arduino !
Ss_TFT.cpp
Go to the documentation of this file.
1 
2 #include "Ss_TFT.h"
3 
4 extern const uint8_t BasicSmallFont[];
5 
6 
7 //Ss_TFT lcd(0,1,2,3,4,5,6,7,A5,A4,A3,A2);
9 {
10  pinMode(0,OUTPUT);
11  pinMode(1,OUTPUT);
12  pinMode(2,OUTPUT);
13  pinMode(3,OUTPUT);
14  pinMode(4,OUTPUT);
15  pinMode(5,OUTPUT);
16  pinMode(6,OUTPUT);
17  pinMode(7,OUTPUT);
18  pinMode(A5,OUTPUT);
19  pinMode(A4,OUTPUT);
20  pinMode(A3,OUTPUT);
21  pinMode(A2,OUTPUT);
22 
23  LCD_RS=A5;
24  LCD_WR=A4;
25  LCD_CS=A3;
26  LCD_REST=A2;
27 
28  ForeColor=0xFFFF;
29  BackColor=0;
30  SCR_WW=240; // è sempre la larghezza col display in portrait
31  SCR_HH=320;
32  SCR_XX=239;
33  SCR_YY=319;
34  Tc_X=0,Tc_Y=0;
35  SCR_WIDTH=SCR_WW; // cambia con l'orientamento
37 
38  Service=0;
39  //0=
40  //1=orientation:0 port / 1 Land
41  #ifdef USE_HC595
42  #ifdef _595_h
43  My595=new hc595(2,4,7,2);
44  #endif
45  #endif
46  LocalFont.memory_pointer=0;
47  LocalFont.x_size=0;
48  LocalFont.y_size=0;
49  LocalFont.font_type=0 ;
50  LocalFont.c_min=0;
51  LocalFont.c_max=0;
52 
53  Touchpin(A1,A3,A0,8,9); // Touchpin(tclk,tcs,din,dout,irq)
54  TouchRawCalibX=160; //230
55  TouchRawCalibSCR_XX=3930; //3800
56 
57  TouchRawCalibY=210;
59 
60 }
61 
62 void Ss_TFT::LCD_Write8(uint8_t data)
63 {
64 #ifdef USE_HC595
65  #ifdef _595_h
66  My595->Send595Pin(data,0);
67  #endif
68 #else
69  #ifdef SS_USEDIRECTPORT
70  #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
71 
72  register uint8_t port=PORTE;
73 
74  if(bitRead(data,0)) port |= B0000001; // pe0 HIGH
75  else port &= ~ B0000001; // pe0 LOW
76  if(bitRead(data,1)) port |= B0000010; // pe1 HIGH
77  else port &= ~ B0000010; // pe1 LOW
78  if(bitRead(data,2)) port |= B0010000; // pe4 HIGH
79  else port &= ~ B0010000; // pe4 LOW
80  if(bitRead(data,3)) port |= B0100000; // pe5 HIGH
81  else port &= ~ B0100000; // pe5 LOW
82  if(bitRead(data,5)) port |= B0001000; // pe3 HIGH
83  else port &= ~ B0001000; // pe3 LOW
84  PORTE=port;
85  port=PORTH;
86  if(bitRead(data,6)) port |= B0001000; // ph3 HIGH
87  else port &= ~ B0001000; // ph3 LOW
88  if(bitRead(data,7)) port |= B0010000; // ph4 HIGH
89  else port &= ~ B0010000; // ph4 LOW
90  PORTH=port;
91 
92  if(bitRead(data,4)) PORTG |= B0100000; // pg5 HIGH
93  else PORTG &= ~ B0100000; // pg5 LOW
94 
95  #else // UNO
96  PORTD=data;
97  #endif
98  #else
99  uint8_t i,temp;
100  for(i=0;i<8;i++) //FastdigitalWrite(DB[i+8],(data>>i)&1);
101  {
102  temp=data&0x01;
103  FastdigitalWrite(i,temp);
104  data=data>>1;
105  }
106  #endif
107 #endif
108  LCD_WR_LOW
110 
111 }
112 
113 
114 
115 void Ss_TFT::LCD_Write8x2(unsigned short dataL)
116 {
117 #ifdef USE_HC595
118  #ifdef _595_h
119  uint8_t data,i,temp;
120  data=dataL>>8;
121  My595->Send595Pin(data,0);
122  LCD_WR_LOW
123  LCD_WR_HIGH
124  data=dataL;
125  My595->Send595Pin(dataL,0);
126  #endif
127 #else
128  #ifdef SS_USEDIRECTPORT
129  #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
130  uint8_t data=dataL>>8;
131  register uint8_t port=PORTE;
132 
133  if(bitRead(data,0)) port |= B0000001; // pe0 HIGH
134  else port &= ~ B0000001; // pe0 LOW
135  if(bitRead(data,1)) port |= B0000010; // pe1 HIGH
136  else port &= ~ B0000010; // pe1 LOW
137  if(bitRead(data,2)) port |= B0010000; // pe4 HIGH
138  else port &= ~ B0010000; // pe4 LOW
139  if(bitRead(data,3)) port |= B0100000; // pe5 HIGH
140  else port &= ~ B0100000; // pe5 LOW
141  if(bitRead(data,5)) port |= B0001000; // pe3 HIGH
142  else port &= ~ B0001000; // pe3 LOW
143  PORTE=port;
144  port=PORTH;
145  if(bitRead(data,6)) port |= B0001000; // ph3 HIGH
146  else port &= ~ B0001000; // ph3 LOW
147  if(bitRead(data,7)) port |= B0010000; // ph4 HIGH
148  else port &= ~ B0010000; // ph4 LOW
149  PORTH=port;
150  if(bitRead(data,4)) PORTG |= B0100000; // pg5 HIGH
151  else PORTG &= ~ B0100000; // pg5 LOW
152  data=dataL;
153  LCD_WR_LOW
154  LCD_WR_HIGH
155  if(bitRead(data,0)) port |= B0000001; // pe0 HIGH
156  else port &= ~ B0000001; // pe0 LOW
157  if(bitRead(data,1)) port |= B0000010; // pe1 HIGH
158  else port &= ~ B0000010; // pe1 LOW
159  if(bitRead(data,2)) port |= B0010000; // pe4 HIGH
160  else port &= ~ B0010000; // pe4 LOW
161  if(bitRead(data,3)) port |= B0100000; // pe5 HIGH
162  else port &= ~ B0100000; // pe5 LOW
163  if(bitRead(data,5)) port |= B0001000; // pe3 HIGH
164  else port &= ~ B0001000; // pe3 LOW
165  PORTE=port;
166  port=PORTH;
167  if(bitRead(data,6)) port |= B0001000; // ph3 HIGH
168  else port &= ~ B0001000; // ph3 LOW
169  if(bitRead(data,7)) port |= B0010000; // ph4 HIGH
170  else port &= ~ B0010000; // ph4 LOW
171  PORTH=port;
172  if(bitRead(data,4)) PORTG |= B0100000; // pg5 HIGH
173  else PORTG &= ~ B0100000; // pg5 LOW
174 
175 
176 
177 
178 
179  #else // UNO
180  PORTD=dataL>>8;
181  LCD_WR_LOW
182  LCD_WR_HIGH
183  PORTD=dataL;
184  #endif
185  #else
186  uint8_t data,i,temp;
187  data=dataL>>8;
188  for(i=0;i<8;i++) //FastdigitalWrite(DB[i+8],(data>>i)&1);
189  {
190  temp=data&0x01;
191  FastdigitalWrite(i,temp);
192  data=data>>1;
193  }
194  data=dataL;
195  LCD_WR_LOW
197  for(i=0;i<8;i++) //FastdigitalWrite(DB[i+8],(data>>i)&1);
198  {
199  temp=data&0x01;
200  FastdigitalWrite(i,temp);
201  data=data>>1;
202  }
203  #endif
204 #endif
205  LCD_WR_LOW
207 
208 }
209 
210 
211 
212 void Ss_TFT::LCD_Write_COMM8(unsigned short comm)
213 {
214  LCD_RS_LOW
215  LCD_Write8x2(comm);
216 }
217 
218 
219 void Ss_TFT::LCD_Write_DATA8(unsigned short data)
220 {
222  LCD_Write8x2(data);
223 }
224 
225 void Ss_TFT::LCD_Write_CD(unsigned short command,unsigned short data)
226 {
227  LCD_Write_COMM8(command);
228  LCD_Write_DATA8(data);
229 }
230 
231 void Ss_TFT::SetXY(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2)
232 {
233 
234 
235  LCD_Write_CD(0x0020,x1);
236  LCD_Write_CD(0x0021,y1);
237  LCD_Write_CD(0x0050,x1);
238  LCD_Write_CD(0x0052,y1);
239  LCD_Write_CD(0x0051,x2);
240  LCD_Write_CD(0x0053,y2);
241  LCD_Write_COMM8(0x0022);//LCD_Write_COM(0x00,0x22);
242 
243 }
244 /*!Inizialize dislay in standar portrait orientation*/
246 {
247  FastdigitalWrite(LCD_REST,HIGH);
248  delay(5);
249  FastdigitalWrite(LCD_REST,LOW);
250  delay(15);
251  FastdigitalWrite(LCD_REST,HIGH);
252  delay(15);
253  //FastdigitalWrite(LCD_CS,LOW);
254  LCD_CS_LOW
255  //************* Start Initial Sequence **********//
256  LCD_Write_CD(0x00E5,0x78F0); // set SRAM internal timing
257  LCD_Write_CD(0x0001,0x0100); // set SS and SM bit - Driver Output Control
258  LCD_Write_CD(0x0002,0x0000); // set 1 line inversion //LCD_Write_CD(0x0002,0x0700);
259  LCD_Write_CD(0x0003,0x1030); // set GRAM write direction and BGR=1.
260 
261  //LCD_Write_CD(0x0004,0x0000); // Resize register
262  LCD_Write_CD(0x0008,0x0207); // set the back porch and front porch
263  LCD_Write_CD(0x0009,0x0000); // set non-display area refresh cycle ISC[3:0]
264  LCD_Write_CD(0x000A,0x0000); // FMARK function
265  LCD_Write_CD(0x000C,0x0000); // RGB interface setting
266  LCD_Write_CD(0x000D,0x0000); // Frame marker Position
267  LCD_Write_CD(0x000F,0x0000); // RGB interface polarity
268 
269  //*************Power On sequence ****************//
270  LCD_Write_CD(0x0010,0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB // (0x0010, 0x1690
271  LCD_Write_CD(0x0011,0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
272  LCD_Write_CD(0x0012,0x0000); // VREG1OUT voltage
273  LCD_Write_CD(0x0013,0x0000); // VDV[4:0] for VCOM amplitude
274  LCD_Write_CD(0x0007,0x0001);
275 
276  delay(200); // Dis-charge capacitor power voltage
277  LCD_Write_CD(0x0010,0x1690); // 1490//SAP, BT[3:0], AP, DSTB, SLP, STB
278  LCD_Write_CD(0x0011,0x0227); // DC1[2:0], DC0[2:0], VC[2:0]
279 
280  delay(50); // Delay 50ms
281  LCD_Write_CD(0x0012,0x000D); //1C-1f// Internal reference voltage= Vci;
282  delay(50); // Delay 50ms
283  LCD_Write_CD(0x0013,0x1200);//0x1000//1400 Set VDV[4:0] for VCOM amplitude 1A00
284  LCD_Write_CD(0x0029,0x000A);//0x0012 //001a Set VCM[5:0] for VCOMH //0x0025 0034
285  LCD_Write_CD(0x002B,0x000D);// Set Frame Rate 000C
286 
287  delay(50); // Delay 50ms
288 
289  LCD_Write_CD(0x0020,0x0000);// GRAM horizontal Address
290  LCD_Write_CD(0x0021,0x0000);// GRAM Vertical Address
291 
292  // ----------- Adjust the Gamma Curve ----------//
293 
294  LCD_Write_CD(0x30, 0x0000);
295  LCD_Write_CD(0x31, 0x0404);
296  LCD_Write_CD(0x32, 0x0003);
297  LCD_Write_CD(0x35, 0x0405);
298  LCD_Write_CD(0x36, 0x0808);
299  LCD_Write_CD(0x37, 0x0407);
300  LCD_Write_CD(0x38, 0x0303);
301  LCD_Write_CD(0x39, 0x0707);
302  LCD_Write_CD(0x3C, 0x0504);
303  LCD_Write_CD(0x3D, 0x0808);
304 
305  //------------------ Set GRAM area ---------------//
306 
307  LCD_Write_CD(0x0050,0x0000);// Horizontal GRAM Start Address
308  LCD_Write_CD(0x0051,0x00EF);// Horizontal GRAM End Address
309  LCD_Write_CD(0x0052,0x0000);// Vertical GRAM Start Address
310  LCD_Write_CD(0x0053,0x013F);// Vertical GRAM End Address
311  LCD_Write_CD(0x0060,0xA700);// Gate Scan Line
312  LCD_Write_CD(0x0061,0x0001); // NDL,VLE, REV
313  LCD_Write_CD(0x006A,0x0000);// set scrolling line
314 
315  //-------------- Partial Display Control ---------//
316  LCD_Write_CD(0x0080,0x0000);
317  LCD_Write_CD(0x0081,0x0000);
318  LCD_Write_CD(0x0082,0x0000);
319  LCD_Write_CD(0x0083,0x0000);
320  LCD_Write_CD(0x0084,0x0000);
321  LCD_Write_CD(0x0085,0x0000);
322 
323  //-------------- Panel Control -------------------//
324 
325  LCD_Write_CD(0x0090,0x0010);
326  LCD_Write_CD(0x0092,0x0600);
327  LCD_Write_CD(0x0007,0x0133);// 262K color and display ON
328 
329  //FastdigitalWrite(LCD_CS,HIGH);
331 
332 
333 }
334 /*
335 resta bianco, in stand by ma non si spegne.
336  LCD_CS_LOW
337  lcd.LCD_Write_CD(0x0007,0x0030);// 262K color and display ON
338  LCD_CS_HIGH*/
339 
340  /*!Draw empty rectangle
341 \param x0 x coordinate of starting point
342 \param y0 y coordinate of starting point
343 \param x1 x coordinate of target point
344 \param y1 y coordinate of target point
345 
346 */
347 void Ss_TFT::Rect(int x0,int y0,int x1,int y1)
348 {
349  LCD_CS_LOW
351  Line(x0,y0,x1,y0);
353  Line(x0,y1,x1,y1);
355  Line(x0,y0+1,x0,y1-1);
357  Line(x1,y0,x1,y1-1);
359 }
360 
361 void Ss_TFT::CheckPoint(int * x,int * y)
362 {
363  if(*x<0) *x=0;
364  if(*x>SCR_XX) *x=SCR_XX;
365  if(*y<0) *y=0;
366  if(*y>SCR_YY) *y=SCR_YY;
367 }
368 
369 
370 /*!Draw filled rectangle
371 \param sx x coordinate of starting point
372 \param sy y coordinate of starting point
373 \param ex x coordinate of target point
374 \param ey y coordinate of target point
375 \param force optional parameter (default false): if set to true the dysplay orientation will be ignored (used default portrait)
376 */
377 
378 void Ss_TFT::RectFill(int sx,int sy, int ex, int ey,bool force)
379 {
380  unsigned short i,j;
381 
382 if (bitRead(Service,1)==Ss_LANDSCAPE && !force)
383  {
384  int z;
385  int dx=ex-sx;
386  int dy=ey-sy;
387  z=sx;
388  sx=sy;
389  sy=SCR_YY-z-dx;
390  ex=sx+dy;
391  ey=sy+dx;
392 
393  }
394 
395 
396 
397  LCD_CS_LOW
398  SetXY(sx,sy,ex,ey);
400  for(i=0;i<(ey-sy+1);i++)
401  {
402  for (j=0;j<(ex-sx+1);j++)
403  {
404 
405  LCD_Write8x2(ForeColor);//LCD_Write_DATA8(ForeColor);
406 
407  }
408  }
409 
411 }
412 /*!This function empties the display content. Without parameter it uses the white color.
413 Alternatively you can select a color on the format 0xRRGGBB.
414 \param rgb optional background color
415 */
416 void Ss_TFT::CleanLCD(unsigned short rgb)
417 {
418  unsigned int fc=ForeColor;
419  //SetFcolor(255,255,255);
420  ForeColor=rgb;
422  ForeColor=fc;
423 }
424 /*!Sets foreground color. Every componente are from 0 to 255 (8bit for channel) but the display support less colors number, for this an automatic conversion will done.
425 \param r red component
426 \param g green component
427 \param b blue component
428 */
429 void Ss_TFT::SetFcolor(uint8_t r,uint8_t g,uint8_t b)
430 {
431  ForeColor=((r>>3)<<11)+((g>>2)<<5)+(b>>3);
432 }
433 /*!Sets background color. Every componente are from 0 to 255 (8bit for channel) but the display support less colors number, for this an automatic conversion will done.
434 \param r red component
435 \param g green component
436 \param b blue component
437 */
438 void Ss_TFT::SetBcolor(uint8_t r,uint8_t g,uint8_t b)
439 {
440  BackColor=((r>>3)<<11)+((g>>2)<<5)+(b>>3);
441 }
442 /*!Sets foreground and color using single integer value (for example 0xff00cc
443 \param FC Foreground color
444 \param BC Background color
445 
446 */
447 void Ss_TFT::SetFBcolor(int FC,int BC)
448 {
449  ForeColor=FC;
450  BackColor=BC;
451 }
452 
453 /*!Draw horizontal line
454 \param x x coordinate of starting point
455 \param y y coordinate of starting point
456 \param ln lenght of line
457 */
458 void Ss_TFT::HLine(short x,short y, short ln)
459 {
460  if (ln<0) {ln = -ln;x -= ln;}
461  if(x<0) {ln+=x;x=0;}
462  else if(x>SCR_XX) {ln-=(x-SCR_XX);x=SCR_XX;}
463 
464  SetXY(x, y, x+ln, y);
466  for (unsigned short i=0; i<ln+1; i++) LCD_Write8x2(ForeColor);//LCD_Write_DATA8(ForeColor);
467 }
468 /*!Draw vertical line
469 \param x x coordinate of starting point
470 \param y y coordinate of starting point
471 \param ln lenght of line
472 */
473 void Ss_TFT::VLine(short x, short y, short ln)
474 {
475 
476  if (ln<0) {ln = -ln;y -= ln;}
477  if(y<0) {ln+=y;y=0;}
478  else if(y>SCR_YY) {ln-=(y-SCR_YY); y=SCR_YY;}
479  SetXY(x, y, x, y+ln);
481  for (unsigned short i=0; i<ln+1; i++) LCD_Write8x2(ForeColor);//LCD_Write_DATA8(ForeColor);
482 
483 
484 }
485 
486 
487 void Ss_TFT::LineVS(int x,int y, int l)
488 {
489  Line(x,y,x,y+l);
490 }
491 void Ss_TFT::LineHS(int x,int y, int l)
492 {
493  Line(x,y,x+l,y);
494 }
495 
496 /*!Draw line
497 \param x1 x coordinate of starting point
498 \param y1 y coordinate of starting point
499 \param x2 x coordinate of target point
500 \param y2 y coordinate of target point
501 */
502 void Ss_TFT::Line(int x1,int y1, int x2, int y2)
503 {
504  LCD_CS_LOW
505  if (bitRead(Service,1)==Ss_LANDSCAPE)
506  {
507  int z;
508  z=x1;
509  x1=y1;
510  y1=SCR_YY-z;
511  z=x2;
512  x2=y2;
513  y2=SCR_YY-z;
514  }
515 
516 
517  if (y1==y2) HLine(x1, y1, x2-x1);
518  else if (x1==x2) VLine(x1, y1, y2-y1);
519  else
520  {
521 
522 
523 
524 
525  unsigned short dx,xstep,dy,ystep;
526  unsigned short col = x1, row = y1;
527 
528  if(x2>x1) {dx=x2-x1;xstep=1;}
529  else {dx=x1-x2;xstep=-1;}
530  if(y2>y1) {dy=y2-y1;ystep=1;}
531  else {dy=y1-y2;ystep=-1;}
532 
533  if (dx < dy)
534  {
535  int t = - (dy >> 1);
536  while (true)
537  {
538  SetXY (col, row, col, row);
540  if (row == y2) return;
541  row += ystep;
542  t += dx;
543  if (t >= 0)
544  {
545  col += xstep;
546  t -= dy;
547  }
548  }
549  }
550  else
551  {
552  int t = - (dx >> 1);
553  while (true)
554  {
555  SetXY (col, row, col, row);
557  if (col == x2) return;
558  col += xstep;
559  t += dy;
560  if (t >= 0)
561  {
562  row += ystep;
563  t -= dx;
564  }
565  }
566  }
567  }
569 }
570 
571 /*!Draw empty circle
572 \param cx x coordinate of circle center
573 \param cy y coordinate of circle center
574 \param radius radius
575 */
576 void Ss_TFT::Circle(int cx, int cy, int radius) //7227 -- 7194
577 {
578 
579  if (bitRead(Service,1)==Ss_LANDSCAPE)
580  {
581  int z;
582  z=cx;
583  cx=cy;
584  cy=SCR_YY-z;
585  }
586 
587 
588  LCD_CS_LOW
589 
590  int error = -radius;
591  int x = radius;
592  int y = 0;
593 
594  while (x > y)
595  {
596  plot4points(cx, cy, x, y);
597  plot4points(cx, cy, y, x);
598 
599  error += y;
600  ++y;
601  error += y;
602 
603  if (error>=0) //!(error&0x80))
604  {
605  error -= x;
606  --x;
607  error -= x;
608  }
609  }
610 
612 }
613 
614 void Ss_TFT::plot4points(int cx, int cy, int x, int y)
615 {
616  FPixel(cx + x, cy + y);
617 
618  if (x)
619  {
620  FPixel(cx - x, cy + y);
621  if (y ) FPixel(cx - x, cy - y);
622  }
623  if (y ) FPixel(cx + x, cy - y);
624 }
625 
626  /*!Draw filled circle
627 \param cx x coordinate of circle center
628 \param cy y coordinate of circle center
629 \param radius radius
630 */
631 void Ss_TFT::CircleFill(int x, int y, int raggio) //7383
632 {
633  for(int y1=-raggio; y1<=0; y1++)
634  for(int x1=-raggio; x1<=0; x1++)
635  if(x1*x1+y1*y1 <= raggio*raggio)
636  {
637  Line(x-x1, y+y1, x+x1,y+y1);
638  Line(x-x1, y-y1,x+x1,y-y1);
639  break;
640  }
641 }
642 
643 
644 
645 
646 
647 
648 void Ss_TFT::d32s(short x,short y,uint8_t val)
649 {
650  uint8_t i,j,ch,seg,bsp,cmax,spx,spy; // bsp è lo spazio fra i segmenti
651  unsigned short offset;
652 
653  if(LocalFont.font_type!=2) return;
654  seg=LocalFont.x_size;
655  bsp=LocalFont.y_size;
656  spx=LocalFont.sp_x;
657  spy=LocalFont.sp_y;
658  val++; // nel primo carattere memorizzo il simbolo d'errore
659  if(val<LocalFont.c_min+1) val=LocalFont.c_min; // occhio che c_min da qui in poi contiene l'errore e NON il primo carattere
660  if(val>LocalFont.c_max+1) val=LocalFont.c_min;
661  offset=4*(val-LocalFont.c_min);
662 
663  //cmax=LocalFont.c_max;
664 
665 
666 
667 
668  LocalFont.font_x_space=4*spx+7+8*seg;
669  LocalFont.font_y_space=4*spy+7+8*seg;
670 
671  LCD_CS_LOW
672 
673 
674  uint8_t b1=pgm_read_byte(LocalFont.memory_pointer+offset);
675  uint8_t b2=pgm_read_byte(LocalFont.memory_pointer+offset+1);
676  uint8_t b3=pgm_read_byte(LocalFont.memory_pointer+offset+2);
677  uint8_t b4=pgm_read_byte(LocalFont.memory_pointer+offset+3);
678 
679  //b1=b2=b3=b4=255;
680 
681  unsigned short VU=1+2*seg;
682  unsigned short HU=1+2*seg;
683 
684  unsigned short HSU=1+spx;
685  unsigned short VSU=1+spy;
686 
687  unsigned short VSegment=2*VSU+3*seg+1;
688  unsigned short HSegment=2*HSU+3*seg+1;//2*HSU+HU+1+seg;
689  uint8_t step;
690 
691  unsigned short x1,x2,x3,y1,y2,y3,y4,y5,x4,x5;
692 
693  x1=x+seg; // togliere -1
694  x2=x1+HSegment;
695  x3=x2+HSegment;
696  y1=y+seg; // togli -1
697  y2=y1+VSegment;
698  y3=y2+VSegment;
699 
700  //bsp*=2;
701 
702  VSegment-=(2*bsp);
703  HSegment-=(2*bsp);
704 
705 y4=(y2+y1)>>1;
706 y5=(y3+y2)>>1;
707 x4=(x1+x2)>>1;
708 x5=(x2+x3)>>1;
709 
710 //LocalFont.font_x_space=x3-x1+2*seg+1;
711 //LocalFont.font_y_space=y3-y1+2*seg+1;
712 
713  for(step=0;step<seg;step++)
714  {
715  // PRIMO BYTE 1 - 8
716  if(bitRead(b1,7)) //segmento 1
717  {
718  LineVS(x1-step,y1+step+bsp,VSegment-step*2);
719  if(step) LineVS(x1+step,y1+step+bsp,VSegment-step*2);
720 
721  }
722  if(bitRead(b1,6)) //segmento 2
723  {
724  LineVS(x1-step,y2+step+bsp,VSegment-step*2);
725  if(step) LineVS(x1+step,y2+step+bsp,VSegment-step*2);
726  }
727  if(bitRead(b1,5)) //segmento 3
728  {
729  LineVS(x2-step,y1+step+bsp,VSegment-step*2);
730  if(step) LineVS(x2+step,y1+step+bsp,VSegment-step*2);
731  }
732 
733  if(bitRead(b1,4)) //segmento 4
734  {
735  LineVS(x2-step,y2+step+bsp,VSegment-step*2);
736  if(step) LineVS(x2+step,y2+step+bsp,VSegment-step*2);
737  }
738 
739  if(bitRead(b1,3)) //segmento 5
740  {
741  LineVS(x3-step,y1+step+bsp,VSegment-step*2);
742  if(step) LineVS(x3+step,y1+step+bsp,VSegment-step*2);
743  }
744 
745  if(bitRead(b1,2)) //segmento 6
746  {
747  LineVS(x3-step,y2+step+bsp,VSegment-step*2);
748  if(step) LineVS(x3+step,y2+step+bsp,VSegment-step*2);
749  }
750 
751  if(bitRead(b1,1))//segmento 7
752  {
753  LineHS(x1+step+bsp,y1-step,HSegment-step*2);
754  if(step) LineHS(x1+step+bsp,y1+step,HSegment-step*2);
755  }
756 
757  if(bitRead(b1,0))//segmento 8
758  {
759  LineHS(x2+step+bsp,y1-step,HSegment-step*2);
760  if(step) LineHS(x2+step+bsp,y1+step,HSegment-step*2);
761  }
762 
763 // SECONDO BYTE 9 - 16
764  //HSegment+=2;
765  if(bitRead(b2,7)) //segmento 9
766  {
767  LineHS(x1+step+bsp,y2-step,HSegment-step*2);
768  if(step) LineHS(x1+step+bsp,y2+step,HSegment-step*2);
769  }
770 
771  if(bitRead(b2,6)) //segmento 10
772  {
773  LineHS(x2+step+bsp,y2-step,HSegment-step*2);
774  if(step) LineHS(x2+step+bsp,y2+step,HSegment-step*2);
775  }
776 
777  if(bitRead(b2,5))//segmento 11
778  {
779  LineHS(x1+step+bsp,y3-step,HSegment-step*2);
780  if(step) LineHS(x1+step+bsp,y3+step,HSegment-step*2);
781  }
782 
783  if(bitRead(b2,4)) //segmento 12
784  {
785  LineHS(x2+step+bsp,y3-step,HSegment-step*2);
786  if(step) LineHS(x2+step+bsp,y3+step,HSegment-step*2);
787  }
788  if(bitRead(b2,3))//segmento 13
789  {
790  Line(x1+step+seg+bsp,y1+seg+bsp,x2-seg-bsp,y2-step-seg-bsp);
791  if(step) Line(x1+seg+bsp,y1+step+seg+bsp,x2-step-seg-bsp,y2-seg-bsp);
792  }
793 
794  if(bitRead(b2,2))//segmento 14
795  {
796  Line(x2+seg+bsp,y2-seg-step-bsp,x3+bsp-step-seg-bsp,y1+seg+bsp);
797  if(step) Line(x2+step+seg+bsp,y2-seg-bsp,x3-seg-bsp,y1+step+seg+bsp);
798  }
799 
800  if(bitRead(b2,1)) //segmento 15
801  {
802  Line(x1+seg+bsp,y3-step-seg-bsp,x2-seg-step-bsp,y2+seg+bsp);
803  if(step) Line(x1+step+seg+bsp,y3-seg-bsp,x2-seg-bsp,y2+step+seg+bsp);
804  }
805 
806 
807  if(bitRead(b2,0))//segmento 16
808  {
809  Line(x2+step+seg+bsp,y2+seg+bsp,x3-seg-bsp,y3-step-seg-bsp);
810  if(step) Line(x2+seg+bsp,y2+step+seg+bsp,x3-step-seg-bsp,y3-seg-bsp);
811  }
812 
813 // TERZO BYTE 17 - 24
814  if(bitRead(b3,7))//segmento 17
815  {
816  HLine(x1+bsp+seg+1,y4+step-(seg>>1),HSegment-2*seg-2);
817  }
818 
819  if(bitRead(b3,6))//segmento 18
820  {
821  HLine(x2+bsp+seg+1,y4+step-(seg>>1),HSegment-2*seg-2);
822  }
823 
824  if(bitRead(b3,5))//segmento 19
825  {
826  HLine(x1+bsp+seg+1,y5+step-(seg>>1),HSegment-2*seg-2);
827  }
828  if(bitRead(b3,4))//segmento 20
829  {
830  HLine(x2+bsp+seg+1,y5+step-(seg>>1),HSegment-2*seg-2);
831  }
832 
833  //---------------
834 
835  if(bitRead(b3,3))//segmento 21
836  {
837  VLine(x4+step-(seg>>1),y1+bsp+seg+1,VSegment-2*seg-2);
838  }
839  if(bitRead(b3,2))//segmento 22
840  {
841  VLine(x5+step-(seg>>1),y1+bsp+seg+1,VSegment-2*seg-2);
842  }
843 
844 
845  if(bitRead(b3,1))//segmento 23
846  {
847  VLine(x4+step-(seg>>1),y2+bsp+seg+1,VSegment-2*seg-2);
848  }
849  if(bitRead(b3,0))//segmento 24
850  {
851  VLine(x5+step-(seg>>1),y2+bsp+seg+1,VSegment-2*seg-2);
852  }
853 
854 
855 
856 
857 // QUARTO BYTE 25 - 16
858 
859  // SetFcolor(0,0,255);
860  if(bitRead(b4,6))
861  {
862  HLine(x2-step,y3+step,step*2);//RectFill(x2-seg,y3-seg,x2+seg,y3+seg);//segmento 26
863  HLine(x2-step,y3+seg+(seg-step),step*2);//RectFill(x2-seg,y3-seg,x2+seg,y3+seg);//segmento 26
864  }
865  }
866  }
867 
868 /*!Select the font type. Parameters changes if you use bitmap or vectorial font. If you use bitmap font you have to choice only the font pointer:
869 \code
870 extern uint8_t BasicSmallFont[];
871 ...
872 lcd.SetFont(BasicSmallFont);
873 \endcode
874 If you want to use the vectorial font you must use 4 parameters: font pointer, segment width, segment height, space between segments, more X width and Y height (for change X:Y ratio).
875 \code
876 extern unsigned char SegmentFont[];
877 ...
878 lcd.SetFont(SegmentFont,2,1,0);
879 \endcode
880 */
881 void Ss_TFT::SetFont(uint8_t * font,uint8_t x,uint8_t y,uint8_t spx,uint8_t spy)
882 {
883  LocalFont.font_type=pgm_read_byte(font+0);
884  if(LocalFont.font_type==1)
885  {
886  LocalFont.x_size=pgm_read_byte(font+1);
887  LocalFont.y_size=pgm_read_byte(font+2);
888  LocalFont.c_min=pgm_read_byte(font+3);
889  LocalFont.c_max=pgm_read_byte(font+4);
890  LocalFont.memory_pointer=font+5;
891  LocalFont.sp_x=x; // usato per mantenere l'opzione di zoom sugli assi x ed y
892  LocalFont.font_x_space=LocalFont.x_size;
893  LocalFont.font_y_space=LocalFont.y_size;
894  }
895  else if(LocalFont.font_type==2)
896  {
897  //if(x<1) x=1;
898  LocalFont.x_size=x; // spessore dei segmenti - seg
899  LocalFont.y_size=y; // usato per il bordo di spaziatura fra i segmenti
900  LocalFont.sp_x=spx;// spaziatura aggiuntiva x
901  LocalFont.sp_y=spy;// spaziatura aggiuntiva y
902  LocalFont.c_min=pgm_read_byte(font+1);
903  LocalFont.c_max=pgm_read_byte(font+2);
904  LocalFont.memory_pointer=font+3;
905  LocalFont.font_x_space=4*spx+7+8*x;//4*spx+6*x+11;//4*(1+2*x)+spx*4+4;
906  LocalFont.font_y_space=4*spy+7+8*y;////4*spy+10*x+12;//6*(1+2*x)+spy*4;;
907  }
908 }
909 
910 void Ss_TFT::SetFontOption(uint8_t option) // da usare SOLO con fonttype=1
911 {
912  if(LocalFont.font_type==1)
913  {
914  LocalFont.font_x_space=LocalFont.x_size;
915  LocalFont.font_y_space=LocalFont.y_size;
916  if(bitRead(option,0)) LocalFont.font_x_space=LocalFont.x_size<<1; // raddoppia X
917  if(bitRead(option,1)) LocalFont.font_y_space=LocalFont.y_size<<1; // raddoppia Y
918  }
919 }
920 
921 void Ss_TFT::DisplayChar(short x,short y ,uint8_t val,uint8_t option)
922 {
923  uint8_t type;
924  type=LocalFont.font_type;
925  LocalFont.sp_x=option;
926 
927  if(type==1)
928  {
929  SetFontOption(option);
930  DisplayBitmapChar(x,y,val,option);
931  }
932  else if(type==2) d32s(x,y,val);
933 
934  //localX=x+LocalFont.x_size;
935  //localY=y+LocalFont.y_size;
936 }
937 
938 
939 
940 
941 void Ss_TFT::DisplayBitmapChar(int x,int y ,uint8_t val,uint8_t option)
942 {
943 
944  uint8_t i,j,ch,chx,chy,cmin,cmax,bit,type,sp=1,L,H;
945  unsigned int bitnum,bytenum;
946 
947  uint8_t bit_x,bit_y;
948  uint8_t *bit_buff;
949 
950  type=LocalFont.font_type;
951  chx=LocalFont.x_size;
952  chy=LocalFont.y_size;
953  cmin=LocalFont.c_min;
954  cmax=LocalFont.c_max;
955 
956  if(type!=1) return; // segmenti
957  if(option>3) option=3;
958 
959 
960  if (bitRead(Service,1)==Ss_LANDSCAPE) GetLandscapePoint(&x,&y);// rotazione di 90 gradi
961  /* {
962  int z;
963  z=x;
964  x=y;
965  y=SCR_YY-z;
966  }*/
967 
968 
969  bit_x=chx;
970  bit_y=chy;
971  if(bitRead(option,0)) bit_x=bit_x*2;
972  if(bitRead(option,1)) bit_y=bit_y*2;
973 
974  bit_buff=(uint8_t*)malloc(bit_x*bit_y);
975 
976  LCD_CS_LOW
977 
978 
979 
980 
981  //HU=2*SP+1;
982 
983  bitnum=(val-cmin)*chx*chy;
984  bool * myarray;
985  myarray=(bool *)malloc(sizeof(bool)*chy*chx);
986  unsigned short pointer=0,fpointer=0;
987 
988  for(j=0;j<chy;j++) // preparo un array di valori booleani per una più facile gestione
989  {
990  for(i=0;i<chx;i++)
991  {
992  bytenum=bitnum>>3; //Fbit/8;
993  bit=bitnum-8*bytenum;
994  ch=pgm_read_byte(LocalFont.memory_pointer+bytenum);
995  if(ch&(1<<(7-bit))) *(myarray+pointer)=1;
996  else *(myarray+pointer)=0;
997  pointer++;
998  bitnum++;
999  }
1000  }
1001  if (bitRead(Service,1)==Ss_LANDSCAPE) SetXY(x,y-bit_x+1,x+bit_y-1,y);
1002  else SetXY(x,y,x+bit_x-1,y+bit_y-1);
1003 
1004 
1005 // option: 0:1:1 1:2x 2:2y 3:2xy
1006 
1007  pointer=0;
1008  bool FoB1=0;
1009  bool FoB2=0;
1010  // e ora interagisco con i valori.
1011 
1012  for(j=0;j<chy;j++)
1013  {
1014 
1015  for(i=0;i<chx;i++) // for x prima riga
1016  {
1017 
1018  FoB1=0;
1019  FoB2=0;
1020 
1021  if(*(myarray+pointer))
1022  {
1023  FoB1=1; // 1
1024  if(i<chx-1) if(*(myarray+pointer+1)) FoB2=1;//2 //OK
1025  if(option==1) FoB2=1; // duplicazione solo x
1026  }
1027 
1028 
1029 
1030  if(FoB1) {*(bit_buff+fpointer)=1;/*LCD_Write_DATA8(ForeColor);*/}
1031  else {*(bit_buff+fpointer)=0;/*LCD_Write_DATA8(BackColor);*/}
1032 
1033  if(option==1 || option==3) if(FoB2){fpointer++;/*LCD_Write_DATA8(ForeColor);*/*(bit_buff+fpointer)=1; }// solo x doppie
1034  else {fpointer++;/*LCD_Write_DATA8(BackColor);*/*(bit_buff+fpointer)=0;}
1035 
1036 
1037  pointer++;
1038  fpointer++;
1039  } // for x prima riga
1040 
1041 
1042  if(bitRead(option,1)) // solo y doppie
1043  {
1044  pointer-=chx;
1045 
1046  for(i=0;i<chx;i++) // for x seconda riga - righe calcolate
1047  {
1048  FoB1=0;
1049  FoB2=0;
1050 
1051  if(j<chy-1)
1052  {
1053  if(*(myarray+pointer+chx) & *(myarray+pointer) ) FoB1=1;//1
1054  if(option==2 && *(myarray+pointer)) FoB1=1; // duplicazione solo y
1055  if(*(myarray+pointer+chx+1) & *(myarray+pointer) & *(myarray+pointer+1)==0 & *(myarray+pointer+chx)==0) FoB2=1;//2 //ok
1056  if(i<chx-1) if( *(myarray+pointer)==0 & *(myarray+pointer+chx) & *(myarray+pointer+1) & *(myarray+pointer+chx+1)==0) FoB2=1;
1057  }
1058 
1059 
1060  if(FoB1) *(bit_buff+fpointer)=1;
1061  else *(bit_buff+fpointer)=0;
1062 
1063  if(option==3)
1064  {
1065  if(FoB2) {fpointer++;*(bit_buff+fpointer)=1;}
1066  else {fpointer++;*(bit_buff+fpointer)=0;}
1067  }
1068 
1069 
1070  pointer++;
1071  fpointer++;
1072  } // for x seconda riga*/
1073 
1074 
1075  } // option
1076 
1077 
1078  //temp++;
1079 
1080  } // for y
1081 
1082 
1083 
1084  pointer=0;
1085  uint8_t * bitpointer=0;
1086 
1087 
1088 
1089  if(!bitRead(Service,1))
1090  {
1091  for(j=0;j<bit_y;j++) // pre
1092  {
1093  for(i=0;i<bit_x;i++)
1094  {
1095  //if(*(bit_buff+i+j*bit_x)) LCD_Write_DATA8(ForeColor);
1096  if(*(bit_buff+pointer)) LCD_Write_DATA8(ForeColor);
1097  else LCD_Write_DATA8(BackColor);
1098  pointer++;
1099  }
1100  }
1101  }
1102  else // LANDSCAPE
1103  {
1104  for(i=0;i<bit_x;i++) // pre
1105  {
1106  for(j=0;j<bit_y;j++)
1107  {
1108  if(*(bit_buff+(bit_x-i-1)+j*bit_x))LCD_Write_DATA8(ForeColor);
1109  else LCD_Write_DATA8(BackColor);
1110  }
1111  }
1112  }
1113 
1114  free(myarray);
1115  free(bit_buff);
1116  //FastdigitalWrite(LCD_CS,HIGH);
1117  LCD_CS_HIGH
1118 
1119 }
1120 
1121  /*!This function writes a string to the display in the selected position, using actual font and colors.
1122 
1123 For vectorial font you need 3 parameters: X, Y and string
1124 \code
1125 lcd.DisplayString(10,10,"MCMAJAN.COM");
1126 \endcode
1127 If you are using a bitmap font, you have to add a fourth parameter: this one at 0 indicate normal dimension, at 1 doubles X, at 2 doubles Y, at 3 doubles X and Y.
1128 \code
1129 lcd.DisplayString(10,10,"MCMAJAN.COM",3);
1130 \endcode
1131 */
1132 void Ss_TFT::DisplayString(int x,int y, char *st,uint8_t options)
1133 {
1134  unsigned int x1,y1;
1135  x1=x;
1136  y1=y;
1137  if(LocalFont.font_type==1) SetFontOption(options);
1138  //FastdigitalWrite(LCD_CS,LOW);
1139  LCD_CS_LOW
1140  while(*st!='\0')
1141  {
1142  DisplayChar(x1,y1,*st,options);
1143  x1+=LocalFont.font_x_space;
1144  st++;
1145  }
1146  LCD_CS_HIGH
1147 }
1148 
1149 /*!Draw a single dot
1150 \param x
1151 \param y
1152 */
1153 void Ss_TFT::Pixel(int x, int y)
1154 {
1155  LCD_CS_LOW //FastdigitalWrite(LCD_CS,LOW);
1156  SetXY(x, y, x, y);
1157  LCD_RS_HIGH
1159  LCD_CS_HIGH //FastdigitalWrite(LCD_CS,HIGH);
1160 }
1161 
1162 void Ss_TFT::GetLandscapePoint(int * x,int * y)
1163 {
1164  int z;
1165  z=*x;
1166  *x=*y;
1167  *y=SCR_YY-z;
1168 }
1169 
1170 
1171 
1172 
1173 // TOUCH
1174 
1175 
1176 void Ss_TFT::Touchpin(int tclk,int tcs,int din,int dout, int irq)
1177 {
1178  T_CLK=tclk;
1179  pinMode(T_CLK,OUTPUT);
1180  T_CS=tcs;
1181  pinMode(T_CS,OUTPUT);
1182  T_DIN=din;
1183  pinMode(T_DIN,OUTPUT);
1184  T_DOUT=dout;
1185  pinMode(T_DOUT,INPUT);
1186  T_IRQ=irq;
1187  pinMode(T_IRQ,INPUT);
1188 }
1189 
1190 /*! Initialize touch screen capabilities*/
1192 {
1193  FastdigitalWrite(T_CS,HIGH);
1194  FastdigitalWrite(T_CLK,HIGH);
1195  FastdigitalWrite(T_DIN,HIGH);
1196  FastdigitalWrite(T_CLK,HIGH);
1197 }
1198 
1199 void Ss_TFT::Write7843(uint8_t num)
1200 {
1201 
1202  //S A2 A1 A0 MOD SER PD1 PD0
1203 
1204  uint8_t count=0;
1205  uint8_t temp;
1206  unsigned nop;
1207  temp=num;
1208  FastdigitalWrite(T_CLK,LOW);
1209  for(count=0;count<8;count++)
1210  {
1211  if(temp&0x80) // primo bit sempre alto
1212  FastdigitalWrite(T_DIN,HIGH);
1213  else
1214  FastdigitalWrite(T_DIN,LOW);
1215 
1216  temp=temp<<1;
1217 
1218  FastdigitalWrite(T_CLK,LOW);
1219  nop++;
1220  FastdigitalWrite(T_CLK,HIGH);
1221  nop++;
1222 
1223  }
1224 }
1225 
1226 unsigned int Ss_TFT::Read7843()
1227 {
1228  //unsigned nop;
1229  uint8_t count=0;
1230  unsigned short Num=0;
1231  for(count=0;count<12;count++)
1232  {
1233  Num<<=1;
1234  HPulse(T_CLK);
1235  if(FastdigitalRead(T_DOUT)) Num++;
1236  }
1237  return(Num);
1238 }
1239 /*!Transforms raw touch screen coordinates to real X,Y pixel. If you need it, you can read coordinates reading Tc_X e Tc_Y.
1240 \code
1241  lcd.TouchGetPoint();
1242  int lx=lcd.Tc_X;
1243  int ly=lcd.Tc_Y;
1244 \endcode
1245 */
1246 
1248 {
1249 
1250 
1251  FastdigitalWrite(T_CS,LOW);
1252  //for(;;)
1253  //{
1254  Write7843(0x90); //1001 0000 A0 12 bit differenziale Y
1255  HPulse(T_CLK);
1257  //if(TouchRawY>0 && TouchRawY<4096) break;
1258  //}
1259  //for(;;)
1260  //{
1261  Write7843(0xD0); //1101 0000 A2 A0 12 bit differenziale X
1262  HPulse(T_CLK);
1264  //if(TouchRawX>0 && TouchRawX<4096) break;
1265 
1266  // }
1267 
1268  float fy=(TouchRawCalibSCR_YY/SCR_YY);
1269  float fx=(TouchRawCalibSCR_XX/SCR_XX);
1270  FastdigitalWrite(T_CS,HIGH);
1271 
1272  Tc_X=((float)TouchRawX-(float)TouchRawCalibX)/fx;
1273  Tc_Y=((float)TouchRawY-(float)TouchRawCalibY)/fy;
1274 //Tc_Y=(TouchRawY-TouchRawCalibY)*SCR_YY/TouchRawCalibSCR_YY;
1275 
1276 #ifdef Touch_Limit
1277  if(Tc_X<0) Tc_X=0;
1278  if(Tc_X>SCR_XX) Tc_X=SCR_XX;
1279  if(Tc_Y<0) Tc_Y=0;
1280  if(Tc_Y>SCR_YY) Tc_Y=SCR_YY;
1281 #endif
1282 
1283  if (bitRead(Service,1)==Ss_LANDSCAPE)
1284  {
1285  int z;
1286  z=Tc_Y;
1287  Tc_Y=Tc_X;
1288  Tc_X=SCR_YY-z;
1289 
1290  }
1291 
1292 
1293 
1294 
1295 
1296 }
1297 
1298 
1299 /*! Return true if touch sensor was touched*/
1301 {
1302  return !(FastdigitalRead(T_IRQ));
1303 }
1304 
1305 
1306 
1307 
1308 //if (bitRead(Service,1)==Ss_LANDSCAPE)
1309 unsigned int Ss_TFT::TouchGetX()
1310 {
1311  //int TouchW=TouchRawCalibSCR_XX-TouchRawCalibX;
1313 
1314 }
1315 
1316 unsigned int Ss_TFT::TouchGetY()
1317 {
1318  //int TouchH=TouchRawCalibSCR_YY-TouchRawCalibY;
1320 }
unsigned short SCR_WIDTH
Definition: Ss_TFT.h:195
void DisplayBitmapChar(int, int, uint8_t, uint8_t option=0)
Definition: Ss_TFT.cpp:941
void HLine(short x, short y, short l)
Definition: Ss_TFT.cpp:458
#define LCD_WR_LOW
Definition: Ss_TFT.h:80
void HPulse(uint8_t pin)
Set digital pin to high, then to low.
void d32s(short, short, uint8_t)
Definition: Ss_TFT.cpp:648
void Circle(int, int, int)
Definition: Ss_TFT.cpp:576
void CircleFill(int, int, int)
Definition: Ss_TFT.cpp:631
int T_CS
Definition: Ss_TFT.h:200
int T_IRQ
Definition: Ss_TFT.h:200
void LCD_Write_CD(unsigned short, unsigned short)
Definition: Ss_TFT.cpp:225
void CheckPoint(int *, int *)
Definition: Ss_TFT.cpp:361
#define LCD_RS_LOW
Definition: Ss_TFT.h:78
void plot4points(int, int, int, int)
Definition: Ss_TFT.cpp:614
void VLine(short x, short y, short l)
Definition: Ss_TFT.cpp:473
int Tc_Y
Definition: Ss_TFT.h:118
void SetFBcolor(int FC, int BC)
Definition: Ss_TFT.cpp:447
void GetLandscapePoint(int *, int *)
Definition: Ss_TFT.cpp:1162
int TouchRawY
Definition: Ss_TFT.h:115
unsigned short SCR_HH
Definition: Ss_TFT.h:195
void DisplayChar(short, short, uint8_t, uint8_t option=0)
Definition: Ss_TFT.cpp:921
bool TouchReady()
Definition: Ss_TFT.cpp:1300
#define LCD_CS_LOW
Definition: Ss_TFT.h:82
void SetXY(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2)
Definition: Ss_TFT.cpp:231
#define FastdigitalWrite(a, b)
int T_CLK
Definition: Ss_TFT.h:200
void LineVS(int x, int y, int l)
Definition: Ss_TFT.cpp:487
unsigned short SCR_HEIGHT
Definition: Ss_TFT.h:195
void LCD_Write8x2(unsigned short)
Definition: Ss_TFT.cpp:115
void SetFont(uint8_t *font, uint8_t x=0, uint8_t y=0, uint8_t spx=0, uint8_t spy=0)
Definition: Ss_TFT.cpp:881
int TouchRawCalibSCR_YY
Definition: Ss_TFT.h:117
#define Ss_LANDSCAPE
Definition: Ss_TFT.h:45
Definition: Ss_TFT.h:112
int TouchRawCalibX
Definition: Ss_TFT.h:116
void DisplayString(int x, int y, char *st, uint8_t options=0)
Definition: Ss_TFT.cpp:1132
void CleanLCD(unsigned short rgb=0xFFFF)
Definition: Ss_TFT.cpp:416
unsigned short SCR_WW
Definition: Ss_TFT.h:195
int TouchRawX
Definition: Ss_TFT.h:115
int T_DIN
Definition: Ss_TFT.h:200
#define LCD_CS_HIGH
Definition: Ss_TFT.h:81
unsigned short SCR_YY
Definition: Ss_TFT.h:195
#define FastdigitalRead(a)
void SetFcolor(uint8_t, uint8_t, uint8_t)
Definition: Ss_TFT.cpp:429
void Write7843(uint8_t num)
Definition: Ss_TFT.cpp:1199
Ss_TFT()
Definition: Ss_TFT.cpp:8
int TouchRawCalibY
Definition: Ss_TFT.h:117
#define LCD_RS_HIGH
Definition: Ss_TFT.h:77
int TouchRawCalibSCR_XX
Definition: Ss_TFT.h:116
void Rect(int, int, int, int)
Definition: Ss_TFT.cpp:347
void LCD_Write8(uint8_t)
Definition: Ss_TFT.cpp:62
void LineHS(int x, int y, int l)
Definition: Ss_TFT.cpp:491
void LCD_Write_DATA8(unsigned short)
Definition: Ss_TFT.cpp:219
void TouchInitial()
Definition: Ss_TFT.cpp:1191
void RectFill(int sx, int sy, int ex, int ey, bool force=0)
Definition: Ss_TFT.cpp:378
#define LCD_WR_HIGH
Definition: Ss_TFT.h:79
unsigned int TouchGetX()
Definition: Ss_TFT.cpp:1309
void Pixel(int x, int y)
Definition: Ss_TFT.cpp:1153
void SetBcolor(uint8_t, uint8_t, uint8_t)
Definition: Ss_TFT.cpp:438
int Tc_X
Definition: Ss_TFT.h:118
void Line(int sx, int sy, int ex, int ey)
Definition: Ss_TFT.cpp:502
unsigned short SCR_XX
Definition: Ss_TFT.h:195
unsigned int Read7843()
Definition: Ss_TFT.cpp:1226
#define Touch_Limit
Definition: Ss_TFT.h:42
unsigned short BackColor
Definition: Ss_TFT.h:194
void TouchGetPoint()
Definition: Ss_TFT.cpp:1247
unsigned short ForeColor
Definition: Ss_TFT.h:193
int T_DOUT
Definition: Ss_TFT.h:200
void Touchpin(int tclk, int tcs, int tdin, int dout, int irq)
Definition: Ss_TFT.cpp:1176
unsigned int TouchGetY()
Definition: Ss_TFT.cpp:1316
void LCD_Write_COMM8(unsigned short)
Definition: Ss_TFT.cpp:212
#define FPixel(x, y)
Definition: Ss_TFT.h:92
void Initialize()
Definition: Ss_TFT.cpp:245