|
在编译UTFT的demo时,出现了如下的错误,该怎么解决呢?
ERROR
- \UTFT_Demo_128x160_Serial\UTFT_Demo_128x128_Serial\UTFT_Demo_128x128_Serial.ino:11:0:
- C:\Users\love2\Documents\Arduino\libraries\UTFT/UTFT.h:227:49: error: 'bitmapdatatype' has not been declared
- void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int scale=1);
- ^
- C:\Users\love2\Documents\Arduino\libraries\UTFT/UTFT.h:228:49: error: 'bitmapdatatype' has not been declared
- void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int deg, int rox, int roy);
- ^
- C:\Users\love2\Documents\Arduino\libraries\UTFT/UTFT.h:250:3: error: 'regtype' does not name a type
- regtype *P_RS, *P_WR, *P_CS, *P_RST, *P_SDA, *P_SCL, *P_ALE;
- ^
- C:\Users\love2\Documents\Arduino\libraries\UTFT/UTFT.h:251:3: error: 'regsize' does not name a type
- regsize B_RS, B_WR, B_CS, B_RST, B_SDA, B_SCL, B_ALE;
- ^
- exit status 1
- 为开发板 NodeMCU 1.0 (ESP-12E Module) 编译时出错。
- 下载 https://downloads.arduino.cc/packages/package_index.json 时出错
复制代码
这是demo的代码
- // UTFT_Demo_128x128_Serial (C)2012 Henning Karlsen
- // This program is a demo of how to use most of the functions
- // of the library with a supported display modules.
- //
- // This demo was made to work on the 128x128 modules.
- // Any other size displays may cause strange behaviour.
- //
- // This program requires the UTFT library.
- //
- #include <UTFT.h>
- // Declare which fonts we will be using
- extern uint8_t SmallFont[];
- // Declare an instance of the class
- //UTFT myGLCD(ST7735S,A2,A1,A5,A4,A3); // Remember to change the model parameter to suit your display module!
- UTFT myGLCD(ST7735S,4,5,15,0);
-
- void setup()
- {
- randomSeed(analogRead(0));
-
- // Setup the LCD
- myGLCD.InitLCD();//G:LANDSCAPE is default;PORTRAIT
- myGLCD.setFont(SmallFont);
- }
- void loop()
- {
- byte buf[126];
- int x, x2;
- int y, y2;
- int r;
-
- // Clear the screen and draw the frame
- myGLCD.clrScr();
- myGLCD.setContrast(64);
- myGLCD.setColor(255, 0, 0);
- myGLCD.fillRect(0,0,127,12);
- myGLCD.setColor(64, 64, 64);
- myGLCD.fillRect(0,117,127,127);
- myGLCD.setColor(255, 255, 255);
- myGLCD.setBackColor(255,0,0);
- myGLCD.print("Universal TFT", CENTER, 0);
- myGLCD.setBackColor(64,64,64);
- myGLCD.setColor(255,255,0);
- myGLCD.print("H.Karlsen", LEFT, 116);
- myGLCD.print("(C)2012", RIGHT, 116);
- myGLCD.setColor(0,255,0);
- myGLCD.drawRect(0,13,127,116);
- // Draw crosshairs
- myGLCD.setColor(0,0,255);
- myGLCD.drawLine(63,14,63,115);
- myGLCD.drawLine(1,63,126,63);
- for (int i=3; i<128; i+=10)
- myGLCD.drawLine(i, 61, i, 65);
- for (int i=14; i<118; i+=10)
- myGLCD.drawLine(61, i, 65, i);
-
- // Draw sin-, cos- and tan-lines
- myGLCD.setColor(0,255,255);
- myGLCD.setBackColor(0,0,0);
- myGLCD.print("Sin", 2, 14);
- for (int i=1; i<126; i++)
- {
- myGLCD.drawPixel(i,63+(sin(((i*2.85)*3.14)/180)*45));
- }
-
- myGLCD.setColor(255,0,0);
- myGLCD.print("Cos", 2, 26);
- for (int i=1; i<126; i++)
- {
- myGLCD.drawPixel(i,63+(cos(((i*2.85)*3.14)/180)*45));
- }
- myGLCD.setColor(255,255,0);
- myGLCD.print("Tan", 2, 38);
- for (int i=1; i<126; i++)
- {
- myGLCD.drawPixel(i,63+(tan(((i*2.85)*3.14)/180)));
- }
- delay(2000);
-
- myGLCD.setColor(0,0,0);
- myGLCD.fillRect(1,14,126,115);
- myGLCD.setColor(0,0,255);
- myGLCD.drawLine(63,14,63,115);
- myGLCD.drawLine(1,63,126,63);
- // Draw a moving sinewave
- x=1;
- for (int i=1; i<3654; i++)
- {
- x++;
- if (x==127)
- x=1;
- if (i>127)
- {
- if ((x==63)||(buf[x-1]==63))
- myGLCD.setColor(0,0,255);
- else
- myGLCD.setColor(0,0,0);
- myGLCD.drawPixel(x,buf[x-1]);
- }
- myGLCD.setColor(0,255,255);
- y=63+(sin(((i*1.3)*3.14)/180)*45);
- myGLCD.drawPixel(x,y);
- buf[x-1]=y;
- // delay(3);
- }
- myGLCD.setColor(0,0,0);
- myGLCD.fillRect(1,14,126,115);
-
- // Draw some filled rectangles
- for (int i=1; i<6; i++)
- {
- switch (i)
- {
- case 1:
- myGLCD.setColor(255,0,255);
- break;
- case 2:
- myGLCD.setColor(255,0,0);
- break;
- case 3:
- myGLCD.setColor(0,255,0);
- break;
- case 4:
- myGLCD.setColor(0,0,255);
- break;
- case 5:
- myGLCD.setColor(255,255,0);
- break;
- }
- myGLCD.fillRect(10+(i*10),10+(i*10), 60+(i*10), 60+(i*10));
- }
-
- delay(2000);
- myGLCD.setColor(0,0,0);
- myGLCD.fillRect(1,14,126,115);
-
- // Draw some filled, rounded rectangles
- for (int i=1; i<6; i++)
- {
- switch (i)
- {
- case 1:
- myGLCD.setColor(255,0,255);
- break;
- case 2:
- myGLCD.setColor(255,0,0);
- break;
- case 3:
- myGLCD.setColor(0,255,0);
- break;
- case 4:
- myGLCD.setColor(0,0,255);
- break;
- case 5:
- myGLCD.setColor(255,255,0);
- break;
- }
- myGLCD.fillRoundRect(70-(i*10),10+(i*10), 120-(i*10), 60+(i*10));
- }
-
- delay(2000);
- myGLCD.setColor(0,0,0);
- myGLCD.fillRect(1,14,126,115);
-
- // Draw some filled circles
- for (int i=1; i<6; i++)
- {
- switch (i)
- {
- case 1:
- myGLCD.setColor(255,0,255);
- break;
- case 2:
- myGLCD.setColor(255,0,0);
- break;
- case 3:
- myGLCD.setColor(0,255,0);
- break;
- case 4:
- myGLCD.setColor(0,0,255);
- break;
- case 5:
- myGLCD.setColor(255,255,0);
- break;
- }
- myGLCD.fillCircle(30+(i*10),35+(i*10), 25);
- }
-
- delay(2000);
- myGLCD.setColor(0,0,0);
- myGLCD.fillRect(1,14,126,115);
- // Draw some lines in a pattern
- myGLCD.setColor (255,0,0);
- for (int i=11; i<115; i+=3)
- {
- myGLCD.drawLine(1, i, i-10, 115);
- }
- myGLCD.setColor (255,0,0);
- for (int i=112; i>14; i-=3)
- {
- myGLCD.drawLine(126, i, i+14, 14);
- }
- myGLCD.setColor (0,255,255);
- for (int i=115; i>14; i-=3)
- {
- myGLCD.drawLine(1, i, 116-i, 14);
- }
- myGLCD.setColor (0,255,255);
- for (int i=14; i<115; i+=3)
- {
- myGLCD.drawLine(126, i, 140-i, 115);
- }
-
- delay(2000);
- myGLCD.setColor(0,0,0);
- myGLCD.fillRect(1,14,126,115);
- // Draw some random circles
- for (int i=0; i<100; i++)
- {
- myGLCD.setColor(random(255), random(255), random(255));
- x=22+random(85);
- y=35+random(59);
- r=random(20);
- myGLCD.drawCircle(x, y, r);
- }
- delay(2000);
-
- myGLCD.setColor(0,0,0);
- myGLCD.fillRect(1,14,126,115);
- // Draw some random rectangles
- for (int i=0; i<100; i++)
- {
- myGLCD.setColor(random(255), random(255), random(255));
- x=2+random(124);
- y=15+random(101);
- x2=2+random(124);
- y2=15+random(101);
- myGLCD.drawRect(x, y, x2, y2);
- }
-
- delay(2000);
- myGLCD.setColor(0,0,0);
- myGLCD.fillRect(1,14,126,115);
- // Draw some random rounded rectangles
- for (int i=0; i<100; i++)
- {
- myGLCD.setColor(random(255), random(255), random(255));
- x=2+random(124);
- y=15+random(101);
- x2=2+random(124);
- y2=15+random(101);
- myGLCD.drawRoundRect(x, y, x2, y2);
- }
-
- delay(2000);
- myGLCD.setColor(0,0,0);
- myGLCD.fillRect(1,14,126,115);
- // Draw some random lines
- for (int i=0; i<100; i++)
- {
- myGLCD.setColor(random(255), random(255), random(255));
- x=2+random(124);
- y=15+random(101);
- x2=2+random(124);
- y2=15+random(101);
- myGLCD.drawLine(x, y, x2, y2);
- }
-
- delay(2000);
- myGLCD.setColor(0,0,0);
- myGLCD.fillRect(1,14,126,115);
- // Draw some random pixels
- for (int i=0; i<5000; i++)
- {
- myGLCD.setColor(random(255), random(255), random(255));
- myGLCD.drawPixel(2+random(124), 15+random(101));
- }
-
- delay (2000);
-
- // Set up the "Finished"-screen
- myGLCD.setContrast(0);
- myGLCD.fillScr(0,0,255);
- myGLCD.setColor(255,0,0);
- myGLCD.fillRoundRect(2, 40, 125, 88);
-
- myGLCD.setColor(255,255,255);
- myGLCD.setBackColor(255,0,0);
- myGLCD.print("That's it!", CENTER, 46);
- myGLCD.print("Restarting in a", CENTER, 66);
- myGLCD.print("few seconds...", CENTER, 76);
-
- myGLCD.setColor(0,0,0);
- myGLCD.setBackColor(0,0,255);
- myGLCD.print("Runtime: (msecs)", CENTER, 108);
- myGLCD.printNumI(millis(), CENTER, 118);
-
- myGLCD.setContrast(64);
-
- delay (10000);
-
- // Fade screen to black
- for (int i=64; i>0; i--)
- {
- myGLCD.setContrast(i);
- delay(100);
- }
- }
复制代码 libraries/UTFT/UTFT.h
- /*
- UTFT.h - Arduino/chipKit library support for Color TFT LCD Boards
- Copyright (C)2010-2014 Henning Karlsen. All right reserved
-
- This library is the continuation of my ITDB02_Graph, ITDB02_Graph16
- and RGB_GLCD libraries for Arduino and chipKit. As the number of
- supported display modules and controllers started to increase I felt
- it was time to make a single, universal library as it will be much
- easier to maintain in the future.
- Basic functionality of this library was origianlly based on the
- demo-code provided by ITead studio (for the ITDB02 modules) and
- NKC Electronics (for the RGB GLCD module/shield).
- This library supports a number of 8bit, 16bit and serial graphic
- displays, and will work with both Arduino and chipKit boards. For a
- full list of tested display modules and controllers, see the
- document UTFT_Supported_display_modules_&_controllers.pdf.
- When using 8bit and 16bit display modules there are some
- requirements you must adhere to. These requirements can be found
- in the document UTFT_Requirements.pdf.
- There are no special requirements when using serial displays.
- You can always find the latest version of the library at
- http://electronics.henningkarlsen.com/
- If you make any modifications or improvements to the code, I would
- appreciate that you share the code with me so that I might include
- it in the next release. I can be contacted through
- http://electronics.henningkarlsen.com/contact.php.
- This library is free software; you can redistribute it and/or
- modify it under the terms of the CC BY-NC-SA 3.0 license.
- Please see the included documents for further information.
- Commercial use of this library requires you to buy a license that
- will allow commercial use. This includes using the library,
- modified or not, as a tool to sell products.
- The license applies to all part of the library including the
- examples and tools supplied with the library.
- */
- #ifndef UTFT_h
- #define UTFT_h
- #define UTFT_VERSION 277
- #define LEFT 0
- #define RIGHT 9999
- #define CENTER 9998
- #define PORTRAIT 0
- #define LANDSCAPE 1
- #define HX8347A 0
- #define ILI9327 1
- #define SSD1289 2
- #define ILI9325C 3
- #define ILI9325D_8 4
- #define ILI9325D_16 5
- #define HX8340B_8 6
- #define HX8340B_S 7
- #define HX8352A 8
- #define ST7735 9
- #define PCF8833 10
- #define S1D19122 11
- #define SSD1963_480 12
- #define SSD1963_800 13
- #define S6D1121_8 14
- #define S6D1121_16 15
- #define SSD1289LATCHED 16
- #define ILI9320_8 17
- #define ILI9320_16 18
- #define SSD1289_8 19
- #define SSD1963_800ALT 20
- #define ILI9481 21
- #define ILI9325D_16ALT 22
- #define S6D0164 23
- #define ST7735S 24
- #define ILI9341_S5P 25
- #define ILI9341_S4P 26
- #define R61581 27
- #define ILI9486 28
- #define CPLD 29
- #define HX8353C 30
- #define ITDB32 0 // HX8347-A (16bit)
- #define ITDB32WC 1 // ILI9327 (16bit)
- #define TFT01_32W 1 // ILI9327 (16bit)
- #define ITDB32S 2 // SSD1289 (16bit)
- #define TFT01_32 2 // SSD1289 (16bit)
- #define CTE32 2 // SSD1289 (16bit)
- #define GEEE32 2 // SSD1289 (16bit)
- #define ITDB24 3 // ILI9325C (8bit)
- #define ITDB24D 4 // ILI9325D (8bit)
- #define ITDB24DWOT 4 // ILI9325D (8bit)
- #define ITDB28 4 // ILI9325D (8bit)
- #define TFT01_24_8 4 // ILI9325D (8bit)
- #define DMTFT24104 4 // ILI9325D (8bit)
- #define DMTFT28103 4 // ILI9325D (8bit)
- #define TFT01_24_16 5 // ILI9325D (16bit)
- #define ITDB22 6 // HX8340-B (8bit)
- #define GEEE22 6 // HX8340-B (8bit)
- #define ITDB22SP 7 // HX8340-B (Serial 4Pin)
- #define ITDB32WD 8 // HX8352-A (16bit)
- #define TFT01_32WD 8 // HX8352-A (16bit)
- #define CTE32W 8 // HX8352-A (16bit)
- #define ITDB18SP 9 // ST7735 (Serial 5Pin)
- #define LPH9135 10 // PCF8833 (Serial 5Pin)
- #define ITDB25H 11 // S1D19122 (16bit)
- #define ITDB43 12 // SSD1963 (16bit) 480x272
- #define TFT01_43 12 // SSD1963 (16bit) 480x272
- #define ITDB50 13 // SSD1963 (16bit) 800x480
- #define TFT01_50 13 // SSD1963 (16bit) 800x480
- #define CTE50 13 // SSD1963 (16bit) 800x480
- #define EHOUSE50 13 // SSD1963 (16bit) 800x480
- #define ITDB24E_8 14 // S6D1121 (8bit)
- #define TFT01_24R2 14 // S6D1121 (8bit)
- #define ITDB24E_16 15 // S6D1121 (16bit)
- #define INFINIT32 16 // SSD1289 (Latched 16bit) -- Legacy, will be removed later
- #define ELEE32_REVA 16 // SSD1289 (Latched 16bit)
- #define GEEE24 17 // ILI9320 (8bit)
- #define GEEE28 18 // ILI9320 (16bit)
- #define ELEE32_REVB 19 // SSD1289 (8bit)
- #define TFT01_70 20 // SSD1963 (16bit) 800x480 Alternative Init
- #define CTE70 20 // SSD1963 (16bit) 800x480 Alternative Init
- #define EHOUSE70 20 // SSD1963 (16bit) 800x480 Alternative Init
- #define CTE32HR 21 // ILI9481 (16bit)
- #define CTE28 22 // ILI9325D (16bit) Alternative Init
- #define TFT01_28 22 // ILI9325D (16bit) Alternative Init
- #define CTE22 23 // S6D0164 (8bit)
- #define TFT01_22 23 // S6D0164 (8bit)
- #define DMTFT22102 23 // S6D0164 (8bit)
- #define TFT01_18SP 24 // ST7735S (Serial 5Pin)
- #define TFT01_22SP 25 // ILI9341 (Serial 5Pin)
- #define DMTFT28105 25 // ILI9341 (Serial 5Pin)
- #define MI0283QT9 26 // ILI9341 (Serial 4Pin)
- #define CTE35IPS 27 // R61581 (16bit)
- #define CTE40 28 // ILI9486 (16bit)
- #define EHOUSE50CPLD 29 // CPLD (16bit)
- #define CTE50CPLD 29 // CPLD (16bit)
- #define CTE70CPLD 29 // CPLD (16bit)
- #define DMTFT18101 30 // HX8353C (Serial 5Pin)
- #define SERIAL_4PIN 4
- #define SERIAL_5PIN 5
- #define LATCHED_16 17
- #define NOTINUSE 255
- //*********************************
- // COLORS
- //*********************************
- // VGA color palette
- #define VGA_BLACK 0x0000
- #define VGA_WHITE 0xFFFF
- #define VGA_RED 0xF800
- #define VGA_GREEN 0x0400
- #define VGA_BLUE 0x001F
- #define VGA_SILVER 0xC618
- #define VGA_GRAY 0x8410
- #define VGA_MAROON 0x8000
- #define VGA_YELLOW 0xFFE0
- #define VGA_OLIVE 0x8400
- #define VGA_LIME 0x07E0
- #define VGA_AQUA 0x07FF
- #define VGA_TEAL 0x0410
- #define VGA_NAVY 0x0010
- #define VGA_FUCHSIA 0xF81F
- #define VGA_PURPLE 0x8010
- #define VGA_TRANSPARENT 0xFFFFFFFF
- #if defined(__AVR__)
- #include "Arduino.h"
- #include "hardware/avr/HW_AVR_defines.h"
- #elif defined(__PIC32MX__)
- #include "WProgram.h"
- #include "hardware/pic32/HW_PIC32_defines.h"
- #elif defined(__arm__)
- #include "Arduino.h"
- #include "hardware/arm/HW_ARM_defines.h"
- #endif
- struct _current_font
- {
- uint8_t* font;
- uint8_t x_size;
- uint8_t y_size;
- uint8_t offset;
- uint8_t numchars;
- };
- class UTFT
- {
- public:
- UTFT();
- UTFT(byte model, int RS, int WR, int CS, int RST, int SER=0);
- void InitLCD(byte orientation=LANDSCAPE);
- void clrScr();
- void drawPixel(int x, int y);
- void drawLine(int x1, int y1, int x2, int y2);
- void fillScr(byte r, byte g, byte b);
- void fillScr(word color);
- void drawRect(int x1, int y1, int x2, int y2);
- void drawRoundRect(int x1, int y1, int x2, int y2);
- void fillRect(int x1, int y1, int x2, int y2);
- void fillRoundRect(int x1, int y1, int x2, int y2);
- void drawCircle(int x, int y, int radius);
- void fillCircle(int x, int y, int radius);
- void setColor(byte r, byte g, byte b);
- void setColor(word color);
- word getColor();
- void setBackColor(byte r, byte g, byte b);
- void setBackColor(uint32_t color);
- word getBackColor();
- void print(char *st, int x, int y, int deg=0);
- void print(String st, int x, int y, int deg=0);
- void printNumI(long num, int x, int y, int length=0, char filler=' ');
- void printNumF(double num, byte dec, int x, int y, char divider='.', int length=0, char filler=' ');
- void setFont(uint8_t* font);
- uint8_t* getFont();
- uint8_t getFontXsize();
- uint8_t getFontYsize();
- void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int scale=1); //出错位置
- void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int deg, int rox, int roy); //出错位置
- void lcdOff();
- void lcdOn();
- void setContrast(char c);
- int getDisplayXSize();
- int getDisplayYSize();
- void setBrightness(byte br);
- void setDisplayPage(byte page);
- void setWritePage(byte page);
- /*
- The functions and variables below should not normally be used.
- They have been left publicly available for use in add-on libraries
- that might need access to the lower level functions of UTFT.
- Please note that these functions and variables are not documented
- and I do not provide support on how to use them.
- */
- byte fch, fcl, bch, bcl;
- byte orient;
- long disp_x_size, disp_y_size;
- byte display_model, display_transfer_mode, display_serial_mode;
- regtype *P_RS, *P_WR, *P_CS, *P_RST, *P_SDA, *P_SCL, *P_ALE;
- regsize B_RS, B_WR, B_CS, B_RST, B_SDA, B_SCL, B_ALE;
- byte __p1, __p2, __p3, __p4, __p5;
- _current_font cfont;
- boolean _transparent;
- void LCD_Writ_Bus(char VH,char VL, byte mode);
- void LCD_Write_COM(char VL);
- void LCD_Write_DATA(char VH,char VL);
- void LCD_Write_DATA(char VL);
- void LCD_Write_COM_DATA(char com1,int dat1);
- void _hw_special_init();
- void setPixel(word color);
- void drawHLine(int x, int y, int l);
- void drawVLine(int x, int y, int l);
- void printChar(byte c, int x, int y);
- void setXY(word x1, word y1, word x2, word y2);
- void clrXY();
- void rotateChar(byte c, int x, int y, int pos, int deg);
- void _set_direction_registers(byte mode);
- void _fast_fill_16(int ch, int cl, long pix);
- void _fast_fill_8(int ch, long pix);
- void _convert_float(char *buf, double num, int width, byte prec);
- };
- #endif
复制代码 求高人指点。
TIA
|
|