├── README.txt ├── library.properties ├── keywords.txt ├── examples ├── ILI9163C_HelloWorld │ └── ILI9163C_HelloWorld.ino ├── ILI9163C_Colors │ └── ILI9163C_Colors.ino ├── ILI9163C_Rotation │ └── ILI9163C_Rotation.ino ├── ILI9163C_Mario_RRE │ ├── rre_mario6.h │ ├── rre_mario6_v.h │ ├── rre_mario5.h │ ├── rre_mario3.h │ ├── rre_mario4.h │ ├── rre_mario5_v.h │ ├── rre_mario3_v.h │ ├── rre_mario4_v.h │ ├── rre_mario1.h │ ├── ILI9163C_Mario_RRE.ino │ ├── rre_mario2.h │ ├── rre_mario0.h │ ├── rre_mario2_v.h │ └── rre_mario0_v.h ├── ILI9163C_Bitmap │ ├── ILI9163C_Bitmap.ino │ └── bitmap.h ├── ILI9163C_MovingText │ └── ILI9163C_MovingText.ino ├── ILI9163C_Lines │ └── ILI9163C_Lines.ino ├── ILI9163C_ControllerModes │ └── ILI9163C_ControllerModes.ino ├── ILI9163C_BigScroll │ └── ILI9163C_BigScroll.ino ├── ILI9163C_BMPviaSerial_Scroll │ └── ILI9163C_BMPviaSerial_Scroll.ino ├── ILI9163C_HWMonitor │ └── ILI9163C_HWMonitor.ino ├── ILI9163C_Gauges │ └── ILI9163C_Gauges.ino └── ILI9163C_AdafruitBenchmark │ └── ILI9163C_AdafruitBenchmark.ino ├── README.md ├── LICENSE ├── Arduino_ILI9163C_Fast.h └── Arduino_ILI9163C_Fast.cpp /README.txt: -------------------------------------------------------------------------------- 1 | This is fast SPI library for the ILI9163C 128x128 LCD display. 2 | 3 | Optimized for the best performance for 16MHz AVR Arduino boards. 4 | Requires Adafruit_GFX library for Arduino. 5 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=Arduino Fast ILI9163C Library 2 | version=1.0.3 3 | author=Pawel A. Hernik 4 | maintainer=Pawel A. Hernik 5 | sentence=Fast SPI library for ILI9163C LCD display. 6 | paragraph=Fast SPI library for ILI9163C LCD display. 7 | category=Display 8 | url=https://github.com/cbm80amiga/Arduino_ILI9163C_Fast 9 | architectures=* 10 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | Arduino_ILI9163C KEYWORD3 2 | 3 | init KEYWORD2 4 | invertDisplay KEYWORD2 5 | partialDisplay KEYWORD2 6 | sleepDisplay KEYWORD2 7 | enableDisplay KEYWORD2 8 | idleDisplay KEYWORD2 9 | resetDisplay KEYWORD2 10 | setScrollArea KEYWORD2 11 | setScroll KEYWORD2 12 | setPartArea KEYWORD2 13 | rgbWheel KEYWORD2 14 | RGBto565 KEYWORD2 15 | drawImage KEYWORD2 16 | drawImageF KEYWORD2 17 | -------------------------------------------------------------------------------- /examples/ILI9163C_HelloWorld/ILI9163C_HelloWorld.ino: -------------------------------------------------------------------------------- 1 | // ILI9163C library example 2 | // (c) 2019 Pawel A. Hernik 3 | 4 | /* 5 | Pinout (header on the top, from left): 6 | LED -> 3.3V 7 | SCK -> D13 8 | SDA -> D11/MOSI 9 | A0/DC -> D8 or any digital 10 | RESET -> D9 or any digital 11 | CS -> D10 or any digital 12 | GND -> GND 13 | VCC -> 3.3V 14 | */ 15 | 16 | 17 | #define TFT_CS 10 18 | #define TFT_DC 8 19 | #define TFT_RST 9 20 | #include 21 | #include 22 | #include 23 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 24 | 25 | void setup(void) 26 | { 27 | Serial.begin(9600); 28 | lcd.init(); 29 | lcd.fillScreen(BLACK); 30 | lcd.setCursor(0, 0); 31 | lcd.setTextColor(WHITE,BLUE); 32 | lcd.setTextSize(1); 33 | lcd.println("HELLO WORLD"); 34 | } 35 | 36 | void loop() 37 | { 38 | } 39 | 40 | -------------------------------------------------------------------------------- /examples/ILI9163C_Colors/ILI9163C_Colors.ino: -------------------------------------------------------------------------------- 1 | // ILI9163C library example 2 | // (c) 2019 Pawel A. Hernik 3 | 4 | /* 5 | Pinout (header on the top, from left): 6 | LED -> 3.3V 7 | SCK -> D13 8 | SDA -> D11/MOSI 9 | A0/DC -> D8 or any digital 10 | RESET -> D9 or any digital 11 | CS -> D10 or any digital 12 | GND -> GND 13 | VCC -> 3.3V 14 | */ 15 | 16 | #define SCR_WD 128 17 | #define SCR_HT 128 18 | 19 | #define TFT_CS 10 20 | #define TFT_DC 8 21 | #define TFT_RST 9 22 | #include 23 | #include 24 | #include 25 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 26 | 27 | void setup() 28 | { 29 | Serial.begin(9600); 30 | lcd.init(); 31 | 32 | for(int i=0;i<128;i++) { 33 | lcd.fillRect(32*0,i,32,1,RGBto565(i*2,0,0)); 34 | lcd.fillRect(32*1,i,32,1,RGBto565(0,i*2,0)); 35 | lcd.fillRect(32*2,i,32,1,RGBto565(0,0,i*2)); 36 | lcd.fillRect(32*3,i,32,1,RGBto565(i*2,i*2,i*2)); 37 | } 38 | } 39 | 40 | void loop() 41 | { 42 | } 43 | 44 | -------------------------------------------------------------------------------- /examples/ILI9163C_Rotation/ILI9163C_Rotation.ino: -------------------------------------------------------------------------------- 1 | // ILI9163C library example 2 | // (c) 2019 Pawel A. Hernik 3 | 4 | /* 5 | Pinout (header on the top, from left): 6 | LED -> 3.3V 7 | SCK -> D13 8 | SDA -> D11/MOSI 9 | A0/DC -> D8 or any digital 10 | RESET -> D9 or any digital 11 | CS -> D10 or any digital 12 | GND -> GND 13 | VCC -> 3.3V 14 | */ 15 | 16 | #define TFT_CS 10 17 | #define TFT_DC 8 18 | #define TFT_RST 9 19 | #include 20 | #include 21 | #include 22 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 23 | 24 | void setup() 25 | { 26 | Serial.begin(9600); 27 | lcd.init(); 28 | } 29 | 30 | void loop(void) 31 | { 32 | for(uint8_t rot = 0; rot < 4; rot++) { 33 | testText(rot); 34 | delay(2000); 35 | } 36 | } 37 | 38 | unsigned long testText(int rot) 39 | { 40 | lcd.setRotation(rot); 41 | lcd.fillScreen(BLACK); 42 | lcd.setCursor(0, 0); 43 | lcd.setTextColor(BLUE); 44 | lcd.setTextSize(1); 45 | lcd.println("Hello World!"); 46 | lcd.setTextColor(WHITE); 47 | lcd.print("Rotation = "); 48 | lcd.println(rot); 49 | lcd.setTextColor(YELLOW); 50 | lcd.setTextSize(2); 51 | lcd.println(1234.56); 52 | lcd.setTextColor(RED); 53 | lcd.setTextSize(3); 54 | lcd.println(0xDEAD, HEX); 55 | lcd.println(); 56 | lcd.setTextColor(GREEN); 57 | lcd.setTextSize(4); 58 | lcd.println("Hello"); 59 | } 60 | 61 | 62 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/rre_mario6.h: -------------------------------------------------------------------------------- 1 | #ifndef __font_mario6_h__ 2 | #define __font_mario6_h__ 3 | 4 | /* 5 | *** Generated by rrefontgen *** 6 | Font: [mario6] 48x64 7 | Total chars: 4 (' ' to '#') 8 | Total rects: 48 * 3 bytes 9 | Total pixels: 1099 (409 overlapping) 10 | Total bytes: 152 (144 rects + 8 offs) 11 | Bitmap size: 1536 (48x64 * 4) (+4 opt) 12 | */ 13 | 14 | const unsigned char fontmario6_Rects[144] PROGMEM = { 15 | 0x9e,0x58,0x07, 0xed,0x87,0x01, 0xa9,0x15,0x45, 0xab,0x52,0x42, 0x61,0x1f,0x04, 0xef,0x48,0x00, 0x25,0xd7,0x03, 0x1d,0x17,0x03, 0xac,0x07,0x00, 0xac,0x0f,0x00, 0x6e,0x27,0x01, 0x23,0x21,0x01, 0x27,0x27,0x01, 0x2a,0x14,0x00, 0x1d,0x16,0x00, 0x28,0x16,0x00, 16 | 0x1d,0x1d,0x00, 0x20,0x1f,0x00, 0x25,0x26,0x00, 0xa6,0xd8,0x09, 0x80,0x9b,0x0b, 0x0b,0x4c,0x45, 0x51,0x95,0x01, 0xc0,0x0a,0x03, 0x40,0x26,0x06, 0x89,0x98,0x06, 0xc9,0x0c,0x01, 0x53,0x56,0x00, 0x06,0xda,0x03, 0x40,0x08,0x01, 0x4e,0x0a,0x01, 0x05,0x0d,0x03, 17 | 0x51,0xd2,0x00, 0x00,0x1a,0x02, 0xc8,0x99,0x04, 0x4c,0x07,0x00, 0x4d,0x08,0x00, 0x4a,0x10,0x00, 0xc0,0xd9,0x00, 0x0b,0x06,0x00, 0x02,0x09,0x00, 0x0e,0x09,0x00, 0x10,0x0b,0x00, 0x04,0x0c,0x00, 0x00,0x0e,0x00, 0x08,0x0e,0x00, 0x0d,0x23,0x00, 0x4a,0x17,0x0a, 18 | }; 19 | 20 | const unsigned short fontmario6_CharOffs[5] PROGMEM = { 21 | 0x0000, 0x0000, 0x0000, 0x0014, 0x0030, 22 | }; 23 | 24 | RRE_Font rre_mario6 = { RRE_24B, 48,64, 0x20, 0x23, (const uint8_t*)fontmario6_Rects, (const uint16_t*)fontmario6_CharOffs }; 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /examples/ILI9163C_Bitmap/ILI9163C_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // ILI9163C library example 2 | // (c) 2019 Pawel A. Hernik 3 | 4 | /* 5 | Pinout (header on the top, from left): 6 | LED -> 3.3V 7 | SCK -> D13 8 | SDA -> D11/MOSI 9 | A0/DC -> D8 or any digital 10 | RESET -> D9 or any digital 11 | CS -> D10 or any digital 12 | GND -> GND 13 | VCC -> 3.3V 14 | */ 15 | 16 | #define TFT_CS 10 17 | #define TFT_DC 8 18 | #define TFT_RST 9 19 | #include 20 | #include 21 | #include 22 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 23 | 24 | #include "bitmap.h" 25 | 26 | #define BARWD 24 27 | uint16_t colorBar[BARWD]; 28 | 29 | void setup(void) 30 | { 31 | Serial.begin(9600); 32 | lcd.init(); 33 | lcd.fillScreen(BLACK); 34 | 35 | int i,j; 36 | for(j=0;j<4;j++) 37 | for(i=0;i<4;i++) 38 | lcd.drawImageF(i*32,j*32,32,32,mario); 39 | delay(4000); 40 | 41 | for(i=0;i 3.3V 10 | SCK -> D13 11 | SDA -> D11/MOSI 12 | A0/DC -> D8 or any digital 13 | RESET -> D9 or any digital 14 | CS -> D10 or any digital 15 | GND -> GND 16 | VCC -> 3.3V 17 | */ 18 | 19 | #define SCR_WD 128 20 | #define SCR_HT 128 21 | 22 | #define TFT_CS 10 23 | #define TFT_DC 8 24 | #define TFT_RST 9 25 | #include 26 | #include 27 | #include 28 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 29 | 30 | 31 | #include "RREFont.h" 32 | #include "rre_chicago_20x24.h" 33 | 34 | RREFont font; 35 | 36 | // needed for RREFont library initialization, define your fillRect 37 | void customRect(int x, int y, int w, int h, int c) { return lcd.fillRect(x, y, w, h, c); } 38 | 39 | void setup() 40 | { 41 | Serial.begin(9600); 42 | lcd.init(); 43 | lcd.fillScreen(BLACK); 44 | 45 | font.init(customRect, SCR_WD, SCR_HT); // custom fillRect function and screen width and height values 46 | font.setFont(&rre_chicago_20x24); 47 | int i; 48 | for(i=0;i<10;i++) { 49 | font.setColor(RGBto565(i*25,i*25,i*25)); 50 | font.printStr(30+i,20+i,"Hello"); 51 | } 52 | font.setColor(WHITE); 53 | font.printStr(30+i,20+i,"Hello"); 54 | 55 | for(i=0;i<10;i++) { 56 | font.setColor(lcd.rgbWheel(0+i*8)); 57 | font.printStr(25+i,60+i,"World"); 58 | } 59 | font.setColor(WHITE); 60 | font.printStr(25+i,60+i,"World"); 61 | delay(4000); 62 | lcd.fillScreen(); 63 | } 64 | 65 | #define MAX_TXT 32 66 | byte tx[MAX_TXT]; 67 | byte ty[MAX_TXT]; 68 | byte cur=0; 69 | int numTxt=16; 70 | int x=0,y=0; 71 | int dx=6,dy=5; 72 | int i,ii,cc=0; 73 | 74 | void loop() 75 | { 76 | x+=dx; 77 | y+=dy; 78 | if(x>110) { dx=-dx; x=110; } 79 | if(x<1) { dx=-dx; x=0; } 80 | if(y>120) { dy=-dy; y=120; } 81 | if(y<1) { dy=-dy; y=0; } 82 | int i=cur; 83 | //font.setColor(BLACK); 84 | //font.printStr(tx[i],ty[i],"Hello!"); 85 | tx[cur]=x; 86 | ty[cur]=y; 87 | if(++cur>=numTxt) cur=0; 88 | for(i=0;i=numTxt) ii-=numTxt; 91 | font.setColor(RGBto565(i*15,i*5,0)); 92 | if(i==numTxt-1) font.setColor(WHITE); 93 | font.printStr(tx[ii],ty[ii],"Hello!"); 94 | cc++; 95 | } 96 | delay(20); 97 | } 98 | 99 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/rre_mario4.h: -------------------------------------------------------------------------------- 1 | #ifndef __font_mario4_h__ 2 | #define __font_mario4_h__ 3 | 4 | /* 5 | *** Generated by rrefontgen *** 6 | Font: [mario4] 48x64 7 | Total chars: 4 (' ' to '#') 8 | Total rects: 110 * 3 bytes 9 | Total pixels: 1974 (889 overlapping) 10 | Total bytes: 338 (330 rects + 8 offs) 11 | Bitmap size: 1536 (48x64 * 4) (+4 opt) 12 | */ 13 | 14 | const unsigned char fontmario4_Rects[330] PROGMEM = { 15 | 0xe0,0x8c,0x0a, 0x9a,0x95,0x06, 0x0e,0x66,0x0b, 0xd7,0x9b,0x04, 0x28,0x5b,0x06, 0x66,0x47,0x05, 0xdd,0x90,0x07, 0xa4,0x1f,0x05, 0x6b,0x59,0x04, 0xd5,0x21,0x07, 0xe2,0xca,0x04, 0x0d,0x68,0x03, 0x9b,0xd3,0x03, 0x18,0x59,0x0a, 0x62,0x21,0x04, 0xe6,0x1d,0x06, 16 | 0x65,0x08,0x08, 0x96,0x9e,0x04, 0xeb,0x13,0x00, 0x51,0x24,0x01, 0x59,0x17,0x0f, 0x2d,0x04,0x02, 0x2d,0x18,0x02, 0x9f,0x0e,0x40, 0xa8,0x06,0x06, 0x8f,0x65,0x02, 0x14,0x25,0x01, 0x0e,0x2d,0x01, 0x64,0x09,0x08, 0xe1,0x0b,0x40, 0x1c,0x12,0x41, 0x5e,0xcf,0x05, 17 | 0x2c,0x15,0x00, 0x2f,0x17,0x00, 0x25,0x1a,0x00, 0x2a,0x1a,0x00, 0x27,0x1c,0x00, 0x25,0x1e,0x00, 0x23,0x20,0x00, 0x21,0x22,0x00, 0x0e,0x2e,0x00, 0xaa,0x05,0x05, 0x8d,0x12,0x0b, 0xc3,0x15,0x08, 0x40,0x57,0x04, 0x80,0x04,0x05, 0xc9,0x13,0x07, 0x80,0x4c,0x01, 18 | 0x84,0x0c,0x02, 0x01,0x56,0x06, 0x87,0x0e,0x01, 0x43,0x3e,0x02, 0x42,0x0e,0x03, 0x46,0x14,0x0d, 0x46,0x05,0x01, 0x07,0x07,0x02, 0x00,0x1d,0x02, 0x09,0x08,0x01, 0x45,0x0a,0x00, 0x4c,0x0c,0x00, 0x0c,0x17,0x01, 0x08,0x19,0x01, 0x52,0x3e,0x00, 0x08,0x06,0x00, 19 | 0x0a,0x09,0x00, 0x0b,0x0a,0x00, 0x00,0x0b,0x00, 0x06,0x0b,0x00, 0x02,0x0d,0x00, 0x07,0x0d,0x00, 0x04,0x10,0x00, 0x09,0x10,0x00, 0x08,0x11,0x00, 0x05,0x1b,0x00, 0x00,0x1e,0x00, 0x13,0x3d,0x00, 0x06,0x3f,0x00, 0x11,0x3f,0x00, 0x19,0x13,0x02, 0xdf,0x4c,0x08, 20 | 0x17,0x45,0x08, 0xda,0x04,0x09, 0x5e,0x4f,0x08, 0x16,0x46,0x07, 0xa8,0x87,0x01, 0xa1,0x8b,0x03, 0x94,0x07,0x01, 0x18,0x0b,0x04, 0x64,0x05,0x01, 0x12,0x08,0x0f, 0x9d,0x11,0x00, 0x23,0x8a,0x05, 0x19,0x0c,0x01, 0x24,0x04,0x00, 0x15,0x06,0x00, 0x28,0x06,0x00, 21 | 0x27,0x08,0x00, 0x20,0x15,0x00, 0x65,0x49,0x05, 0x86,0x08,0x03, 0x44,0x00,0x02, 0x0f,0x01,0x01, 0x07,0x07,0x01, 0x04,0x08,0x01, 0x4a,0x09,0x00, 0x0f,0x02,0x00, 0x0e,0x03,0x00, 0x05,0x09,0x00, 0x08,0x16,0x00, 0x10,0x00,0x01, 22 | }; 23 | 24 | const unsigned short fontmario4_CharOffs[5] PROGMEM = { 25 | 0x0000, 0x002a, 0x004f, 0x0063, 0x006e, 26 | }; 27 | 28 | RRE_Font rre_mario4 = { RRE_24B, 48,64, 0x20, 0x23, (const uint8_t*)fontmario4_Rects, (const uint16_t*)fontmario4_CharOffs }; 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/rre_mario5_v.h: -------------------------------------------------------------------------------- 1 | #ifndef __font_mario5_h__ 2 | #define __font_mario5_h__ 3 | 4 | /* 5 | *** Generated by rrefontgen *** 6 | Font: [mario5] 96x128 7 | Total chars: 1 (' ' to ' ') 8 | Total rects: 124 * 3 bytes 9 | Total pixels: 716 (0 overlapping) 10 | Total bytes: 374 (372 rects + 2 offs) 11 | Bitmap size: 1536 (96x128 * 1) (+1 opt) 12 | */ 13 | 14 | const unsigned char fontmario5_Rects[372] PROGMEM = { 15 | 0x04,0x55,0x07, 0x05,0x53,0x0b, 0x06,0x52,0x0d, 0x07,0x51,0x04, 0x07,0x59,0x07, 0x08,0x50,0x03, 0x08,0x59,0x07, 0x09,0x50,0x02, 0x09,0x59,0x08, 0x0a,0x4f,0x03, 0x0a,0x56,0x0b, 0x0b,0x4c,0x00, 0x0b,0x4f,0x13, 0x0c,0x4b,0x01, 0x0c,0x4f,0x08, 0x0c,0x5b,0x07, 16 | 0x0d,0x4b,0x0b, 0x0d,0x5c,0x06, 0x0d,0x70,0x06, 0x0e,0x4b,0x09, 0x0e,0x5b,0x08, 0x0e,0x6c,0x0c, 0x0f,0x4b,0x09, 0x0f,0x5a,0x09, 0x0f,0x6a,0x03, 0x10,0x4b,0x18, 0x10,0x67,0x02, 0x11,0x4b,0x18, 0x12,0x4c,0x17, 0x13,0x4c,0x11, 0x13,0x62,0x00, 0x14,0x4c,0x10, 17 | 0x14,0x62,0x00, 0x15,0x4d,0x0e, 0x15,0x61,0x00, 0x16,0x4d,0x0d, 0x16,0x5d,0x00, 0x17,0x4e,0x02, 0x17,0x52,0x0b, 0x18,0x4f,0x01, 0x18,0x53,0x0a, 0x19,0x50,0x01, 0x19,0x54,0x09, 0x1a,0x56,0x06, 0x2d,0x0c,0x06, 0x2e,0x0b,0x09, 0x2f,0x0a,0x04, 0x2f,0x13,0x01, 18 | 0x30,0x09,0x01, 0x31,0x09,0x02, 0x31,0x51,0x00, 0x32,0x09,0x02, 0x32,0x10,0x01, 0x32,0x50,0x00, 0x33,0x08,0x04, 0x33,0x11,0x01, 0x33,0x4f,0x00, 0x34,0x08,0x02, 0x34,0x12,0x00, 0x34,0x4f,0x00, 0x35,0x11,0x01, 0x36,0x09,0x01, 0x36,0x10,0x01, 0x37,0x09,0x02, 19 | 0x38,0x0a,0x03, 0x39,0x0b,0x03, 0x3a,0x0d,0x03, 0x44,0x1d,0x02, 0x45,0x0e,0x00, 0x45,0x1d,0x02, 0x46,0x0e,0x00, 0x46,0x1d,0x02, 0x47,0x0e,0x00, 0x47,0x1c,0x03, 0x48,0x0e,0x01, 0x48,0x1c,0x04, 0x49,0x0e,0x01, 0x49,0x1c,0x04, 0x4a,0x0b,0x00, 0x4a,0x0e,0x01, 20 | 0x4a,0x1b,0x05, 0x4b,0x0b,0x00, 0x4b,0x0f,0x00, 0x4b,0x1a,0x06, 0x4c,0x0b,0x00, 0x4c,0x10,0x00, 0x4c,0x1a,0x07, 0x4d,0x0b,0x01, 0x4d,0x19,0x05, 0x4d,0x21,0x01, 0x4e,0x0c,0x01, 0x4e,0x18,0x07, 0x4e,0x21,0x02, 0x4f,0x0d,0x02, 0x4f,0x18,0x07, 0x4f,0x22,0x02, 21 | 0x50,0x0d,0x05, 0x50,0x19,0x06, 0x50,0x22,0x02, 0x51,0x0d,0x09, 0x51,0x19,0x06, 0x51,0x22,0x01, 0x52,0x0d,0x09, 0x52,0x19,0x06, 0x52,0x22,0x01, 0x52,0x62,0x01, 0x53,0x0e,0x08, 0x53,0x19,0x05, 0x53,0x61,0x01, 0x54,0x0e,0x08, 0x54,0x19,0x05, 0x54,0x5f,0x01, 22 | 0x55,0x0f,0x07, 0x55,0x18,0x05, 0x55,0x5c,0x01, 0x56,0x0f,0x07, 0x56,0x18,0x04, 0x56,0x5b,0x00, 0x57,0x11,0x09, 0x57,0x58,0x02, 0x58,0x13,0x04, 0x58,0x56,0x02, 0x59,0x53,0x03, 0x5a,0x4f,0x04, 23 | }; 24 | 25 | const unsigned short fontmario5_CharOffs[2] PROGMEM = { 26 | 0x0000, 0x007c, 27 | }; 28 | 29 | RRE_Font rre_mario5 = { RRE_V24B, 96,128, 0x20, 0x20, (const uint8_t*)fontmario5_Rects, (const uint16_t*)fontmario5_CharOffs }; 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/rre_mario3_v.h: -------------------------------------------------------------------------------- 1 | #ifndef __font_mario3_h__ 2 | #define __font_mario3_h__ 3 | 4 | /* 5 | *** Generated by rrefontgen *** 6 | Font: [mario3] 96x128 7 | Total chars: 1 (' ' to ' ') 8 | Total rects: 136 * 3 bytes 9 | Total pixels: 1117 (0 overlapping) 10 | Total bytes: 410 (408 rects + 2 offs) 11 | Bitmap size: 1536 (96x128 * 1) (+1 opt) 12 | */ 13 | 14 | const unsigned char fontmario3_Rects[408] PROGMEM = { 15 | 0x10,0x31,0x06, 0x11,0x30,0x09, 0x12,0x2f,0x0b, 0x13,0x2e,0x0d, 0x14,0x2d,0x0e, 0x15,0x2d,0x0f, 0x16,0x2d,0x03, 0x16,0x32,0x0a, 0x17,0x2d,0x03, 0x17,0x32,0x07, 0x17,0x3b,0x01, 0x18,0x2d,0x03, 0x18,0x33,0x00, 0x18,0x35,0x03, 0x18,0x3b,0x01, 0x19,0x2d,0x03, 16 | 0x19,0x35,0x03, 0x19,0x3b,0x02, 0x1a,0x2d,0x04, 0x1a,0x35,0x03, 0x1a,0x3a,0x03, 0x1b,0x2e,0x04, 0x1b,0x3a,0x03, 0x1c,0x2f,0x04, 0x1c,0x39,0x03, 0x1d,0x30,0x0c, 0x1e,0x32,0x0a, 0x1f,0x33,0x09, 0x20,0x34,0x07, 0x21,0x34,0x08, 0x22,0x25,0x01, 0x22,0x35,0x08, 17 | 0x23,0x25,0x03, 0x23,0x35,0x09, 0x24,0x25,0x05, 0x24,0x35,0x0a, 0x25,0x25,0x05, 0x25,0x34,0x0c, 0x26,0x25,0x05, 0x26,0x33,0x0d, 0x27,0x24,0x07, 0x27,0x31,0x10, 0x28,0x24,0x08, 0x28,0x30,0x12, 0x29,0x24,0x1e, 0x2a,0x23,0x20, 0x2b,0x23,0x20, 0x2c,0x23,0x0a, 18 | 0x2c,0x35,0x0f, 0x2d,0x22,0x0a, 0x2d,0x37,0x0d, 0x2e,0x22,0x0a, 0x2e,0x38,0x0c, 0x2f,0x0f,0x03, 0x2f,0x21,0x0c, 0x2f,0x38,0x0c, 0x30,0x13,0x00, 0x30,0x28,0x05, 0x30,0x39,0x0c, 0x30,0x53,0x01, 0x31,0x13,0x00, 0x31,0x2a,0x04, 0x31,0x42,0x03, 0x31,0x52,0x04, 19 | 0x32,0x0c,0x00, 0x32,0x12,0x00, 0x32,0x20,0x00, 0x32,0x2b,0x03, 0x32,0x44,0x01, 0x32,0x51,0x06, 0x33,0x0d,0x00, 0x33,0x10,0x00, 0x33,0x1f,0x02, 0x33,0x2b,0x04, 0x33,0x44,0x01, 0x33,0x50,0x07, 0x34,0x0b,0x00, 0x34,0x11,0x00, 0x34,0x1f,0x04, 0x34,0x2b,0x04, 20 | 0x34,0x50,0x08, 0x35,0x09,0x00, 0x35,0x10,0x00, 0x35,0x1e,0x11, 0x35,0x4f,0x09, 0x36,0x0f,0x00, 0x36,0x1e,0x12, 0x36,0x44,0x00, 0x36,0x4f,0x08, 0x37,0x0c,0x00, 0x37,0x11,0x00, 0x37,0x1d,0x13, 0x37,0x44,0x00, 0x37,0x50,0x07, 0x38,0x1d,0x13, 0x38,0x43,0x00, 21 | 0x38,0x51,0x04, 0x39,0x0f,0x00, 0x39,0x1c,0x14, 0x39,0x42,0x01, 0x3a,0x1c,0x14, 0x3a,0x41,0x01, 0x3b,0x1b,0x0b, 0x3b,0x28,0x09, 0x3b,0x3f,0x03, 0x3c,0x1b,0x01, 0x3c,0x23,0x01, 0x3c,0x27,0x0a, 0x3c,0x3f,0x02, 0x3d,0x1a,0x01, 0x3d,0x26,0x0c, 0x3d,0x3f,0x01, 22 | 0x3e,0x1b,0x00, 0x3e,0x25,0x0d, 0x3e,0x3f,0x00, 0x3f,0x1c,0x00, 0x3f,0x25,0x0e, 0x40,0x1e,0x00, 0x40,0x24,0x0f, 0x41,0x20,0x00, 0x41,0x24,0x0f, 0x42,0x24,0x0f, 0x43,0x24,0x0f, 0x43,0x4d,0x04, 0x44,0x23,0x10, 0x44,0x4e,0x05, 0x45,0x23,0x10, 0x45,0x50,0x04, 23 | 0x46,0x23,0x10, 0x47,0x23,0x10, 0x48,0x24,0x0e, 0x49,0x24,0x0e, 0x4a,0x24,0x0d, 0x4b,0x25,0x0c, 0x4c,0x27,0x08, 0x4d,0x29,0x05, 24 | }; 25 | 26 | const unsigned short fontmario3_CharOffs[2] PROGMEM = { 27 | 0x0000, 0x0088, 28 | }; 29 | 30 | RRE_Font rre_mario3 = { RRE_V24B, 96,128, 0x20, 0x20, (const uint8_t*)fontmario3_Rects, (const uint16_t*)fontmario3_CharOffs }; 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/rre_mario4_v.h: -------------------------------------------------------------------------------- 1 | #ifndef __font_mario4_h__ 2 | #define __font_mario4_h__ 3 | 4 | /* 5 | *** Generated by rrefontgen *** 6 | Font: [mario4] 96x128 7 | Total chars: 1 (' ' to ' ') 8 | Total rects: 155 * 3 bytes 9 | Total pixels: 1085 (0 overlapping) 10 | Total bytes: 467 (465 rects + 2 offs) 11 | Bitmap size: 1536 (96x128 * 1) (+1 opt) 12 | */ 13 | 14 | const unsigned char fontmario4_Rects[465] PROGMEM = { 15 | 0x0d,0x28,0x04, 0x0e,0x26,0x08, 0x0f,0x25,0x08, 0x10,0x25,0x07, 0x11,0x24,0x07, 0x12,0x24,0x06, 0x12,0x48,0x00, 0x13,0x26,0x04, 0x13,0x48,0x00, 0x14,0x25,0x05, 0x14,0x47,0x02, 0x15,0x21,0x09, 0x15,0x46,0x03, 0x16,0x1e,0x0c, 0x16,0x46,0x04, 0x17,0x1b,0x0f, 16 | 0x17,0x45,0x05, 0x18,0x19,0x11, 0x18,0x45,0x06, 0x19,0x17,0x13, 0x19,0x45,0x07, 0x1a,0x15,0x13, 0x1a,0x44,0x08, 0x1b,0x13,0x13, 0x1b,0x44,0x07, 0x1c,0x12,0x12, 0x1c,0x44,0x07, 0x1d,0x10,0x12, 0x1d,0x44,0x06, 0x1d,0x51,0x02, 0x1e,0x0f,0x12, 0x1e,0x44,0x05, 17 | 0x1e,0x4f,0x05, 0x1f,0x0e,0x12, 0x1f,0x44,0x05, 0x1f,0x4c,0x08, 0x20,0x0c,0x13, 0x20,0x44,0x04, 0x20,0x4c,0x09, 0x21,0x0b,0x13, 0x21,0x22,0x00, 0x21,0x44,0x04, 0x21,0x4b,0x0a, 0x22,0x0a,0x13, 0x22,0x21,0x01, 0x22,0x44,0x03, 0x22,0x4b,0x0a, 0x23,0x0a,0x12, 18 | 0x23,0x20,0x02, 0x23,0x44,0x03, 0x23,0x4a,0x0b, 0x24,0x09,0x12, 0x24,0x1f,0x03, 0x24,0x44,0x02, 0x24,0x4a,0x0b, 0x25,0x08,0x12, 0x25,0x1e,0x04, 0x25,0x45,0x01, 0x25,0x49,0x0b, 0x26,0x07,0x12, 0x26,0x1d,0x05, 0x26,0x49,0x0b, 0x27,0x07,0x11, 0x27,0x1c,0x05, 19 | 0x27,0x48,0x0b, 0x28,0x06,0x12, 0x28,0x1b,0x06, 0x28,0x46,0x0c, 0x29,0x06,0x11, 0x29,0x1b,0x06, 0x29,0x47,0x0a, 0x2a,0x05,0x12, 0x2a,0x1a,0x06, 0x2a,0x49,0x05, 0x2b,0x05,0x07, 0x2b,0x13,0x03, 0x2b,0x19,0x07, 0x2c,0x05,0x05, 0x2c,0x15,0x00, 0x2c,0x19,0x07, 20 | 0x2d,0x04,0x05, 0x2d,0x18,0x07, 0x2e,0x04,0x04, 0x2e,0x18,0x07, 0x2f,0x04,0x03, 0x2f,0x17,0x07, 0x30,0x04,0x02, 0x30,0x0b,0x07, 0x30,0x17,0x07, 0x31,0x04,0x02, 0x31,0x0c,0x06, 0x31,0x16,0x07, 0x32,0x04,0x02, 0x32,0x0d,0x02, 0x32,0x16,0x07, 0x33,0x04,0x02, 21 | 0x33,0x0e,0x01, 0x33,0x15,0x07, 0x33,0x3e,0x01, 0x34,0x04,0x02, 0x34,0x0c,0x04, 0x34,0x15,0x07, 0x34,0x3e,0x03, 0x34,0x48,0x00, 0x35,0x04,0x02, 0x35,0x0a,0x05, 0x35,0x15,0x06, 0x35,0x3e,0x03, 0x35,0x48,0x01, 0x36,0x05,0x01, 0x36,0x0b,0x03, 0x36,0x14,0x06, 22 | 0x36,0x3f,0x02, 0x36,0x48,0x02, 0x37,0x05,0x02, 0x37,0x0d,0x03, 0x37,0x14,0x06, 0x37,0x47,0x03, 0x38,0x06,0x01, 0x38,0x0e,0x03, 0x38,0x14,0x05, 0x38,0x47,0x03, 0x38,0x56,0x00, 0x39,0x07,0x01, 0x39,0x10,0x00, 0x39,0x13,0x06, 0x39,0x48,0x02, 0x3a,0x08,0x01, 23 | 0x3a,0x13,0x05, 0x3a,0x49,0x01, 0x3b,0x0a,0x00, 0x3b,0x13,0x05, 0x3c,0x0c,0x01, 0x3c,0x13,0x04, 0x3d,0x12,0x05, 0x3e,0x12,0x04, 0x3e,0x43,0x00, 0x3f,0x12,0x04, 0x3f,0x41,0x01, 0x40,0x12,0x04, 0x40,0x40,0x01, 0x41,0x12,0x03, 0x41,0x3f,0x01, 0x42,0x12,0x03, 24 | 0x42,0x3e,0x01, 0x43,0x12,0x03, 0x43,0x3d,0x00, 0x44,0x12,0x02, 0x45,0x12,0x02, 0x46,0x12,0x02, 0x47,0x12,0x02, 0x48,0x12,0x02, 0x49,0x13,0x00, 0x4a,0x13,0x00, 0x4b,0x13,0x00, 25 | }; 26 | 27 | const unsigned short fontmario4_CharOffs[2] PROGMEM = { 28 | 0x0000, 0x009b, 29 | }; 30 | 31 | RRE_Font rre_mario4 = { RRE_V24B, 96,128, 0x20, 0x20, (const uint8_t*)fontmario4_Rects, (const uint16_t*)fontmario4_CharOffs }; 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /examples/ILI9163C_Lines/ILI9163C_Lines.ino: -------------------------------------------------------------------------------- 1 | // ILI9163C library example 2 | // (c) 2019 Pawel A. Hernik 3 | 4 | /* 5 | Pinout (header on the top, from left): 6 | LED -> 3.3V 7 | SCK -> D13 8 | SDA -> D11/MOSI 9 | A0/DC -> D8 or any digital 10 | RESET -> D9 or any digital 11 | CS -> D10 or any digital 12 | GND -> GND 13 | VCC -> 3.3V 14 | */ 15 | 16 | #define SCR_WD 128 17 | #define SCR_HT 128 18 | 19 | #define TFT_CS 10 20 | #define TFT_DC 8 21 | #define TFT_RST 9 22 | #include 23 | #include 24 | #include 25 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 26 | 27 | void setup() 28 | { 29 | Serial.begin(9600); 30 | lcd.init(); 31 | 32 | for(int i=0;i<128;i++) { 33 | lcd.fillRect(32*0,i,32,1,RGBto565(i*2,0,0)); 34 | lcd.fillRect(32*1,i,32,1,RGBto565(0,i*2,0)); 35 | lcd.fillRect(32*2,i,32,1,RGBto565(0,0,i*2)); 36 | lcd.fillRect(32*3,i,32,1,RGBto565(i*2,i*2,i*2)); 37 | } 38 | } 39 | 40 | void circles() 41 | { 42 | int x,y; 43 | x = 15+random(128-30); 44 | y = 15+random(128-30); 45 | lcd.fillCircle(x,y,15,random()); 46 | lcd.drawCircle(x,y,16,YELLOW); 47 | } 48 | 49 | #define MAX_LINES 16 50 | byte lx0[MAX_LINES]; 51 | byte lx1[MAX_LINES]; 52 | byte ly0[MAX_LINES]; 53 | byte ly1[MAX_LINES]; 54 | byte curLine=0; 55 | int x0=40,y0=0; 56 | int dx0=6,dy0=5; 57 | int x1=80,y1=40; 58 | int dx1=9,dy1=8; 59 | int cc=0; 60 | int numLines=12; 61 | 62 | void animLines(int mode) 63 | { 64 | uint16_t c; 65 | x0+=dx0; 66 | y0+=dy0; 67 | x1+=dx1; 68 | y1+=dy1; 69 | if(x0>127) { dx0=-dx0; x0=127; } 70 | if(x0<1) { dx0=-dx0; x0=0; } 71 | if(y0>127) { dy0=-dy0; y0=127; } 72 | if(y0<1) { dy0=-dy0; y0=0; } 73 | if(x1>127) { dx1=-dx1; x1=127; } 74 | if(x1<1) { dx1=-dx1; x1=0; } 75 | if(y1>127) { dy1=-dy1; y1=127; } 76 | if(y1<1) { dy1=-dy1; y1=0; } 77 | int i=curLine; 78 | if(mode&1) lcd.drawLine(lx0[i],ly0[i],lx1[i],ly1[i], 0); 79 | if(mode&2) lcd.drawLine(127-lx0[i],ly0[i],127-lx1[i],ly1[i],0); 80 | if(mode&4) lcd.drawLine(lx0[i],127-ly0[i],lx1[i],127-ly1[i],0); 81 | if(mode&8) lcd.drawLine(127-lx0[i],127-ly0[i],127-lx1[i],127-ly1[i],0); 82 | lx0[curLine]=x0; 83 | lx1[curLine]=x1; 84 | ly0[curLine]=y0; 85 | ly1[curLine]=y1; 86 | if(++curLine>=numLines) curLine=0; 87 | for(int i=0;i 3.3V 11 | SCK -> D13 12 | SDA -> D11/MOSI 13 | A0/DC -> D8 or any digital 14 | RESET -> D9 or any digital 15 | CS -> D10 or any digital 16 | GND -> GND 17 | VCC -> 3.3V 18 | */ 19 | 20 | #define SCR_WD 128 21 | #define SCR_HT 128 22 | 23 | #define TFT_CS 10 24 | #define TFT_DC 8 25 | #define TFT_RST 9 26 | #include 27 | #include 28 | #include 29 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 30 | 31 | #include "RREFont.h" 32 | #include "rre_fjg_8x16.h" 33 | 34 | RREFont font; 35 | 36 | // needed for RREFont library initialization, define your fillRect 37 | void customRect(int x, int y, int w, int h, int c) { return lcd.fillRect(x, y, w, h, c); } 38 | 39 | void setup() 40 | { 41 | Serial.begin(9600); 42 | lcd.init(); 43 | font.init(customRect, SCR_WD, SCR_HT); // custom fillRect function and screen width and height values 44 | font.setFont(&rre_fjg_8x16); 45 | font.setScale(1); font.setSpacing(3); 46 | font.setColor(WHITE); 47 | } 48 | 49 | void rainbow() 50 | { 51 | for(int i=0;i<128;i+=4) { 52 | uint8_t r,g,b; 53 | lcd.rgbWheel(i*512L/128,&r,&g,&b); 54 | lcd.fillRect(0,i,128,4,RGBto565(r,g,b)); 55 | } 56 | } 57 | 58 | void loop() 59 | { 60 | lcd.fillScreen(RGBto565(120,60,30)); 61 | font.printStr(ALIGN_CENTER,45,"ILI9163C"); 62 | font.printStr(ALIGN_CENTER,45+16,"modes"); 63 | delay(2000); 64 | 65 | rainbow(); 66 | font.setColor(BLACK); 67 | font.printStr(ALIGN_CENTER,50,"Idle mode OFF"); 68 | lcd.idleDisplay(false); delay(2000); 69 | rainbow(); 70 | font.printStr(ALIGN_CENTER,50,"Idle mode ON"); 71 | lcd.idleDisplay(true); delay(4000); 72 | rainbow(); 73 | font.printStr(ALIGN_CENTER,50,"Idle mode OFF"); 74 | lcd.idleDisplay(false); delay(2000); 75 | 76 | rainbow(); 77 | font.setColor(WHITE,BLACK); 78 | lcd.fillRect(10,46,128-20,22,BLACK); 79 | font.printStr(ALIGN_CENTER,50,"Invert OFF"); 80 | lcd.invertDisplay(false); delay(2000); 81 | font.printStr(ALIGN_CENTER,50," Invert ON "); 82 | lcd.invertDisplay(true); delay(4000); 83 | font.printStr(ALIGN_CENTER,50,"Invert OFF"); 84 | lcd.invertDisplay(false); delay(2000); 85 | 86 | font.setColor(WHITE); 87 | lcd.fillScreen(RGBto565(180,0,180)); 88 | font.printStr(ALIGN_CENTER,50,"Sleep mode 2s"); 89 | delay(2000); 90 | //lcd.enableDisplay(false); 91 | lcd.sleepDisplay(true); delay(4000); 92 | lcd.sleepDisplay(false); 93 | //lcd.enableDisplay(true); 94 | 95 | lcd.fillScreen(RGBto565(180,0,180)); 96 | font.printStr(ALIGN_CENTER,50,"Display on/off"); 97 | delay(2000); 98 | lcd.enableDisplay(false); delay(4000); 99 | lcd.enableDisplay(true); delay(1000); 100 | 101 | lcd.fillScreen(RGBto565(180,0,180)); 102 | font.printStr(ALIGN_CENTER,50,"Partial display"); 103 | font.setColor(YELLOW); 104 | font.printStr(ALIGN_CENTER,4,"Top"); 105 | font.printStr(ALIGN_CENTER,128-18,"Bottom"); 106 | font.setColor(WHITE); 107 | delay(2000); 108 | lcd.setPartArea(30*1, 30*3); lcd.partialDisplay(true); delay(4000); 109 | lcd.setPartArea(30*3, 30*1); lcd.partialDisplay(true); delay(4000); 110 | lcd.partialDisplay(false); 111 | delay(1000); 112 | 113 | lcd.fillScreen(RGBto565(180,0,0)); 114 | font.printStr(ALIGN_CENTER,50,"Sw reset ..."); 115 | delay(2000); 116 | lcd.resetDisplay(); delay(2000); 117 | lcd.init(); 118 | lcd.fillScreen(RGBto565(0,0,180)); 119 | font.printStr(0,0,"After reset"); delay(2000); 120 | } 121 | 122 | -------------------------------------------------------------------------------- /examples/ILI9163C_BigScroll/ILI9163C_BigScroll.ino: -------------------------------------------------------------------------------- 1 | // ILI9163C library example 2 | // (c) 2019 Pawel A. Hernik 3 | 4 | // requires RRE Font library: 5 | // https://github.com/cbm80amiga/RREFont 6 | 7 | /* 8 | Pinout (header on the top, from left): 9 | LED -> 3.3V 10 | SCK -> D13 11 | SDA -> D11/MOSI 12 | A0/DC -> D8 or any digital 13 | RESET -> D9 or any digital 14 | CS -> D10 or any digital 15 | GND -> GND 16 | VCC -> 3.3V 17 | */ 18 | 19 | #define TFT_CS 10 20 | #define TFT_DC 8 21 | #define TFT_RST 9 22 | #include 23 | #include 24 | #include 25 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 26 | 27 | #include "RREFont.h" 28 | #include "rre_times_98v.h" 29 | #include "rre_tahoma_65v.h" 30 | 31 | //RRE_Font *rFont = &rre_Times98v; 32 | RRE_Font *rFont = &rre_tahoma_65v; 33 | 34 | uint16_t bg = 0x0000, fg = 0xffff; 35 | int maxy = 128; 36 | int screenWd = 128, screenHt = 128; 37 | int spacing = 1; 38 | int sx = 1, sy = 1; 39 | int scrollStep = 2; 40 | int scrollDelay = 10; 41 | int cnt = 0; 42 | int ycnt = 0, yscr = 0; 43 | int offsY = 30; 44 | unsigned long ms; 45 | 46 | 47 | int scrollCharRRE(unsigned char c) 48 | { 49 | if(cfirstCh || c>rFont->lastCh) return 0; 50 | uint16_t recIdx = pgm_read_word(&(rFont->offs[c-rFont->firstCh])); 51 | uint16_t recNum = pgm_read_word(&(rFont->offs[c-rFont->firstCh+1]))-recIdx; 52 | int chWd = recNum>0 ? pgm_read_byte(rFont->rects + (recNum-1+recIdx)*3)+1 : 0; 53 | //Serial.println(String(char(c))+": "+chWd); 54 | spacing = (c==' ') ? rFont->wd/3 : 4; 55 | int idx = recIdx*3; 56 | for(int col = 0; col=maxy) yscr-=maxy; 60 | lcd.setScroll(yscr); 61 | ycnt=yscr+127; 62 | if(ycnt>=maxy) ycnt-=maxy; 63 | //Serial.println(String("ycnt=")+ycnt); 64 | int scrHOffs = screenHt-1; 65 | int scrWOffs = screenWd-1; 66 | int lineY = scrHOffs-(screenHt-sx-ycnt); 67 | int wd; 68 | if(col>=chWd) { // draw empty column (spacing) 69 | wd = sy*rFont->ht; 70 | lcd.fillRect(scrWOffs-offsY-wd, lineY, wd, sx, bg); 71 | while(millis()-msrects+idx+0); 75 | int ybg = 0; 76 | //yf = pgm_read_byte(font_Rects+idx+1); Serial.print("yf="); Serial.println(yf); 77 | while(xf==col) { // draw all lines for current column 78 | yf = pgm_read_byte(rFont->rects+idx+1); 79 | hf = pgm_read_byte(rFont->rects+idx+2); 80 | if(yf>0) { // bg line top 81 | wd = (yf-ybg)*sy; 82 | lcd.fillRect(scrWOffs-(offsY+ybg*sy)-wd, lineY, wd, sx, bg); 83 | } 84 | ybg = yf+hf; 85 | wd = hf*sy; 86 | lcd.fillRect(scrWOffs-(offsY+yf*sy)-wd, lineY, wd, sx, fg); 87 | idx+=3; 88 | xf = pgm_read_byte(rFont->rects+idx+0); 89 | } 90 | //Serial.println("ys = "+String(ys)+" "+String(charHt)); 91 | 92 | if(ybght-1) { // last bg line 93 | wd = (rFont->ht-ybg)*sy; 94 | lcd.fillRect(scrWOffs-(offsY+ybg*sy)-wd, lineY, wd, sx, bg); 95 | } 96 | while(millis()-msht*sy)/2; 123 | //scrollString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-!?.: "); 124 | scrollString("This is an example of super-smooth scrolling with ordinary Arduino, ILI9163C 128x128 LCD library and large RRE font ... "); 125 | } 126 | 127 | -------------------------------------------------------------------------------- /examples/ILI9163C_BMPviaSerial_Scroll/ILI9163C_BMPviaSerial_Scroll.ino: -------------------------------------------------------------------------------- 1 | // Photo slideshow via serial port 2 | // ILI9163C library example 3 | // (c) 2019 Pawel A. Hernik 4 | // YT videos: https://youtu.be/P4cwA9jNsfQ and https://youtu.be/vQY5ILjSZBc 5 | 6 | /* 7 | Pinout (header on the top, from left): 8 | LED -> 3.3V 9 | SCK -> D13 10 | SDA -> D11/MOSI 11 | A0/DC -> D8 or any digital 12 | RESET -> D9 or any digital 13 | CS -> D10 or any digital 14 | GND -> GND 15 | VCC -> 3.3V 16 | */ 17 | 18 | // define here display size = desired BMP dimensions 19 | #define SCR_WD 128 20 | #define SCR_HT 128 21 | 22 | #define TFT_CS 10 23 | #define TFT_DC 8 24 | #define TFT_RST 9 25 | #include 26 | #include 27 | #include 28 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 29 | 30 | void setup() 31 | { 32 | Serial.begin(115200); 33 | lcd.init(); 34 | lcd.fillScreen(BLACK); 35 | lcd.drawRect(0,0,128,128,RED); 36 | lcd.setTextColor(WHITE); 37 | lcd.setTextSize(1); 38 | lcd.setCursor((SCR_WD-15*6)/2,SCR_HT/2-8); 39 | lcd.println("WAITING FOR BMP"); 40 | lcd.setCursor((SCR_WD-7*6)/2,SCR_HT/2+8); 41 | lcd.print(SCR_WD); lcd.print("x"); lcd.print(SCR_HT); 42 | lcd.setScrollArea(0,0); 43 | } 44 | 45 | int rgbIdx=0; 46 | int xp=0,yp=127; 47 | uint8_t r,g,b,c; 48 | int header=54; 49 | unsigned long ms; 50 | char buf[30]; 51 | int bmpIdx=0; 52 | int palIdx=0, palCol=0; 53 | int numBits=0; 54 | int numCols=0; 55 | uint16_t palette[256],col,col2; 56 | int xt=0,yt=0; 57 | int bmpWd,bmpHt; 58 | 59 | void showTime() 60 | { 61 | snprintf(buf,20,"Time: %d ms",millis()-ms); 62 | xt=(SCR_WD-13*6)/2; yt=8*SCR_HT/10; 63 | lcd.setTextColor(BLACK); 64 | lcd.setCursor(xt+1,yt+1); lcd.println(buf); 65 | lcd.setCursor(xt-0,yt+1); lcd.println(buf); 66 | lcd.setCursor(xt-1,yt+1); lcd.println(buf); 67 | lcd.setCursor(xt-1,yt-1); lcd.println(buf); 68 | lcd.setCursor(xt-0,yt-1); lcd.println(buf); 69 | lcd.setCursor(xt+1,yt-1); lcd.println(buf); 70 | lcd.setCursor(xt-1,yt-0); lcd.println(buf); 71 | lcd.setCursor(xt+1,yt-0); lcd.println(buf); 72 | lcd.setTextColor(YELLOW); 73 | lcd.setCursor(xt,yt); lcd.println(buf); 74 | } 75 | 76 | void loop() 77 | { 78 | while(Serial.available()) { 79 | c = Serial.read(); 80 | if(header) { 81 | if(bmpIdx==18) bmpWd=c; else 82 | if(bmpIdx==19) bmpWd+=(int)c<<8; else 83 | if(bmpIdx==22) bmpHt=c; else 84 | if(bmpIdx==23) bmpHt+=(int)c<<8; else 85 | if(bmpIdx==28) numBits=c; else 86 | if(bmpIdx==46) numCols=c; else 87 | if(bmpIdx==47) { 88 | numCols+=(int)c*256; 89 | Serial.print(bmpWd); Serial.print(" x "); Serial.print(bmpHt); Serial.print(" x "); 90 | Serial.print(numBits); Serial.print(" bpp"); 91 | if(numBits<=8) { Serial.print(" / "); Serial.print(numCols); Serial.print(" colors"); } 92 | Serial.println(); 93 | if(bmpWd!=SCR_WD || bmpHt!=SCR_HT) Serial.println("Wrong BMP dimensions!"); 94 | } 95 | if(numBits<=8 && bmpIdx>=54) { 96 | palIdx = bmpIdx-54; 97 | rgbIdx = palIdx&3; 98 | if(rgbIdx==0) b=c; else 99 | if(rgbIdx==1) g=c; else 100 | if(rgbIdx==2) palette[palIdx/4]=RGBto565(c,g,b); 101 | } 102 | bmpIdx++; 103 | if((numBits>8 && bmpIdx>=54) || (numBits<=8 && bmpIdx>=54+numCols*4)) { 104 | header=0; 105 | ms=millis(); 106 | } 107 | continue; 108 | } 109 | if(numBits>8) { 110 | if(rgbIdx==0) b = c; else 111 | if(rgbIdx==1) g = c; else 112 | if(rgbIdx==2) col = RGBto565(c,g,b); 113 | } else { 114 | if(numBits==8) col = palette[c]; else 115 | if(numBits==4) { col = palette[c>>4]; col2 = palette[c&0xf]; } 116 | rgbIdx=2; 117 | } 118 | if(rgbIdx==2) { 119 | rgbIdx=-1; 120 | lcd.drawPixel(xp,yp,col); xp++; 121 | if(numBits==4) { lcd.drawPixel(xp,yp,col2); xp++; } 122 | lcd.setScroll((yp)&0x7f); 123 | if(xp>=SCR_WD) { 124 | xp=0; yp--; 125 | if(yp<0) { 126 | yp=SCR_HT-1; 127 | header=54; 128 | bmpIdx=0; 129 | showTime(); 130 | } 131 | lcd.setScroll((yp+1)&0x7f); 132 | } 133 | } 134 | rgbIdx++; 135 | } 136 | } 137 | 138 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/rre_mario1.h: -------------------------------------------------------------------------------- 1 | #ifndef __font_mario1_h__ 2 | #define __font_mario1_h__ 3 | 4 | /* 5 | *** Generated by rrefontgen *** 6 | Font: [mario1] 48x64 7 | Total chars: 4 (' ' to '#') 8 | Total rects: 322 * 3 bytes 9 | Total pixels: 4743 (95 overlapping) 10 | Total bytes: 974 (966 rects + 8 offs) 11 | Bitmap size: 1536 (48x64 * 4) (+4 opt) 12 | */ 13 | 14 | const unsigned char fontmario1_Rects[966] PROGMEM = { 15 | 0xc0,0xc0,0x51, 0xc0,0xe0,0x48, 0x92,0x80,0x0a, 0x09,0xf3,0x03, 0x92,0x4b,0x05, 0xdd,0x00,0x08, 0x52,0x52,0x02, 0x9d,0x04,0x03, 0x89,0x20,0x03, 0x0d,0x7b,0x01, 0x66,0x00,0x03, 0xd8,0x0b,0x01, 0x52,0x58,0x00, 0x89,0x23,0x01, 0x49,0x6d,0x00, 0x5d,0x07,0x01, 16 | 0xec,0x0e,0x00, 0x4f,0x3e,0x01, 0x2a,0x00,0x02, 0x21,0x04,0x02, 0x95,0x12,0x00, 0x0d,0x20,0x02, 0x89,0x26,0x00, 0xa8,0x2d,0x00, 0x8a,0x30,0x00, 0x17,0x3a,0x02, 0x1a,0x0b,0x01, 0x53,0x18,0x00, 0x4d,0x39,0x00, 0x1c,0x3d,0x01, 0x11,0x3f,0x01, 0x26,0x02,0x00, 17 | 0x21,0x05,0x00, 0x1f,0x07,0x00, 0x1d,0x09,0x00, 0x2e,0x0a,0x00, 0x2d,0x0b,0x00, 0x1a,0x0c,0x00, 0x18,0x0f,0x00, 0x16,0x12,0x00, 0x2d,0x13,0x00, 0x0d,0x21,0x00, 0x2e,0x21,0x00, 0x2c,0x22,0x00, 0x0b,0x23,0x00, 0x26,0x24,0x00, 0x21,0x25,0x00, 0x22,0x27,0x00, 18 | 0x23,0x29,0x00, 0x26,0x2b,0x00, 0x12,0x2e,0x00, 0x2c,0x2e,0x00, 0x11,0x2f,0x00, 0x19,0x31,0x00, 0x1e,0x31,0x00, 0x0b,0x32,0x00, 0x20,0x33,0x00, 0x18,0x34,0x00, 0x1c,0x34,0x00, 0x2c,0x34,0x00, 0x2d,0x36,0x00, 0x2e,0x37,0x00, 0x1c,0x38,0x00, 0x18,0x39,0x00, 19 | 0x1b,0x39,0x00, 0x20,0x3c,0x00, 0x0f,0x3d,0x00, 0x18,0x3d,0x00, 0x2f,0x09,0x00, 0x4d,0x40,0x22, 0xad,0x06,0x82, 0x9d,0xb5,0x04, 0xa7,0x62,0x05, 0xa1,0x06,0x0b, 0x8f,0x06,0x06, 0xe9,0x09,0x03, 0xd9,0x3c,0x03, 0x6b,0x5c,0x01, 0x61,0xab,0x00, 0x8a,0x00,0x02, 20 | 0x50,0x09,0x03, 0x66,0x09,0x02, 0x9b,0x39,0x01, 0x0e,0x06,0x0c, 0x1f,0x21,0x04, 0x06,0x00,0x03, 0x1d,0x06,0x03, 0x6b,0x0d,0x01, 0x14,0x0f,0x03, 0xea,0x1e,0x00, 0x65,0x27,0x01, 0xe0,0x31,0x00, 0x1a,0x0a,0x02, 0x9f,0x10,0x00, 0xa0,0x13,0x00, 0x15,0x20,0x02, 21 | 0x0b,0x03,0x01, 0x16,0x07,0x01, 0x01,0x08,0x01, 0x24,0x09,0x01, 0x10,0x0b,0x01, 0x6c,0x0f,0x00, 0x02,0x13,0x01, 0x6c,0x1a,0x00, 0x0d,0x1c,0x01, 0x15,0x1c,0x01, 0x0f,0x1d,0x01, 0x5d,0x1f,0x00, 0x00,0x20,0x01, 0x69,0x20,0x00, 0x4c,0x21,0x00, 0x5f,0x33,0x00, 22 | 0x5c,0x37,0x00, 0x58,0x3e,0x00, 0x09,0x01,0x00, 0x0c,0x04,0x00, 0x20,0x07,0x00, 0x05,0x08,0x00, 0x14,0x09,0x00, 0x19,0x0b,0x00, 0x28,0x0b,0x00, 0x0a,0x0c,0x00, 0x10,0x0c,0x00, 0x1c,0x0c,0x00, 0x1f,0x0c,0x00, 0x18,0x0d,0x00, 0x23,0x0d,0x00, 0x2a,0x0d,0x00, 23 | 0x14,0x0e,0x00, 0x1b,0x0e,0x00, 0x25,0x0e,0x00, 0x1c,0x0f,0x00, 0x1b,0x10,0x00, 0x27,0x10,0x00, 0x09,0x11,0x00, 0x06,0x12,0x00, 0x28,0x12,0x00, 0x00,0x14,0x00, 0x26,0x17,0x00, 0x28,0x18,0x00, 0x1c,0x19,0x00, 0x0c,0x1a,0x00, 0x0e,0x1a,0x00, 0x0a,0x1b,0x00, 24 | 0x19,0x1b,0x00, 0x27,0x1b,0x00, 0x08,0x1c,0x00, 0x06,0x1d,0x00, 0x0c,0x1d,0x00, 0x04,0x1e,0x00, 0x02,0x1f,0x00, 0x23,0x1f,0x00, 0x11,0x21,0x00, 0x1b,0x21,0x00, 0x28,0x21,0x00, 0x23,0x22,0x00, 0x13,0x23,0x00, 0x18,0x23,0x00, 0x21,0x24,0x00, 0x0c,0x25,0x00, 25 | 0x1c,0x26,0x00, 0x26,0x26,0x00, 0x00,0x27,0x00, 0x0b,0x27,0x00, 0x1d,0x28,0x00, 0x24,0x28,0x00, 0x00,0x2e,0x00, 0x05,0x30,0x00, 0x1c,0x30,0x00, 0x1e,0x34,0x00, 0x00,0x38,0x00, 0x1a,0x3b,0x00, 0x17,0x3f,0x00, 0xa2,0x69,0x4d, 0x40,0xa6,0x49, 0x80,0x40,0x0e, 26 | 0xa3,0xb5,0x03, 0x40,0x47,0x06, 0xcf,0x00,0x04, 0x40,0x60,0x02, 0x8a,0x3d,0x05, 0x80,0x0d,0x03, 0x9f,0x3d,0x03, 0x43,0x24,0x03, 0x8a,0x66,0x00, 0xa6,0x6e,0x00, 0x07,0x07,0x05, 0x80,0x10,0x01, 0x8a,0x3a,0x01, 0x00,0x5b,0x00, 0x54,0x01,0x01, 0x61,0x3b,0x01, 27 | 0x50,0x3e,0x01, 0x1b,0x3f,0x03, 0x0f,0x04,0x02, 0x0a,0x0d,0x02, 0x80,0x13,0x00, 0x9b,0x18,0x00, 0x16,0x1e,0x02, 0x8b,0x27,0x00, 0xa5,0x32,0x00, 0x07,0x08,0x01, 0x12,0x0b,0x01, 0x04,0x0d,0x01, 0x17,0x11,0x01, 0x4f,0x18,0x00, 0x41,0x1e,0x00, 0x43,0x22,0x00, 28 | 0x4d,0x2e,0x00, 0x4f,0x2e,0x00, 0x4c,0x3b,0x00, 0x12,0x3f,0x01, 0x14,0x00,0x00, 0x16,0x01,0x00, 0x26,0x01,0x00, 0x0f,0x05,0x00, 0x2f,0x05,0x00, 0x07,0x09,0x00, 0x0b,0x0b,0x00, 0x0a,0x0c,0x00, 0x15,0x0c,0x00, 0x17,0x0d,0x00, 0x04,0x0e,0x00, 0x0c,0x0e,0x00, 29 | 0x18,0x0e,0x00, 0x09,0x0f,0x00, 0x02,0x10,0x00, 0x07,0x10,0x00, 0x06,0x11,0x00, 0x05,0x12,0x00, 0x04,0x14,0x00, 0x08,0x14,0x00, 0x0a,0x15,0x00, 0x0e,0x15,0x00, 0x1a,0x15,0x00, 0x09,0x18,0x00, 0x0c,0x18,0x00, 0x0d,0x1b,0x00, 0x16,0x1b,0x00, 0x04,0x1d,0x00, 30 | 0x13,0x1e,0x00, 0x08,0x21,0x00, 0x14,0x21,0x00, 0x16,0x21,0x00, 0x0a,0x22,0x00, 0x15,0x22,0x00, 0x04,0x23,0x00, 0x0d,0x23,0x00, 0x13,0x23,0x00, 0x07,0x25,0x00, 0x10,0x26,0x00, 0x0f,0x29,0x00, 0x10,0x2a,0x00, 0x0e,0x2b,0x00, 0x24,0x34,0x00, 0x0d,0x37,0x00, 31 | 0x0a,0x39,0x00, 0x22,0x3a,0x00, 0x0d,0x3c,0x00, 0x1e,0x3e,0x00, 0xe7,0x2c,0x48, 0x17,0x40,0x18, 0x8c,0x29,0x23, 0x29,0xa0,0x06, 0x2a,0x45,0x05, 0x13,0x44,0x05, 0x2e,0x97,0x01, 0x0e,0x28,0x11, 0x51,0x26,0x04, 0xab,0x1d,0x02, 0xe7,0x25,0x01, 0x15,0x42,0x05, 32 | 0x24,0x05,0x05, 0x6d,0x0a,0x02, 0x07,0x2b,0x04, 0x44,0x04,0x01, 0xef,0x13,0x00, 0x92,0x05,0x07, 0x27,0x06,0x02, 0xaf,0x0c,0x00, 0x92,0x0d,0x00, 0xad,0x1a,0x00, 0x12,0x25,0x02, 0x10,0x27,0x07, 0x16,0x81,0x01, 0x94,0x03,0x08, 0x41,0x00,0x00, 0x6a,0x14,0x00, 33 | 0x64,0x1d,0x00, 0x61,0x23,0x00, 0x68,0x23,0x00, 0x66,0x27,0x00, 0x0a,0x2a,0x01, 0x02,0x03,0x00, 0x0a,0x03,0x00, 0x08,0x04,0x00, 0x11,0x06,0x00, 0x29,0x07,0x00, 0x2c,0x0a,0x00, 0x2e,0x0c,0x00, 0x02,0x0f,0x00, 0x01,0x10,0x00, 0x00,0x12,0x00, 0x13,0x12,0x00, 34 | 0x29,0x12,0x00, 0x28,0x15,0x00, 0x29,0x17,0x00, 0x03,0x18,0x00, 0x28,0x19,0x00, 0x26,0x1a,0x00, 0x27,0x1b,0x00, 0x26,0x1c,0x00, 0x2c,0x1c,0x00, 0x25,0x1e,0x00, 0x2a,0x1f,0x00, 0x23,0x20,0x00, 0x24,0x21,0x00, 0x23,0x23,0x00, 0x13,0x24,0x00, 0x22,0x24,0x00, 35 | 0x25,0x28,0x00, 0xc0,0x2c,0x6f, 36 | }; 37 | 38 | const unsigned short fontmario1_CharOffs[5] PROGMEM = { 39 | 0x0000, 0x0045, 0x00ae, 0x0105, 0x0142, 40 | }; 41 | 42 | RRE_Font rre_mario1 = { RRE_24B, 48,64, 0x20, 0x23, (const uint8_t*)fontmario1_Rects, (const uint16_t*)fontmario1_CharOffs }; 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/ILI9163C_Mario_RRE.ino: -------------------------------------------------------------------------------- 1 | // ILI9163C library example 2 | // (c) 2019 Pawel A. Hernik 3 | 4 | // requires RRE Font library: 5 | // https://github.com/cbm80amiga/RREFont 6 | 7 | /* 8 | Pinout (header on the top, from left): 9 | LED -> 3.3V 10 | SCK -> D13 11 | SDA -> D11/MOSI 12 | A0/DC -> D8 or any digital 13 | RESET -> D9 or any digital 14 | CS -> D10 or any digital 15 | GND -> GND 16 | VCC -> 3.3V 17 | */ 18 | 19 | #define SCR_WD 128 20 | #define SCR_HT 128 21 | 22 | #define TFT_CS 10 23 | #define TFT_DC 8 24 | #define TFT_RST 9 25 | #include 26 | #include 27 | #include 28 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 29 | 30 | #include "RREFont.h" 31 | 32 | #include "rre_mario0.h" 33 | #include "rre_mario1.h" 34 | #include "rre_mario2.h" 35 | #include "rre_mario3.h" 36 | #include "rre_mario4.h" 37 | #include "rre_mario5.h" 38 | #include "rre_mario6.h" 39 | /* 40 | #include "rre_mario0_v.h" 41 | #include "rre_mario2_v.h" 42 | #include "rre_mario3_v.h" 43 | #include "rre_mario4_v.h" 44 | #include "rre_mario5_v.h" 45 | #include "rre_mario6_v.h" 46 | */ 47 | RREFont font; 48 | 49 | // needed for RREFont library initialization, define your fillRect 50 | void customRect(int x, int y, int w, int h, int c) { return lcd.fillRect(x, y, w, h, c); } 51 | 52 | int sx=64, sy=64,sx0=0, sy0=0; 53 | // special callback with scale&translation feature 54 | void customRectScale(int x, int y, int w, int h, int c) 55 | { 56 | int xx=(x-sx0)*sx>>6, yy=(y-sy0)*sy>>6, ww=((w+x-sx0)*sx>>6)-xx, hh=((h+y-sy0)*sy>>6)-yy; 57 | xx+=sx0; 58 | yy+=sy0; 59 | return lcd.fillRect(xx, yy, ww, hh, c); 60 | } 61 | 62 | void showMarioV() 63 | { 64 | delay(1000); 65 | font.setFont(&rre_mario0); font.setScale(1); font.setSpacing(0); 66 | font.setColor(RGBto565(15,9,8)); 67 | font.printStr(0,0," "); 68 | delay(1000); 69 | font.setFont(&rre_mario2); font.setScale(1); font.setSpacing(0); 70 | font.setColor(RGBto565(113,59,29)); 71 | font.printStr(0,0," "); 72 | delay(1000); 73 | font.setFont(&rre_mario3); font.setScale(1); font.setSpacing(0); 74 | font.setColor(RGBto565(253,212,133)); 75 | font.printStr(0,0," "); 76 | delay(1000); 77 | font.setFont(&rre_mario4); font.setScale(1); font.setSpacing(0); 78 | font.setColor(RGBto565(237,53,15)); 79 | font.printStr(0,0," "); 80 | delay(1000); 81 | font.setFont(&rre_mario5); font.setScale(1); font.setSpacing(0); 82 | font.setColor(RGBto565(249,249,248)); 83 | font.printStr(0,0," "); 84 | delay(1000); 85 | font.setFont(&rre_mario6); font.setScale(1); font.setSpacing(0); 86 | font.setColor(RGBto565(9,69,163)); 87 | font.printStr(0,0," "); 88 | } 89 | 90 | uint16_t bg=RGBto565(157,156,154); 91 | int del=0; 92 | 93 | void showMario(int x, int y) 94 | { 95 | font.setFont(&rre_mario1); font.setScale(1); 96 | font.setColor(bg); 97 | font.printStr(x,y," "); font.printStr(x+48,y,"!"); font.printStr(x,y+64,"\""); font.printStr(x+48,y+64,"#"); 98 | delay(del); 99 | font.setFont(&rre_mario0); font.setScale(1); 100 | font.setColor(RGBto565(15,9,8)); 101 | font.printStr(x,y," "); font.printStr(x+48,y,"!"); font.printStr(x,y+64,"\""); font.printStr(x+48,y+64,"#"); 102 | delay(del); 103 | font.setFont(&rre_mario2); font.setScale(1); 104 | font.setColor(RGBto565(113,59,29)); 105 | font.printStr(x,y," "); font.printStr(x+48,y,"!"); font.printStr(x,y+64,"\""); font.printStr(x+48,y+64,"#"); 106 | delay(del); 107 | font.setFont(&rre_mario3); font.setScale(1); 108 | font.setColor(RGBto565(253,212,133)); 109 | font.printStr(x,y," "); font.printStr(x+48,y,"!"); font.printStr(x,y+64,"\""); font.printStr(x+48,y+64,"#"); 110 | delay(del); 111 | font.setFont(&rre_mario4); font.setScale(1); 112 | font.setColor(RGBto565(237,53,15)); 113 | font.printStr(x,y," "); font.printStr(x+48,y,"!"); font.printStr(x,y+64,"\""); font.printStr(x+48,y+64,"#"); 114 | delay(del); 115 | font.setFont(&rre_mario5); font.setScale(1); 116 | font.setColor(RGBto565(249,249,248)); 117 | font.printStr(x,y," "); font.printStr(x+48,y,"!"); font.printStr(x,y+64,"\""); font.printStr(x+48,y+64,"#"); 118 | delay(del); 119 | font.setFont(&rre_mario6); font.setScale(1); 120 | font.setColor(RGBto565(9,69,163)); 121 | font.printStr(x,y," "); font.printStr(x+48,y,"!"); font.printStr(x,y+64,"\""); font.printStr(x+48,y+64,"#"); 122 | } 123 | 124 | 125 | void setup() 126 | { 127 | Serial.begin(9600); 128 | lcd.init(); 129 | lcd.fillScreen(bg); // c1 130 | // font.init(customRect, SCR_WD, SCR_HT); // custom fillRect function and screen width and height values 131 | font.init(customRectScale, SCR_WD, SCR_HT); // custom fillRect function and screen width and height values 132 | 133 | del=0; 134 | showMario(16,0); 135 | delay(2000); 136 | lcd.fillScreen(bg); // c1 137 | del=1000; 138 | showMario(16,0); 139 | del=0; 140 | delay(2000); 141 | } 142 | 143 | 144 | void loop() 145 | { 146 | lcd.fillScreen(bg); // c1 147 | for(int j=0;j<4;j++) { 148 | sx0=64; sy0=64; 149 | for(int i=64;i>8;i-=2) { 150 | if(j==2) { sx=64;sy=i; } else 151 | if(j==3) { sx=i;sy=64; } else { sx=i;sy=i; } 152 | showMario(16,0); 153 | int w=96*i>>6; 154 | int h=128*i>>6; 155 | if(j<2) { 156 | lcd.fillRect(64-(48*i>>6), 64-(64*i>>6), w,2, bg); 157 | lcd.fillRect(64-(48*i>>6), 64+(64*i>>6)-2, w,2, bg); 158 | lcd.fillRect(64-(48*i>>6)-1, 64-(64*i>>6), 2,h, bg); 159 | lcd.fillRect(64+(48*i>>6)-2, 64-(64*i>>6), 2,h, bg); 160 | } else 161 | if(j==2) { 162 | lcd.fillRect(16, 64-(64*i>>6), 96,2, bg); 163 | lcd.fillRect(16, 64+(64*i>>6)-2, 96,2, bg); 164 | } else 165 | if(j==3) { 166 | lcd.fillRect(64-(48*i>>6)-1, 0, 2,128, bg); 167 | lcd.fillRect(64+(48*i>>6)-2, 0, 2,128, bg); 168 | } 169 | } 170 | for(int i=8;i<=64;i+=2) { 171 | if(j==2) { sx=64;sy=i; } else 172 | if(j==3) { sx=i;sy=64; } else { sx=i;sy=i; } 173 | showMario(16,0); 174 | } 175 | } 176 | for(int j=0;j<200;j++) { 177 | sx=sy=random(8,64); 178 | sx0=sy0=0; 179 | showMario(random(0,128),random(0,128)); 180 | } 181 | } 182 | 183 | -------------------------------------------------------------------------------- /examples/ILI9163C_HWMonitor/ILI9163C_HWMonitor.ino: -------------------------------------------------------------------------------- 1 | // Arduino HWMonitor - version with 4 separate graphs 2 | // ILI9163C & RRE library required 3 | // (c) 2019 Pawel A. Hernik 4 | // YT video: https://youtu.be/dp_P0gZkbL0 5 | 6 | /* 7 | Pinout (header on the top, from left): 8 | LED -> 3.3V 9 | SCK -> D13 10 | SDA -> D11/MOSI 11 | A0/DC -> D8 or any digital 12 | RESET -> D9 or any digital 13 | CS -> D10 or any digital 14 | GND -> GND 15 | VCC -> 3.3V 16 | */ 17 | 18 | #define SCR_WD 128 19 | #define SCR_HT 128 20 | 21 | #define TFT_CS 10 22 | #define TFT_DC 8 23 | #define TFT_RST 9 24 | #include 25 | #include 26 | #include 27 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 28 | 29 | #include "RREFont.h" 30 | #include "rre_5x8.h" 31 | 32 | RREFont font; 33 | 34 | // needed for RREFont library initialization, define your fillRect 35 | void customRect(int x, int y, int w, int h, int c) { return lcd.fillRect(x, y, w, h, c); } 36 | 37 | // --------------------------------------------- 38 | // Configuration 39 | // --------------------------------------------- 40 | #define MIN_RAM 3000 41 | #define MAX_RAM 8192 42 | #define MIN_CLOCK 400 43 | #define MAX_CLOCK 2900 44 | #define MIN_TEMP 30 45 | #define MAX_TEMP 80 46 | // define for vertical bars instead of connecting lines 47 | #define GRAPH_BAR 48 | 49 | // dark theme 50 | uint16_t bgCol = BLACK; 51 | uint16_t txtCol = CYAN; 52 | uint16_t frBgCol = RGBto565(0,0,100); 53 | uint16_t frCol = WHITE; 54 | uint16_t valCol = WHITE; 55 | /* 56 | // bright theme 57 | uint16_t bgCol = RGBto565(200,200,200); 58 | uint16_t txtCol = RGBto565(0,0,220); 59 | uint16_t frBgCol = RGBto565(240,240,240); 60 | uint16_t frCol = BLACK; 61 | uint16_t valCol = BLACK; 62 | */ 63 | // --------------------------------------------- 64 | 65 | String inputString = ""; 66 | String cpuLoadString; 67 | String cpuTempString; 68 | String cpuClockString; 69 | String ramString; 70 | char buf[30]; 71 | int cpuLoad; 72 | int cpuClock; 73 | int cpuTemp; 74 | int usedRam; 75 | int inp=0; 76 | 77 | #define NUM_VAL (12+1) 78 | int tempTab[NUM_VAL]; 79 | int loadTab[NUM_VAL]; 80 | int clockTab[NUM_VAL]; 81 | int ramTab[NUM_VAL]; 82 | int i,v,ght=60-8-2; 83 | 84 | 85 | void setup() 86 | { 87 | Serial.begin(9600); 88 | lcd.init(); 89 | lcd.fillScreen(bgCol); 90 | font.init(customRect, SCR_WD, SCR_HT); // custom fillRect function and screen width and height values 91 | font.setFont(&rre_5x8); 92 | font.setColor(txtCol); 93 | font.setScale(2); 94 | font.printStr(ALIGN_CENTER, 40, "Connecting"); 95 | font.setScale(1); 96 | } 97 | 98 | int readSerial() 99 | { 100 | while (Serial.available()) { 101 | char ch = (char)Serial.read(); 102 | inputString += ch; 103 | 104 | if(ch == '|') { // full info chunk received 105 | int st,en; 106 | st = inputString.indexOf("CHC"); // CPU clock: "CHC1768" 107 | if(st>=0) { 108 | en = inputString.indexOf("|", st); 109 | cpuClockString = inputString.substring(st+3, en); 110 | cpuClock = cpuClockString.toInt(); 111 | inp=3; 112 | } else { 113 | 114 | st = inputString.indexOf("R"); // used RAM: "R6.9" 115 | if(st>=0) { 116 | en = inputString.indexOf("|", st); 117 | ramString = inputString.substring(st+1 , en-1); 118 | st = ramString.indexOf(","); 119 | if(st>=0) ramString.setCharAt(st,'.'); 120 | usedRam = ramString.toFloat()*1024; 121 | inp=2; 122 | } 123 | 124 | int cpuTempStart = inputString.indexOf("C"); // CPU temperature: "C52" 125 | int cpuLoadStart = inputString.indexOf("c"); // CPU load: "c18%" 126 | if(cpuLoadStart>=0 && cpuTempStart>=0) { 127 | en = inputString.indexOf("|"); 128 | cpuTempString = inputString.substring(cpuTempStart+1, cpuLoadStart); 129 | cpuLoadString = inputString.substring(cpuLoadStart+1, en-1); 130 | cpuTemp = cpuTempString.toInt(); 131 | cpuLoad = cpuLoadString.toInt(); 132 | inp=1; 133 | } 134 | } 135 | inputString = ""; 136 | return 1; 137 | } 138 | } 139 | return 0; 140 | } 141 | 142 | void addLoad() 143 | { 144 | for(i=0;i1) lcd.drawFastVLine(1+xg+(i-1)*nx, yg+1+ght-valTab[valTab[i-1]=3) { delay(1000); inp=0; } 222 | } 223 | 224 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/rre_mario2.h: -------------------------------------------------------------------------------- 1 | #ifndef __font_mario2_h__ 2 | #define __font_mario2_h__ 3 | 4 | /* 5 | *** Generated by rrefontgen *** 6 | Font: [mario2] 48x64 7 | Total chars: 4 (' ' to '#') 8 | Total rects: 421 * 3 bytes 9 | Total pixels: 2237 (982 overlapping) 10 | Total bytes: 1271 (1263 rects + 8 offs) 11 | Bitmap size: 1536 (48x64 * 4) (+4 opt) 12 | */ 13 | 14 | const unsigned char fontmario2_Rects[1263] PROGMEM = { 15 | 0x9e,0x68,0x02, 0x5d,0x67,0x02, 0xa1,0x2b,0x01, 0x2c,0x6f,0x00, 0xc9,0x29,0x00, 0x16,0x2c,0x03, 0xe4,0x2f,0x00, 0x5b,0x36,0x01, 0x23,0x2d,0x02, 0x8f,0x33,0x00, 0x9f,0xa5,0x00, 0x2d,0x00,0x01, 0x2b,0x0d,0x01, 0x6b,0x11,0x00, 0x53,0x1a,0x00, 0x54,0x23,0x00, 16 | 0x5c,0x29,0x00, 0x2d,0x2d,0x01, 0x25,0x2e,0x01, 0x60,0x2f,0x00, 0x61,0x30,0x00, 0x58,0x31,0x00, 0x62,0x31,0x00, 0x66,0x31,0x00, 0x59,0x33,0x00, 0x16,0x3d,0x01, 0x21,0x6a,0x00, 0x2a,0x01,0x00, 0x27,0x02,0x00, 0x2c,0x04,0x00, 0x22,0x05,0x00, 0x29,0x05,0x00, 17 | 0x21,0x06,0x00, 0x27,0x06,0x00, 0x24,0x08,0x00, 0x23,0x09,0x00, 0x1a,0x0d,0x00, 0x1f,0x0d,0x00, 0x1e,0x0e,0x00, 0x18,0x10,0x00, 0x1c,0x11,0x00, 0x1b,0x12,0x00, 0x2c,0x12,0x00, 0x16,0x13,0x00, 0x1a,0x14,0x00, 0x2c,0x14,0x00, 0x15,0x15,0x00, 0x2d,0x15,0x00, 18 | 0x19,0x16,0x00, 0x2c,0x16,0x00, 0x2e,0x17,0x00, 0x14,0x18,0x00, 0x18,0x18,0x00, 0x29,0x18,0x00, 0x2c,0x18,0x00, 0x27,0x19,0x00, 0x17,0x1a,0x00, 0x26,0x1a,0x00, 0x29,0x1a,0x00, 0x26,0x1c,0x00, 0x16,0x1d,0x00, 0x25,0x1d,0x00, 0x12,0x1e,0x00, 0x24,0x1e,0x00, 19 | 0x23,0x1f,0x00, 0x10,0x20,0x00, 0x15,0x20,0x00, 0x22,0x20,0x00, 0x2d,0x20,0x00, 0x0e,0x21,0x00, 0x21,0x21,0x00, 0x2a,0x21,0x00, 0x0d,0x22,0x00, 0x1e,0x22,0x00, 0x20,0x22,0x00, 0x27,0x22,0x00, 0x2b,0x22,0x00, 0x12,0x23,0x00, 0x1d,0x23,0x00, 0x29,0x23,0x00, 20 | 0x0b,0x24,0x00, 0x10,0x24,0x00, 0x25,0x24,0x00, 0x1c,0x25,0x00, 0x0a,0x26,0x00, 0x1e,0x26,0x00, 0x0d,0x27,0x00, 0x22,0x28,0x00, 0x12,0x2b,0x00, 0x25,0x2b,0x00, 0x23,0x2c,0x00, 0x27,0x2c,0x00, 0x0d,0x2d,0x00, 0x13,0x2d,0x00, 0x1b,0x2d,0x00, 0x0f,0x2e,0x00, 21 | 0x1c,0x2e,0x00, 0x0a,0x2f,0x00, 0x0e,0x2f,0x00, 0x25,0x2f,0x00, 0x10,0x30,0x00, 0x27,0x30,0x00, 0x0b,0x31,0x00, 0x16,0x31,0x00, 0x0c,0x32,0x00, 0x1a,0x32,0x00, 0x1f,0x32,0x00, 0x23,0x32,0x00, 0x1b,0x33,0x00, 0x22,0x34,0x00, 0x24,0x34,0x00, 0x1c,0x35,0x00, 22 | 0x0d,0x38,0x00, 0x10,0x38,0x00, 0x19,0x39,0x00, 0x0f,0x3c,0x00, 0x14,0x3c,0x00, 0x10,0x3d,0x00, 0x1e,0x3d,0x00, 0x21,0x3d,0x00, 0x11,0x3e,0x00, 0x22,0x3e,0x00, 0x1f,0x3f,0x00, 0x2f,0x1f,0x00, 0x8b,0x0e,0x01, 0x41,0x7a,0x00, 0x11,0x34,0x04, 0x19,0x14,0x03, 23 | 0x0c,0x3e,0x03, 0x00,0x03,0x02, 0x21,0x09,0x02, 0x11,0x11,0x02, 0x23,0x17,0x02, 0x8c,0x1e,0x00, 0x08,0x31,0x02, 0x04,0x00,0x01, 0x1b,0x06,0x01, 0x00,0x07,0x01, 0x46,0x07,0x00, 0x48,0x08,0x00, 0x0b,0x0b,0x01, 0x16,0x0d,0x01, 0x4d,0x0f,0x00, 0x0b,0x12,0x01, 24 | 0x19,0x12,0x01, 0x14,0x15,0x01, 0x53,0x1d,0x00, 0x10,0x1f,0x01, 0x11,0x23,0x01, 0x44,0x24,0x00, 0x54,0x3c,0x00, 0x08,0x3e,0x01, 0x08,0x01,0x00, 0x06,0x04,0x00, 0x09,0x06,0x00, 0x0e,0x07,0x00, 0x1f,0x07,0x00, 0x16,0x08,0x00, 0x20,0x08,0x00, 0x0b,0x09,0x00, 25 | 0x0f,0x09,0x00, 0x15,0x09,0x00, 0x09,0x0a,0x00, 0x14,0x0a,0x00, 0x12,0x0b,0x00, 0x1e,0x0b,0x00, 0x1b,0x0c,0x00, 0x20,0x0c,0x00, 0x19,0x0d,0x00, 0x1d,0x0d,0x00, 0x1e,0x0e,0x00, 0x13,0x0f,0x00, 0x2b,0x0f,0x00, 0x1d,0x10,0x00, 0x0a,0x11,0x00, 0x28,0x11,0x00, 26 | 0x08,0x13,0x00, 0x1c,0x13,0x00, 0x01,0x14,0x00, 0x05,0x14,0x00, 0x02,0x15,0x00, 0x29,0x15,0x00, 0x00,0x16,0x00, 0x11,0x16,0x00, 0x20,0x16,0x00, 0x0e,0x17,0x00, 0x0c,0x18,0x00, 0x20,0x18,0x00, 0x24,0x18,0x00, 0x0a,0x19,0x00, 0x28,0x19,0x00, 0x2c,0x19,0x00, 27 | 0x08,0x1a,0x00, 0x0b,0x1a,0x00, 0x1a,0x1a,0x00, 0x06,0x1b,0x00, 0x0f,0x1b,0x00, 0x18,0x1b,0x00, 0x03,0x1d,0x00, 0x01,0x1e,0x00, 0x25,0x1e,0x00, 0x29,0x1f,0x00, 0x14,0x20,0x00, 0x20,0x20,0x00, 0x00,0x21,0x00, 0x1a,0x21,0x00, 0x03,0x22,0x00, 0x1c,0x22,0x00, 28 | 0x19,0x23,0x00, 0x0d,0x24,0x00, 0x0f,0x24,0x00, 0x1e,0x24,0x00, 0x26,0x25,0x00, 0x00,0x26,0x00, 0x0c,0x26,0x00, 0x1d,0x27,0x00, 0x23,0x28,0x00, 0x01,0x29,0x00, 0x02,0x2a,0x00, 0x04,0x2a,0x00, 0x21,0x2a,0x00, 0x1e,0x2b,0x00, 0x02,0x2f,0x00, 0x1d,0x2f,0x00, 29 | 0x04,0x30,0x00, 0x20,0x30,0x00, 0x0c,0x32,0x00, 0x1a,0x32,0x00, 0x0e,0x33,0x00, 0x18,0x33,0x00, 0x1c,0x36,0x00, 0x1b,0x38,0x00, 0x1a,0x3a,0x00, 0x03,0x3d,0x00, 0x12,0x3d,0x00, 0x18,0x3d,0x00, 0x06,0x3e,0x00, 0x11,0x3e,0x00, 0x13,0x3e,0x00, 0x08,0x3f,0x00, 30 | 0x2c,0x11,0x00, 0xd3,0x26,0x4a, 0x9f,0xa6,0x02, 0x51,0xaf,0x0d, 0x19,0x61,0x04, 0x92,0x28,0x4a, 0x60,0xa4,0x02, 0x95,0x65,0x46, 0x1c,0x03,0x06, 0x03,0x56,0x00, 0x1f,0x71,0x00, 0x1a,0x20,0x02, 0x9e,0x21,0x00, 0x8f,0x30,0x00, 0x11,0xed,0x00, 0x6a,0x0f,0x00, 31 | 0x18,0x12,0x01, 0x5c,0x12,0x00, 0x09,0x13,0x01, 0x40,0x16,0x00, 0x4c,0x19,0x00, 0x58,0x23,0x00, 0x51,0x26,0x00, 0x4f,0x27,0x00, 0x66,0x2c,0x00, 0x13,0x3b,0x01, 0x17,0x01,0x00, 0x27,0x02,0x00, 0x29,0x03,0x00, 0x12,0x04,0x00, 0x19,0x04,0x00, 0x2b,0x04,0x00, 32 | 0x10,0x05,0x00, 0x16,0x05,0x00, 0x28,0x05,0x00, 0x29,0x06,0x00, 0x0d,0x07,0x00, 0x13,0x07,0x00, 0x24,0x07,0x00, 0x27,0x07,0x00, 0x09,0x08,0x00, 0x22,0x08,0x00, 0x26,0x08,0x00, 0x2a,0x08,0x00, 0x08,0x09,0x00, 0x13,0x09,0x00, 0x20,0x09,0x00, 0x24,0x09,0x00, 33 | 0x07,0x0a,0x00, 0x1e,0x0a,0x00, 0x22,0x0a,0x00, 0x17,0x0b,0x00, 0x20,0x0b,0x00, 0x1b,0x0c,0x00, 0x06,0x0d,0x00, 0x1a,0x0d,0x00, 0x0b,0x0e,0x00, 0x1e,0x0e,0x00, 0x08,0x0f,0x00, 0x19,0x0f,0x00, 0x1d,0x10,0x00, 0x02,0x11,0x00, 0x29,0x12,0x00, 0x01,0x13,0x00, 34 | 0x04,0x13,0x00, 0x19,0x13,0x00, 0x28,0x13,0x00, 0x0a,0x14,0x00, 0x1d,0x14,0x00, 0x27,0x14,0x00, 0x1f,0x15,0x00, 0x25,0x15,0x00, 0x07,0x16,0x00, 0x0d,0x17,0x00, 0x0f,0x17,0x00, 0x1b,0x17,0x00, 0x00,0x1a,0x00, 0x0e,0x1a,0x00, 0x1b,0x1b,0x00, 0x1a,0x1d,0x00, 35 | 0x19,0x1e,0x00, 0x15,0x20,0x00, 0x03,0x21,0x00, 0x13,0x21,0x00, 0x1f,0x22,0x00, 0x05,0x23,0x00, 0x0c,0x23,0x00, 0x14,0x23,0x00, 0x17,0x24,0x00, 0x08,0x25,0x00, 0x0b,0x26,0x00, 0x0c,0x27,0x00, 0x0b,0x2a,0x00, 0x10,0x2b,0x00, 0x27,0x2b,0x00, 0x0a,0x2d,0x00, 36 | 0x20,0x31,0x00, 0x25,0x31,0x00, 0x24,0x33,0x00, 0x23,0x34,0x00, 0x0a,0x38,0x00, 0x22,0x39,0x00, 0x0e,0x3c,0x00, 0x20,0x3c,0x00, 0x10,0x3d,0x00, 0x1d,0x3e,0x00, 0x14,0x3f,0x00, 0x1a,0x3f,0x00, 0x2d,0x05,0x01, 0x5b,0x0b,0x48, 0x98,0x98,0x07, 0x5a,0x8d,0x0c, 37 | 0x9c,0xca,0x09, 0xd7,0x1d,0x0a, 0x59,0xd6,0x05, 0x5e,0x49,0x44, 0x67,0x4d,0x00, 0x96,0x1f,0x0a, 0xc9,0x12,0x00, 0x99,0x0f,0x00, 0xab,0x10,0x00, 0x43,0x00,0x00, 0x47,0x00,0x00, 0x04,0x02,0x01, 0x4d,0x03,0x00, 0x1d,0x05,0x01, 0x22,0x05,0x01, 0x05,0x07,0x01, 38 | 0x4b,0x09,0x00, 0x66,0x0b,0x00, 0x69,0x10,0x00, 0x56,0x13,0x00, 0x64,0x19,0x00, 0x05,0x2b,0x01, 0x0a,0x00,0x00, 0x16,0x00,0x00, 0x09,0x01,0x00, 0x0e,0x02,0x00, 0x07,0x03,0x00, 0x06,0x05,0x00, 0x1b,0x06,0x00, 0x26,0x06,0x00, 0x09,0x07,0x00, 0x28,0x07,0x00, 39 | 0x0a,0x08,0x00, 0x29,0x08,0x00, 0x05,0x0a,0x00, 0x17,0x0a,0x00, 0x2b,0x0a,0x00, 0x06,0x0b,0x00, 0x2a,0x0e,0x00, 0x07,0x0f,0x00, 0x15,0x0f,0x00, 0x08,0x10,0x00, 0x12,0x10,0x00, 0x00,0x11,0x00, 0x14,0x14,0x00, 0x28,0x14,0x00, 0x00,0x15,0x00, 0x15,0x15,0x00, 40 | 0x2e,0x16,0x00, 0x01,0x17,0x00, 0x27,0x17,0x00, 0x06,0x18,0x00, 0x26,0x19,0x00, 0x2d,0x19,0x00, 0x25,0x1b,0x00, 0x2c,0x1b,0x00, 0x2a,0x1e,0x00, 0x29,0x1f,0x00, 0x17,0x22,0x00, 0x28,0x22,0x00, 0x27,0x24,0x00, 0x16,0x26,0x00, 0x26,0x26,0x00, 0x0f,0x27,0x00, 41 | 0x18,0x27,0x00, 0x24,0x28,0x00, 0x0b,0x29,0x00, 0x09,0x2a,0x00, 0xef,0x0f,0x00, 42 | }; 43 | 44 | const unsigned short fontmario2_CharOffs[5] PROGMEM = { 45 | 0x0000, 0x007c, 0x00f1, 0x015d, 0x01a5, 46 | }; 47 | 48 | RRE_Font rre_mario2 = { RRE_24B, 48,64, 0x20, 0x23, (const uint8_t*)fontmario2_Rects, (const uint16_t*)fontmario2_CharOffs }; 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /examples/ILI9163C_Bitmap/bitmap.h: -------------------------------------------------------------------------------- 1 | // Generated by bmp2src by Pawel A. Hernik 2 | // Generated from: mario24b.bmp 3 | // Dimensions : 32x32x16 (65536 colors) 4 | // Size : 2048 [0x0800] bytes 5 | 6 | const uint16_t mario[] PROGMEM = { 7 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x8430,0x4208,0x18a2, 8 | 0x1861,0x18e3,0x6b4d,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 9 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x9cf3,0x528a,0x2080,0xa1e1,0xf2c1, 10 | 0xd261,0xb221,0x38a0,0x6b4d,0xa514,0x9cf3,0x738e,0x7bcf,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 11 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x9cf3,0x39e7,0x5100,0xf2c1,0xfae2,0xa349, 12 | 0xe69a,0xdd33,0x92a7,0x18a2,0x8c71,0x2965,0x39e7,0x3186,0x3186,0x632c,0x9cf3,0xa514,0xa514,0xa514,0xa514,0xa514, 13 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x52aa,0x40c0,0xf2c2,0xfac2,0xd241,0xde9a, 14 | 0xf246,0xf225,0xc513,0x3060,0x1082,0x6b6d,0x8430,0x8430,0xbdd7,0x4a49,0x39e7,0xa514,0xa514,0xa514,0xa514,0xa514, 15 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x8c51,0x1840,0xe281,0xfaa2,0xfa82,0xda21,0xd618, 16 | 0xec0e,0xac2f,0x8a06,0x80e1,0x88e1,0x80c1,0x60c2,0x3985,0xffdf,0xffdf,0x2124,0x8c71,0xa514,0xa514,0xa514,0xa514, 17 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x39c7,0x8941,0xfa41,0xfa41,0xf221,0xe1e1,0x69a5, 18 | 0x9163,0xd981,0xf181,0xe161,0x88c1,0x4860,0x2020,0x0800,0xad55,0xdefb,0x4a49,0x7bef,0xa514,0xa514,0xa514,0xa514, 19 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x94b2,0x1040,0xe9e1,0xf1e1,0xf1e1,0xb141,0x78a1,0xd921, 20 | 0xe941,0xd941,0x8983,0x62a7,0x0000,0x0000,0x4228,0xd6ba,0xc638,0xef5d,0x10a2,0x9492,0xa514,0xa514,0xa514,0xa514, 21 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x6b6d,0x68a0,0xf1a1,0xf1a1,0x9901,0xa0a1,0xd901,0xd901, 22 | 0x9963,0xa42b,0xfeb1,0x5a86,0x39a4,0xe71c,0xffff,0xf7be,0xffdf,0x632c,0x4208,0xa514,0xa514,0xa514,0xa514,0xa514, 23 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x52aa,0x1061,0xb101,0xf161,0xa901,0x7081,0xa0c1,0x91c4,0xac2a, 24 | 0x5a66,0xfed1,0xfed2,0x2943,0x3163,0x5aa8,0x5aeb,0xad75,0x94b2,0x1082,0x9cd3,0xa514,0xa514,0xa514,0xa514,0xa514, 25 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x6b6d,0x4860,0xc901,0xe941,0xe141,0x40a0,0x7307,0xddef,0xfed2,0xfed2, 26 | 0x1081,0xcd8e,0xf691,0xbd0d,0xfed1,0xfe90,0xedee,0x39a5,0x18c3,0x4a69,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 27 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x4208,0xa8a1,0xd0e1,0xb0e1,0x6880,0x6101,0x4962,0xddef,0xfed2,0xfed2, 28 | 0x8ba9,0xddcf,0xfeb1,0xfed2,0xfed2,0xfeb1,0xfe4f,0x8368,0x52aa,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 29 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x4a69,0x7080,0x6225,0xcd4d,0xc52d,0x4942,0x48c0,0x30a1,0xf670,0x8369, 30 | 0xd58e,0xfed2,0xfed2,0xfed2,0xfeb1,0xfe90,0xfe4f,0x7b28,0x738e,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 31 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x9492,0x1082,0xf62f,0xedce,0xa46b,0xbd0d,0x38e1,0x6266,0xfe90,0x28a1, 32 | 0x1840,0x3963,0x6286,0xd58e,0xfe90,0xfe4f,0xac6b,0x18c2,0x94b2,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 33 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x3165,0xfe4f,0xfe4f,0xac8b,0xddcf,0xee30,0xf691,0xfe91,0x7285, 34 | 0x2040,0x3880,0x4080,0x2860,0x30e1,0x1881,0x0000,0x7bcf,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 35 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x528a,0x9c0a,0xf62f,0xc52d,0xfeb1,0xfed2,0xfed2,0xfed2,0xfe70, 36 | 0x51e4,0x2860,0x2860,0x3880,0x2860,0x1020,0x3186,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 37 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x9cf3,0x31a6,0x41c4,0x7328,0x6aa6,0x7b28,0xfed2,0xfed2,0xfed1, 38 | 0x82a6,0x5060,0x3061,0x49c4,0x5080,0x1061,0x8c71,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 39 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x9cf3,0x4228,0x0000,0x2020,0x1820,0x4a05,0xe5ef,0xfe4f, 40 | 0x9b68,0x78c1,0x93e9,0x79c4,0x3040,0x6b6d,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 41 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x9cf3,0x7bef,0x20e3,0x7881,0xd0e1,0xe921,0xf141,0x5880,0x40a2,0x5aca, 42 | 0x7b28,0x7245,0x28c4,0x0841,0x4a69,0xa514,0x8430,0x39e7,0x31a6,0x5aeb,0x9cf3,0xa514,0xa514,0xa514,0xa514,0xa514, 43 | 0xa514,0xa514,0xa514,0xa514,0xa514,0x9492,0x2104,0x4228,0x59c6,0x8881,0xe101,0xb0e1,0x7080,0xc101,0xa8e1,0x0a33, 44 | 0x09d0,0xa102,0x88c1,0x014b,0x0862,0x4208,0x1061,0x5961,0x6181,0x28a0,0x3186,0x9492,0xa514,0xa514,0xa514,0xa514, 45 | 0xa514,0xa514,0xa514,0xa514,0x9cf3,0x4208,0x630c,0xe73c,0xffff,0xd6ba,0x5124,0x5060,0xd0c1,0xe101,0xa8e1,0x0a12, 46 | 0x1a2f,0x3a4a,0x09f1,0x0a55,0x4aca,0x2920,0x4100,0x8201,0x8a02,0x8202,0x10a2,0x2945,0xa514,0xa514,0xa514,0xa514, 47 | 0xa514,0xa514,0xa514,0xa514,0x52aa,0x8430,0xe73c,0xffff,0xffff,0xf7be,0x5acb,0xa8c1,0xd0a1,0xe101,0x60e4,0x09af, 48 | 0xd62a,0xfec5,0x42a9,0x0a55,0x324a,0x8382,0x5121,0x81c1,0x81e1,0x79c1,0x73ae,0x1082,0xa514,0xa514,0xa514,0xa514, 49 | 0xa514,0xa514,0xa514,0xa514,0x2124,0xdedb,0x7bcf,0xa534,0xffff,0xffdf,0xa534,0x30a5,0x68a3,0x48c5,0x09f1,0x09af, 50 | 0xcd84,0xf644,0x3a69,0x0a55,0x09f1,0x2962,0x5120,0x79c1,0x81c1,0x5961,0x7bcf,0x31a6,0xa514,0xa514,0xa514,0xa514, 51 | 0xa514,0xa514,0xa514,0xa514,0x2945,0xef7d,0xef5d,0x73ae,0xffff,0xef5d,0xd69a,0x012b,0x0a34,0x0a55,0x0a55,0x0a55, 52 | 0x11cc,0x2a09,0x0a33,0x0a55,0x0a55,0x0041,0x6961,0x7181,0x79c1,0x7b4b,0x18e3,0x738e,0xa514,0xa514,0xa514,0xa514, 53 | 0xa514,0xa514,0xa514,0xa514,0x39e7,0xc618,0xffdf,0xf7be,0xe71c,0x528a,0x630c,0x00c9,0x01f3,0x0a34,0x0a54,0x0a55, 54 | 0x0a55,0x0a55,0x0a55,0x0a55,0x09ae,0x1840,0x6140,0x6940,0x5121,0x5acb,0x3186,0xa514,0xa514,0xa514,0xa514,0xa514, 55 | 0xa514,0xa514,0xa514,0xa514,0x8c71,0x2104,0x94b2,0xdefb,0xd69a,0x4a49,0x4900,0x48e0,0x0085,0x0190,0x01f3,0x01f3, 56 | 0x0214,0x0214,0x0214,0x0a12,0x0042,0x2060,0x6141,0x6140,0x730b,0x10a2,0x8c51,0xa514,0xa514,0xa514,0xa514,0xa514, 57 | 0xa514,0xa514,0xa514,0xa514,0xa514,0x94b2,0x528a,0x0861,0x3144,0x5120,0x6140,0x40c0,0x5100,0x012b,0x01f3,0x01f3, 58 | 0x01f3,0x01f2,0x014c,0x0062,0x630c,0x4a49,0x0020,0x0020,0x10a2,0x2965,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 59 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x8c71,0x39c7,0x6a46,0x79a1,0x7181,0x5100,0x4900,0x0841,0x0042,0x0063, 60 | 0x0042,0x10a2,0x4228,0x8c71,0xa514,0xa514,0x9cf3,0x9cf3,0x7bef,0x9cd3,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 61 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x5aeb,0x8430,0x5941,0x79a1,0x79a1,0x6981,0x4900,0x4228,0x9cf3,0x94b2, 62 | 0x9cd3,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 63 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x4a49,0x94b2,0x6981,0x81c1,0x81c1,0x79a1,0x1860,0x6b6d,0xa514,0xa514, 64 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 65 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x4a49,0x8410,0x71c1,0x8a02,0x8201,0x71a1,0x2124,0xa514,0xa514,0xa514, 66 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 67 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x8410,0x18e3,0x4101,0x8a22,0x8a22,0x30c0,0x4a69,0xa514,0xa514,0xa514, 68 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 69 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0x94b2,0x4208,0x1061,0x1082,0x4a49,0x9cf3,0xa514,0xa514,0xa514, 70 | 0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514,0xa514, 71 | }; 72 | 73 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/rre_mario0.h: -------------------------------------------------------------------------------- 1 | #ifndef __font_mario0_h__ 2 | #define __font_mario0_h__ 3 | 4 | /* 5 | *** Generated by rrefontgen *** 6 | Font: [mario0] 48x64 7 | Total chars: 4 (' ' to '#') 8 | Total rects: 456 * 3 bytes 9 | Total pixels: 3519 (742 overlapping) 10 | Total bytes: 1376 (1368 rects + 8 offs) 11 | Bitmap size: 1536 (48x64 * 4) (+4 opt) 12 | */ 13 | 14 | const unsigned char fontmario0_Rects[1368] PROGMEM = { 15 | 0xcb,0xa5,0x01, 0x53,0x3e,0x0b, 0x68,0x02,0x07, 0xcd,0x70,0x01, 0x95,0x56,0x01, 0x93,0x5c,0x01, 0x5e,0x23,0x06, 0xdb,0x0c,0x02, 0xd7,0x12,0x02, 0x64,0x04,0x04, 0x13,0x2b,0x09, 0xa0,0x07,0x02, 0x8f,0x21,0x02, 0xde,0x09,0x01, 0xca,0x67,0x00, 0x99,0x0f,0x02, 16 | 0x8c,0x23,0x02, 0x0e,0x76,0x01, 0x62,0x06,0x03, 0xa2,0x2e,0x01, 0x90,0x3a,0x01, 0xda,0x29,0x01, 0xd6,0x14,0x02, 0x94,0x59,0x01, 0x2b,0x01,0x04, 0x11,0x2c,0x04, 0x21,0x33,0x04, 0x11,0x3d,0x04, 0x66,0x03,0x05, 0x6e,0x15,0x01, 0xd2,0x1f,0x00, 0x25,0x23,0x03, 17 | 0x60,0x26,0x01, 0x5b,0x27,0x01, 0x50,0x2d,0x01, 0xcf,0x2f,0x00, 0x5f,0x3d,0x01, 0x20,0x3f,0x03, 0x5d,0x0a,0x03, 0xab,0x0e,0x00, 0x2b,0x17,0x02, 0x28,0x19,0x02, 0x25,0x1b,0x02, 0x2b,0x21,0x02, 0x28,0x22,0x02, 0x93,0x23,0x00, 0x9d,0x24,0x00, 0x24,0x2c,0x02, 18 | 0x9d,0x2d,0x00, 0xa7,0x2d,0x00, 0xa5,0x30,0x00, 0xd2,0x3b,0x00, 0x5a,0x4e,0x00, 0xcc,0x2e,0x01, 0x6c,0x0b,0x00, 0x57,0x18,0x00, 0x2a,0x18,0x01, 0x27,0x1a,0x01, 0x24,0x1c,0x01, 0x23,0x1d,0x01, 0x22,0x1e,0x01, 0x21,0x1f,0x01, 0x20,0x20,0x01, 0x2e,0x20,0x01, 19 | 0x1f,0x21,0x01, 0x61,0x28,0x00, 0x62,0x29,0x00, 0x63,0x2a,0x00, 0x5c,0x2c,0x00, 0x5e,0x2f,0x00, 0x66,0x2f,0x00, 0x5f,0x30,0x00, 0x60,0x31,0x00, 0x5a,0x33,0x00, 0x5b,0x34,0x00, 0x2e,0x36,0x01, 0xe3,0x05,0x00, 0x5c,0x4b,0x00, 0x8e,0x22,0x01, 0x8f,0x39,0x01, 20 | 0x9f,0x08,0x02, 0x2f,0x00,0x00, 0x26,0x06,0x00, 0x2f,0x08,0x00, 0x2e,0x09,0x00, 0x2d,0x0a,0x00, 0x1e,0x0d,0x00, 0x18,0x11,0x00, 0x2c,0x13,0x00, 0x2d,0x14,0x00, 0x2d,0x16,0x00, 0x11,0x20,0x00, 0x1f,0x22,0x00, 0x1e,0x25,0x00, 0x20,0x25,0x00, 0x0d,0x26,0x00, 21 | 0x1c,0x26,0x00, 0x24,0x2b,0x00, 0x12,0x2d,0x00, 0x26,0x2d,0x00, 0x24,0x2e,0x00, 0x10,0x2f,0x00, 0x21,0x2f,0x00, 0x17,0x31,0x00, 0x23,0x31,0x00, 0x19,0x32,0x00, 0x21,0x32,0x00, 0x23,0x34,0x00, 0x2f,0x37,0x00, 0x1b,0x38,0x00, 0x1a,0x39,0x00, 0x13,0x3c,0x00, 22 | 0x21,0x3e,0x00, 0xed,0x6e,0x02, 0x82,0x75,0x17, 0xcf,0x17,0x0a, 0x40,0x72,0x0b, 0x44,0xb4,0x0c, 0x96,0x15,0x09, 0xea,0x90,0x01, 0x9f,0xa5,0x01, 0x98,0x07,0x06, 0xce,0x0d,0x04, 0x4d,0x5e,0x02, 0x64,0x5f,0x02, 0x41,0x63,0x02, 0x40,0x01,0x07, 0x52,0x21,0x07, 23 | 0xa1,0x0a,0x04, 0x9e,0x25,0x06, 0x54,0x10,0x06, 0x95,0x0a,0x03, 0x8d,0x48,0x01, 0x19,0x73,0x02, 0x28,0x5a,0x01, 0x50,0x1b,0x04, 0x9e,0x6c,0x01, 0x88,0x03,0x02, 0xa6,0x0c,0x02, 0x95,0x3c,0x02, 0xa9,0x4e,0x01, 0x01,0xb1,0x06, 0xcb,0x05,0x01, 0x5b,0x11,0x03, 24 | 0xdc,0x31,0x01, 0xe6,0x1d,0x02, 0x4d,0x18,0x0e, 0x93,0x0b,0x02, 0x43,0x02,0x06, 0x52,0x56,0x05, 0x9f,0x09,0x01, 0x0b,0x11,0x05, 0x5d,0x13,0x02, 0x5b,0x23,0x02, 0xc0,0x22,0x02, 0xc2,0x26,0x02, 0xe9,0x56,0x01, 0x80,0x2f,0x01, 0xc2,0xf0,0x00, 0x56,0x74,0x04, 25 | 0x00,0x00,0x03, 0x02,0x07,0x03, 0x07,0x12,0x03, 0x04,0x13,0x03, 0x61,0x17,0x01, 0x51,0x1d,0x01, 0x52,0x1f,0x01, 0xd0,0x20,0x00, 0x13,0x3f,0x03, 0x4a,0x06,0x03, 0x5e,0x28,0x03, 0x11,0x0c,0x09, 0xa4,0x0b,0x03, 0xe3,0x23,0x02, 0x03,0x3c,0x10, 0x8f,0x0a,0x00, 26 | 0x1a,0x0d,0x02, 0x02,0x14,0x02, 0x07,0x1b,0x02, 0x05,0x1c,0x02, 0x21,0x20,0x02, 0x5a,0x22,0x01, 0x56,0x09,0x03, 0xe8,0x0d,0x01, 0x9d,0x08,0x02, 0x4c,0x09,0x00, 0x4a,0x0a,0x00, 0x4b,0x0c,0x00, 0x1c,0x0e,0x01, 0x1d,0x0f,0x01, 0x00,0x15,0x01, 0x1c,0x18,0x01, 27 | 0x0b,0x19,0x01, 0x09,0x1a,0x01, 0x04,0x1d,0x01, 0x0d,0x1d,0x01, 0x02,0x1e,0x01, 0x00,0x1f,0x01, 0x1e,0x20,0x01, 0x01,0x21,0x01, 0x1c,0x25,0x01, 0x0c,0x33,0x01, 0x47,0x3e,0x00, 0x0a,0x3e,0x01, 0x50,0x3e,0x00, 0x09,0x3f,0x01, 0x07,0x04,0x04, 0x22,0x64,0x00, 28 | 0x67,0x5c,0x00, 0xdd,0x30,0x01, 0xdb,0x32,0x01, 0x00,0x08,0x00, 0x07,0x08,0x00, 0x17,0x08,0x00, 0x09,0x09,0x00, 0x13,0x0e,0x00, 0x27,0x0f,0x00, 0x13,0x10,0x00, 0x1e,0x10,0x00, 0x20,0x17,0x00, 0x23,0x18,0x00, 0x11,0x22,0x00, 0x0e,0x24,0x00, 0x0d,0x25,0x00, 29 | 0x1d,0x26,0x00, 0x03,0x2a,0x00, 0x1e,0x2a,0x00, 0x03,0x30,0x00, 0x18,0x3c,0x00, 0x11,0x3d,0x00, 0x14,0x3e,0x00, 0x0f,0x3f,0x00, 0xac,0x52,0x00, 0x98,0x00,0x0c, 0x23,0x22,0x41, 0x92,0x3c,0x0a, 0x8b,0xeb,0x01, 0x8a,0x08,0x07, 0x49,0x24,0x0b, 0xa0,0x72,0x02, 30 | 0x41,0x94,0x01, 0x4f,0xb3,0x01, 0x9a,0x4e,0x01, 0x2b,0xc5,0x00, 0x13,0x1f,0x0c, 0xc7,0x0b,0x02, 0xa5,0x28,0x05, 0x9c,0x94,0x00, 0x9e,0xa4,0x00, 0x54,0x03,0x04, 0x1e,0x16,0x09, 0x0d,0x66,0x01, 0x4a,0xae,0x00, 0x84,0x20,0x02, 0xa0,0x21,0x02, 0x9e,0x39,0x02, 31 | 0x65,0x03,0x03, 0x51,0x05,0x03, 0xdc,0x0c,0x01, 0xef,0x50,0x00, 0x87,0x22,0x02, 0x90,0x6c,0x00, 0x02,0x5b,0x01, 0x65,0xa7,0x00, 0x85,0x0e,0x01, 0x83,0x10,0x01, 0x88,0x15,0x01, 0x97,0x20,0x01, 0x8d,0x39,0x01, 0x4f,0x06,0x03, 0xdd,0x3a,0x01, 0x4c,0x68,0x01, 32 | 0x08,0x0a,0x0d, 0x2c,0x4a,0x00, 0x1d,0x58,0x00, 0x11,0x68,0x00, 0x15,0x3f,0x04, 0x2a,0x06,0x05, 0xc2,0x12,0x01, 0x56,0x02,0x05, 0x62,0x6e,0x01, 0x1f,0x76,0x02, 0x69,0x04,0x01, 0x66,0x05,0x01, 0xce,0x16,0x00, 0x21,0x17,0x03, 0x54,0x1d,0x01, 0x1d,0x20,0x03, 33 | 0x55,0x23,0x01, 0xd1,0x3a,0x00, 0x9d,0x0b,0x01, 0x63,0x02,0x03, 0x15,0x00,0x02, 0x23,0x08,0x02, 0x21,0x09,0x02, 0x1f,0x0a,0x02, 0x14,0x0b,0x02, 0x16,0x0c,0x02, 0xaa,0x11,0x00, 0x26,0x15,0x02, 0x8d,0x18,0x00, 0x9b,0x1c,0x00, 0x9f,0x23,0x00, 0x1b,0x15,0x03, 34 | 0x47,0x17,0x01, 0x83,0x1e,0x01, 0x06,0x23,0x05, 0x1b,0x4d,0x01, 0x25,0x07,0x01, 0x18,0x0d,0x01, 0x69,0x13,0x00, 0x6e,0x13,0x00, 0x4f,0x15,0x00, 0x40,0x18,0x00, 0x15,0x1c,0x01, 0x13,0x20,0x01, 0x65,0x24,0x00, 0x52,0x26,0x00, 0x04,0x0f,0x03, 0x1a,0x1e,0x03, 35 | 0x16,0x20,0x03, 0x56,0x22,0x01, 0x0c,0x26,0x03, 0x26,0x67,0x00, 0x53,0x04,0x02, 0x89,0x09,0x01, 0x8c,0x38,0x01, 0x5c,0x3b,0x03, 0x25,0x01,0x00, 0x2c,0x05,0x00, 0x0e,0x07,0x00, 0x2a,0x07,0x00, 0x2f,0x07,0x00, 0x12,0x09,0x00, 0x1f,0x0b,0x00, 0x0a,0x0e,0x00, 36 | 0x19,0x0e,0x00, 0x05,0x11,0x00, 0x09,0x14,0x00, 0x28,0x14,0x00, 0x1b,0x16,0x00, 0x05,0x1f,0x00, 0x07,0x21,0x00, 0x1f,0x21,0x00, 0x21,0x31,0x00, 0x12,0x3b,0x00, 0xa8,0x29,0x07, 0x99,0x25,0x0c, 0x9c,0x06,0x09, 0x17,0xcb,0x01, 0xd4,0x99,0x01, 0x81,0x28,0x07, 37 | 0xd1,0x09,0x04, 0x0e,0x44,0x02, 0x2a,0x56,0x02, 0x26,0x5d,0x02, 0x95,0x56,0x02, 0x55,0x24,0x0b, 0xa8,0x49,0x01, 0xd1,0x20,0x02, 0xce,0x23,0x02, 0x8a,0x26,0x03, 0x00,0x06,0x0a, 0x19,0x48,0x01, 0xa8,0x1a,0x03, 0xe4,0x22,0x02, 0x92,0x00,0x02, 0x16,0x8a,0x00, 38 | 0xa3,0x07,0x04, 0x49,0x04,0x03, 0xaa,0x0b,0x02, 0x07,0x0b,0x06, 0x01,0x0e,0x06, 0x01,0x19,0x06, 0x90,0x02,0x02, 0x91,0x87,0x00, 0x80,0x29,0x04, 0x9a,0x07,0x03, 0x87,0x27,0x03, 0x6b,0x53,0x02, 0x00,0x07,0x04, 0x0a,0x52,0x00, 0xe8,0x88,0x00, 0x93,0x1c,0x03, 39 | 0x25,0x5f,0x02, 0x03,0x03,0x03, 0x05,0x0c,0x03, 0xd2,0x11,0x00, 0xd9,0x12,0x00, 0xe7,0x13,0x00, 0x20,0x28,0x03, 0xa9,0x58,0x00, 0xd7,0x23,0x01, 0x55,0x0d,0x04, 0x10,0x61,0x01, 0x07,0x05,0x0a, 0xa7,0x0a,0x03, 0x82,0x00,0x00, 0x88,0x00,0x00, 0x1f,0x05,0x02, 40 | 0x84,0x09,0x00, 0x93,0x13,0x00, 0x80,0x16,0x00, 0x03,0x1a,0x02, 0xa3,0x1d,0x00, 0xa2,0x1f,0x00, 0x0c,0x42,0x00, 0x4f,0x08,0x03, 0x58,0x09,0x03, 0xcd,0x24,0x01, 0xeb,0x0c,0x02, 0x0e,0x00,0x01, 0x55,0x00,0x00, 0x0d,0x01,0x01, 0x06,0x02,0x01, 0x4d,0x06,0x00, 41 | 0x0a,0x07,0x01, 0x02,0x08,0x01, 0x4c,0x09,0x00, 0x00,0x0f,0x01, 0x49,0x10,0x00, 0x54,0x15,0x00, 0x49,0x16,0x00, 0x48,0x17,0x00, 0x66,0x17,0x00, 0x01,0x18,0x01, 0x65,0x19,0x00, 0x64,0x1b,0x00, 0x12,0x1f,0x01, 0x61,0x21,0x00, 0x56,0x22,0x00, 0x60,0x22,0x00, 42 | 0x0f,0x03,0x04, 0x67,0x1c,0x03, 0x09,0x00,0x00, 0x11,0x01,0x00, 0x03,0x02,0x00, 0x0d,0x02,0x00, 0x0b,0x03,0x00, 0x0b,0x08,0x00, 0x03,0x09,0x00, 0x0d,0x0a,0x00, 0x10,0x0a,0x00, 0x26,0x0a,0x00, 0x05,0x0b,0x00, 0x04,0x0d,0x00, 0x14,0x0d,0x00, 0x08,0x0f,0x00, 43 | 0x00,0x10,0x00, 0x16,0x15,0x00, 0x07,0x18,0x00, 0x1f,0x23,0x00, 0x12,0x24,0x00, 0x23,0x24,0x00, 0x0c,0x25,0x00, 0x2c,0x8d,0x02, 44 | }; 45 | 46 | const unsigned short fontmario0_CharOffs[5] PROGMEM = { 47 | 0x0000, 0x0072, 0x00e9, 0x015b, 0x01c8, 48 | }; 49 | 50 | RRE_Font rre_mario0 = { RRE_24B, 48,64, 0x20, 0x23, (const uint8_t*)fontmario0_Rects, (const uint16_t*)fontmario0_CharOffs }; 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/rre_mario2_v.h: -------------------------------------------------------------------------------- 1 | #ifndef __font_mario2_h__ 2 | #define __font_mario2_h__ 3 | 4 | /* 5 | *** Generated by rrefontgen *** 6 | Font: [mario2] 96x128 7 | Total chars: 1 (' ' to ' ') 8 | Total rects: 478 * 3 bytes 9 | Total pixels: 1255 (1 overlapping) 10 | Total bytes: 1436 (1434 rects + 2 offs) 11 | Bitmap size: 1536 (96x128 * 1) (+1 opt) 12 | */ 13 | 14 | const unsigned char fontmario2_Rects[1434] PROGMEM = { 15 | 0x00,0x56,0x01, 0x00,0x5a,0x00, 0x01,0x53,0x00, 0x02,0x51,0x00, 0x03,0x56,0x04, 0x03,0x61,0x00, 0x04,0x53,0x00, 0x05,0x63,0x00, 0x06,0x4d,0x00, 0x07,0x4a,0x00, 0x07,0x56,0x00, 0x08,0x49,0x00, 0x08,0x4f,0x00, 0x08,0x65,0x00, 0x09,0x29,0x03, 0x09,0x48,0x00, 16 | 0x09,0x53,0x00, 0x0a,0x26,0x00, 0x0a,0x2f,0x00, 0x0a,0x53,0x01, 0x0a,0x6d,0x00, 0x0a,0x78,0x00, 0x0b,0x24,0x00, 0x0b,0x31,0x00, 0x0b,0x4e,0x00, 0x0b,0x66,0x00, 0x0b,0x6a,0x00, 0x0c,0x32,0x00, 0x0c,0x59,0x01, 0x0c,0x63,0x00, 0x0c,0x67,0x00, 0x0d,0x22,0x00, 17 | 0x0d,0x27,0x00, 0x0d,0x2d,0x00, 0x0d,0x38,0x00, 0x0d,0x47,0x00, 0x0d,0x57,0x00, 0x0e,0x21,0x00, 0x0e,0x2f,0x00, 0x0e,0x5a,0x00, 0x0e,0x7c,0x00, 0x0f,0x2e,0x00, 0x0f,0x33,0x02, 0x0f,0x3c,0x00, 0x0f,0x57,0x00, 0x0f,0x67,0x01, 0x0f,0x70,0x02, 0x10,0x20,0x00, 18 | 0x10,0x24,0x00, 0x10,0x30,0x00, 0x10,0x38,0x00, 0x10,0x3d,0x00, 0x10,0x45,0x00, 0x10,0x6b,0x00, 0x10,0x7d,0x00, 0x11,0x3e,0x00, 0x11,0x66,0x01, 0x11,0x6d,0x0c, 0x12,0x1e,0x00, 0x12,0x23,0x00, 0x12,0x2b,0x00, 0x12,0x44,0x00, 0x12,0x68,0x12, 0x13,0x1a,0x01, 19 | 0x13,0x2d,0x00, 0x13,0x47,0x00, 0x13,0x49,0x00, 0x13,0x61,0x00, 0x13,0x66,0x15, 0x14,0x18,0x00, 0x14,0x23,0x01, 0x14,0x3c,0x00, 0x14,0x63,0x00, 0x14,0x66,0x15, 0x14,0x7f,0x00, 0x15,0x15,0x00, 0x15,0x20,0x00, 0x15,0x60,0x00, 0x15,0x65,0x16, 0x16,0x13,0x00, 20 | 0x16,0x1d,0x00, 0x16,0x2c,0x00, 0x16,0x31,0x00, 0x16,0x3d,0x00, 0x16,0x45,0x00, 0x16,0x65,0x16, 0x17,0x1a,0x00, 0x17,0x2c,0x00, 0x17,0x3d,0x00, 0x17,0x41,0x00, 0x17,0x4b,0x00, 0x17,0x64,0x17, 0x18,0x10,0x00, 0x18,0x18,0x00, 0x18,0x2c,0x00, 0x18,0x31,0x01, 21 | 0x18,0x52,0x00, 0x18,0x63,0x18, 0x19,0x16,0x00, 0x19,0x2c,0x00, 0x19,0x33,0x01, 0x19,0x39,0x00, 0x19,0x44,0x00, 0x19,0x4f,0x00, 0x19,0x52,0x01, 0x19,0x5e,0x00, 0x19,0x61,0x1a, 0x1a,0x0d,0x00, 0x1a,0x14,0x00, 0x1a,0x32,0x00, 0x1a,0x4d,0x00, 0x1a,0x5d,0x00, 22 | 0x1a,0x60,0x1b, 0x1a,0x7f,0x00, 0x1b,0x12,0x00, 0x1b,0x2d,0x00, 0x1b,0x33,0x00, 0x1b,0x36,0x01, 0x1b,0x4c,0x00, 0x1b,0x57,0x00, 0x1b,0x5b,0x00, 0x1b,0x60,0x1b, 0x1c,0x11,0x00, 0x1c,0x25,0x00, 0x1c,0x29,0x01, 0x1c,0x2e,0x00, 0x1c,0x35,0x02, 0x1c,0x43,0x00, 23 | 0x1c,0x52,0x01, 0x1c,0x60,0x1a, 0x1d,0x23,0x00, 0x1d,0x27,0x05, 0x1d,0x43,0x00, 0x1d,0x50,0x00, 0x1d,0x54,0x00, 0x1d,0x61,0x18, 0x1d,0x7e,0x00, 0x1e,0x0e,0x00, 0x1e,0x22,0x00, 0x1e,0x26,0x08, 0x1e,0x3d,0x00, 0x1e,0x43,0x00, 0x1e,0x4a,0x00, 0x1e,0x4e,0x00, 24 | 0x1e,0x61,0x02, 0x1e,0x6f,0x09, 0x1f,0x0d,0x00, 0x1f,0x25,0x0a, 0x1f,0x32,0x00, 0x1f,0x3f,0x00, 0x1f,0x43,0x00, 0x1f,0x55,0x00, 0x1f,0x62,0x00, 0x1f,0x66,0x0f, 0x20,0x22,0x00, 0x20,0x28,0x08, 0x20,0x43,0x00, 0x20,0x49,0x00, 0x20,0x4b,0x00, 0x20,0x64,0x0d, 25 | 0x20,0x7c,0x00, 0x21,0x06,0x00, 0x21,0x21,0x00, 0x21,0x2a,0x04, 0x21,0x30,0x01, 0x21,0x3d,0x00, 0x21,0x43,0x00, 0x21,0x64,0x0c, 0x22,0x05,0x00, 0x22,0x20,0x00, 0x22,0x28,0x00, 0x22,0x2b,0x02, 0x22,0x31,0x01, 0x22,0x34,0x00, 0x22,0x3e,0x00, 0x22,0x43,0x00, 26 | 0x22,0x48,0x00, 0x22,0x4a,0x00, 0x22,0x64,0x09, 0x22,0x79,0x00, 0x23,0x09,0x00, 0x23,0x1f,0x00, 0x23,0x2c,0x01, 0x23,0x32,0x00, 0x23,0x74,0x00, 0x24,0x08,0x00, 0x24,0x1e,0x00, 0x24,0x2d,0x00, 0x24,0x2f,0x03, 0x24,0x34,0x00, 0x24,0x47,0x00, 0x24,0x49,0x00, 27 | 0x24,0x73,0x00, 0x25,0x1d,0x00, 0x25,0x24,0x00, 0x25,0x2b,0x00, 0x25,0x2d,0x02, 0x25,0x55,0x00, 0x25,0x71,0x00, 0x26,0x1a,0x00, 0x26,0x1c,0x00, 0x26,0x2e,0x00, 0x26,0x31,0x01, 0x26,0x48,0x00, 0x26,0x6c,0x01, 0x27,0x02,0x00, 0x27,0x06,0x00, 0x27,0x19,0x00, 28 | 0x27,0x22,0x00, 0x27,0x2c,0x00, 0x27,0x30,0x00, 0x27,0x42,0x00, 0x27,0x47,0x00, 0x27,0x54,0x00, 0x27,0x6b,0x00, 0x28,0x45,0x00, 0x28,0x53,0x00, 0x29,0x05,0x00, 0x29,0x18,0x00, 0x29,0x1a,0x00, 0x29,0x23,0x00, 0x29,0x43,0x00, 0x29,0x46,0x00, 0x29,0x52,0x00, 29 | 0x2a,0x01,0x00, 0x2a,0x21,0x00, 0x2a,0x48,0x00, 0x2a,0x4f,0x01, 0x2b,0x0d,0x00, 0x2b,0x11,0x01, 0x2b,0x22,0x00, 0x2b,0x44,0x00, 0x2c,0x04,0x00, 0x2c,0x0d,0x00, 0x2c,0x12,0x00, 0x2c,0x14,0x00, 0x2c,0x16,0x00, 0x2c,0x18,0x00, 0x2c,0x2f,0x04, 0x2d,0x00,0x00, 30 | 0x2d,0x15,0x00, 0x2d,0x20,0x00, 0x2d,0x2d,0x00, 0x2d,0x45,0x00, 0x2e,0x00,0x00, 0x2e,0x17,0x00, 0x2e,0x2d,0x00, 0x2e,0x45,0x00, 0x2f,0x1f,0x00, 0x30,0x03,0x00, 0x30,0x07,0x00, 0x30,0x16,0x00, 0x30,0x21,0x00, 0x30,0x26,0x00, 0x30,0x51,0x00, 0x30,0x55,0x00, 31 | 0x31,0x03,0x00, 0x31,0x07,0x00, 0x31,0x14,0x00, 0x31,0x1e,0x00, 0x31,0x29,0x00, 0x31,0x3a,0x05, 0x31,0x57,0x00, 0x32,0x03,0x00, 0x32,0x15,0x00, 0x32,0x2a,0x00, 0x32,0x2f,0x00, 0x33,0x1d,0x00, 0x33,0x22,0x00, 0x33,0x3d,0x00, 0x33,0x40,0x01, 0x34,0x00,0x00, 32 | 0x34,0x24,0x01, 0x34,0x2a,0x00, 0x34,0x30,0x00, 0x34,0x42,0x00, 0x35,0x00,0x00, 0x35,0x14,0x00, 0x35,0x42,0x00, 0x35,0x47,0x00, 0x35,0x4a,0x00, 0x35,0x6b,0x00, 0x36,0x04,0x00, 0x36,0x07,0x01, 0x36,0x1b,0x00, 0x36,0x3e,0x00, 0x36,0x45,0x00, 0x36,0x47,0x00, 33 | 0x36,0x4b,0x00, 0x36,0x58,0x00, 0x36,0x6b,0x00, 0x37,0x40,0x01, 0x37,0x43,0x00, 0x37,0x4f,0x00, 0x38,0x01,0x00, 0x38,0x08,0x01, 0x38,0x13,0x00, 0x38,0x1a,0x00, 0x38,0x31,0x00, 0x38,0x3e,0x01, 0x38,0x50,0x00, 0x39,0x06,0x00, 0x39,0x0a,0x00, 0x39,0x31,0x00, 34 | 0x39,0x3e,0x00, 0x39,0x41,0x00, 0x39,0x47,0x00, 0x39,0x52,0x03, 0x39,0x6a,0x00, 0x3a,0x11,0x00, 0x3a,0x19,0x00, 0x3a,0x31,0x00, 0x3a,0x40,0x00, 0x3a,0x48,0x00, 0x3b,0x09,0x00, 0x3b,0x0b,0x00, 0x3b,0x0e,0x02, 0x3b,0x12,0x00, 0x3b,0x1a,0x00, 0x3b,0x49,0x01, 35 | 0x3b,0x69,0x00, 0x3c,0x0b,0x00, 0x3c,0x0e,0x02, 0x3c,0x12,0x00, 0x3c,0x18,0x00, 0x3c,0x1e,0x02, 0x3c,0x26,0x00, 0x3c,0x32,0x00, 0x3c,0x3e,0x00, 0x3d,0x0f,0x01, 0x3d,0x24,0x00, 0x3d,0x3e,0x00, 0x3d,0x43,0x01, 0x3e,0x07,0x00, 0x3e,0x17,0x00, 0x3e,0x33,0x00, 36 | 0x3e,0x3e,0x00, 0x3e,0x42,0x00, 0x3f,0x09,0x00, 0x3f,0x1b,0x00, 0x3f,0x24,0x00, 0x3f,0x3e,0x00, 0x3f,0x67,0x00, 0x40,0x1f,0x00, 0x41,0x11,0x00, 0x41,0x16,0x00, 0x41,0x1f,0x00, 0x41,0x23,0x00, 0x41,0x34,0x00, 0x41,0x3e,0x00, 0x42,0x0b,0x00, 0x42,0x11,0x00, 37 | 0x42,0x23,0x00, 0x42,0x34,0x00, 0x42,0x3d,0x00, 0x42,0x50,0x00, 0x43,0x0f,0x00, 0x43,0x11,0x00, 0x43,0x1d,0x01, 0x43,0x34,0x00, 0x43,0x3e,0x00, 0x44,0x0a,0x00, 0x44,0x15,0x00, 0x44,0x20,0x00, 0x44,0x34,0x00, 0x44,0x3c,0x01, 0x44,0x54,0x00, 0x45,0x09,0x00, 38 | 0x45,0x15,0x00, 0x45,0x34,0x00, 0x45,0x4f,0x00, 0x45,0x55,0x00, 0x46,0x08,0x00, 0x46,0x0d,0x00, 0x46,0x40,0x00, 0x46,0x53,0x01, 0x46,0x5f,0x02, 0x46,0x66,0x00, 0x47,0x0d,0x00, 0x47,0x4a,0x00, 0x47,0x5d,0x05, 0x48,0x1b,0x00, 0x48,0x33,0x00, 0x48,0x3d,0x00, 39 | 0x48,0x58,0x0a, 0x48,0x67,0x00, 0x49,0x0d,0x00, 0x49,0x12,0x00, 0x49,0x14,0x00, 0x49,0x23,0x00, 0x49,0x4f,0x02, 0x49,0x56,0x0d, 0x4a,0x12,0x00, 0x4a,0x14,0x00, 0x4a,0x1a,0x00, 0x4a,0x21,0x00, 0x4a,0x32,0x00, 0x4a,0x3a,0x00, 0x4a,0x4d,0x16, 0x4b,0x06,0x00, 40 | 0x4b,0x0c,0x00, 0x4b,0x14,0x00, 0x4b,0x38,0x00, 0x4b,0x46,0x00, 0x4b,0x4b,0x18, 0x4c,0x06,0x00, 0x4c,0x13,0x01, 0x4c,0x22,0x00, 0x4c,0x36,0x00, 0x4c,0x4a,0x19, 0x4d,0x0d,0x00, 0x4d,0x10,0x00, 0x4d,0x27,0x00, 0x4d,0x2f,0x00, 0x4d,0x45,0x00, 0x4d,0x4a,0x19, 41 | 0x4e,0x0b,0x00, 0x4e,0x0e,0x00, 0x4e,0x24,0x00, 0x4e,0x2b,0x00, 0x4e,0x45,0x00, 0x4e,0x49,0x1a, 0x4f,0x07,0x00, 0x4f,0x49,0x19, 0x50,0x08,0x00, 0x50,0x0c,0x00, 0x50,0x16,0x00, 0x50,0x18,0x00, 0x50,0x20,0x00, 0x50,0x30,0x00, 0x50,0x49,0x18, 0x51,0x09,0x00, 42 | 0x51,0x2a,0x00, 0x51,0x49,0x17, 0x52,0x09,0x00, 0x52,0x45,0x00, 0x52,0x49,0x15, 0x53,0x09,0x00, 0x53,0x17,0x00, 0x53,0x28,0x00, 0x53,0x45,0x00, 0x53,0x4a,0x12, 0x54,0x17,0x01, 0x54,0x4a,0x10, 0x54,0x68,0x00, 0x55,0x17,0x00, 0x55,0x1e,0x00, 0x55,0x4a,0x0e, 43 | 0x55,0x5b,0x00, 0x56,0x25,0x00, 0x56,0x46,0x00, 0x56,0x4b,0x0b, 0x56,0x59,0x00, 0x56,0x66,0x00, 0x57,0x4d,0x05, 0x57,0x57,0x00, 0x57,0x64,0x00, 0x58,0x11,0x00, 0x58,0x19,0x00, 0x58,0x47,0x00, 0x58,0x54,0x00, 0x58,0x62,0x00, 0x59,0x15,0x00, 0x59,0x1f,0x00, 44 | 0x59,0x48,0x00, 0x59,0x50,0x01, 0x59,0x5f,0x00, 0x5a,0x4e,0x00, 0x5a,0x5e,0x00, 0x5b,0x0f,0x00, 0x5b,0x4a,0x00, 0x5b,0x50,0x02, 0x5c,0x11,0x00, 0x5c,0x19,0x00, 0x5c,0x5b,0x00, 0x5d,0x59,0x00, 0x5e,0x56,0x00, 0x5f,0x4f,0x03, 45 | }; 46 | 47 | const unsigned short fontmario2_CharOffs[2] PROGMEM = { 48 | 0x0000, 0x01de, 49 | }; 50 | 51 | RRE_Font rre_mario2 = { RRE_V24B, 96,128, 0x20, 0x20, (const uint8_t*)fontmario2_Rects, (const uint16_t*)fontmario2_CharOffs }; 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /Arduino_ILI9163C_Fast.h: -------------------------------------------------------------------------------- 1 | // Fast ILI9163C 128x128 LCD SPI display library 2 | // (c) 2019 by Pawel A. Hernik 3 | 4 | #ifndef _ILI9163C_FAST_H_ 5 | #define _ILI9163C_FAST_H_ 6 | 7 | // ------------------------------ 8 | // Define LCD PCB type 9 | //#define __144_RED_PCB__ //128x128 10 | #define __144_BLACK_PCB__ //128x128 11 | //#define __22_RED_PCB__ //240x320 12 | 13 | // remove "define COMPATIBILITY_MODE" for best performance on 16MHz AVR Arduinos 14 | // if defined - the library should work on all Arduino compatible boards 15 | //#define COMPATIBILITY_MODE 16 | 17 | // define for LCD boards where CS pin is internally connected to the ground 18 | //#define CS_ALWAYS_LOW 19 | // ------------------------------ 20 | 21 | #include "Arduino.h" 22 | #include "Print.h" 23 | #include 24 | #include 25 | 26 | 27 | #define ST_CMD_DELAY 0x80 28 | 29 | // ---------- ILI9163C registers ------------------- 30 | // taken from https://github.com/sumotoy/TFT_ILI9163C 31 | #define ILI9163C_NOP 0x00 // Non operation 32 | #define ILI9163C_SWRESET 0x01 // Soft Reset 33 | #define ILI9163C_SLPIN 0x10 // Sleep ON 34 | #define ILI9163C_SLPOUT 0x11 // Sleep OFF 35 | #define ILI9163C_PTLON 0x12 // Partial Mode ON 36 | #define ILI9163C_NORML 0x13 // Normal Display ON 37 | #define ILI9163C_DINVOF 0x20 // Display Inversion OFF 38 | #define ILI9163C_DINVON 0x21 // Display Inversion ON 39 | #define ILI9163C_GAMMASET 0x26 // Gamma Set (0x01[1],0x02[2],0x04[3],0x08[4]) 40 | #define ILI9163C_DISPOFF 0x28 // Display OFF 41 | #define ILI9163C_DISPON 0x29 // Display ON 42 | #define ILI9163C_IDLEON 0x39 // Idle Mode ON 43 | #define ILI9163C_IDLEOF 0x38 // Idle Mode OFF 44 | #define ILI9163C_CLMADRS 0x2A // Column Address Set 45 | #define ILI9163C_PGEADRS 0x2B // Page Address Set 46 | 47 | #define ILI9163C_RAMWR 0x2C // Memory Write 48 | #define ILI9163C_RAMRD 0x2E // Memory Read 49 | #define ILI9163C_CLRSPACE 0x2D // Color Space : 4K/65K/262K 50 | #define ILI9163C_PARTAREA 0x30 // Partial Area 51 | #define ILI9163C_VSCLLDEF 0x33 // Vertical Scroll Definition 52 | #define ILI9163C_TEFXLON 0x35 // Tearing Effect Line ON 53 | #define ILI9163C_TEFXLOF 0x34 // Tearing Effect Line OFF 54 | #define ILI9163C_MADCTL 0x36 // Memory Access Control 55 | #define ILI9163C_VSSTADRS 0x37 // Vertical Scrolling Start address 56 | #define ILI9163C_PIXFMT 0x3A // Interface Pixel Format 57 | #define ILI9163C_FRMCTR1 0xB1 // Frame Rate Control (In normal mode/Full colors) 58 | #define ILI9163C_FRMCTR2 0xB2 // Frame Rate Control(In Idle mode/8-colors) 59 | #define ILI9163C_FRMCTR3 0xB3 // Frame Rate Control(In Partial mode/full colors) 60 | #define ILI9163C_DINVCTR 0xB4 // Display Inversion Control 61 | #define ILI9163C_RGBBLK 0xB5 // RGB Interface Blanking Porch setting 62 | #define ILI9163C_DFUNCTR 0xB6 // Display Fuction set 5 63 | #define ILI9163C_SDRVDIR 0xB7 // Source Driver Direction Control 64 | #define ILI9163C_GDRVDIR 0xB8 // Gate Driver Direction Control 65 | 66 | #define ILI9163C_PWCTR1 0xC0 // Power_Control1 67 | #define ILI9163C_PWCTR2 0xC1 // Power_Control2 68 | #define ILI9163C_PWCTR3 0xC2 // Power_Control3 69 | #define ILI9163C_PWCTR4 0xC3 // Power_Control4 70 | #define ILI9163C_PWCTR5 0xC4 // Power_Control5 71 | #define ILI9163C_VCOMCTR1 0xC5 // VCOM_Control 1 72 | #define ILI9163C_VCOMCTR2 0xC6 // VCOM_Control 2 73 | #define ILI9163C_VCOMOFFS 0xC7 // VCOM Offset Control 74 | #define ILI9163C_PGAMMAC 0xE0 // Positive Gamma Correction Setting 75 | #define ILI9163C_NGAMMAC 0xE1 // Negative Gamma Correction Setting 76 | #define ILI9163C_GAMRSEL 0xF2 // GAM_R_SEL 77 | 78 | // ------- bits in MADCTL ------- 79 | #define ILI9163C_MADCTL_MY 0x80 80 | #define ILI9163C_MADCTL_MX 0x40 81 | #define ILI9163C_MADCTL_MV 0x20 82 | #define ILI9163C_MADCTL_ML 0x10 83 | #define ILI9163C_MADCTL_BGR 0x08 84 | #define ILI9163C_MADCTL_RGB 0x00 85 | 86 | #if defined(__144_RED_PCB__) 87 | #define _TFTWIDTH 128 // real W resolution of the TFT 88 | #define _TFTHEIGHT 128 // real H resolution of the TFT 89 | #define _GRAMWIDTH 128 90 | #define _GRAMHEIGH 160 91 | #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH 92 | #define __COLORSPC ILI9163C_MADCTL_BGR 93 | #define __GAMMASET3 94 | #define __OFFSET 32 95 | #elif defined (__144_BLACK_PCB__) 96 | #define _TFTWIDTH 128 // real W resolution of the TFT 97 | #define _TFTHEIGHT 128 // real H resolution of the TFT 98 | #define _GRAMWIDTH 128 99 | #define _GRAMHEIGH 128 100 | #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH 101 | #define __COLORSPC ILI9163C_MADCTL_BGR 102 | #define __GAMMASET1 103 | #define __OFFSET 0 104 | #elif defined (__22_RED_PCB__) 105 | #define _TFTWIDTH 240 // real W resolution of the TFT 106 | #define _TFTHEIGHT 320 // real H resolution of the TFT 107 | #define _GRAMWIDTH 240 108 | #define _GRAMHEIGH 320 109 | #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH 110 | #define __COLORSPC ILI9163C_MADCTL_BGR 111 | #define __GAMMASET1 112 | #define __OFFSET 0 113 | #else 114 | #define _TFTWIDTH 128 115 | #define _TFTHEIGHT 160 116 | #define _GRAMWIDTH 128 117 | #define _GRAMHEIGH 160 118 | #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH 119 | #define __COLORSPC ILI9163C_MADCTL_BGR 120 | #define __GAMMASET1 121 | #define __OFFSET 0 122 | #endif 123 | 124 | #if defined(__GAMMASET1) 125 | const uint8_t pGammaSet[15]= {0x36,0x29,0x12,0x22,0x1C,0x15,0x42,0xB7,0x2F,0x13,0x12,0x0A,0x11,0x0B,0x06}; 126 | const uint8_t nGammaSet[15]= {0x09,0x16,0x2D,0x0D,0x13,0x15,0x40,0x48,0x53,0x0C,0x1D,0x25,0x2E,0x34,0x39}; 127 | #elif defined(__GAMMASET2) 128 | const uint8_t pGammaSet[15]= {0x3F,0x21,0x12,0x22,0x1C,0x15,0x42,0xB7,0x2F,0x13,0x02,0x0A,0x01,0x00,0x00}; 129 | const uint8_t nGammaSet[15]= {0x09,0x18,0x2D,0x0D,0x13,0x15,0x40,0x48,0x53,0x0C,0x1D,0x25,0x2E,0x24,0x29}; 130 | #elif defined(__GAMMASET3) 131 | const uint8_t pGammaSet[15]= {0x3F,0x26,0x23,0x30,0x28,0x10,0x55,0xB7,0x40,0x19,0x10,0x1E,0x02,0x01,0x00}; 132 | const uint8_t nGammaSet[15]= {0x09,0x18,0x2D,0x0D,0x13,0x15,0x40,0x48,0x53,0x0C,0x1D,0x25,0x2E,0x24,0x29}; 133 | #else 134 | const uint8_t pGammaSet[15]= {0x3F,0x25,0x1C,0x1E,0x20,0x12,0x2A,0x90,0x24,0x11,0x00,0x00,0x00,0x00,0x00}; 135 | const uint8_t nGammaSet[15]= {0x20,0x20,0x20,0x20,0x05,0x15,0x00,0xA7,0x3D,0x18,0x25,0x2A,0x2B,0x2B,0x3A}; 136 | #endif 137 | 138 | // Color definitions 139 | #define BLACK 0x0000 140 | #define BLUE 0x001F 141 | #define RED 0xF800 142 | #define GREEN 0x07E0 143 | #define CYAN 0x07FF 144 | #define MAGENTA 0xF81F 145 | #define YELLOW 0xFFE0 146 | #define WHITE 0xFFFF 147 | 148 | #define RGBto565(r,g,b) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | ((b) >> 3)) 149 | 150 | class Arduino_ILI9163C : public Adafruit_GFX { 151 | 152 | public: 153 | Arduino_ILI9163C(int8_t DC, int8_t RST, int8_t CS = -1); 154 | 155 | void init(); 156 | void begin() { init(); } 157 | int errorCode() { return 0; } 158 | void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); 159 | void pushColor(uint16_t color); 160 | void fillScreen(uint16_t color=BLACK); 161 | void clearScreen() { fillScreen(BLACK); } 162 | void drawPixel(int16_t x, int16_t y, uint16_t color); 163 | void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); 164 | void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); 165 | void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); 166 | void drawImage(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t *img); 167 | void drawImageF(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *img16); 168 | void setRotation(uint8_t r); 169 | void invertDisplay(boolean mode); 170 | void partialDisplay(boolean mode); 171 | void sleepDisplay(boolean mode); 172 | void enableDisplay(boolean mode); 173 | void idleDisplay(boolean mode); 174 | void resetDisplay(); 175 | void setScrollArea(uint16_t tfa, uint16_t bfa); 176 | void setScroll(uint16_t vsp); 177 | void setPartArea(uint16_t sr, uint16_t er); 178 | 179 | uint16_t Color565(uint8_t r, uint8_t g, uint8_t b); 180 | uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return Color565(r, g, b); } 181 | void rgbWheel(int idx, uint8_t *_r, uint8_t *_g, uint8_t *_b); 182 | uint16_t rgbWheel(int idx); 183 | 184 | protected: 185 | void displayInit(const uint8_t *addr); 186 | void writeSPI(uint8_t); 187 | void writeCmd(uint8_t c); 188 | void writeData(uint8_t d); 189 | void writeData16(uint16_t d); 190 | void commonILI9163CInit(const uint8_t *cmdList); 191 | 192 | private: 193 | int8_t csPin, dcPin, rstPin; 194 | uint8_t csMask, dcMask; 195 | volatile uint8_t *csPort, *dcPort; 196 | 197 | }; 198 | 199 | #endif 200 | -------------------------------------------------------------------------------- /examples/ILI9163C_Mario_RRE/rre_mario0_v.h: -------------------------------------------------------------------------------- 1 | #ifndef __font_mario0_h__ 2 | #define __font_mario0_h__ 3 | 4 | /* 5 | *** Generated by rrefontgen *** 6 | Font: [mario0] 96x128 7 | Total chars: 1 (' ' to ' ') 8 | Total rects: 647 * 3 bytes 9 | Total pixels: 2777 (4 overlapping) 10 | Total bytes: 1943 (1941 rects + 2 offs) 11 | Bitmap size: 1536 (96x128 * 1) (+1 opt) 12 | */ 13 | 14 | const unsigned char fontmario0_Rects[1941] PROGMEM = { 15 | 0x00,0x58,0x01, 0x01,0x54,0x09, 0x02,0x52,0x0d, 0x03,0x50,0x05, 0x03,0x5b,0x05, 0x04,0x4f,0x03, 0x04,0x5e,0x04, 0x05,0x4e,0x03, 0x05,0x5f,0x03, 0x06,0x4e,0x02, 0x06,0x60,0x03, 0x07,0x4b,0x04, 0x07,0x57,0x01, 0x07,0x61,0x03, 0x08,0x4a,0x04, 0x08,0x55,0x03, 16 | 0x08,0x62,0x02, 0x09,0x49,0x05, 0x09,0x54,0x03, 0x09,0x62,0x03, 0x0a,0x27,0x07, 0x0a,0x48,0x03, 0x0a,0x4e,0x00, 0x0a,0x63,0x02, 0x0a,0x6e,0x09, 0x0b,0x25,0x0b, 0x0b,0x48,0x02, 0x0b,0x63,0x02, 0x0b,0x6b,0x0e, 0x0c,0x23,0x0e, 0x0c,0x48,0x02, 0x0c,0x64,0x02, 17 | 0x0c,0x68,0x12, 0x0d,0x23,0x03, 0x0d,0x2e,0x09, 0x0d,0x48,0x02, 0x0d,0x58,0x02, 0x0d,0x64,0x09, 0x0d,0x78,0x03, 0x0e,0x22,0x03, 0x0e,0x30,0x0a, 0x0e,0x47,0x03, 0x0e,0x56,0x03, 0x0e,0x64,0x06, 0x0e,0x79,0x02, 0x0f,0x21,0x03, 0x0f,0x2f,0x03, 0x0f,0x36,0x05, 18 | 0x0f,0x46,0x04, 0x0f,0x55,0x01, 0x0f,0x64,0x02, 0x0f,0x73,0x09, 0x10,0x21,0x02, 0x10,0x2d,0x02, 0x10,0x39,0x03, 0x10,0x46,0x04, 0x10,0x64,0x01, 0x10,0x6c,0x10, 0x11,0x20,0x03, 0x11,0x2c,0x02, 0x11,0x3a,0x03, 0x11,0x45,0x05, 0x11,0x64,0x01, 0x11,0x68,0x04, 19 | 0x11,0x7a,0x03, 0x12,0x1f,0x03, 0x12,0x2c,0x01, 0x12,0x3b,0x03, 0x12,0x45,0x02, 0x12,0x49,0x01, 0x12,0x64,0x03, 0x12,0x7b,0x03, 0x13,0x1c,0x09, 0x13,0x2b,0x01, 0x13,0x3c,0x03, 0x13,0x44,0x02, 0x13,0x4a,0x00, 0x13,0x5f,0x01, 0x13,0x64,0x01, 0x13,0x7c,0x02, 20 | 0x14,0x19,0x09, 0x14,0x2b,0x01, 0x14,0x3d,0x02, 0x14,0x43,0x03, 0x14,0x4a,0x01, 0x14,0x5d,0x03, 0x14,0x64,0x01, 0x14,0x7c,0x02, 0x15,0x16,0x09, 0x15,0x2b,0x01, 0x15,0x3d,0x03, 0x15,0x43,0x02, 0x15,0x4a,0x01, 0x15,0x5c,0x03, 0x15,0x63,0x01, 0x15,0x7c,0x03, 21 | 0x16,0x14,0x08, 0x16,0x2b,0x00, 0x16,0x3e,0x02, 0x16,0x42,0x02, 0x16,0x4b,0x01, 0x16,0x5c,0x00, 0x16,0x5f,0x01, 0x16,0x62,0x02, 0x16,0x7c,0x03, 0x17,0x12,0x07, 0x17,0x2b,0x00, 0x17,0x31,0x00, 0x17,0x3e,0x02, 0x17,0x42,0x02, 0x17,0x4c,0x00, 0x17,0x5f,0x04, 22 | 0x17,0x7c,0x03, 0x18,0x11,0x06, 0x18,0x2b,0x00, 0x18,0x3e,0x06, 0x18,0x4c,0x01, 0x18,0x5f,0x03, 0x18,0x7c,0x03, 0x19,0x0f,0x06, 0x19,0x2b,0x00, 0x19,0x32,0x00, 0x19,0x3e,0x05, 0x19,0x4d,0x01, 0x19,0x5f,0x01, 0x19,0x7c,0x03, 0x1a,0x0e,0x05, 0x1a,0x29,0x03, 23 | 0x1a,0x33,0x01, 0x1a,0x39,0x00, 0x1a,0x3e,0x05, 0x1a,0x4e,0x06, 0x1a,0x5e,0x01, 0x1a,0x7c,0x02, 0x1b,0x0c,0x05, 0x1b,0x27,0x05, 0x1b,0x34,0x01, 0x1b,0x38,0x00, 0x1b,0x3e,0x05, 0x1b,0x4d,0x09, 0x1b,0x5c,0x03, 0x1b,0x7c,0x02, 0x1c,0x0b,0x05, 0x1c,0x26,0x02, 24 | 0x1c,0x2b,0x02, 0x1c,0x3e,0x04, 0x1c,0x4c,0x05, 0x1c,0x54,0x0b, 0x1c,0x7b,0x03, 0x1d,0x0a,0x05, 0x1d,0x24,0x02, 0x1d,0x2d,0x02, 0x1d,0x3e,0x04, 0x1d,0x4b,0x04, 0x1d,0x55,0x00, 0x1d,0x58,0x04, 0x1d,0x5e,0x02, 0x1d,0x7a,0x03, 0x1e,0x09,0x04, 0x1e,0x23,0x02, 25 | 0x1e,0x2f,0x01, 0x1e,0x3e,0x04, 0x1e,0x4b,0x02, 0x1e,0x55,0x01, 0x1e,0x5f,0x01, 0x1e,0x64,0x0a, 0x1e,0x79,0x04, 0x1f,0x08,0x04, 0x1f,0x21,0x03, 0x1f,0x30,0x01, 0x1f,0x3d,0x01, 0x1f,0x40,0x02, 0x1f,0x4a,0x01, 0x1f,0x56,0x00, 0x1f,0x5f,0x02, 0x1f,0x63,0x02, 26 | 0x1f,0x76,0x06, 0x20,0x07,0x04, 0x20,0x20,0x01, 0x20,0x23,0x04, 0x20,0x31,0x01, 0x20,0x3d,0x05, 0x20,0x4a,0x00, 0x20,0x56,0x00, 0x20,0x60,0x03, 0x20,0x72,0x09, 0x21,0x07,0x03, 0x21,0x1f,0x01, 0x21,0x23,0x01, 0x21,0x26,0x03, 0x21,0x2f,0x00, 0x21,0x32,0x01, 27 | 0x21,0x3e,0x04, 0x21,0x49,0x01, 0x21,0x56,0x01, 0x21,0x61,0x02, 0x21,0x71,0x09, 0x22,0x06,0x03, 0x22,0x1e,0x01, 0x22,0x23,0x01, 0x22,0x29,0x01, 0x22,0x2e,0x02, 0x22,0x33,0x00, 0x22,0x3f,0x03, 0x22,0x49,0x00, 0x22,0x56,0x01, 0x22,0x61,0x02, 0x22,0x6e,0x0a, 28 | 0x23,0x05,0x03, 0x23,0x1d,0x01, 0x23,0x23,0x01, 0x23,0x2a,0x01, 0x23,0x2e,0x03, 0x23,0x33,0x01, 0x23,0x3f,0x04, 0x23,0x48,0x01, 0x23,0x56,0x01, 0x23,0x62,0x11, 0x24,0x04,0x03, 0x24,0x1c,0x01, 0x24,0x23,0x01, 0x24,0x2b,0x01, 0x24,0x2e,0x00, 0x24,0x33,0x00, 29 | 0x24,0x40,0x03, 0x24,0x48,0x00, 0x24,0x56,0x01, 0x24,0x62,0x10, 0x25,0x04,0x03, 0x25,0x1b,0x01, 0x25,0x23,0x00, 0x25,0x2c,0x00, 0x25,0x30,0x03, 0x25,0x41,0x03, 0x25,0x47,0x01, 0x25,0x56,0x00, 0x25,0x64,0x01, 0x25,0x67,0x09, 0x26,0x03,0x03, 0x26,0x1b,0x00, 30 | 0x26,0x23,0x00, 0x26,0x2c,0x01, 0x26,0x2f,0x01, 0x26,0x42,0x05, 0x26,0x55,0x01, 0x26,0x67,0x04, 0x27,0x03,0x02, 0x27,0x1a,0x01, 0x27,0x23,0x00, 0x27,0x2d,0x02, 0x27,0x43,0x03, 0x27,0x55,0x01, 0x27,0x68,0x02, 0x28,0x02,0x03, 0x28,0x19,0x01, 0x28,0x22,0x01, 31 | 0x28,0x43,0x01, 0x28,0x54,0x01, 0x28,0x68,0x03, 0x29,0x02,0x02, 0x29,0x19,0x00, 0x29,0x22,0x00, 0x29,0x44,0x01, 0x29,0x53,0x01, 0x29,0x68,0x03, 0x2a,0x02,0x02, 0x2a,0x18,0x01, 0x2a,0x22,0x00, 0x2a,0x44,0x03, 0x2a,0x51,0x02, 0x2a,0x68,0x03, 0x2b,0x01,0x03, 32 | 0x2b,0x0e,0x02, 0x2b,0x17,0x01, 0x2b,0x21,0x00, 0x2b,0x45,0x0c, 0x2b,0x69,0x02, 0x2c,0x01,0x02, 0x2c,0x0b,0x01, 0x2c,0x13,0x00, 0x2c,0x17,0x00, 0x2c,0x21,0x00, 0x2c,0x45,0x01, 0x2c,0x4a,0x04, 0x2c,0x69,0x02, 0x2d,0x01,0x02, 0x2d,0x0a,0x00, 0x2d,0x14,0x00, 33 | 0x2d,0x16,0x01, 0x2d,0x21,0x00, 0x2d,0x2e,0x07, 0x2d,0x46,0x00, 0x2d,0x69,0x02, 0x2e,0x01,0x02, 0x2e,0x09,0x00, 0x2e,0x15,0x01, 0x2e,0x20,0x00, 0x2e,0x2e,0x08, 0x2e,0x46,0x00, 0x2e,0x53,0x01, 0x2e,0x69,0x02, 0x2f,0x00,0x03, 0x2f,0x08,0x00, 0x2f,0x15,0x01, 34 | 0x2f,0x20,0x00, 0x2f,0x2e,0x09, 0x2f,0x46,0x01, 0x2f,0x50,0x07, 0x2f,0x69,0x02, 0x30,0x00,0x02, 0x30,0x08,0x00, 0x30,0x15,0x00, 0x30,0x1f,0x00, 0x30,0x22,0x03, 0x30,0x2f,0x08, 0x30,0x46,0x01, 0x30,0x4f,0x01, 0x30,0x56,0x02, 0x30,0x69,0x02, 0x31,0x00,0x02, 35 | 0x31,0x15,0x00, 0x31,0x1f,0x00, 0x31,0x21,0x07, 0x31,0x2f,0x0a, 0x31,0x46,0x01, 0x31,0x4e,0x01, 0x31,0x58,0x01, 0x31,0x68,0x03, 0x32,0x00,0x02, 0x32,0x07,0x00, 0x32,0x14,0x00, 0x32,0x1e,0x00, 0x32,0x21,0x08, 0x32,0x30,0x12, 0x32,0x46,0x02, 0x32,0x4e,0x00, 36 | 0x32,0x58,0x01, 0x32,0x68,0x03, 0x33,0x00,0x03, 0x33,0x07,0x00, 0x33,0x14,0x00, 0x33,0x1e,0x00, 0x33,0x23,0x07, 0x33,0x30,0x0c, 0x33,0x42,0x01, 0x33,0x46,0x03, 0x33,0x4e,0x00, 0x33,0x59,0x01, 0x33,0x68,0x03, 0x34,0x01,0x02, 0x34,0x07,0x00, 0x34,0x13,0x01, 37 | 0x34,0x1d,0x00, 0x34,0x26,0x03, 0x34,0x31,0x0c, 0x34,0x43,0x00, 0x34,0x46,0x01, 0x34,0x49,0x02, 0x34,0x4d,0x01, 0x34,0x59,0x01, 0x34,0x68,0x03, 0x35,0x01,0x02, 0x35,0x07,0x00, 0x35,0x13,0x00, 0x35,0x1c,0x01, 0x35,0x31,0x0c, 0x35,0x43,0x00, 0x35,0x46,0x00, 38 | 0x35,0x4b,0x01, 0x35,0x4e,0x00, 0x35,0x59,0x01, 0x35,0x68,0x02, 0x36,0x01,0x02, 0x36,0x13,0x00, 0x36,0x1c,0x00, 0x36,0x31,0x0c, 0x36,0x42,0x01, 0x36,0x46,0x00, 0x36,0x4c,0x00, 0x36,0x4e,0x00, 0x36,0x59,0x00, 0x36,0x68,0x02, 0x37,0x01,0x03, 0x37,0x08,0x00, 39 | 0x37,0x12,0x01, 0x37,0x1b,0x01, 0x37,0x31,0x0e, 0x37,0x42,0x00, 0x37,0x45,0x01, 0x37,0x4b,0x01, 0x37,0x4e,0x00, 0x37,0x58,0x01, 0x37,0x67,0x03, 0x38,0x02,0x03, 0x38,0x12,0x00, 0x38,0x1b,0x00, 0x38,0x32,0x0b, 0x38,0x40,0x02, 0x38,0x45,0x01, 0x38,0x4b,0x01, 40 | 0x38,0x4f,0x00, 0x38,0x57,0x01, 0x38,0x67,0x03, 0x39,0x02,0x03, 0x39,0x09,0x00, 0x39,0x12,0x00, 0x39,0x1a,0x01, 0x39,0x32,0x0b, 0x39,0x3f,0x01, 0x39,0x44,0x02, 0x39,0x4b,0x00, 0x39,0x50,0x01, 0x39,0x56,0x01, 0x39,0x67,0x02, 0x3a,0x03,0x04, 0x3a,0x0a,0x01, 41 | 0x3a,0x12,0x00, 0x3a,0x1a,0x00, 0x3a,0x32,0x0d, 0x3a,0x44,0x03, 0x3a,0x4b,0x00, 0x3a,0x52,0x04, 0x3a,0x66,0x03, 0x3b,0x04,0x04, 0x3b,0x0c,0x01, 0x3b,0x11,0x00, 0x3b,0x19,0x00, 0x3b,0x32,0x0c, 0x3b,0x43,0x02, 0x3b,0x47,0x01, 0x3b,0x4b,0x00, 0x3b,0x66,0x02, 42 | 0x3c,0x05,0x05, 0x3c,0x11,0x00, 0x3c,0x19,0x00, 0x3c,0x33,0x0a, 0x3c,0x42,0x04, 0x3c,0x49,0x02, 0x3c,0x65,0x03, 0x3d,0x06,0x08, 0x3d,0x11,0x00, 0x3d,0x18,0x01, 0x3d,0x1d,0x06, 0x3d,0x25,0x00, 0x3d,0x33,0x0a, 0x3d,0x41,0x01, 0x3d,0x45,0x02, 0x3d,0x4a,0x01, 43 | 0x3d,0x64,0x04, 0x3e,0x08,0x09, 0x3e,0x18,0x01, 0x3e,0x1d,0x07, 0x3e,0x34,0x09, 0x3e,0x40,0x01, 0x3e,0x44,0x04, 0x3e,0x63,0x04, 0x3f,0x0a,0x07, 0x3f,0x17,0x03, 0x3f,0x1e,0x05, 0x3f,0x34,0x09, 0x3f,0x3f,0x01, 0x3f,0x43,0x06, 0x3f,0x63,0x03, 0x40,0x0d,0x04, 44 | 0x40,0x17,0x05, 0x40,0x20,0x03, 0x40,0x34,0x0b, 0x40,0x42,0x08, 0x40,0x61,0x05, 0x41,0x0c,0x04, 0x41,0x17,0x07, 0x41,0x22,0x00, 0x41,0x35,0x08, 0x41,0x41,0x04, 0x41,0x47,0x0a, 0x41,0x60,0x05, 0x42,0x0c,0x04, 0x42,0x16,0x0c, 0x42,0x35,0x07, 0x42,0x40,0x04, 45 | 0x42,0x48,0x04, 0x42,0x51,0x03, 0x42,0x5f,0x05, 0x43,0x0b,0x03, 0x43,0x10,0x00, 0x43,0x16,0x06, 0x43,0x1f,0x03, 0x43,0x35,0x07, 0x43,0x3f,0x04, 0x43,0x49,0x03, 0x43,0x53,0x02, 0x43,0x5c,0x07, 0x44,0x0b,0x02, 0x44,0x10,0x01, 0x44,0x16,0x06, 0x44,0x21,0x01, 46 | 0x44,0x35,0x06, 0x44,0x3e,0x04, 0x44,0x49,0x04, 0x44,0x55,0x01, 0x44,0x59,0x0b, 0x45,0x0a,0x03, 0x45,0x10,0x01, 0x45,0x16,0x05, 0x45,0x21,0x01, 0x45,0x35,0x0c, 0x45,0x49,0x05, 0x45,0x56,0x0f, 0x46,0x09,0x03, 0x46,0x10,0x01, 0x46,0x15,0x06, 0x46,0x21,0x01, 47 | 0x46,0x34,0x0b, 0x46,0x4a,0x08, 0x46,0x55,0x09, 0x46,0x62,0x03, 0x47,0x08,0x04, 0x47,0x10,0x01, 0x47,0x15,0x06, 0x47,0x21,0x01, 0x47,0x34,0x0a, 0x47,0x4b,0x11, 0x47,0x63,0x03, 0x48,0x07,0x05, 0x48,0x10,0x01, 0x48,0x15,0x05, 0x48,0x21,0x01, 0x48,0x34,0x08, 48 | 0x48,0x49,0x0e, 0x48,0x63,0x03, 0x49,0x07,0x03, 0x49,0x0c,0x00, 0x49,0x10,0x01, 0x49,0x15,0x05, 0x49,0x21,0x01, 0x49,0x33,0x08, 0x49,0x48,0x06, 0x49,0x52,0x03, 0x49,0x64,0x03, 0x4a,0x07,0x02, 0x4a,0x0c,0x01, 0x4a,0x10,0x01, 0x4a,0x15,0x04, 0x4a,0x22,0x01, 49 | 0x4a,0x33,0x06, 0x4a,0x47,0x05, 0x4a,0x64,0x03, 0x4b,0x07,0x02, 0x4b,0x0d,0x00, 0x4b,0x11,0x01, 0x4b,0x15,0x04, 0x4b,0x22,0x02, 0x4b,0x32,0x05, 0x4b,0x47,0x03, 0x4b,0x64,0x03, 0x4c,0x07,0x02, 0x4c,0x0d,0x01, 0x4c,0x11,0x01, 0x4c,0x15,0x03, 0x4c,0x23,0x02, 50 | 0x4c,0x31,0x04, 0x4c,0x46,0x03, 0x4c,0x64,0x03, 0x4d,0x07,0x03, 0x4d,0x0e,0x01, 0x4d,0x11,0x07, 0x4d,0x23,0x03, 0x4d,0x30,0x04, 0x4d,0x46,0x03, 0x4d,0x64,0x03, 0x4e,0x07,0x03, 0x4e,0x0f,0x08, 0x4e,0x20,0x00, 0x4e,0x25,0x05, 0x4e,0x2c,0x07, 0x4e,0x46,0x02, 51 | 0x4e,0x64,0x03, 0x4f,0x08,0x03, 0x4f,0x13,0x04, 0x4f,0x20,0x00, 0x4f,0x25,0x0d, 0x4f,0x45,0x03, 0x4f,0x63,0x04, 0x50,0x09,0x02, 0x50,0x17,0x00, 0x50,0x25,0x0a, 0x50,0x45,0x03, 0x50,0x62,0x06, 0x51,0x0a,0x02, 0x51,0x17,0x01, 0x51,0x20,0x00, 0x51,0x25,0x04, 52 | 0x51,0x45,0x03, 0x51,0x61,0x01, 0x51,0x65,0x03, 0x52,0x0a,0x02, 0x52,0x17,0x01, 0x52,0x20,0x00, 0x52,0x24,0x04, 0x52,0x46,0x02, 0x52,0x5f,0x02, 0x52,0x65,0x03, 0x53,0x0a,0x02, 0x53,0x18,0x00, 0x53,0x20,0x00, 0x53,0x23,0x04, 0x53,0x46,0x03, 0x53,0x5d,0x02, 53 | 0x53,0x64,0x04, 0x54,0x0a,0x03, 0x54,0x1f,0x08, 0x54,0x46,0x03, 0x54,0x5b,0x01, 0x54,0x62,0x05, 0x55,0x0a,0x03, 0x55,0x1f,0x07, 0x55,0x46,0x03, 0x55,0x59,0x01, 0x55,0x5f,0x08, 0x56,0x0b,0x03, 0x56,0x1d,0x07, 0x56,0x47,0x03, 0x56,0x57,0x01, 0x56,0x5d,0x08, 54 | 0x57,0x0b,0x04, 0x57,0x1c,0x05, 0x57,0x47,0x05, 0x57,0x53,0x03, 0x57,0x5c,0x07, 0x58,0x0c,0x04, 0x58,0x1a,0x06, 0x58,0x48,0x0b, 0x58,0x5a,0x07, 0x59,0x0d,0x07, 0x59,0x16,0x08, 0x59,0x49,0x06, 0x59,0x58,0x06, 0x5a,0x0e,0x0f, 0x5a,0x4a,0x03, 0x5a,0x56,0x07, 55 | 0x5b,0x10,0x0b, 0x5b,0x4b,0x04, 0x5b,0x53,0x09, 0x5c,0x12,0x06, 0x5c,0x4b,0x0f, 0x5d,0x4c,0x0c, 0x5e,0x4d,0x08, 56 | }; 57 | 58 | const unsigned short fontmario0_CharOffs[2] PROGMEM = { 59 | 0x0000, 0x0287, 60 | }; 61 | 62 | RRE_Font rre_mario0 = { RRE_V24B, 96,128, 0x20, 0x20, (const uint8_t*)fontmario0_Rects, (const uint16_t*)fontmario0_CharOffs }; 63 | 64 | #endif 65 | 66 | -------------------------------------------------------------------------------- /examples/ILI9163C_Gauges/ILI9163C_Gauges.ino: -------------------------------------------------------------------------------- 1 | // ILI9163C library example 2 | // Color gauges and progress bars 3 | // (c) 2019 Pawel A. Hernik 4 | // YouTube videos: 5 | // https://youtu.be/rdL3qHEnd4Q 6 | // https://youtu.be/x94y-qH2RBs 7 | 8 | /* 9 | Pinout (header on the top, from left): 10 | LED -> 3.3V 11 | SCK -> D13 12 | SDA -> D11/MOSI 13 | A0/DC -> D8 or any digital 14 | RESET -> D9 or any digital 15 | CS -> D10 or any digital 16 | GND -> GND 17 | VCC -> 3.3V 18 | */ 19 | 20 | #define SCR_WD 128 21 | #define SCR_HT 128 22 | 23 | #define TFT_CS 10 24 | #define TFT_DC 8 25 | #define TFT_RST 9 26 | #include 27 | #include 28 | #include 29 | Arduino_ILI9163C lcd = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 30 | 31 | #include "RREFont.h" 32 | #include "rre_bold13x20.h" 33 | #include "rre_5x8.h" 34 | 35 | RREFont font; 36 | 37 | // needed for RREFont library initialization, define your fillRect 38 | void customRect(int x, int y, int w, int h, int c) { return lcd.fillRect(x, y, w, h, c); } 39 | 40 | //#include "bold13x20digtop_font.h" 41 | //#include "small4x6_font.h" 42 | 43 | int cx,cy; 44 | int sx,sy; 45 | int xs0,ys0,xe0,ye0; 46 | int xs1,ys1,xe1,ye1; 47 | uint16_t bgCol; 48 | int i; 49 | char buf[20]; 50 | 51 | // ------------------------------------------------ 52 | #define MAXSIN 255 53 | const uint8_t sinTab[91] PROGMEM = { 54 | 0,4,8,13,17,22,26,31,35,39,44,48,53,57,61,65,70,74,78,83,87,91,95,99,103,107,111,115,119,123, 55 | 127,131,135,138,142,146,149,153,156,160,163,167,170,173,177,180,183,186,189,192,195,198,200,203,206,208,211,213,216,218, 56 | 220,223,225,227,229,231,232,234,236,238,239,241,242,243,245,246,247,248,249,250,251,251,252,253,253,254,254,254,254,254, 57 | 255 58 | }; 59 | 60 | int fastSin(int i) 61 | { 62 | while(i<0) i+=360; 63 | while(i>=360) i-=360; 64 | if(i<90) return(pgm_read_byte(&sinTab[i])); else 65 | if(i<180) return(pgm_read_byte(&sinTab[180-i])); else 66 | if(i<270) return(-pgm_read_byte(&sinTab[i-180])); else 67 | return(-pgm_read_byte(&sinTab[360-i])); 68 | } 69 | 70 | int fastCos(int i) 71 | { 72 | return fastSin(i+90); 73 | } 74 | 75 | // ------------------------------------------------ 76 | 77 | void drawGauge1(int level) 78 | { 79 | cx=128/2; 80 | cy=128/2; 81 | int rx0=40, ry0=40; 82 | int rx1=63, ry1=63; 83 | int mina=-75; 84 | int maxa=180+75; 85 | for(int i=mina; imina) lcd.drawLine(xs0,ys0,lastx,lasty,BLACK); 134 | lastx=xs0; 135 | lasty=ys0; 136 | xs0 = cx+sx*rx2/MAXSIN; 137 | ys0 = cy+sy*rx2/MAXSIN; 138 | snprintf(buf,4,"%d",(i-mina)/8); 139 | font.setFont(&rre_5x8); 140 | font.setColor(RGBto565(150,150,150)); 141 | font.printStr(i==maxa?xs0-4:xs0-2,ys0-2,buf); 142 | } 143 | 144 | int a = map(level,0,100,mina,maxa); 145 | rx1 = rx0-12; 146 | sx = fastCos(a-180); 147 | sy = fastSin(a-180); 148 | xs0 = cx+(sx*rx1+MAXSIN/2)/MAXSIN; 149 | ys0 = cy+(sy*rx1+MAXSIN/2)/MAXSIN; 150 | rx1 = rx0-42; 151 | sx = fastCos(a-180); 152 | sy = fastSin(a-180); 153 | xs1 = cx+(sx*rx1+MAXSIN/2)/MAXSIN; 154 | ys1 = cy+(sy*rx1+MAXSIN/2)/MAXSIN; 155 | rx1 = rx0-42; 156 | sx = fastCos(a-180-8); 157 | sy = fastSin(a-180-8); 158 | xe0 = cx+(sx*rx1+MAXSIN/2)/MAXSIN; 159 | ye0 = cy+(sy*rx1+MAXSIN/2)/MAXSIN; 160 | sx = fastCos(a-180+8); 161 | sy = fastSin(a-180+8); 162 | xe1 = cx+(sx*rx1+MAXSIN/2)/MAXSIN; 163 | ye1 = cy+(sy*rx1+MAXSIN/2)/MAXSIN; 164 | 165 | lcd.drawLine(xs1Old,ys1Old,cx,cy,bgCol); 166 | lcd.fillTriangle(xs0Old,ys0Old,xe0Old,ye0Old,xe1Old,ye1Old,bgCol); 167 | lcd.drawLine(xs1,ys1,cx,cy,BLACK); 168 | lcd.fillTriangle(xs0,ys0,xe0,ye0,xe1,ye1,RED); 169 | lcd.fillCircle(cx,cy,2,BLACK); 170 | xs0Old=xs0; ys0Old=ys0; xs1Old=xs1; ys1Old=ys1; 171 | xe0Old=xe0; ye0Old=ye0; xe1Old=xe1; ye1Old=ye1; 172 | } 173 | 174 | void drawGauge3(int level) 175 | { 176 | cx=128/2; 177 | cy=128/2; 178 | int rx0=63; 179 | int rx1=rx0-4; 180 | int mina=0; 181 | int maxa=270; 182 | int lastx,lasty; 183 | static int xs0Old=0,ys0Old=0; 184 | for(int i=mina; i<=maxa; i+=3) { 185 | sx = fastCos(i-270); 186 | sy = fastSin(i-270); 187 | xs0 = cx+sx*rx0/MAXSIN; 188 | ys0 = cy+sy*rx0/MAXSIN; 189 | if(i>mina) lcd.drawLine(xs0,ys0,lastx,lasty,WHITE); 190 | lastx=xs0; 191 | lasty=ys0; 192 | } 193 | for(int i=mina; i<=maxa; i+=9) { 194 | sx = fastCos(i-270); 195 | sy = fastSin(i-270); 196 | xs0 = cx+sx*rx0/MAXSIN; 197 | ys0 = cy+sy*rx0/MAXSIN; 198 | if(i%27==0) rx1=rx0-5; else rx1=rx0-3; 199 | xe0 = cx+sx*rx1/MAXSIN; 200 | ye0 = cy+sy*rx1/MAXSIN; 201 | lcd.drawLine(xs0,ys0,xe0,ye0,WHITE); 202 | } 203 | 204 | int a = map(level,0,100,mina,maxa); 205 | rx1=rx0-7; 206 | sx = fastCos(a-270); 207 | sy = fastSin(a-270); 208 | xs0 = cx+sx*rx1/MAXSIN; 209 | ys0 = cy+sy*rx1/MAXSIN; 210 | lcd.drawLine(xs0Old,ys0Old,cx,cy,BLACK); 211 | lcd.drawLine(xs0,ys0,cx,cy,RED); 212 | lcd.fillCircle(cx,cy,2,RED); 213 | xs0Old=xs0; ys0Old=ys0; 214 | 215 | lcd.fillRect(SCR_WD-13*3-2,SCR_HT-20,13*3+2,20,BLACK); 216 | snprintf(buf,10,"%d",level); 217 | font.setFont(&rre_Bold13x20); 218 | font.setCharMinWd(13); 219 | font.setColor(WHITE); 220 | font.printStr(ALIGN_RIGHT,SCR_HT-20,buf); 221 | } 222 | 223 | void drawGauge4(int level) 224 | { 225 | cx=128-1; 226 | cy=128-1; 227 | int rx0=cx-2, ry0=cy-2; 228 | int rx1=rx0-20, ry1=ry0-20; 229 | int rx2=rx0+2, ry2=ry0+2; 230 | int mina=0; 231 | int maxa=90; 232 | for(int i=mina; i<=maxa; i+=5) { 233 | sx = fastCos(i-180); 234 | sy = fastSin(i-180); 235 | xs0 = cx+sx*rx0/MAXSIN; 236 | ys0 = cy+sy*ry0/MAXSIN; 237 | xe0 = cx+sx*rx1/MAXSIN; 238 | ye0 = cy+sy*ry1/MAXSIN; 239 | if(i>mina) { 240 | if(i<=level) { 241 | lcd.fillTriangle(xs0,ys0,xe0,ye0,xe1,ye1, lcd.rgbWheel(85*2*(90-i)/90)); 242 | lcd.fillTriangle(xs1,ys1,xe1,ye1,xs0,ys0, lcd.rgbWheel(85*2*(90-i)/90)); 243 | } else { 244 | lcd.fillTriangle(xs0,ys0,xe0,ye0,xe1,ye1, RGBto565(60,60,60)); 245 | lcd.fillTriangle(xs1,ys1,xe1,ye1,xs0,ys0, RGBto565(60,60,60)); 246 | } 247 | } 248 | xs1 = xs0; ys1 = ys0; 249 | xe1 = xe0; ye1 = ye0; 250 | xe0 = cx+sx*rx2/MAXSIN; 251 | ye0 = cy+sy*ry2/MAXSIN; 252 | lcd.drawLine(xs0,ys0,xe0,ye0, YELLOW); 253 | } 254 | lcd.fillRect(SCR_WD-(13*3+2)*1,SCR_HT-20,(13*3+2)*1,20,BLACK); 255 | snprintf(buf,10,"%d",level); 256 | font.setFont(&rre_Bold13x20); 257 | font.setCharMinWd(13); 258 | font.setColor(WHITE); 259 | font.printStr(ALIGN_RIGHT,SCR_HT-20,buf); 260 | } 261 | 262 | void drawBar(int level) 263 | { 264 | int i=level*SCR_WD/100; 265 | lcd.fillRect(0,10,i,15,lcd.rgbWheel(85*2*level/100)); 266 | lcd.fillRect(i,10,SCR_WD-i,15,RGBto565(60,60,60)); 267 | 268 | for(i=0;i100) k=127; else k=30+(127-30)*(k-30)/(100-30); 294 | lcd.fillRect(i*8,127-barLev[i],7,barLev[i],RGBto565(r*k/127,g*k/127,b*k/127)); 295 | barLevOld[i]=barLev[i]; 296 | } 297 | 298 | for(int i=0;i<16;i++) { 299 | if(!barDec[i]) { 300 | if(barLev[i]>barLevSet[i]) { 301 | barLev[i]-=4; 302 | if(barLev[i]barLevSet[i]) { barLev[i]=barLevSet[i]; barDec[i]=1; } 306 | } 307 | } else { 308 | barLev[i]--; 309 | if(barLev[i]<0) barLev[i]=0; 310 | } 311 | } 312 | int r=random(16); 313 | barLevSet[r]=random(10,128); barDec[r]=0; 314 | if(r>0) { barLevSet[r-1]=7*barLevSet[r]/10; barDec[r-1]=0; } 315 | if(r<15) { barLevSet[r+1]=7*barLevSet[r]/10; barDec[r+1]=0; } 316 | } 317 | 318 | unsigned long ms,tm=15000; 319 | 320 | void setup(void) 321 | { 322 | Serial.begin(9600); 323 | lcd.init(); 324 | lcd.fillScreen(BLACK); 325 | font.init(customRect, SCR_WD, SCR_HT); // custom fillRect function and screen width and height values 326 | font.setFont(&rre_5x8); 327 | font.setColor(GREEN); 328 | font.printStr(ALIGN_CENTER,SCR_HT/2-3,"GAUGES DEMO"); 329 | delay(2000); 330 | } 331 | 332 | void loop() 333 | { 334 | lcd.fillScreen(BLACK); 335 | ms=millis(); 336 | while(millis()-ms=0;i-=5) { drawGauge1(i); delay(10); } 340 | delay(250); 341 | } 342 | 343 | lcd.fillScreen(BLACK); 344 | ms=millis(); 345 | while(millis()-ms=0;i-=5) { drawBar(i); delay(60); } 349 | delay(250); 350 | } 351 | 352 | bgCol=RGBto565(220,220,220); 353 | lcd.fillScreen(bgCol); 354 | ms=millis(); 355 | while(millis()-ms=0;i-=2) { drawGauge2(i); delay(10); } 359 | delay(450); 360 | } 361 | 362 | lcd.fillScreen(BLACK); 363 | ms=millis(); 364 | while(millis()-ms=0;i-=2) { drawGauge3(i); delay(40); } 374 | delay(450); 375 | } 376 | 377 | lcd.fillScreen(BLACK); 378 | ms=millis(); 379 | while(millis()-ms=0;i-=5) { drawGauge4(i); delay(40); } 383 | delay(450); 384 | } 385 | } 386 | 387 | 388 | -------------------------------------------------------------------------------- /examples/ILI9163C_AdafruitBenchmark/ILI9163C_AdafruitBenchmark.ino: -------------------------------------------------------------------------------- 1 | // ILI9163C library benchmark 2 | // (c) 2019 Pawel A. Hernik 3 | 4 | /* 5 | Pinout (header on the top, from left): 6 | LED -> 3.3V 7 | SCK -> D13 8 | SDA -> D11/MOSI 9 | A0/DC -> D8 or any digital 10 | RESET -> D9 or any digital 11 | CS -> D10 or any digital 12 | GND -> GND 13 | VCC -> 3.3V 14 | */ 15 | 16 | #define TFT_CS 10 17 | #define TFT_DC 8 18 | #define TFT_RST 9 19 | 20 | #include 21 | #include 22 | #include 23 | Arduino_ILI9163C tft = Arduino_ILI9163C(TFT_DC, TFT_RST, TFT_CS); 24 | //#include 25 | //TFT_ILI9163C tft = TFT_ILI9163C(TFT_CS, TFT_DC, TFT_RST); 26 | 27 | // Color definitions 28 | #define BLACK 0x0000 29 | #define BLUE 0x001F 30 | #define RED 0xF800 31 | #define GREEN 0x07E0 32 | #define CYAN 0x07FF 33 | #define MAGENTA 0xF81F 34 | #define YELLOW 0xFFE0 35 | #define WHITE 0xFFFF 36 | #define RGBto565(r,g,b) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | ((b) >> 3)) 37 | 38 | 39 | // ------------------------------------------------ 40 | unsigned long FillScreenTest() 41 | { 42 | unsigned long start = millis(); 43 | for(int i=0;i<5;i++) { 44 | tft.fillScreen(RED); 45 | tft.fillScreen(GREEN); 46 | tft.fillScreen(BLUE); 47 | tft.fillScreen(YELLOW); 48 | } 49 | return millis()-start; 50 | } 51 | 52 | // ------------------------------------------------ 53 | unsigned long ClearScreenTest() 54 | { 55 | unsigned long start = millis(); 56 | for(int i=0;i<5*4;i++) 57 | tft.fillScreen(BLACK); 58 | return millis()-start; 59 | } 60 | // ------------------------------------------------ 61 | 62 | unsigned long orig[14]={ 4061,4061,1015596,81344,558032,88616,73228, 63 | 1572316,280652,235748,235844,626672,157688,1732376 }; 64 | 65 | unsigned long res[14]; 66 | void result(int i) 67 | { 68 | Serial.print(res[i]); 69 | if(res[i]<1000000) Serial.print("\t"); 70 | Serial.print("\t\t\t"); 71 | Serial.print(100*orig[i]/res[i]); 72 | Serial.println("%"); 73 | } 74 | 75 | void setup(void) 76 | { 77 | Serial.begin(9600); 78 | Serial.println(F("ILI9163C 128x128")); 79 | //tft.begin(); 80 | tft.init(); 81 | tft.fillScreen(BLACK); 82 | tft.setCursor(0, 0); 83 | tft.setTextColor(WHITE); tft.setTextSize(1); 84 | tft.println("ILI9163C 128x128"); 85 | tft.println("Library Benchmark"); 86 | tft.println("starts in 3s ..."); 87 | delay(3000); 88 | 89 | Serial.println(F("Benchmark Time (microseconds)")); 90 | 91 | res[0]=FillScreenTest(); 92 | Serial.print(F("FillScreen Mbps ")); 93 | Serial.println(String(res[0])+"ms "+String(1000*20.0/res[0])+"fps "+String(128.0*128*16*20.0/res[0]/1000.0)+" Mbps\t"+100*orig[0]/res[0]+"%"); 94 | 95 | res[1]=ClearScreenTest(); 96 | Serial.print(F("ClearScreen Mbps ")); 97 | Serial.println(String(res[1])+"ms "+String(1000*20.0/res[1])+"fps "+String(128.0*128*16*20.0/res[1]/1000.0)+" Mbps\t"+100*orig[1]/res[1]+"%"); 98 | 99 | res[2]=testFillScreen(); 100 | Serial.print(F("Screen fill ")); 101 | result(2); 102 | delay(500); 103 | 104 | res[3]=testText(); 105 | Serial.print(F("Text ")); 106 | result(3); 107 | delay(3000); 108 | 109 | res[4]=testLines(CYAN); 110 | Serial.print(F("Lines ")); 111 | result(4); 112 | delay(500); 113 | 114 | res[5]=testFastLines(RED, BLUE); 115 | Serial.print(F("Horiz/Vert Lines ")); 116 | result(5); 117 | delay(500); 118 | 119 | res[6]=testRects(GREEN); 120 | Serial.print(F("Rectangles (outline) ")); 121 | result(6); 122 | delay(500); 123 | 124 | res[7]=testFilledRects(YELLOW, MAGENTA); 125 | Serial.print(F("Rectangles (filled) ")); 126 | result(7); 127 | delay(500); 128 | 129 | res[8]=testFilledCircles(10, MAGENTA); 130 | Serial.print(F("Circles (filled) ")); 131 | result(8); 132 | 133 | res[9]=testCircles(10, WHITE); 134 | Serial.print(F("Circles (outline) ")); 135 | result(9); 136 | delay(500); 137 | 138 | res[10]=testTriangles(); 139 | Serial.print(F("Triangles (outline) ")); 140 | result(10); 141 | delay(500); 142 | 143 | res[11]=testFilledTriangles(); 144 | Serial.print(F("Triangles (filled) ")); 145 | result(11); 146 | delay(500); 147 | 148 | res[12]=testRoundRects(); 149 | Serial.print(F("Rounded rects (outline) ")); 150 | result(12); 151 | delay(500); 152 | 153 | res[13]=testFilledRoundRects(); 154 | Serial.print(F("Rounded rects (filled) ")); 155 | result(13); 156 | delay(500); 157 | 158 | Serial.println(F("Done!")); 159 | 160 | int c1=YELLOW, c2=WHITE; 161 | tft.fillScreen(BLACK); 162 | tft.setCursor(0, 0); 163 | tft.setTextSize(1); 164 | tft.setTextColor(CYAN); 165 | //tft.println("RESULTS:"); 166 | 167 | //tft.setTextSize(1); 168 | //tft.println(); 169 | tft.setTextColor(GREEN); 170 | tft.println(F("Benchmark Time/us")); 171 | tft.setTextColor(c1); tft.print(F("FillScr Mbps ")); 172 | //tft.setTextColor(c2); tft.print(String(res[0])+"ms "+String(128.0*128*16*20.0/res[0]/1000.0)+" Mbps"); 173 | tft.setTextColor(c2); tft.println(String(128.0*128*16*20.0/res[0]/1000.0)); 174 | tft.setTextColor(c1); tft.print(F("ClrScr Mbps ")); 175 | //tft.setTextColor(c2); tft.print(String(res[1])+"ms "+String(128.0*128*16*20.0/res[1]/1000.0)+" Mbps"); 176 | tft.setTextColor(c2); tft.println(String(128.0*128*16*20.0/res[1]/1000.0)); 177 | tft.setTextColor(c1); tft.print(F("Screen fill ")); 178 | tft.setTextColor(c2); tft.println(res[2]); 179 | tft.setTextColor(c1); tft.print(F("Text ")); 180 | tft.setTextColor(c2); tft.println(res[3]); 181 | tft.setTextColor(c1); tft.print(F("Lines ")); 182 | tft.setTextColor(c2); tft.println(res[4]); 183 | tft.setTextColor(c1); tft.print(F("H/V Lines ")); 184 | tft.setTextColor(c2); tft.println(res[5]); 185 | tft.setTextColor(c1); tft.print(F("Rects O ")); 186 | tft.setTextColor(c2); tft.println(res[6]); 187 | tft.setTextColor(c1); tft.print(F("Rects F ")); 188 | tft.setTextColor(c2); tft.println(res[7]); 189 | tft.setTextColor(c1); tft.print(F("Circles F ")); 190 | tft.setTextColor(c2); tft.println(res[8]); 191 | tft.setTextColor(c1); tft.print(F("Circles O ")); 192 | tft.setTextColor(c2); tft.println(res[9]); 193 | tft.setTextColor(c1); tft.print(F("Tris O ")); 194 | tft.setTextColor(c2); tft.println(res[10]); 195 | tft.setTextColor(c1); tft.print(F("Tris F ")); 196 | tft.setTextColor(c2); tft.println(res[11]); 197 | tft.setTextColor(c1); tft.print(F("Round rects O ")); 198 | tft.setTextColor(c2); tft.println(res[12]); 199 | tft.setTextColor(c1); tft.print(F("Round rects F ")); 200 | tft.setTextColor(c2); tft.println(res[13]); 201 | tft.setTextColor(RED); tft.println(F("Done!")); 202 | } 203 | 204 | /* 205 | ILI9163C 128x128 - original 206 | Benchmark Time (microseconds) 207 | FillScreen Mbps 4061ms 4.92fps 1.29 Mbps 208 | ClearScreen Mbps 4061ms 4.92fps 1.29 Mbps 209 | Screen fill 1015596 210 | Text 81344 211 | Lines 558032 212 | Horiz/Vert Lines 88616 213 | Rectangles (outline) 73228 214 | Rectangles (filled) 1572316 215 | Circles (filled) 280652 216 | Circles (outline) 235748 217 | Triangles (outline) 235844 218 | Triangles (filled) 626672 219 | Rounded rects (outline) 157688 220 | Rounded rects (filled) 1732376 221 | Done! 222 | 223 | ILI9163C 128x128 - optimized, with CS controlled by MCU 224 | Benchmark Time (microseconds) 225 | FillScreen Mbps 754ms 26.53fps 6.95 Mbps 538% 226 | ClearScreen Mbps 755ms 26.49fps 6.94 Mbps 537% 227 | Screen fill 188968 537% 228 | Text 30548 266% 229 | Lines 185528 300% 230 | Horiz/Vert Lines 17096 518% 231 | Rectangles (outline) 14948 489% 232 | Rectangles (filled) 287904 546% 233 | Circles (filled) 71236 393% 234 | Circles (outline) 78324 300% 235 | Triangles (outline) 78500 300% 236 | Triangles (filled) 187840 333% 237 | Rounded rects (outline) 45224 348% 238 | Rounded rects (filled) 326948 529% 239 | Done! 240 | 241 | ILI9163C 128x128 - optimized, with CS connected to the ground and CS_ALWAYS_LOW 242 | Benchmark Time (microseconds) 243 | FillScreen Mbps 753ms 26.56fps 6.96 Mbps 539% 244 | ClearScreen Mbps 753ms 26.56fps 6.96 Mbps 539% 245 | Screen fill 188648 538% 246 | Text 30608 265% 247 | Lines 181280 307% 248 | Horiz/Vert Lines 17092 518% 249 | Rectangles (outline) 14948 489% 250 | Rectangles (filled) 287444 546% 251 | Circles (filled) 71232 393% 252 | Circles (outline) 76528 308% 253 | Triangles (outline) 76700 307% 254 | Triangles (filled) 187840 333% 255 | Rounded rects (outline) 44492 354% 256 | Rounded rects (filled) 326592 530% 257 | Done! 258 | */ 259 | 260 | // ------------------------------------------------ 261 | 262 | void loop(void) 263 | { 264 | } 265 | 266 | // ------------------------------------------------ 267 | 268 | unsigned long testFillScreen() { 269 | unsigned long start = micros(); 270 | tft.fillScreen(BLACK); 271 | tft.fillScreen(RED); 272 | tft.fillScreen(GREEN); 273 | tft.fillScreen(BLUE); 274 | tft.fillScreen(BLACK); 275 | return micros() - start; 276 | } 277 | 278 | // ------------------------------------------------ 279 | unsigned long testText() { 280 | tft.fillScreen(BLACK); 281 | unsigned long start = micros(); 282 | tft.setCursor(0, 0); 283 | tft.setTextColor(WHITE); tft.setTextSize(1); 284 | tft.println("Hello World!"); 285 | tft.setTextColor(YELLOW); tft.setTextSize(2); 286 | tft.println(1234.56); 287 | tft.setTextColor(RED); tft.setTextSize(3); 288 | tft.println(0xDEADBEEF, HEX); 289 | tft.println(); 290 | tft.setTextColor(GREEN); 291 | tft.setTextSize(5); 292 | tft.println("Groop"); 293 | tft.setTextSize(2); 294 | tft.println("I implore thee,"); 295 | tft.setTextSize(1); 296 | tft.println("my foonting turlingdromes."); 297 | tft.println("And hooptiously drangle me"); 298 | tft.println("with crinkly bindlewurdles,"); 299 | tft.println("Or I will rend thee"); 300 | tft.println("in the gobberwarts"); 301 | tft.println("with my blurglecruncheon,"); 302 | tft.println("see if I don't!"); 303 | return micros() - start; 304 | } 305 | 306 | // ------------------------------------------------ 307 | unsigned long testLines(uint16_t color) { 308 | unsigned long start, t; 309 | int x1, y1, x2, y2, 310 | w = tft.width(), 311 | h = tft.height(); 312 | 313 | tft.fillScreen(BLACK); 314 | 315 | x1 = y1 = 0; 316 | y2 = h - 1; 317 | start = micros(); 318 | for(x2=0; x20; i-=6) { 399 | i2 = i / 2; 400 | start = micros(); 401 | tft.fillRect(cx-i2, cy-i2, i, i, color1); 402 | t += micros() - start; 403 | // Outlines are not included in timing results 404 | tft.drawRect(cx-i2, cy-i2, i, i, color2); 405 | } 406 | 407 | return t; 408 | } 409 | 410 | // ------------------------------------------------ 411 | unsigned long testFilledCircles(uint8_t radius, uint16_t color) { 412 | unsigned long start; 413 | int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2; 414 | 415 | tft.fillScreen(BLACK); 416 | start = micros(); 417 | for(x=radius; x10; i-=5) { 474 | start = micros(); 475 | tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, 476 | RGBto565(0, i, i)); 477 | t += micros() - start; 478 | tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, 479 | RGBto565(i, i, 0)); 480 | } 481 | 482 | return t; 483 | } 484 | 485 | // ------------------------------------------------ 486 | unsigned long testRoundRects() { 487 | unsigned long start; 488 | int w, i, i2, 489 | cx = tft.width() / 2 - 1, 490 | cy = tft.height() / 2 - 1; 491 | 492 | tft.fillScreen(BLACK); 493 | w = min(tft.width(), tft.height()); 494 | start = micros(); 495 | for(i=0; i20; i-=6) { 513 | i2 = i / 2; 514 | tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, RGBto565(0, i, 0)); 515 | } 516 | 517 | return micros() - start; 518 | } 519 | // ------------------------------------------------ 520 | 521 | -------------------------------------------------------------------------------- /Arduino_ILI9163C_Fast.cpp: -------------------------------------------------------------------------------- 1 | // Fast ILI9163C 128x128 LCD SPI display library 2 | // (c) 2019 by Pawel A. Hernik 3 | 4 | #include "Arduino_ILI9163C_Fast.h" 5 | #include 6 | #include "pins_arduino.h" 7 | #include "wiring_private.h" 8 | #include 9 | 10 | // Initialization commands for ILI9163C 11 | // taken from https://github.com/sumotoy/TFT_ILI9163C 12 | static const uint8_t PROGMEM init_ILI9163C[] = { 13 | 18, 14 | ILI9163C_SWRESET, ST_CMD_DELAY, 100, 15 | ILI9163C_SLPOUT, ST_CMD_DELAY, 5, 16 | ILI9163C_PIXFMT, 1+ST_CMD_DELAY, 0x05, 5, 17 | ILI9163C_GAMMASET, 1+ST_CMD_DELAY, 0x04, 1, 18 | ILI9163C_GAMRSEL, 1+ST_CMD_DELAY, 0x01, 1, 19 | ILI9163C_NORML, 0, 20 | ILI9163C_DFUNCTR, 2,0b11111111,0b00000110, 21 | 22 | ILI9163C_FRMCTR1, 2+ST_CMD_DELAY, 0x08,0x02, 1, 23 | ILI9163C_DINVCTR, 1+ST_CMD_DELAY, 0x07, 1, 24 | ILI9163C_PWCTR1, 2+ST_CMD_DELAY, 0x0A,0x02, 1, 25 | ILI9163C_PWCTR2, 1+ST_CMD_DELAY, 0x02, 1, 26 | ILI9163C_VCOMCTR1, 2+ST_CMD_DELAY, 0x50,99, 1, 27 | ILI9163C_VCOMOFFS, 1+ST_CMD_DELAY, 0, 1, 28 | ILI9163C_CLMADRS, 4, 0,0, (_GRAMWIDTH>>8),(_GRAMWIDTH), 29 | ILI9163C_PGEADRS, 4, 0,0, (_GRAMHEIGH>>8),(_GRAMHEIGH), 30 | ILI9163C_VSCLLDEF, 6, (__OFFSET>>8),(__OFFSET), (_GRAMHEIGH - __OFFSET)>>8,(_GRAMHEIGH - __OFFSET), 0,0, 31 | 32 | ILI9163C_DISPON, ST_CMD_DELAY, 1, 33 | ILI9163C_RAMWR, ST_CMD_DELAY, 1 34 | }; 35 | 36 | #ifdef COMPATIBILITY_MODE 37 | static SPISettings spiSettings; 38 | #define SPI_START SPI.beginTransaction(spiSettings) 39 | #define SPI_END SPI.endTransaction() 40 | #else 41 | #define SPI_START 42 | #define SPI_END 43 | #endif 44 | 45 | // macros for fast DC and CS state changes 46 | #ifdef COMPATIBILITY_MODE 47 | #define DC_DATA digitalWrite(dcPin, HIGH) 48 | #define DC_COMMAND digitalWrite(dcPin, LOW) 49 | #define CS_IDLE digitalWrite(csPin, HIGH) 50 | #define CS_ACTIVE digitalWrite(csPin, LOW) 51 | #else 52 | #define DC_DATA *dcPort |= dcMask 53 | #define DC_COMMAND *dcPort &= ~dcMask 54 | #define CS_IDLE *csPort |= csMask 55 | #define CS_ACTIVE *csPort &= ~csMask 56 | #endif 57 | 58 | // if CS always connected to the ground then don't do anything for better performance 59 | #ifdef CS_ALWAYS_LOW 60 | #define CS_IDLE 61 | #define CS_ACTIVE 62 | #endif 63 | 64 | // ---------------------------------------------------------- 65 | // speed test results: 66 | // in AVR best performance mode -> about 6.9 Mbps 67 | // in compatibility mode (SPI.transfer(c)) -> about 4 Mbps 68 | inline void Arduino_ILI9163C::writeSPI(uint8_t c) 69 | { 70 | #ifdef COMPATIBILITY_MODE 71 | SPI.transfer(c); 72 | #else 73 | SPDR = c; 74 | asm volatile("nop"); // 8 NOPs seem to be enough for 16MHz AVR @ DIV2 to avoid using while loop 75 | asm volatile("nop"); 76 | asm volatile("nop"); 77 | asm volatile("nop"); 78 | asm volatile("nop"); 79 | asm volatile("nop"); 80 | asm volatile("nop"); 81 | asm volatile("nop"); 82 | //while(!(SPSR & _BV(SPIF))) ; 83 | #endif 84 | } 85 | 86 | // ---------------------------------------------------------- 87 | Arduino_ILI9163C::Arduino_ILI9163C(int8_t dc, int8_t rst, int8_t cs) : Adafruit_GFX(_TFTWIDTH,_TFTHEIGHT) 88 | { 89 | csPin = cs; 90 | dcPin = dc; 91 | rstPin = rst; 92 | } 93 | 94 | // ---------------------------------------------------------- 95 | void Arduino_ILI9163C::init() 96 | { 97 | commonILI9163CInit(NULL); 98 | 99 | _width = 128; 100 | _height = 128; 101 | displayInit(init_ILI9163C); 102 | setRotation(0); 103 | 104 | int i; 105 | writeCmd(ILI9163C_PGAMMAC); //Positive Gamma Correction Setting 106 | for(i=0;i<15;i++) writeData(pGammaSet[i]); 107 | writeCmd(ILI9163C_NGAMMAC); //Negative Gamma Correction Setting 108 | for(i=0;i<15;i++) writeData(nGammaSet[i]); 109 | } 110 | 111 | // ---------------------------------------------------------- 112 | void Arduino_ILI9163C::writeCmd(uint8_t c) 113 | { 114 | DC_COMMAND; 115 | CS_ACTIVE; 116 | SPI_START; 117 | 118 | writeSPI(c); 119 | 120 | CS_IDLE; 121 | SPI_END; 122 | } 123 | 124 | // ---------------------------------------------------------- 125 | void Arduino_ILI9163C::writeData(uint8_t d) 126 | { 127 | DC_DATA; 128 | CS_ACTIVE; 129 | SPI_START; 130 | 131 | writeSPI(d); 132 | 133 | CS_IDLE; 134 | SPI_END; 135 | } 136 | // ---------------------------------------------------------- 137 | void Arduino_ILI9163C::writeData16(uint16_t d) 138 | { 139 | DC_DATA; 140 | CS_ACTIVE; 141 | SPI_START; 142 | 143 | writeSPI(d>>8); 144 | writeSPI(d); 145 | 146 | CS_IDLE; 147 | SPI_END; 148 | } 149 | 150 | // ---------------------------------------------------------- 151 | void Arduino_ILI9163C::displayInit(const uint8_t *addr) 152 | { 153 | uint8_t numCommands, numArgs; 154 | uint16_t ms; 155 | numCommands = pgm_read_byte(addr++); 156 | while(numCommands--) { 157 | writeCmd(pgm_read_byte(addr++)); 158 | numArgs = pgm_read_byte(addr++); 159 | ms = numArgs & ST_CMD_DELAY; 160 | numArgs &= ~ST_CMD_DELAY; 161 | while(numArgs--) writeData(pgm_read_byte(addr++)); 162 | 163 | if(ms) { 164 | ms = pgm_read_byte(addr++); 165 | if(ms == 255) ms = 500; 166 | delay(ms); 167 | } 168 | } 169 | } 170 | 171 | // ---------------------------------------------------------- 172 | // Initialization code - common 173 | void Arduino_ILI9163C::commonILI9163CInit(const uint8_t *cmdList) 174 | { 175 | pinMode(dcPin, OUTPUT); 176 | #ifndef CS_ALWAYS_LOW 177 | pinMode(csPin, OUTPUT); 178 | #endif 179 | 180 | #ifndef COMPATIBILITY_MODE 181 | dcPort = portOutputRegister(digitalPinToPort(dcPin)); 182 | dcMask = digitalPinToBitMask(dcPin); 183 | #ifndef CS_ALWAYS_LOW 184 | csPort = portOutputRegister(digitalPinToPort(csPin)); 185 | csMask = digitalPinToBitMask(csPin); 186 | #endif 187 | #endif 188 | 189 | SPI.begin(); 190 | #ifdef COMPATIBILITY_MODE 191 | spiSettings = SPISettings(16000000, MSBFIRST, SPI_MODE0); // 8000000 gives max speed on AVR 16MHz 192 | #else 193 | SPI.setClockDivider(SPI_CLOCK_DIV2); 194 | SPI.setDataMode(SPI_MODE0); 195 | #endif 196 | 197 | CS_ACTIVE; 198 | if(rstPin != -1) { 199 | pinMode(rstPin, OUTPUT); 200 | digitalWrite(rstPin, HIGH); 201 | delay(50); 202 | digitalWrite(rstPin, LOW); 203 | delay(50); 204 | digitalWrite(rstPin, HIGH); 205 | delay(50); 206 | } 207 | 208 | if(cmdList) displayInit(cmdList); 209 | 210 | setRotation(0); 211 | } 212 | 213 | // ---------------------------------------------------------- 214 | void Arduino_ILI9163C::setRotation(uint8_t m) 215 | { 216 | uint8_t madctl; 217 | rotation = m & 3; 218 | switch (rotation) { 219 | case 0: 220 | madctl = __COLORSPC; 221 | _width = _TFTWIDTH; 222 | _height = _TFTHEIGHT; 223 | break; 224 | case 1: 225 | madctl = ILI9163C_MADCTL_MX | ILI9163C_MADCTL_MV | __COLORSPC; 226 | _width = _TFTHEIGHT; 227 | _height = _TFTWIDTH; 228 | break; 229 | case 2: 230 | madctl = ILI9163C_MADCTL_MY | ILI9163C_MADCTL_MX | __COLORSPC; 231 | _width = _TFTWIDTH; 232 | _height = _TFTHEIGHT; 233 | break; 234 | case 3: 235 | madctl = ILI9163C_MADCTL_MY | ILI9163C_MADCTL_MV | __COLORSPC; 236 | _width = _TFTWIDTH; 237 | _height = _TFTHEIGHT; 238 | break; 239 | } 240 | writeCmd(ILI9163C_MADCTL); 241 | writeData(madctl); 242 | } 243 | 244 | // ---------------------------------------------------------- 245 | void Arduino_ILI9163C::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) 246 | { 247 | uint16_t xs = x0, xe = x1; 248 | uint16_t ys = y0, ye = y1; 249 | 250 | CS_ACTIVE; 251 | SPI_START; 252 | 253 | DC_COMMAND; writeSPI(ILI9163C_CLMADRS); 254 | DC_DATA; 255 | writeSPI(xs >> 8); writeSPI(xs & 0xFF); 256 | writeSPI(xe >> 8); writeSPI(xe & 0xFF); 257 | 258 | DC_COMMAND; writeSPI(ILI9163C_PGEADRS); 259 | DC_DATA; 260 | writeSPI(ys >> 8); writeSPI(ys & 0xFF); 261 | writeSPI(ye >> 8); writeSPI(ye & 0xFF); 262 | 263 | DC_COMMAND; writeSPI(ILI9163C_RAMWR); 264 | 265 | CS_IDLE; 266 | SPI_END; 267 | } 268 | 269 | // ---------------------------------------------------------- 270 | void Arduino_ILI9163C::pushColor(uint16_t color) 271 | { 272 | SPI_START; 273 | DC_DATA; 274 | CS_ACTIVE; 275 | 276 | writeSPI(color >> 8); writeSPI(color); 277 | 278 | CS_IDLE; 279 | SPI_END; 280 | } 281 | 282 | // ---------------------------------------------------------- 283 | void Arduino_ILI9163C::drawPixel(int16_t x, int16_t y, uint16_t color) 284 | { 285 | if(x<0 ||x>=_width || y<0 || y>=_height) return; 286 | setAddrWindow(x,y,x+1,y+1); 287 | 288 | SPI_START; 289 | DC_DATA; 290 | CS_ACTIVE; 291 | 292 | writeSPI(color >> 8); writeSPI(color); 293 | 294 | CS_IDLE; 295 | SPI_END; 296 | } 297 | 298 | // ---------------------------------------------------------- 299 | void Arduino_ILI9163C::drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) 300 | { 301 | if(x>=_width || y>=_height || h<=0) return; 302 | if(y+h-1>=_height) h=_height-y; 303 | setAddrWindow(x, y, x, y+h-1); 304 | 305 | uint8_t hi = color >> 8, lo = color; 306 | 307 | SPI_START; 308 | DC_DATA; 309 | CS_ACTIVE; 310 | 311 | uint8_t num8 = h>>3; 312 | while(num8--) { 313 | writeSPI(hi); writeSPI(lo); 314 | writeSPI(hi); writeSPI(lo); 315 | writeSPI(hi); writeSPI(lo); 316 | writeSPI(hi); writeSPI(lo); 317 | writeSPI(hi); writeSPI(lo); 318 | writeSPI(hi); writeSPI(lo); 319 | writeSPI(hi); writeSPI(lo); 320 | writeSPI(hi); writeSPI(lo); 321 | } 322 | num8 = (uint8_t)h & 7; 323 | while(num8--) { writeSPI(hi); writeSPI(lo); } 324 | 325 | CS_IDLE; 326 | SPI_END; 327 | } 328 | 329 | // ---------------------------------------------------------- 330 | void Arduino_ILI9163C::drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) 331 | { 332 | if(x>=_width || y>=_height || w<=0) return; 333 | if(x+w-1>=_width) w=_width-x; 334 | setAddrWindow(x, y, x+w-1, y); 335 | 336 | uint8_t hi = color >> 8, lo = color; 337 | 338 | SPI_START; 339 | DC_DATA; 340 | CS_ACTIVE; 341 | 342 | uint8_t num8 = w>>3; 343 | while(num8--) { 344 | writeSPI(hi); writeSPI(lo); 345 | writeSPI(hi); writeSPI(lo); 346 | writeSPI(hi); writeSPI(lo); 347 | writeSPI(hi); writeSPI(lo); 348 | writeSPI(hi); writeSPI(lo); 349 | writeSPI(hi); writeSPI(lo); 350 | writeSPI(hi); writeSPI(lo); 351 | writeSPI(hi); writeSPI(lo); 352 | } 353 | num8 = (uint8_t)w & 7; 354 | while(num8--) { writeSPI(hi); writeSPI(lo); } 355 | 356 | CS_IDLE; 357 | SPI_END; 358 | } 359 | 360 | // ---------------------------------------------------------- 361 | void Arduino_ILI9163C::fillScreen(uint16_t color) 362 | { 363 | fillRect(0, 0, _width, _height, color); 364 | } 365 | 366 | // ---------------------------------------------------------- 367 | void Arduino_ILI9163C::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) 368 | { 369 | if(x>=_width || y>=_height || w<=0 || h<=0) return; 370 | if(x+w-1>=_width) w=_width -x; 371 | if(y+h-1>=_height) h=_height-y; 372 | setAddrWindow(x, y, x+w-1, y+h-1); 373 | 374 | uint8_t hi = color >> 8, lo = color; 375 | 376 | SPI_START; 377 | DC_DATA; 378 | CS_ACTIVE; 379 | 380 | uint32_t num = (uint32_t)w*h; 381 | uint16_t num16 = num>>4; 382 | while(num16--) { 383 | writeSPI(hi); writeSPI(lo); 384 | writeSPI(hi); writeSPI(lo); 385 | writeSPI(hi); writeSPI(lo); 386 | writeSPI(hi); writeSPI(lo); 387 | writeSPI(hi); writeSPI(lo); 388 | writeSPI(hi); writeSPI(lo); 389 | writeSPI(hi); writeSPI(lo); 390 | writeSPI(hi); writeSPI(lo); 391 | writeSPI(hi); writeSPI(lo); 392 | writeSPI(hi); writeSPI(lo); 393 | writeSPI(hi); writeSPI(lo); 394 | writeSPI(hi); writeSPI(lo); 395 | writeSPI(hi); writeSPI(lo); 396 | writeSPI(hi); writeSPI(lo); 397 | writeSPI(hi); writeSPI(lo); 398 | writeSPI(hi); writeSPI(lo); 399 | } 400 | uint8_t num8 = num & 0xf; 401 | while(num8--) { writeSPI(hi); writeSPI(lo); } 402 | 403 | CS_IDLE; 404 | SPI_END; 405 | } 406 | 407 | // ---------------------------------------------------------- 408 | // draws image from RAM 409 | void Arduino_ILI9163C::drawImage(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t *img16) 410 | { 411 | if(x>=_width || y>=_height || w<=0 || h<=0) return; 412 | setAddrWindow(x, y, x+w-1, y+h-1); 413 | 414 | SPI_START; 415 | DC_DATA; 416 | CS_ACTIVE; 417 | 418 | uint32_t num = (uint32_t)w*h; 419 | uint16_t num16 = num>>3; 420 | uint8_t *img = (uint8_t *)img16; 421 | while(num16--) { 422 | writeSPI(*(img+1)); writeSPI(*(img+0)); img+=2; 423 | writeSPI(*(img+1)); writeSPI(*(img+0)); img+=2; 424 | writeSPI(*(img+1)); writeSPI(*(img+0)); img+=2; 425 | writeSPI(*(img+1)); writeSPI(*(img+0)); img+=2; 426 | writeSPI(*(img+1)); writeSPI(*(img+0)); img+=2; 427 | writeSPI(*(img+1)); writeSPI(*(img+0)); img+=2; 428 | writeSPI(*(img+1)); writeSPI(*(img+0)); img+=2; 429 | writeSPI(*(img+1)); writeSPI(*(img+0)); img+=2; 430 | } 431 | uint8_t num8 = num & 0x7; 432 | while(num8--) { writeSPI(*(img+1)); writeSPI(*(img+0)); img+=2; } 433 | 434 | CS_IDLE; 435 | SPI_END; 436 | } 437 | 438 | // ---------------------------------------------------------- 439 | // draws image from flash (PROGMEM) 440 | void Arduino_ILI9163C::drawImageF(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *img16) 441 | { 442 | if(x>=_width || y>=_height || w<=0 || h<=0) return; 443 | setAddrWindow(x, y, x+w-1, y+h-1); 444 | 445 | SPI_START; 446 | DC_DATA; 447 | CS_ACTIVE; 448 | 449 | uint32_t num = (uint32_t)w*h; 450 | uint16_t num16 = num>>3; 451 | uint8_t *img = (uint8_t *)img16; 452 | while(num16--) { 453 | writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2; 454 | writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2; 455 | writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2; 456 | writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2; 457 | writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2; 458 | writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2; 459 | writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2; 460 | writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2; 461 | } 462 | uint8_t num8 = num & 0x7; 463 | while(num8--) { writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2; } 464 | 465 | CS_IDLE; 466 | SPI_END; 467 | } 468 | 469 | // ---------------------------------------------------------- 470 | // Pass 8-bit (each) R,G,B, get back 16-bit packed color 471 | uint16_t Arduino_ILI9163C::Color565(uint8_t r, uint8_t g, uint8_t b) 472 | { 473 | return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3); 474 | } 475 | 476 | // ---------------------------------------------------------- 477 | void Arduino_ILI9163C::invertDisplay(boolean mode) 478 | { 479 | writeCmd(mode ? ILI9163C_DINVON : ILI9163C_DINVOF); 480 | } 481 | 482 | // ---------------------------------------------------------- 483 | void Arduino_ILI9163C::partialDisplay(boolean mode) 484 | { 485 | writeCmd(mode ? ILI9163C_PTLON : ILI9163C_NORML); 486 | } 487 | 488 | // ---------------------------------------------------------- 489 | void Arduino_ILI9163C::sleepDisplay(boolean mode) 490 | { 491 | writeCmd(mode ? ILI9163C_SLPIN : ILI9163C_SLPOUT); 492 | delay(5); 493 | } 494 | 495 | // ---------------------------------------------------------- 496 | void Arduino_ILI9163C::enableDisplay(boolean mode) 497 | { 498 | writeCmd(mode ? ILI9163C_DISPON : ILI9163C_DISPOFF); 499 | } 500 | 501 | // ---------------------------------------------------------- 502 | void Arduino_ILI9163C::idleDisplay(boolean mode) 503 | { 504 | writeCmd(mode ? ILI9163C_IDLEON : ILI9163C_IDLEOF); 505 | } 506 | 507 | // ---------------------------------------------------------- 508 | void Arduino_ILI9163C::resetDisplay() 509 | { 510 | writeCmd(ILI9163C_SWRESET); 511 | delay(500); 512 | } 513 | 514 | // ---------------------------------------------------------- 515 | void Arduino_ILI9163C::setScrollArea(uint16_t tfa, uint16_t bfa) 516 | { 517 | tfa += __OFFSET; 518 | uint16_t vsa = _GRAMHEIGH-tfa-bfa; 519 | writeCmd(ILI9163C_VSCLLDEF); 520 | writeData(tfa >> 8); writeData(tfa); 521 | writeData(vsa >> 8); writeData(vsa); 522 | writeData(bfa >> 8); writeData(bfa); 523 | } 524 | 525 | // ---------------------------------------------------------- 526 | void Arduino_ILI9163C::setScroll(uint16_t vsp) 527 | { 528 | writeCmd(ILI9163C_VSSTADRS); 529 | vsp+=__OFFSET; 530 | writeData(vsp >> 8); 531 | writeData(vsp); 532 | } 533 | 534 | // ---------------------------------------------------------- 535 | void Arduino_ILI9163C::setPartArea(uint16_t sr, uint16_t er) 536 | { 537 | writeCmd(ILI9163C_PARTAREA); // SETPARTAREA = 0x30 538 | writeData(sr >> 8); 539 | writeData(sr); 540 | writeData(er >> 8); 541 | writeData(er); 542 | } 543 | 544 | // ------------------------------------------------ 545 | // Input a value 0 to 511 (85*6) to get a color value. 546 | // The colours are a transition R - Y - G - C - B - M - R. 547 | void Arduino_ILI9163C::rgbWheel(int idx, uint8_t *_r, uint8_t *_g, uint8_t *_b) 548 | { 549 | idx &= 0x1ff; 550 | if(idx < 85) { // R->Y 551 | *_r = 255; *_g = idx * 3; *_b = 0; 552 | return; 553 | } else if(idx < 85*2) { // Y->G 554 | idx -= 85*1; 555 | *_r = 255 - idx * 3; *_g = 255; *_b = 0; 556 | return; 557 | } else if(idx < 85*3) { // G->C 558 | idx -= 85*2; 559 | *_r = 0; *_g = 255; *_b = idx * 3; 560 | return; 561 | } else if(idx < 85*4) { // C->B 562 | idx -= 85*3; 563 | *_r = 0; *_g = 255 - idx * 3; *_b = 255; 564 | return; 565 | } else if(idx < 85*5) { // B->M 566 | idx -= 85*4; 567 | *_r = idx * 3; *_g = 0; *_b = 255; 568 | return; 569 | } else { // M->R 570 | idx -= 85*5; 571 | *_r = 255; *_g = 0; *_b = 255 - idx * 3; 572 | return; 573 | } 574 | } 575 | 576 | uint16_t Arduino_ILI9163C::rgbWheel(int idx) 577 | { 578 | uint8_t r,g,b; 579 | rgbWheel(idx, &r,&g,&b); 580 | return RGBto565(r,g,b); 581 | } 582 | 583 | // ------------------------------------------------ --------------------------------------------------------------------------------