PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

před 3 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /*
  2. UTFT.h - Arduino/chipKit library support for Color TFT LCD Boards
  3. Copyright (C)2010-2013 Henning Karlsen. All right reserved
  4. This library is the continuation of my ITDB02_Graph, ITDB02_Graph16
  5. and RGB_GLCD libraries for Arduino and chipKit. As the number of
  6. supported display modules and controllers started to increase I felt
  7. it was time to make a single, universal library as it will be much
  8. easier to maintain in the future.
  9. Basic functionality of this library was origianlly based on the
  10. demo-code provided by ITead studio (for the ITDB02 modules) and
  11. NKC Electronics (for the RGB GLCD module/shield).
  12. This library supports a number of 8bit, 16bit and serial graphic
  13. displays, and will work with both Arduino and chipKit boards. For a
  14. full list of tested display modules and controllers, see the
  15. document UTFT_Supported_display_modules_&_controllers.pdf.
  16. When using 8bit and 16bit display modules there are some
  17. requirements you must adhere to. These requirements can be found
  18. in the document UTFT_Requirements.pdf.
  19. There are no special requirements when using serial displays.
  20. You can always find the latest version of the library at
  21. http://electronics.henningkarlsen.com/
  22. If you make any modifications or improvements to the code, I would
  23. appreciate that you share the code with me so that I might include
  24. it in the next release. I can be contacted through
  25. http://electronics.henningkarlsen.com/contact.php.
  26. This library is free software; you can redistribute it and/or
  27. modify it under the terms of the CC BY-NC-SA 3.0 license.
  28. Please see the included documents for further information.
  29. */
  30. #ifndef UTFT_h
  31. #define UTFT_h
  32. #define UTFT_VERSION 272
  33. #define LEFT 0
  34. #define RIGHT 9999
  35. #define CENTER 9998
  36. #define PORTRAIT 0
  37. #define LANDSCAPE 1
  38. #define HX8347A 0
  39. #define ILI9327 1
  40. #define SSD1289 2
  41. #define ILI9325C 3
  42. #define ILI9325D_8 4
  43. #define ILI9325D_16 5
  44. #define HX8340B_8 6
  45. #define HX8340B_S 7
  46. #define HX8352A 8
  47. #define ST7735 9
  48. #define PCF8833 10
  49. #define S1D19122 11
  50. #define SSD1963_480 12
  51. #define SSD1963_800 13
  52. #define S6D1121_8 14
  53. #define S6D1121_16 15
  54. #define SSD1289LATCHED 16
  55. #define ILI9320_8 17
  56. #define ILI9320_16 18
  57. #define SSD1289_8 19
  58. #define SSD1963_800ALT 20
  59. #define ILI9481 21
  60. #define ILI9325D_16ALT 22
  61. #define S6D0164 23
  62. #define ST7735S 24
  63. #define ILI9341_S5P 25
  64. #define ILI9341_S4P 26
  65. #define R61581 27
  66. #define ILI9486 28
  67. #define ITDB32 0 // HX8347-A (16bit)
  68. #define ITDB32WC 1 // ILI9327 (16bit)
  69. #define TFT01_32W 1 // ILI9327 (16bit)
  70. #define ITDB32S 2 // SSD1289 (16bit)
  71. #define TFT01_32 2 // SSD1289 (16bit)
  72. #define CTE32 2 // SSD1289 (16bit)
  73. #define GEEE32 2 // SSD1289 (16bit)
  74. #define ITDB24 3 // ILI9325C (8bit)
  75. #define ITDB24D 4 // ILI9325D (8bit)
  76. #define ITDB24DWOT 4 // ILI9325D (8bit)
  77. #define ITDB28 4 // ILI9325D (8bit)
  78. #define TFT01_24_8 4 // ILI9325D (8bit)
  79. #define TFT01_24_16 5 // ILI9325D (16bit)
  80. #define ITDB22 6 // HX8340-B (8bit)
  81. #define GEEE22 6 // HX8340-B (8bit)
  82. #define ITDB22SP 7 // HX8340-B (Serial)
  83. #define ITDB32WD 8 // HX8352-A (16bit)
  84. #define TFT01_32WD 8 // HX8352-A (16bit)
  85. #define CTE32W 8 // HX8352-A (16bit)
  86. #define ITDB18SP 9 // ST7735 (Serial)
  87. #define LPH9135 10 // PCF8833 (Serial)
  88. #define ITDB25H 11 // S1D19122 (16bit)
  89. #define ITDB43 12 // SSD1963 (16bit) 480x272
  90. #define TFT01_43 12 // SSD1963 (16bit) 480x272
  91. #define ITDB50 13 // SSD1963 (16bit) 800x480
  92. #define TFT01_50 13 // SSD1963 (16bit) 800x480
  93. #define CTE50 13 // SSD1963 (16bit) 800x480
  94. #define ITDB24E_8 14 // S6D1121 (8bit)
  95. #define TFT01_24R2 14 // S6D1121 (8bit)
  96. #define ITDB24E_16 15 // S6D1121 (16bit)
  97. #define INFINIT32 16 // SSD1289 (Latched 16bit) -- Legacy, will be removed later
  98. #define ELEE32_REVA 16 // SSD1289 (Latched 16bit)
  99. #define GEEE24 17 // ILI9320 (8bit)
  100. #define GEEE28 18 // ILI9320 (16bit)
  101. #define ELEE32_REVB 19 // SSD1289 (8bit)
  102. #define TFT01_70 20 // SSD1963 (16bit) 800x480 Alternative Init
  103. #define CTE70 20 // SSD1963 (16bit) 800x480 Alternative Init
  104. #define CTE32HR 21 // ILI9481 (16bit)
  105. #define CTE28 22 // ILI9325D (16bit) Alternative Init
  106. #define TFT01_28 22 // ILI9325D (16bit) Alternative Init
  107. #define CTE22 23 // S6D0164 (8bit)
  108. #define TFT01_22 23 // S6D0164 (8bit)
  109. #define TFT01_18SP 24 // ST7735S (Serial)
  110. #define TFT01_22SP 25 // ILI9341 (Serial 5Pin)
  111. #define MI0283QT9 26 // ILI9341 (Serial 4Pin)
  112. #define CTE35IPS 27 // R61581 (16bit)
  113. #define CTE40 28 // ILI9486 (16bit)
  114. #define SERIAL_4PIN 4
  115. #define SERIAL_5PIN 5
  116. #define LATCHED_16 17
  117. //*********************************
  118. // COLORS
  119. //*********************************
  120. // VGA color palette
  121. #define VGA_BLACK 0x0000
  122. #define VGA_WHITE 0xFFFF
  123. #define VGA_RED 0xF800
  124. #define VGA_GREEN 0x0400
  125. #define VGA_BLUE 0x001F
  126. #define VGA_SILVER 0xC618
  127. #define VGA_GRAY 0x8410
  128. #define VGA_MAROON 0x8000
  129. #define VGA_YELLOW 0xFFE0
  130. #define VGA_OLIVE 0x8400
  131. #define VGA_LIME 0x07E0
  132. #define VGA_AQUA 0x07FF
  133. #define VGA_TEAL 0x0410
  134. #define VGA_NAVY 0x0010
  135. #define VGA_FUCHSIA 0xF81F
  136. #define VGA_PURPLE 0x8010
  137. #define VGA_TRANSPARENT 0xFFFFFFFF
  138. #if defined(__AVR__)
  139. #include "Arduino.h"
  140. #include "hardware/avr/HW_AVR_defines.h"
  141. #elif defined(__PIC32MX__)
  142. #include "WProgram.h"
  143. #include "hardware/pic32/HW_PIC32_defines.h"
  144. #elif defined(__arm__)
  145. #include "Arduino.h"
  146. #include "hardware/arm/HW_ARM_defines.h"
  147. #endif
  148. struct _current_font
  149. {
  150. uint8_t* font;
  151. uint8_t x_size;
  152. uint8_t y_size;
  153. uint8_t offset;
  154. uint8_t numchars;
  155. };
  156. class UTFT
  157. {
  158. public:
  159. UTFT();
  160. UTFT(byte model, int RS, int WR,int CS, int RST, int SER=0);
  161. void InitLCD(byte orientation=LANDSCAPE);
  162. void clrScr();
  163. void drawPixel(int x, int y);
  164. void drawLine(int x1, int y1, int x2, int y2);
  165. void fillScr(byte r, byte g, byte b);
  166. void fillScr(word color);
  167. void drawRect(int x1, int y1, int x2, int y2);
  168. void drawRoundRect(int x1, int y1, int x2, int y2);
  169. void fillRect(int x1, int y1, int x2, int y2);
  170. void fillRoundRect(int x1, int y1, int x2, int y2);
  171. void drawCircle(int x, int y, int radius);
  172. void fillCircle(int x, int y, int radius);
  173. void setColor(byte r, byte g, byte b);
  174. void setColor(word color);
  175. word getColor();
  176. void setBackColor(byte r, byte g, byte b);
  177. void setBackColor(uint32_t color);
  178. word getBackColor();
  179. void print(const char *st, int x, int y, int deg=0);
  180. void print(String st, int x, int y, int deg=0);
  181. void printNumI(long num, int x, int y, int length=0, char filler=' ');
  182. void printNumF(double num, byte dec, int x, int y, char divider='.', int length=0, char filler=' ');
  183. void setFont(uint8_t* font);
  184. uint8_t* getFont();
  185. uint8_t getFontXsize();
  186. uint8_t getFontYsize();
  187. void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int scale=1);
  188. void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int deg, int rox, int roy);
  189. void lcdOff();
  190. void lcdOn();
  191. void setContrast(char c);
  192. int getDisplayXSize();
  193. int getDisplayYSize();
  194. /*
  195. The functions and variables below should not normally be used.
  196. They have been left publicly available for use in add-on libraries
  197. that might need access to the lower level functions of UTFT.
  198. Please note that these functions and variables are not documented
  199. and I do not provide support on how to use them.
  200. */
  201. byte fch, fcl, bch, bcl;
  202. byte orient;
  203. long disp_x_size, disp_y_size;
  204. byte display_model, display_transfer_mode, display_serial_mode;
  205. regtype *P_RS, *P_WR, *P_CS, *P_RST, *P_SDA, *P_SCL, *P_ALE;
  206. regsize B_RS, B_WR, B_CS, B_RST, B_SDA, B_SCL, B_ALE;
  207. _current_font cfont;
  208. boolean _transparent;
  209. void LCD_Writ_Bus(char VH,char VL, byte mode);
  210. void LCD_Write_COM(char VL);
  211. void LCD_Write_DATA(char VH,char VL);
  212. void LCD_Write_DATA(char VL);
  213. void LCD_Write_COM_DATA(char com1,int dat1);
  214. void _hw_special_init();
  215. void setPixel(word color);
  216. void drawHLine(int x, int y, int l);
  217. void drawVLine(int x, int y, int l);
  218. void printChar(byte c, int x, int y);
  219. void setXY(word x1, word y1, word x2, word y2);
  220. void clrXY();
  221. void rotateChar(byte c, int x, int y, int pos, int deg);
  222. void _set_direction_registers(byte mode);
  223. void _fast_fill_16(int ch, int cl, long pix);
  224. void _fast_fill_8(int ch, long pix);
  225. void _convert_float(char *buf, double num, int width, byte prec);
  226. };
  227. #endif