#ifndef __SAM3X8E__ /* * Copyright 2010 Reef Angel / Roberto Imai * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Updated by: Curt Binder * Updates Released under Apache License, Version 2.0 */ #include #include #include #include "RA_NokiaLCD.h" #include #include #include #include #include #if defined WDT || defined WDT_FORCE #include #endif // defined WDT || defined WDT_FORCE // Define Software SPI Pin Signal #define BL 2 // Digital 2 --> BL #define CS 3 // Digital 3 --> #CS #define CLK 4 // Digital 4 --> SCLK #define SDA 5 // Digital 5 --> SDATA #ifdef REEFANGEL_MINI #define RESET 7 // Digital 7 --> #RESET #else #define RESET 6 // Digital 6 --> #RESET #endif //REEFANGEL_MINI #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) #define bitOut(cond) PORTG = clk0; PORTE = (cond ? dat1 : dat0); PORTG = clk1 #else // __AVR_ATmega2560__ #define bitOut(cond) PORTD = clk0; PORTD = (cond ? dat1 : dat0); PORTD = clk1 #endif // __AVR_ATmega2560__ // Phillips PCF8833 Command Set #define NOP 0x00 // nop #define SWRESET 0x01 // software reset #define BSTROFF 0x02 // booster voltage OFF #define BSTRON 0x03 // booster voltage ON #define RDDIDIF 0x04 // read display identification #define RDDST 0x09 // read display status #define SLEEPIN 0x10 // sleep in #define SLEEPOUT 0x11 // sleep out #define PTLON 0x12 // partial display mode #define NORON 0x13 // display normal mode #define INVOFF 0x20 // inversion OFF #define INVON 0x21 // inversion ON #define DALO 0x22 // all pixel OFF #define DAL 0x23 // all pixel ON #define SETCON 0x25 // write contrast #define DISPOFF 0x28 // display OFF #define DISPON 0x29 // display ON #define CASET 0x2A // column address set #define PASET 0x2B // page address set #define RAMWR 0x2C // memory write #define RGBSET 0x2D // colour set #define PTLAR 0x30 // partial area #define VSCRDEF 0x33 // vertical scrolling definition #define TEOFF 0x34 // test mode #define TEON 0x35 // test mode #define MADCTL 0x36 // memory access control #define SEP 0x37 // vertical scrolling start address #define IDMOFF 0x38 // idle mode OFF #define IDMON 0x39 // idle mode ON #define COLMOD 0x3A // interface pixel format #define SETVOP 0xB0 // set Vop #define BRS 0xB4 // bottom row swap #define TRS 0xB6 // top row swap #define DISCTR 0xB9 // display control //#define DAOR 0xBA // data order(DOR) #define TCDFE 0xBD // enable/disable DF temperature compensation #define TCVOPE 0xBF // enable/disable Vop temp comp #define EC 0xC0 // internal or external oscillator #define SETMUL 0xC2 // set multiplication factor #define TCVOPAB 0xC3 // set TCVOP slopes A and B #define TCVOPCD 0xC4 // set TCVOP slopes c and d #define TCDF 0xC5 // set divider frequency #define DF8COLOR 0xC6 // set divider frequency 8-color mode #define SETBS 0xC7 // set bias system #define RDTEMP 0xC8 // temperature read back #define NLI 0xC9 // n-line inversion #define RDID1 0xDA // read ID1 #define RDID2 0xDB // read ID2 #define RDID3 0xDC // read ID3 #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) #define BL0 cbi(PORTE,4); #define BL1 sbi(PORTE,4); #define CS0 cbi(PORTE,5); #define CS1 sbi(PORTE,5); #ifdef HWSPILCD #define CLK0 cbi(PORTB,1); #define CLK1 sbi(PORTB,1); #define SDA0 cbi(PORTB,2); #define SDA1 sbi(PORTB,2); #else #define CLK0 cbi(PORTG,5); #define CLK1 sbi(PORTG,5); #define SDA0 cbi(PORTE,3); #define SDA1 sbi(PORTE,3); #endif // HWSPILCD #define RESET0 cbi(PORTH,3); #define RESET1 sbi(PORTH,3); #else // __AVR_ATmega2560__ #define CS0 cbi(PORTD,CS); #define CS1 sbi(PORTD,CS); #define CLK0 cbi(PORTD,CLK); #define CLK1 sbi(PORTD,CLK); #define SDA0 cbi(PORTD,SDA); #define SDA1 sbi(PORTD,SDA); #define RESET0 cbi(PORTD,RESET); #define RESET1 sbi(PORTD,RESET); #define BL0 cbi(PORTD,BL); #define BL1 sbi(PORTD,BL); #endif // __AVR_ATmega2560__ const prog_uchar font[] PROGMEM = { 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x06 , 0x5F , 0x06 , 0x00 , // ! 0x07 , 0x03 , 0x00 , 0x07 , 0x03 , // , 0x24 , 0x7E , 0x24 , 0x7E , 0x24 , // # 0x24 , 0x2B , 0x6A , 0x12 , 0x00 , // $ 0x63 , 0x13 , 0x08 , 0x64 , 0x63 , // % 0x36 , 0x49 , 0x56 , 0x20 , 0x50 , // & 0x00 , 0x07 , 0x03 , 0x00 , 0x00 , // // 0x00 , 0x3E , 0x41 , 0x00 , 0x00 , // ( 0x00 , 0x41 , 0x3E , 0x00 , 0x00 , // ) 0x08 , 0x3E , 0x1C , 0x3E , 0x08 , // * 0x08 , 0x08 , 0x3E , 0x08 , 0x08 , // + 0x00 , 0xE0 , 0x60 , 0x00 , 0x00 , // , 0x08 , 0x08 , 0x08 , 0x08 , 0x08 , // - 0x00 , 0x60 , 0x60 , 0x00 , 0x00 , // . 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , // / 0x3E , 0x51 , 0x49 , 0x45 , 0x3E , // 0 0x00 , 0x42 , 0x7F , 0x40 , 0x00 , // 1 0x62 , 0x51 , 0x49 , 0x49 , 0x46 , // 2 0x22 , 0x49 , 0x49 , 0x49 , 0x36 , // 3 0x18 , 0x14 , 0x12 , 0x7F , 0x10 , // 4 0x2F , 0x49 , 0x49 , 0x49 , 0x31 , // 5 0x3C , 0x4A , 0x49 , 0x49 , 0x30 , // 6 0x01 , 0x71 , 0x09 , 0x05 , 0x03 , // 7 0x36 , 0x49 , 0x49 , 0x49 , 0x36 , // 8 0x06 , 0x49 , 0x49 , 0x29 , 0x1E , // 9 0x00 , 0x6C , 0x6C , 0x00 , 0x00 , // : 0x00 , 0xEC , 0x6C , 0x00 , 0x00 , // ; 0x08 , 0x14 , 0x22 , 0x41 , 0x00 , // < 0x24 , 0x24 , 0x24 , 0x24 , 0x24 , // = 0x00 , 0x41 , 0x22 , 0x14 , 0x08 , // > 0x02 , 0x01 , 0x59 , 0x09 , 0x06 , // ? 0x3E , 0x41 , 0x5D , 0x55 , 0x1E , // @ 0x7E , 0x09 , 0x09 , 0x09 , 0x7E , // A 0x7F , 0x49 , 0x49 , 0x49 , 0x36 , // B 0x3E , 0x41 , 0x41 , 0x41 , 0x22 , // C 0x7F , 0x41 , 0x41 , 0x41 , 0x3E , // D 0x7F , 0x49 , 0x49 , 0x49 , 0x41 , // E 0x7F , 0x09 , 0x09 , 0x09 , 0x01 , // F 0x3E , 0x41 , 0x49 , 0x49 , 0x7A , // G 0x7F , 0x08 , 0x08 , 0x08 , 0x7F , // H 0x00 , 0x41 , 0x7F , 0x41 , 0x00 , // I 0x30 , 0x40 , 0x40 , 0x40 , 0x3F , // J 0x7F , 0x08 , 0x14 , 0x22 , 0x41 , // K 0x7F , 0x40 , 0x40 , 0x40 , 0x40 , // L 0x7F , 0x02 , 0x04 , 0x02 , 0x7F , // M 0x7F , 0x02 , 0x04 , 0x08 , 0x7F , // N 0x3E , 0x41 , 0x41 , 0x41 , 0x3E , // O 0x7F , 0x09 , 0x09 , 0x09 , 0x06 , // P 0x3E , 0x41 , 0x51 , 0x21 , 0x5E , // Q 0x7F , 0x09 , 0x09 , 0x19 , 0x66 , // R 0x26 , 0x49 , 0x49 , 0x49 , 0x32 , // S 0x01 , 0x01 , 0x7F , 0x01 , 0x01 , // T 0x3F , 0x40 , 0x40 , 0x40 , 0x3F , // U 0x1F , 0x20 , 0x40 , 0x20 , 0x1F , // V 0x3F , 0x40 , 0x3C , 0x40 , 0x3F , // W 0x63 , 0x14 , 0x08 , 0x14 , 0x63 , // X 0x07 , 0x08 , 0x70 , 0x08 , 0x07 , // Y 0x71 , 0x49 , 0x45 , 0x43 , 0x00 , // Z 0x00 , 0x7F , 0x41 , 0x41 , 0x00 , // [ 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , // Back slash 0x00 , 0x41 , 0x41 , 0x7F , 0x00 , // ] 0x04 , 0x02 , 0x01 , 0x02 , 0x04 , // ^ 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , // _ 0x20 , 0x40 , 0x80 , 0x40 , 0x20 , // ` 0x20 , 0x54 , 0x54 , 0x54 , 0x78 , // a 0x7F , 0x44 , 0x44 , 0x44 , 0x38 , // b 0x38 , 0x44 , 0x44 , 0x44 , 0x28 , // c 0x38 , 0x44 , 0x44 , 0x44 , 0x7F , // d 0x38 , 0x54 , 0x54 , 0x54 , 0x18 , // e 0x08 , 0x7E , 0x09 , 0x09 , 0x00 , // f 0x18 , 0xA4 , 0xA4 , 0xA4 , 0x7C , // g 0x7F , 0x04 , 0x04 , 0x78 , 0x00 , // h 0x00 , 0x00 , 0x7D , 0x00 , 0x00 , // i 0x40 , 0x80 , 0x84 , 0x7D , 0x00 , // j 0x7F , 0x10 , 0x28 , 0x44 , 0x00 , // k 0x00 , 0x00 , 0x7F , 0x40 , 0x00 , // l 0x7C , 0x04 , 0x18 , 0x04 , 0x78 , // m 0x7C , 0x04 , 0x04 , 0x78 , 0x00 , // n 0x38 , 0x44 , 0x44 , 0x44 , 0x38 , // o 0xFC , 0x44 , 0x44 , 0x44 , 0x38 , // p 0x38 , 0x44 , 0x44 , 0x44 , 0xFC , // q 0x44 , 0x78 , 0x44 , 0x04 , 0x08 , // r 0x08 , 0x54 , 0x54 , 0x54 , 0x20 , // s 0x04 , 0x3E , 0x44 , 0x24 , 0x00 , // t 0x3C , 0x40 , 0x20 , 0x7C , 0x00 , // u 0x1C , 0x20 , 0x40 , 0x20 , 0x1C , // v 0x3C , 0x60 , 0x30 , 0x60 , 0x3C , // w 0x6C , 0x10 , 0x10 , 0x6C , 0x00 , // x 0x9C , 0xA0 , 0x60 , 0x3C , 0x00 , // y 0x64 , 0x54 , 0x54 , 0x4C , 0x00 , // z 0x33 , 0x66 , 0xCC , 0x66 , 0x33 , // { 0x00 , 0x00 , 0x7F , 0x00 , 0x00 , // | 0xCC , 0x66 , 0x33 , 0x66 , 0xCC , // } 0x02 , 0x01 , 0x02 , 0x01 , 0x00 // ~ }; #ifdef FONT_8x8 const prog_uchar font_8x8[] PROGMEM = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // space 0x20 0x30,0x78,0x78,0x30,0x30,0x00,0x30,0x00, // ! 0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00, // " 0x6C,0x6C,0xFE,0x6C,0xFE,0x6C,0x6C,0x00, // # 0x18,0x3E,0x60,0x3C,0x06,0x7C,0x18,0x00, // $ 0x00,0x63,0x66,0x0C,0x18,0x33,0x63,0x00, // % 0x1C,0x36,0x1C,0x3B,0x6E,0x66,0x3B,0x00, // & 0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00, // ' 0x0C,0x18,0x30,0x30,0x30,0x18,0x0C,0x00, // ( 0x30,0x18,0x0C,0x0C,0x0C,0x18,0x30,0x00, // ) 0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00, // * 0x00,0x30,0x30,0xFC,0x30,0x30,0x00,0x00, // + 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x30, // , 0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00, // - 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00, // . 0x03,0x06,0x0C,0x18,0x30,0x60,0x40,0x00, // / (forward slash) 0x3E,0x63,0x63,0x6B,0x63,0x63,0x3E,0x00, // 0 0x30 0x18,0x38,0x58,0x18,0x18,0x18,0x7E,0x00, // 1 0x3C,0x66,0x06,0x1C,0x30,0x66,0x7E,0x00, // 2 0x3C,0x66,0x06,0x1C,0x06,0x66,0x3C,0x00, // 3 0x0E,0x1E,0x36,0x66,0x7F,0x06,0x0F,0x00, // 4 0x7E,0x60,0x7C,0x06,0x06,0x66,0x3C,0x00, // 5 0x1C,0x30,0x60,0x7C,0x66,0x66,0x3C,0x00, // 6 0x7E,0x66,0x06,0x0C,0x18,0x18,0x18,0x00, // 7 0x3C,0x66,0x66,0x3C,0x66,0x66,0x3C,0x00, // 8 0x3C,0x66,0x66,0x3E,0x06,0x0C,0x38,0x00, // 9 0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x00, // : 0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x30, // ; 0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00, // < 0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00, // = 0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00, // > 0x3C,0x66,0x06,0x0C,0x18,0x00,0x18,0x00, // ? 0x3E,0x63,0x6F,0x69,0x6F,0x60,0x3E,0x00, // @ 0x40 0x18,0x3C,0x66,0x66,0x7E,0x66,0x66,0x00, // A 0x7E,0x33,0x33,0x3E,0x33,0x33,0x7E,0x00, // B 0x1E,0x33,0x60,0x60,0x60,0x33,0x1E,0x00, // C 0x7C,0x36,0x33,0x33,0x33,0x36,0x7C,0x00, // D 0x7F,0x31,0x34,0x3C,0x34,0x31,0x7F,0x00, // E 0x7F,0x31,0x34,0x3C,0x34,0x30,0x78,0x00, // F 0x1E,0x33,0x60,0x60,0x67,0x33,0x1F,0x00, // G 0x66,0x66,0x66,0x7E,0x66,0x66,0x66,0x00, // H 0x3C,0x18,0x18,0x18,0x18,0x18,0x3C,0x00, // I 0x0F,0x06,0x06,0x06,0x66,0x66,0x3C,0x00, // J 0x73,0x33,0x36,0x3C,0x36,0x33,0x73,0x00, // K 0x78,0x30,0x30,0x30,0x31,0x33,0x7F,0x00, // L 0x63,0x77,0x7F,0x7F,0x6B,0x63,0x63,0x00, // M 0x63,0x73,0x7B,0x6F,0x67,0x63,0x63,0x00, // N 0x3E,0x63,0x63,0x63,0x63,0x63,0x3E,0x00, // O 0x7E,0x33,0x33,0x3E,0x30,0x30,0x78,0x00, // P 0x50 0x3C,0x66,0x66,0x66,0x6E,0x3C,0x0E,0x00, // Q 0x7E,0x33,0x33,0x3E,0x36,0x33,0x73,0x00, // R 0x3C,0x66,0x30,0x18,0x0C,0x66,0x3C,0x00, // S 0x7E,0x5A,0x18,0x18,0x18,0x18,0x3C,0x00, // T 0x66,0x66,0x66,0x66,0x66,0x66,0x7E,0x00, // U 0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00, // V 0x63,0x63,0x63,0x6B,0x7F,0x77,0x63,0x00, // W 0x63,0x63,0x36,0x1C,0x1C,0x36,0x63,0x00, // X 0x66,0x66,0x66,0x3C,0x18,0x18,0x3C,0x00, // Y 0x7F,0x63,0x46,0x0C,0x19,0x33,0x7F,0x00, // Z 0x3C,0x30,0x30,0x30,0x30,0x30,0x3C,0x00, // [ 0x60,0x30,0x18,0x0C,0x06,0x03,0x01,0x00, // backslash 0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00, // ] 0x08,0x1C,0x36,0x63,0x00,0x00,0x00,0x00, // ^ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, // _ 0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00, // ` 0x60 0x00,0x00,0x3C,0x06,0x3E,0x66,0x3B,0x00, // a 0x70,0x30,0x3E,0x33,0x33,0x33,0x6E,0x00, // b 0x00,0x00,0x3C,0x66,0x60,0x66,0x3C,0x00, // c 0x0E,0x06,0x3E,0x66,0x66,0x66,0x3B,0x00, // d 0x00,0x00,0x3C,0x66,0x7E,0x60,0x3C,0x00, // e 0x1C,0x36,0x30,0x78,0x30,0x30,0x78,0x00, // f 0x00,0x00,0x3B,0x66,0x66,0x3E,0x06,0x7C, // g 0x70,0x30,0x36,0x3B,0x33,0x33,0x73,0x00, // h 0x18,0x00,0x38,0x18,0x18,0x18,0x3C,0x00, // i 0x06,0x00,0x06,0x06,0x06,0x66,0x66,0x3C, // j 0x70,0x30,0x33,0x36,0x3C,0x36,0x73,0x00, // k 0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00, // l 0x00,0x00,0x66,0x7F,0x7F,0x6B,0x63,0x00, // m 0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x00, // n 0x00,0x00,0x3C,0x66,0x66,0x66,0x3C,0x00, // o 0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x78, // p 0x70 0x00,0x00,0x3B,0x66,0x66,0x3E,0x06,0x0F, // q 0x00,0x00,0x6E,0x3B,0x33,0x30,0x78,0x00, // r 0x00,0x00,0x3E,0x60,0x3C,0x06,0x7C,0x00, // s 0x08,0x18,0x3E,0x18,0x18,0x1A,0x0C,0x00, // t 0x00,0x00,0x66,0x66,0x66,0x66,0x3B,0x00, // u 0x00,0x00,0x66,0x66,0x66,0x3C,0x18,0x00, // v 0x00,0x00,0x63,0x6B,0x7F,0x7F,0x36,0x00, // w 0x00,0x00,0x63,0x36,0x1C,0x36,0x63,0x00, // x 0x00,0x00,0x66,0x66,0x66,0x3E,0x06,0x7C, // y 0x00,0x00,0x7E,0x4C,0x18,0x32,0x7E,0x00, // z 0x0E,0x18,0x18,0x70,0x18,0x18,0x0E,0x00, // { 0x0C,0x0C,0x0C,0x00,0x0C,0x0C,0x0C,0x00, // | 0x70,0x18,0x18,0x0E,0x18,0x18,0x70,0x00, // } 0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00, // ~ 0x1C,0x36,0x36,0x1C,0x00,0x00,0x00,0x00 // DEL }; #endif // FONT_8x8 #ifdef FONT_8x16 const prog_uchar font_8x16[] PROGMEM = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, // ! 0x00,0x63,0x63,0x63,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // " 0x00,0x00,0x00,0x36,0x36,0x7F,0x36,0x36,0x36,0x7F,0x36,0x36,0x00,0x00,0x00,0x00, // # 0x0C,0x0C,0x3E,0x63,0x61,0x60,0x3E,0x03,0x03,0x43,0x63,0x3E,0x0C,0x0C,0x00,0x00, // $ 0x00,0x00,0x00,0x00,0x00,0x61,0x63,0x06,0x0C,0x18,0x33,0x63,0x00,0x00,0x00,0x00, // % 0x00,0x00,0x00,0x1C,0x36,0x36,0x1C,0x3B,0x6E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00, // & 0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ' 0x00,0x00,0x0C,0x18,0x18,0x30,0x30,0x30,0x30,0x18,0x18,0x0C,0x00,0x00,0x00,0x00, // ( 0x00,0x00,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x00,0x00,0x00,0x00, // ) 0x00,0x00,0x00,0x00,0x42,0x66,0x3C,0xFF,0x3C,0x66,0x42,0x00,0x00,0x00,0x00,0x00, // * 0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00, // + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00, // , 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, // . 0x00,0x00,0x01,0x03,0x07,0x0E,0x1C,0x38,0x70,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00, // / 0x00,0x00,0x3E,0x63,0x63,0x63,0x6B,0x6B,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00, // 0 0x00,0x00,0x0C,0x1C,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3F,0x00,0x00,0x00,0x00, // 1 0x00,0x00,0x3E,0x63,0x03,0x06,0x0C,0x18,0x30,0x61,0x63,0x7F,0x00,0x00,0x00,0x00, // 2 0x00,0x00,0x3E,0x63,0x03,0x03,0x1E,0x03,0x03,0x03,0x63,0x3E,0x00,0x00,0x00,0x00, // 3 0x00,0x00,0x06,0x0E,0x1E,0x36,0x66,0x66,0x7F,0x06,0x06,0x0F,0x00,0x00,0x00,0x00, // 4 0x00,0x00,0x7F,0x60,0x60,0x60,0x7E,0x03,0x03,0x63,0x73,0x3E,0x00,0x00,0x00,0x00, // 5 0x00,0x00,0x1C,0x30,0x60,0x60,0x7E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00, // 6 0x00,0x00,0x7F,0x63,0x03,0x06,0x06,0x0C,0x0C,0x18,0x18,0x18,0x00,0x00,0x00,0x00, // 7 0x00,0x00,0x3E,0x63,0x63,0x63,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00, // 8 0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x3F,0x03,0x03,0x06,0x3C,0x00,0x00,0x00,0x00, // 9 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, // : 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00, // ; 0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00, // < 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00, // = 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00, // > 0x00,0x00,0x3E,0x63,0x63,0x06,0x0C,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x00,0x00,0x00, // ? 0x00,0x00,0x3E,0x63,0x63,0x6F,0x6B,0x6B,0x6E,0x60,0x60,0x3E,0x00,0x00,0x00,0x00, // @ 0x00,0x00,0x08,0x1C,0x36,0x63,0x63,0x63,0x7F,0x63,0x63,0x63,0x00,0x00,0x00,0x00, // A 0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x33,0x33,0x33,0x33,0x7E,0x00,0x00,0x00,0x00, // B 0x00,0x00,0x1E,0x33,0x61,0x60,0x60,0x60,0x60,0x61,0x33,0x1E,0x00,0x00,0x00,0x00, // C 0x00,0x00,0x7C,0x36,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x7C,0x00,0x00,0x00,0x00, // D 0x00,0x00,0x7F,0x33,0x31,0x34,0x3C,0x34,0x30,0x31,0x33,0x7F,0x00,0x00,0x00,0x00, // E 0x00,0x00,0x7F,0x33,0x31,0x34,0x3C,0x34,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, // F 0x00,0x00,0x1E,0x33,0x61,0x60,0x60,0x6F,0x63,0x63,0x37,0x1D,0x00,0x00,0x00,0x00, // G 0x00,0x00,0x63,0x63,0x63,0x63,0x7F,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00, // H 0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, // I 0x00,0x00,0x0F,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,0x00, // J 0x00,0x00,0x73,0x33,0x36,0x36,0x3C,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00, // K 0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x33,0x7F,0x00,0x00,0x00,0x00, // L 0x00,0x00,0x63,0x77,0x7F,0x6B,0x63,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00, // M 0x00,0x00,0x63,0x63,0x73,0x7B,0x7F,0x6F,0x67,0x63,0x63,0x63,0x00,0x00,0x00,0x00, // N 0x00,0x00,0x1C,0x36,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1C,0x00,0x00,0x00,0x00, // O 0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, // P 0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x63,0x6B,0x6F,0x3E,0x06,0x07,0x00,0x00, // Q 0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00, // R 0x00,0x00,0x3E,0x63,0x63,0x30,0x1C,0x06,0x03,0x63,0x63,0x3E,0x00,0x00,0x00,0x00, // S 0x00,0x00,0xFF,0xDB,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, // T 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00, // U 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1C,0x08,0x00,0x00,0x00,0x00, // V 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x6B,0x6B,0x7F,0x36,0x36,0x00,0x00,0x00,0x00, // W 0x00,0x00,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x3C,0x66,0xC3,0xC3,0x00,0x00,0x00,0x00, // X 0x00,0x00,0xC3,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, // Y 0x00,0x00,0x7F,0x63,0x43,0x06,0x0C,0x18,0x30,0x61,0x63,0x7F,0x00,0x00,0x00,0x00, // Z 0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00, // [ 0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x07,0x03,0x01,0x00,0x00,0x00,0x00, // \ (backslash) 0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00, // ] 0x08,0x1C,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ^ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00, // _ 0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ` 0x00,0x00,0x00,0x00,0x00,0x3C,0x46,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00, // a 0x00,0x00,0x70,0x30,0x30,0x3C,0x36,0x33,0x33,0x33,0x33,0x6E,0x00,0x00,0x00,0x00, // b 0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x60,0x60,0x60,0x63,0x3E,0x00,0x00,0x00,0x00, // c 0x00,0x00,0x0E,0x06,0x06,0x1E,0x36,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00, // d 0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x7E,0x60,0x63,0x3E,0x00,0x00,0x00,0x00, // e 0x00,0x00,0x1C,0x36,0x32,0x30,0x7C,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, // f 0x00,0x00,0x00,0x00,0x00,0x3B,0x66,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00,0x00, // g 0x00,0x00,0x70,0x30,0x30,0x36,0x3B,0x33,0x33,0x33,0x33,0x73,0x00,0x00,0x00,0x00, // h 0x00,0x00,0x0C,0x0C,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00, // i 0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00, // j 0x00,0x00,0x70,0x30,0x30,0x33,0x33,0x36,0x3C,0x36,0x33,0x73,0x00,0x00,0x00,0x00, // k 0x00,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00, // l 0x00,0x00,0x00,0x00,0x00,0x6E,0x7F,0x6B,0x6B,0x6B,0x6B,0x6B,0x00,0x00,0x00,0x00, // m 0x00,0x00,0x00,0x00,0x00,0x6E,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00, // n 0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00, // o 0x00,0x00,0x00,0x00,0x00,0x6E,0x33,0x33,0x33,0x33,0x3E,0x30,0x30,0x78,0x00,0x00, // p 0x00,0x00,0x00,0x00,0x00,0x3B,0x66,0x66,0x66,0x66,0x3E,0x06,0x06,0x0F,0x00,0x00, // q 0x00,0x00,0x00,0x00,0x00,0x6E,0x3B,0x33,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, // r 0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x38,0x0E,0x03,0x63,0x3E,0x00,0x00,0x00,0x00, // s 0x00,0x00,0x08,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0x1B,0x0E,0x00,0x00,0x00,0x00, // t 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00, // u 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x36,0x36,0x1C,0x1C,0x08,0x00,0x00,0x00,0x00, // v 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x6B,0x6B,0x7F,0x36,0x00,0x00,0x00,0x00, // w 0x00,0x00,0x00,0x00,0x00,0x63,0x36,0x1C,0x1C,0x1C,0x36,0x63,0x00,0x00,0x00,0x00, // x 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x3F,0x03,0x06,0x3C,0x00,0x00, // y 0x00,0x00,0x00,0x00,0x00,0x7F,0x66,0x0C,0x18,0x30,0x63,0x7F,0x00,0x00,0x00,0x00, // z 0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00, // { 0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00, // | 0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00, // } 0x00,0x00,0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ~ 0x00,0x70,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // }; #endif // FONT_8x16 #ifdef FONT_12x16 const prog_uint16_t font_12x16[] PROGMEM = { 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 0x0060,0x0060,0x00F0,0x00F0,0x00F0,0x00F0,0x00F0,0x0060,0x0060,0x0060,0x0000,0x0000,0x0060,0x0060,0x0000,0x0000, // ! 0x0000,0x0000,0x0198,0x0198,0x0198,0x0198,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // " 0x0000,0x0066,0x0066,0x0066,0x03FF,0x00CC,0x00CC,0x0198,0x0198,0x07FC,0x0330,0x0330,0x0330,0x0000,0x0000,0x0000, // # 0x0060,0x0060,0x01F8,0x03FC,0x0360,0x0360,0x03F8,0x01FC,0x006C,0x006C,0x03FC,0x01F8,0x0060,0x0060,0x0000,0x0000, // $ 0x0000,0x0000,0x0001,0x0383,0x0387,0x038E,0x001C,0x0038,0x0070,0x00E0,0x01C0,0x038E,0x070E,0x060E,0x0000,0x0000, // % 0x0000,0x0070,0x00D8,0x0198,0x0198,0x01B0,0x00E0,0x01E0,0x03E0,0x0336,0x033C,0x0318,0x03BC,0x01E6,0x0000,0x0000, // & 0x00E0,0x00E0,0x00E0,0x0060,0x0060,0x00C0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // ' 0x0038,0x0060,0x00E0,0x00C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x00C0,0x00E0,0x0060,0x0038,0x0000,0x0000, // ( 0x01C0,0x0060,0x0070,0x0030,0x0038,0x0038,0x0038,0x0038,0x0038,0x0038,0x0030,0x0070,0x0060,0x01C0,0x0000,0x0000, // ) 0x0000,0x0000,0x0000,0x036C,0x036C,0x01F8,0x00F0,0x03FC,0x00F0,0x01F8,0x036C,0x036C,0x0000,0x0000,0x0000,0x0000, // * 0x0000,0x0000,0x0000,0x0000,0x0060,0x0060,0x0060,0x03FC,0x03FC,0x0060,0x0060,0x0060,0x0000,0x0000,0x0000,0x0000, // + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00E0,0x00E0,0x00E0,0x0060,0x00C0, // , 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03FC,0x03FC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // - 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00E0,0x00E0,0x00E0,0x0000,0x0000, // . 0x0000,0x0001,0x0003,0x0007,0x000E,0x001C,0x0038,0x0070,0x00E0,0x01C0,0x0380,0x0700,0x0600,0x0000,0x0000,0x0000, // / 0x00F8,0x03FE,0x0306,0x0607,0x060F,0x061B,0x0633,0x0663,0x06C3,0x0783,0x0703,0x0306,0x03FE,0x00F8,0x0000,0x0000, // 0 0x0030,0x0070,0x01F0,0x01F0,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x01FE,0x01FE,0x0000,0x0000, // 1 0x01FC,0x03FE,0x0707,0x0603,0x0607,0x000E,0x001C,0x0038,0x0070,0x00E0,0x01C0,0x0380,0x07FF,0x07FF,0x0000,0x0000, // 2 0x01FC,0x03FE,0x0707,0x0603,0x0003,0x0007,0x00FE,0x00FC,0x0006,0x0003,0x0603,0x0707,0x03FE,0x01FC,0x0000,0x0000, // 3 0x001C,0x003C,0x007C,0x00EC,0x01CC,0x038C,0x070C,0x060C,0x07FF,0x07FF,0x000C,0x000C,0x000C,0x000C,0x0000,0x0000, // 4 0x07FF,0x07FF,0x0600,0x0600,0x0600,0x07FC,0x03FE,0x0007,0x0003,0x0003,0x0603,0x0707,0x03FE,0x01FC,0x0000,0x0000, // 5 0x003C,0x007C,0x00E0,0x01C0,0x0380,0x0300,0x07FC,0x07FE,0x0707,0x0603,0x0603,0x0707,0x03FE,0x01FC,0x0000,0x0000, // 6 0x07FF,0x07FF,0x0006,0x0006,0x000C,0x000C,0x0018,0x0018,0x0030,0x0030,0x0060,0x0060,0x00C0,0x00C0,0x0000,0x0000, // 7 0x00F8,0x01FC,0x038E,0x0306,0x0306,0x038E,0x01FC,0x03FE,0x0707,0x0603,0x0603,0x0707,0x03FE,0x01FC,0x0000,0x0000, // 8 0x01FC,0x03FE,0x0707,0x0603,0x0603,0x0707,0x03FF,0x01FF,0x0006,0x000E,0x001C,0x0038,0x01F0,0x01E0,0x0000,0x0000, // 9 0x0000,0x0000,0x0000,0x0000,0x00E0,0x00E0,0x00E0,0x0000,0x0000,0x0000,0x00E0,0x00E0,0x00E0,0x0000,0x0000,0x0000, // : 0x0000,0x0000,0x0000,0x0000,0x00E0,0x00E0,0x00E0,0x0000,0x0000,0x0000,0x00E0,0x00E0,0x00E0,0x0060,0x0060,0x00C0, // ; 0x000C,0x001C,0x0038,0x0070,0x00E0,0x01C0,0x0380,0x0380,0x01C0,0x00E0,0x0070,0x0038,0x001C,0x000C,0x0000,0x0000, // < 0x0000,0x0000,0x0000,0x0000,0x0000,0x03FE,0x03FE,0x0000,0x0000,0x03FE,0x03FE,0x0000,0x0000,0x0000,0x0000,0x0000, // = 0x0300,0x0380,0x01C0,0x00E0,0x0070,0x0038,0x001C,0x001C,0x0038,0x0070,0x00E0,0x01C0,0x0380,0x0300,0x0000,0x0000, // > 0x01F8,0x03FC,0x070E,0x0606,0x060E,0x001C,0x0038,0x0070,0x0060,0x0060,0x0060,0x0000,0x0060,0x0060,0x0000,0x0000, // ? 0x01FC,0x03FE,0x0306,0x067B,0x06FB,0x06DB,0x06DB,0x06DB,0x06DB,0x06FE,0x067C,0x0700,0x03FC,0x00FC,0x0000,0x0000, // @ 0x0060,0x0060,0x00F0,0x00F0,0x00F0,0x0198,0x0198,0x0198,0x030C,0x03FC,0x03FC,0x0606,0x0606,0x0606,0x0000,0x0000, // A 0x07F0,0x07F8,0x061C,0x060C,0x060C,0x061C,0x07F8,0x07FC,0x060E,0x0606,0x0606,0x060E,0x07FC,0x07F8,0x0000,0x0000, // B 0x00F8,0x01FC,0x038E,0x0306,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0306,0x038E,0x01FC,0x00F8,0x0000,0x0000, // C 0x07F0,0x07F8,0x061C,0x060C,0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x060C,0x061C,0x07F8,0x07F0,0x0000,0x0000, // D 0x07FE,0x07FE,0x0600,0x0600,0x0600,0x0600,0x07F8,0x07F8,0x0600,0x0600,0x0600,0x0600,0x07FE,0x07FE,0x0000,0x0000, // E 0x07FE,0x07FE,0x0600,0x0600,0x0600,0x0600,0x07F8,0x07F8,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0000,0x0000, // F 0x00FC,0x01FE,0x0386,0x0300,0x0600,0x0600,0x063E,0x063E,0x0606,0x0606,0x0306,0x0386,0x01FE,0x00FE,0x0000,0x0000, // G 0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x07FE,0x07FE,0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x0000,0x0000, // H 0x01F8,0x01F8,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x01F8,0x01F8,0x0000,0x0000, // I 0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0606,0x0606,0x070C,0x03FC,0x01F8,0x0000,0x0000, // J 0x0606,0x060E,0x061C,0x0638,0x0670,0x06E0,0x07C0,0x07C0,0x06E0,0x0670,0x0638,0x061C,0x060E,0x0606,0x0000,0x0000, // K 0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x0600,0x07FE,0x07FE,0x0000,0x0000, // L 0x0606,0x070E,0x070E,0x079E,0x079E,0x06F6,0x06F6,0x0666,0x0666,0x0606,0x0606,0x0606,0x0606,0x0606,0x0000,0x0000, // M 0x0606,0x0706,0x0706,0x0786,0x06C6,0x06C6,0x0666,0x0666,0x0636,0x0636,0x061E,0x060E,0x060E,0x0606,0x0000,0x0000, // N 0x00F0,0x01F8,0x039C,0x030C,0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x030C,0x039C,0x01F8,0x00F0,0x0000,0x0000, // O 0x07F8,0x07FC,0x060E,0x0606,0x0606,0x0606,0x060E,0x07FC,0x07F8,0x0600,0x0600,0x0600,0x0600,0x0600,0x0000,0x0000, // P 0x00F0,0x01F8,0x039C,0x030C,0x0606,0x0606,0x0606,0x0606,0x0606,0x0636,0x033C,0x039C,0x01FE,0x00F6,0x0000,0x0000, // Q 0x07F8,0x07FC,0x060E,0x0606,0x0606,0x0606,0x060E,0x07FC,0x07F8,0x0670,0x0638,0x061C,0x060E,0x0606,0x0000,0x0000, // R 0x01F8,0x03FC,0x070E,0x0606,0x0600,0x0700,0x03F8,0x01FC,0x000E,0x0006,0x0606,0x070E,0x03FC,0x01F8,0x0000,0x0000, // S 0x03FC,0x03FC,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0000,0x0000, // T 0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x030C,0x03FC,0x01F8,0x0000,0x0000, // U 0x0606,0x0606,0x0606,0x030C,0x030C,0x030C,0x0198,0x0198,0x0198,0x00F0,0x00F0,0x00F0,0x0060,0x0060,0x0000,0x0000, // V 0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x0666,0x0666,0x06F6,0x079E,0x070E,0x070E,0x0606,0x0000,0x0000, // W 0x0606,0x0606,0x030C,0x030C,0x0198,0x00F0,0x0060,0x0060,0x00F0,0x0198,0x030C,0x030C,0x0606,0x0606,0x0000,0x0000, // X 0x0606,0x0606,0x030C,0x030C,0x0198,0x0198,0x00F0,0x00F0,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0000,0x0000, // Y 0x07FE,0x07FE,0x000C,0x000C,0x0018,0x0030,0x0060,0x0060,0x00C0,0x0180,0x0300,0x0300,0x07FE,0x07FE,0x0000,0x0000, // Z 0x01F8,0x01F8,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x01F8,0x01F8,0x0000,0x0000, // [ 0x0000,0x0400,0x0600,0x0700,0x0380,0x01C0,0x00E0,0x0070,0x0038,0x001C,0x000E,0x0007,0x0003,0x0000,0x0000,0x0000, // \ (backslash) 0x01F8,0x01F8,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x01F8,0x01F8,0x0000,0x0000, // ] 0x0020,0x0070,0x00F8,0x01DC,0x038E,0x0707,0x0603,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // ^ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x07FF,0x07FF, // _ 0x0000,0x0070,0x0070,0x0070,0x0060,0x0060,0x0030,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // ` 0x0000,0x0000,0x0000,0x0000,0x0000,0x01FC,0x03FE,0x0006,0x01FE,0x03FE,0x0606,0x0606,0x07FE,0x03FE,0x0000,0x0000, // a 0x0600,0x0600,0x0600,0x0600,0x0600,0x06F8,0x07FC,0x070E,0x0606,0x0606,0x0606,0x060E,0x07FC,0x07F8,0x0000,0x0000, // b 0x0000,0x0000,0x0000,0x0000,0x0000,0x01F8,0x03FC,0x0706,0x0600,0x0600,0x0600,0x0706,0x03FC,0x01F8,0x0000,0x0000, // c 0x0006,0x0006,0x0006,0x0006,0x0006,0x01F6,0x03FE,0x071E,0x0606,0x0606,0x0606,0x0706,0x03FE,0x01FE,0x0000,0x0000, // d 0x0000,0x0000,0x0000,0x0000,0x0000,0x01F8,0x03FC,0x0706,0x07FE,0x07FC,0x0600,0x0700,0x03FC,0x01F8,0x0000,0x0000, // e 0x0078,0x00F8,0x01C0,0x0180,0x0180,0x0180,0x07F0,0x07F0,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0000,0x0000, // f 0x0000,0x0000,0x0000,0x0000,0x0000,0x01FE,0x03FE,0x0706,0x0606,0x070E,0x03FE,0x01F6,0x0006,0x000E,0x03FC,0x03F8, // g 0x0600,0x0600,0x0600,0x0600,0x0600,0x06F0,0x07F8,0x071C,0x060C,0x060C,0x060C,0x060C,0x060C,0x060C,0x0000,0x0000, // h 0x0000,0x0000,0x0060,0x0060,0x0000,0x00E0,0x00E0,0x0060,0x0060,0x0060,0x0060,0x0060,0x01F8,0x01F8,0x0000,0x0000, // i 0x0000,0x0000,0x0018,0x0018,0x0000,0x0038,0x0038,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0198,0x01F8,0x00F0, // j 0x0300,0x0300,0x0300,0x0300,0x0300,0x0318,0x0338,0x0370,0x03E0,0x03E0,0x0370,0x0338,0x031C,0x030C,0x0000,0x0000, // k 0x00E0,0x00E0,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x01F8,0x01F8,0x0000,0x0000, // l 0x0000,0x0000,0x0000,0x0000,0x0000,0x0598,0x07FC,0x07FE,0x0666,0x0666,0x0666,0x0666,0x0666,0x0666,0x0000,0x0000, // m 0x0000,0x0000,0x0000,0x0000,0x0000,0x03F8,0x03FC,0x030E,0x0306,0x0306,0x0306,0x0306,0x0306,0x0306,0x0000,0x0000, // n 0x0000,0x0000,0x0000,0x0000,0x0000,0x01F8,0x03FC,0x070E,0x0606,0x0606,0x0606,0x070E,0x03FC,0x01F8,0x0000,0x0000, // o 0x0000,0x0000,0x0000,0x0000,0x0000,0x07F8,0x07FC,0x060E,0x0606,0x0606,0x070E,0x07FC,0x06F8,0x0600,0x0600,0x0600, // p 0x0000,0x0000,0x0000,0x0000,0x0000,0x01FE,0x03FE,0x0706,0x0606,0x0606,0x070E,0x03FE,0x01F6,0x0006,0x0006,0x0006, // q 0x0000,0x0000,0x0000,0x0000,0x0000,0x037C,0x03FE,0x0386,0x0300,0x0300,0x0300,0x0300,0x0300,0x0300,0x0000,0x0000, // r 0x0000,0x0000,0x0000,0x0000,0x0000,0x03F0,0x07F8,0x0600,0x07F0,0x03F8,0x0018,0x0018,0x07F8,0x03F0,0x0000,0x0000, // s 0x0000,0x0180,0x0180,0x0180,0x0180,0x07F0,0x07F0,0x0180,0x0180,0x0180,0x0180,0x0180,0x01F8,0x00F8,0x0000,0x0000, // t 0x0000,0x0000,0x0000,0x0000,0x0000,0x0606,0x0606,0x0606,0x0606,0x0606,0x0606,0x070E,0x03FE,0x01F6,0x0000,0x0000, // u 0x0000,0x0000,0x0000,0x0000,0x0000,0x0606,0x0606,0x030C,0x030C,0x0198,0x0198,0x00F0,0x00F0,0x0060,0x0000,0x0000, // v 0x0000,0x0000,0x0000,0x0000,0x0000,0x0666,0x0666,0x0666,0x0666,0x0666,0x06F6,0x03FC,0x039C,0x0108,0x0000,0x0000, // w 0x0000,0x0000,0x0000,0x0000,0x0000,0x060C,0x071C,0x03B8,0x01F0,0x00E0,0x01F0,0x03B8,0x071C,0x060C,0x0000,0x0000, // x 0x0000,0x0000,0x0000,0x0000,0x0000,0x030C,0x030C,0x0198,0x0198,0x00F0,0x00F0,0x0060,0x0060,0x00C0,0x00C0,0x0180, // y 0x0000,0x0000,0x0000,0x0000,0x0000,0x07FC,0x07F8,0x0030,0x0060,0x00C0,0x0180,0x0300,0x07FC,0x07FC,0x0000,0x0000, // z 0x003C,0x007C,0x00E0,0x00C0,0x00C0,0x00C0,0x01C0,0x0380,0x01C0,0x00C0,0x00C0,0x00C0,0x00E0,0x007C,0x003C,0x0000, // { 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0000,0x0000, // | 0x03C0,0x03E0,0x0070,0x0030,0x0030,0x0030,0x0038,0x001C,0x0038,0x0030,0x0030,0x0030,0x0070,0x03E0,0x03C0,0x0000, // } 0x0000,0x0000,0x01C6,0x036C,0x0638,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // ~ 0x0000,0x0000,0x0000,0x0000,0x0060,0x00F0,0x0198,0x030C,0x0606,0x0606,0x07FE,0x07FE,0x0000,0x0000,0x0000,0x0000, // }; #endif // FONT_12x16 #ifdef NUMBERS_8x8 const prog_uchar num_8x8[] PROGMEM = { 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00, // . 0x03,0x06,0x0C,0x18,0x30,0x60,0x40,0x00, // / (forward slash) 0x3E,0x63,0x63,0x6B,0x63,0x63,0x3E,0x00, // 0 0x30 0x18,0x38,0x58,0x18,0x18,0x18,0x7E,0x00, // 1 0x3C,0x66,0x06,0x1C,0x30,0x66,0x7E,0x00, // 2 0x3C,0x66,0x06,0x1C,0x06,0x66,0x3C,0x00, // 3 0x0E,0x1E,0x36,0x66,0x7F,0x06,0x0F,0x00, // 4 0x7E,0x60,0x7C,0x06,0x06,0x66,0x3C,0x00, // 5 0x1C,0x30,0x60,0x7C,0x66,0x66,0x3C,0x00, // 6 0x7E,0x66,0x06,0x0C,0x18,0x18,0x18,0x00, // 7 0x3C,0x66,0x66,0x3C,0x66,0x66,0x3C,0x00, // 8 0x3C,0x66,0x66,0x3E,0x06,0x0C,0x38,0x00 // 9 }; #endif // NUMBERS_8x8 #ifdef NUMBERS_8x16 const prog_uchar num_8x16[] PROGMEM = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, // . 0x00,0x00,0x01,0x03,0x07,0x0E,0x1C,0x38,0x70,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00, // / 0x00,0x00,0x3E,0x63,0x63,0x63,0x6B,0x6B,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00, // 0 0x00,0x00,0x0C,0x1C,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3F,0x00,0x00,0x00,0x00, // 1 0x00,0x00,0x3E,0x63,0x03,0x06,0x0C,0x18,0x30,0x61,0x63,0x7F,0x00,0x00,0x00,0x00, // 2 0x00,0x00,0x3E,0x63,0x03,0x03,0x1E,0x03,0x03,0x03,0x63,0x3E,0x00,0x00,0x00,0x00, // 3 0x00,0x00,0x06,0x0E,0x1E,0x36,0x66,0x66,0x7F,0x06,0x06,0x0F,0x00,0x00,0x00,0x00, // 4 0x00,0x00,0x7F,0x60,0x60,0x60,0x7E,0x03,0x03,0x63,0x73,0x3E,0x00,0x00,0x00,0x00, // 5 0x00,0x00,0x1C,0x30,0x60,0x60,0x7E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00, // 6 0x00,0x00,0x7F,0x63,0x03,0x06,0x06,0x0C,0x0C,0x18,0x18,0x18,0x00,0x00,0x00,0x00, // 7 0x00,0x00,0x3E,0x63,0x63,0x63,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00, // 8 0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x3F,0x03,0x03,0x06,0x3C,0x00,0x00,0x00,0x00, // 9 }; #endif // NUMBERS_8x16 #ifdef NUMBERS_12x16 const prog_uint16_t num_12x16[] PROGMEM = { 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00E0,0x00E0,0x00E0,0x0000,0x0000, // . 0x0000,0x0001,0x0003,0x0007,0x000E,0x001C,0x0038,0x0070,0x00E0,0x01C0,0x0380,0x0700,0x0600,0x0000,0x0000,0x0000, // / 0x00F8,0x03FE,0x0306,0x0607,0x060F,0x061B,0x0633,0x0663,0x06C3,0x0783,0x0703,0x0306,0x03FE,0x00F8,0x0000,0x0000, // 0 0x0030,0x0070,0x01F0,0x01F0,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x0030,0x01FE,0x01FE,0x0000,0x0000, // 1 0x01FC,0x03FE,0x0707,0x0603,0x0607,0x000E,0x001C,0x0038,0x0070,0x00E0,0x01C0,0x0380,0x07FF,0x07FF,0x0000,0x0000, // 2 0x01FC,0x03FE,0x0707,0x0603,0x0003,0x0007,0x00FE,0x00FC,0x0006,0x0003,0x0603,0x0707,0x03FE,0x01FC,0x0000,0x0000, // 3 0x001C,0x003C,0x007C,0x00EC,0x01CC,0x038C,0x070C,0x060C,0x07FF,0x07FF,0x000C,0x000C,0x000C,0x000C,0x0000,0x0000, // 4 0x07FF,0x07FF,0x0600,0x0600,0x0600,0x07FC,0x03FE,0x0007,0x0003,0x0003,0x0603,0x0707,0x03FE,0x01FC,0x0000,0x0000, // 5 0x003C,0x007C,0x00E0,0x01C0,0x0380,0x0300,0x07FC,0x07FE,0x0707,0x0603,0x0603,0x0707,0x03FE,0x01FC,0x0000,0x0000, // 6 0x07FF,0x07FF,0x0006,0x0006,0x000C,0x000C,0x0018,0x0018,0x0030,0x0030,0x0060,0x0060,0x00C0,0x00C0,0x0000,0x0000, // 7 0x00F8,0x01FC,0x038E,0x0306,0x0306,0x038E,0x01FC,0x03FE,0x0707,0x0603,0x0603,0x0707,0x03FE,0x01FC,0x0000,0x0000, // 8 0x01FC,0x03FE,0x0707,0x0603,0x0603,0x0707,0x03FF,0x01FF,0x0006,0x000E,0x001C,0x0038,0x01F0,0x01E0,0x0000,0x0000 // 9 }; #endif // NUMBERS_12x16 #ifdef NUMBERS_16x16 const prog_uint16_t num_16x16[] PROGMEM = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE000, 0xE000, 0xE000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // . 0xC000, 0xC000, 0x3000, 0x3000, 0x0C00, 0x0C00, 0x0300, 0x0300, 0x00C0, 0x00C0, 0x0030, 0x0030, 0x000C, 0x000C, 0x0003, 0x0003, // / 0x0000, 0x1FF8, 0x3FFC, 0x7006, 0xD803, 0xCC03, 0xC603, 0xC303, 0xC183, 0xC0C3, 0xC063, 0xC033, 0x601E, 0x3FFC, 0x1FF8, 0x0000, // 0 - with slash //0x0000, 0x1FF8, 0x3FFC, 0x6006, 0xC003, 0xC003, 0xC003, 0xC3C3, 0xC3C3, 0xC003, 0xC003, 0xC003, 0x6006, 0x3FFC, 0x1FF8, 0x0000, // 0 - with dot 0x0000, 0x0000, 0x0000, 0xC030, 0xC030, 0xC038, 0xC03C, 0xFFFF, 0xFFFF, 0xC000, 0xC000, 0xC000, 0xC000, 0x0000, 0x0000, 0x0000, // 1 0x0000, 0xF008, 0xFC0C, 0xDE0E, 0xC707, 0xC303, 0xC183, 0xC183, 0xC183, 0xC1C3, 0xC0C3, 0xC0C7, 0xE0FE, 0xE07C, 0xE038, 0x0000, // 2 0x0000, 0x1008, 0x300C, 0x700E, 0xE007, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xE3C7, 0x77EE, 0x3E7C, 0x1C38, 0x0000, // 3 0x0000, 0x0780, 0x07C0, 0x07E0, 0x0670, 0x0638, 0x061C, 0xC60E, 0xC607, 0xFFFF, 0xFFFF, 0xFFFF, 0xC600, 0xC600, 0x0000, 0x0000, // 4 0x0000, 0x603F, 0xE07F, 0xC0FF, 0xC0C3, 0xC0C3, 0xC0C3, 0xC0C3, 0xC0C3, 0xC0C3, 0xC0C3, 0xE1C3, 0x7383, 0x3F03, 0x1E03, 0x0000, // 5 0x0000, 0x1FE0, 0x3FF0, 0x7FF8, 0xE1BC, 0xC19E, 0xC18E, 0xC187, 0xC183, 0xC183, 0xC183, 0xC183, 0xE380, 0x7F00, 0x3E00, 0x0000, // 6 0x0000, 0x0002, 0x0003, 0x0003, 0x0003, 0xFC03, 0xFE03, 0xFF03, 0x0383, 0x01C3, 0x00E3, 0x0073, 0x003F, 0x001F, 0x000E, 0x0000, // 7 0x0000, 0x1E18, 0x3F3C, 0x73FE, 0xE1E7, 0xC0C3, 0xC0C3, 0xC0C3, 0xC0C3, 0xC0C3, 0xC0C3, 0xE1E7, 0x73FE, 0x3F3C, 0x1E18, 0x0000, // 8 0x0000, 0x007C, 0x00FE, 0x01C7, 0xC183, 0xC183, 0xC183, 0xC183, 0xE183, 0x7183, 0x7983, 0x3D87, 0x1FFE, 0x0FFC, 0x07F8, 0x0000, // 9 }; #endif // NUMBERS_16x16 const prog_uchar init_code_Nokia[] PROGMEM = { 0x11, 0x03, 0x29, 0x13, 0x21 }; const prog_uchar init_code_S6B33B[] PROGMEM = { 0x2c, 0x02, 0x01, 0x20, 0x0f, 0x26, 0x0f, 0x28, 0x01, 0x2e, 0x45, 0x00, 0x53, 0x00, 0x10, 0x03, 0x24, 0x22, 0x30, 0x3d, 0x32, 0x0e, 0x40, 0x80, 0x42, 0x00, 0x83, 0x43, 0x00, 0x83, 0x34, 0x8d, 0x2a, 0x45, 0x2b, 0x69, 0x22, 0x11, 0x55, 0x00, 0x56, 0x00, 0x57, 0x9f, 0x59, 0x00, 0x00, 0x9f, 0x00, 0x51 }; const byte color_table_16bit_red[] = {0,32,72,104,144,176,216,248}; const byte color_table_16bit_green1[] = {0,1,2,3,4,5,6,7}; const byte color_table_16bit_green2[] = {0,1,2,3,4,5,6,7}; const byte color_table_16bit_blue[] = {0,10,20,31}; RA_NokiaLCD::RA_NokiaLCD() { LCDID=255; #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) pinMode(BL,OUTPUT); pinMode(CS,OUTPUT); #if not defined HWSPILCD pinMode(CLK,OUTPUT); pinMode(SDA,OUTPUT); digitalWrite(CLK,HIGH); digitalWrite(SDA,HIGH); #endif // HWSPILCD pinMode(RESET,OUTPUT); digitalWrite(BL,HIGH); digitalWrite(CS,HIGH); digitalWrite(RESET,HIGH); #else // __AVR_ATmega2560__ DDRD |= B01111100; // Set SPI pins as output PORTD |= B01111000; // Set SPI pins HIGH #endif // __AVR_ATmega2560__ #ifdef HWSPILCD SPI.begin(); #endif // HWSPILCD } void RA_NokiaLCD::SendData(const byte data) { #ifdef HWSPILCD CLK0 SPCR=0; CS0 SDA1 CLK1 SPCR=0x50; SPI.transfer(data); CS1 #else #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) byte dat1 = PORTE | 0x08; byte dat0 = PORTE & ~0x08; byte clk1 = PORTG | 0x20; byte clk0 = PORTG & ~0x20; #else // __AVR_ATmega2560__ byte dat1 = PORTD | 0x20; byte dat0 = PORTD & ~0x20; byte clk1 = PORTD | 0x10; byte clk0 = PORTD & ~0x10; #endif // __AVR_ATmega2560__ bitOut(1); bitOut(data & 0x80); bitOut(data & 0x40); bitOut(data & 0x20); bitOut(data & 0x10); bitOut(data & 0x08); bitOut(data & 0x04); bitOut(data & 0x02); bitOut(data & 0x01); #endif // HWSPILCD } void RA_NokiaLCD::SendCMD(const byte data) { #ifdef HWSPILCD CLK0 SPCR=0; CS0 SDA0 CLK1 SPCR=0x50; SPI.transfer(data); CS1 #else #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) byte dat1 = PORTE | 0x08; byte dat0 = PORTE & ~0x08; byte clk1 = PORTG | 0x20; byte clk0 = PORTG & ~0x20; #else // __AVR_ATmega2560__ byte dat1 = PORTD | 0x20; byte dat0 = PORTD & ~0x20; byte clk1 = PORTD | 0x10; byte clk0 = PORTD & ~0x10; #endif // __AVR_ATmega2560__ bitOut(0); bitOut(data & 0x80); bitOut(data & 0x40); bitOut(data & 0x20); bitOut(data & 0x10); bitOut(data & 0x08); bitOut(data & 0x04); bitOut(data & 0x02); bitOut(data & 0x01); #endif // HWSPILCD #if defined wifi ReefAngel.Network.ReceiveData(); #endif // wifi } inline void RA_NokiaLCD::SendColor12Bit(const byte &color) { byte RR = (color & 0xE0) >> 4; if (RR >= 8) RR++; byte GG = (color & 0x1C) << 3; if (GG >= 0x70) GG += 16; byte BB = (color & 0x03) * 5; SendData(RR); SendData(GG+BB); } inline void RA_NokiaLCD::SendColor16Bit(const byte &color) { byte RR = (color & 0xE0) >> 5; byte GG = (color & 0x1C) >> 2; byte BB = (color & 0x03); SendData(color_table_16bit_red[RR] + color_table_16bit_green1[GG]); SendData(color_table_16bit_green2[GG] + color_table_16bit_red[BB]); } void RA_NokiaLCD::SetBox(byte x1, byte y1, byte x2, byte y2) { #if defined WDT || defined WDT_FORCE wdt_reset(); #endif // defined WDT || defined WDT_FORCE if (LCDID==0) { SendCMD(0x42); SendCMD(y1); // for some reason starts at 2 SendCMD(y2); SendCMD(0x43); // column start/end ram SendCMD(x1); SendCMD(x2); SendCMD(RAMWR); } else if (LCDID==1) { SendCMD(CASET); // page start/end ram SendData(0x00); SendData(x1); // for some reason starts at 2 SendData(0x00); SendData(x2); SendCMD(PASET); // column start/end ram SendData(0x00); SendData(y1); SendData(0x00); SendData(y2); SendCMD(RAMWR); } else if (LCDID==2) { SendCMD(0x15); // page start/end ram SendData(x1); // for some reason starts at 2 SendData(x2); SendCMD(0x75); // column start/end ram SendData(y1); SendData(y2); SendCMD(0x5c); } else { SendCMD(CASET); // page start/end ram SendData(x1); // for some reason starts at 2 SendData(x2); SendCMD(PASET); // column start/end ram SendData(y1); SendData(y2); SendCMD(RAMWR); } } void RA_NokiaLCD::Clear(byte color, byte x1, byte y1, byte x2, byte y2) { uint8_t xmin, xmax, ymin, ymax; uint16_t i; // best way to create a filled rectangle is to define a drawing box // and loop two pixels at a time // calculate the min and max for x and y directions xmin = (x1 <= x2) ? x1 : x2; xmax = (x1 > x2) ? x1 : x2; ymin = (y1 <= y2) ? y1 : y2; ymax = (y1 > y2) ? y1 : y2; SetBox(xmin,ymin,xmax,ymax); // loop on total number of pixels / 2 for (i = 0; i<(xmax - xmin + 1); i++) { // use the color value to output three data bytes covering two pixels // For some reason, it has to send blue first then green and red //SendData((color << 4) | ((color & 0xF0) >> 4)); //SendData(((color >> 4) & 0xF0) | (color & 0x0F)); //SendData((color & 0xF0) | (color >> 8)); for (int j=0; j<(ymax - ymin + 1); j++) { if (LCDID==0) SendColor12Bit(color); else if (LCDID==1 || LCDID==2) SendColor16Bit(color); else SendData(~color); } } } void RA_NokiaLCD::Init() { // Initial state CS1 CS0 // Hardware Reset LCD RESET0 delay(100); RESET1 delay(100); if (LCDID==0) { for (int a=0;a=0;i--) { if (1<= 0 ) { y_pos--; ddF_y += 2; f += ddF_y; } x_pos++; ddF_x += 2; f += ddF_x; PutPixel(bordercolor, x + x_pos, y + y_pos); PutPixel(bordercolor, x - x_pos, y + y_pos); PutPixel(bordercolor, x + x_pos, y - y_pos); PutPixel(bordercolor, x - x_pos, y - y_pos); PutPixel(bordercolor, x + y_pos, y + x_pos); PutPixel(bordercolor, x - y_pos, y + x_pos); PutPixel(bordercolor, x + y_pos, y - x_pos); PutPixel(bordercolor, x - y_pos, y - x_pos); } } void RA_NokiaLCD::FillCircle(byte x, byte y, byte radius, byte fillcolor) { // 3/21/12 - Original code from Jon (jsclownfish) int f = 1 - radius; int ddF_x = 1; int ddF_y = -2 * radius; byte x_pos = 0; byte y_pos = radius; byte i; for ( i = y-radius; i <= y+radius; i++ ) { PutPixel(fillcolor, x, i); } while ( x_pos < y_pos ) { if ( f >= 0 ) { y_pos--; ddF_y += 2; f += ddF_y; } x_pos++; ddF_x += 2; f += ddF_x; for ( i = y-y_pos; i <= y+y_pos; i++ ) { PutPixel(fillcolor, x+x_pos, i); PutPixel(fillcolor, x-x_pos, i); } for ( i = y-x_pos; i <= y+x_pos; i++ ) { PutPixel(fillcolor, x+y_pos, i); PutPixel(fillcolor, x-y_pos, i); } } } void RA_NokiaLCD::DrawCircleOutletBox(byte x, byte y, byte RelayData, bool reverse /*= false*/) { // 3/21/12 - Original code from Jon (jsclownfish) byte a = 0; byte b = 0; byte c = 0; for (a=0;a<2;a++) { // 0 & 1 if ( reverse ) c = 1 - a; else c = a; DrawCircleOutline((a*10)+x,y,5,OutletBorderColor); if ((RelayData&(1<12) iTimeHourOffset=12; itoa(hourFormat12(),temp,10); if (temp[1]==0) strcat(text,"0"); strcat(text,temp); strcat(text,":"); itoa(minute(),temp,10); if (temp[1]==0) strcat(text,"0"); strcat(text,temp); strcat(text,":"); itoa(second(),temp,10); if (temp[1]==0) strcat(text,"0"); strcat(text,temp); if (isAM()) { strcat(text," AM"); } else { strcat(text," PM"); } DrawText(DateTextColor, DefaultBGColor, x, y, text); } #if defined(DATETIME24) // Draw date and time according to ISO 8601 // Example: 2012-05-25 21:48:43 void RA_NokiaLCD::DrawDateTimeISO8601(byte x, byte y) { char text[20]; char temp2[]=" "; char temp4[]=" "; strcpy(text,""); // Date itoa(year(),temp4,10); strcat(text,temp4); strcat(text,"-"); itoa(month(),temp2,10); if (temp2[1]==0) strcat(text,"0"); strcat(text,temp2); strcat(text,"-"); itoa(day(),temp2,10); if (temp2[1]==0) strcat(text,"0"); strcat(text,temp2); strcat(text," "); // Time itoa(hour(),temp2,10); if (temp2[1]==0) strcat(text,"0"); strcat(text,temp2); strcat(text,":"); itoa(minute(),temp2,10); if (temp2[1]==0) strcat(text,"0"); strcat(text,temp2); strcat(text,":"); itoa(second(),temp2,10); if (temp2[1]==0) strcat(text,"0"); strcat(text,temp2); DrawText(DateTextColor, DefaultBGColor, x, y, text); } #endif // DATETIME24 void RA_NokiaLCD::DrawOutletBox(byte x, byte y,byte RelayData) { Clear(OutletBorderColor,x,y,x+104,y); //94 Clear(OutletBorderColor,x,y+12,x+104,y+12); for (byte a=0;a<8;a++) { byte bcolor = OutletOffBGColor; byte fcolor = OutletOffFGColor; char temp[]=" "; if ((RelayData&(1< 1 )) { strcpy(text, "Error"); } else { ConvertNumToString(text, Temp, decimal); } Clear(DefaultBGColor,x,y,x+30,y+8); DrawText(fcolor,DefaultBGColor,x,y,text); } void RA_NokiaLCD::DrawCenterSingleMonitor(int Temp, byte fcolor, byte x, byte y, byte decimal, byte num_spaces) { char text[16]; byte offset=(intlength(Temp)+intlength(decimal)-1)*6/2; offset+=(num_spaces*6); if ( Temp == 0xFFFF ) Temp = 0; if (Temp==0) offset+=3; ConvertNumToString(text, Temp, decimal); Clear(DefaultBGColor,x-offset,y,x-offset+(num_spaces*6)-1,y+7); Clear(DefaultBGColor,x+offset-(num_spaces*6),y,x+offset,y+7); DrawText(fcolor,DefaultBGColor,x-offset+(num_spaces*6),y,text); } void RA_NokiaLCD::DrawSingleMonitorAlarm(int Temp, byte fcolor, byte x, byte y, byte decimal, int high, int low, byte warn_color) { int mod=second()%2; if (Temp > high || Temp < low) { if (mod==0) { Clear(DefaultBGColor,x,y,x+40,y+10); } else { DrawSingleMonitor(Temp, warn_color, x, y, decimal); } } else { DrawSingleMonitor(Temp, fcolor, x, y, decimal); } } #if defined DisplayLEDPWM && ! defined RemoveAllLights void RA_NokiaLCD::DrawMonitor(byte x, byte y, ParamsStruct Params, byte DaylightPWMValue, byte ActinicPWMValue) #else // defined DisplayLEDPWM && ! defined RemoveAllLights void RA_NokiaLCD::DrawMonitor(byte x, byte y, ParamsStruct Params) #endif // defined DisplayLEDPWM && ! defined RemoveAllLights { DrawText(T1TempColor,DefaultBGColor,x,y,"T1:"); DrawSingleMonitor(Params.Temp[T1_PROBE], T1TempColor, x+18, y,10); DrawText(T2TempColor,DefaultBGColor,x,y+10,"T2:"); DrawSingleMonitor(Params.Temp[T2_PROBE], T2TempColor, x+18, y+10,10); DrawText(T3TempColor,DefaultBGColor,x,y+20,"T3:"); DrawSingleMonitor(Params.Temp[T3_PROBE], T3TempColor, x+18, y+20,10); DrawText(PHColor,DefaultBGColor,x+60,y,"PH:"); DrawSingleMonitor(Params.PH, PHColor, x+78, y,100); #if defined DisplayLEDPWM && ! defined RemoveAllLights DrawText(DPColor,DefaultBGColor,x+60,y+10,"DP:"); DrawSingleMonitor(DaylightPWMValue, DPColor, x+78, y+10,1); DrawText(APColor,DefaultBGColor,x+60,y+20,"AP:"); DrawSingleMonitor(ActinicPWMValue, APColor, x+78, y+20,1); #endif // defined DisplayLEDPWM && ! defined RemoveAllLights } void RA_NokiaLCD::DrawSingleGraph(byte color, byte x, byte y, int EEaddr) { int start; #if defined WDT || defined WDT_FORCE wdt_reset(); #endif // defined WDT || defined WDT_FORCE for (byte a=0;a<120;a++) { start=EEaddr+a; if (start > (int(EEaddr/120)+1)*120) start=start-120; // Wire.beginTransmission(I2CAddr); // Wire.print((int)(start >> 8)); // MSB // Wire.print((int)(start & 0xFF)); // LSB // Wire.endTransmission(); // Wire.requestFrom(I2CAddr,1); // if (Wire.available()) PutPixel(color,x+a,y+50-Wire.read()); PutPixel(color, x+a, y+50-Memory.Read(start)); } } void RA_NokiaLCD::DrawEEPromImage(int swidth, int sheight, byte x, byte y, int I2CAddr, int EEaddr) { int count = 0; SetBox(x,y,swidth-1+x,sheight-1+y); SendCMD(0x2c); do { Wire.beginTransmission(I2CAddr); Wire.write((int)(EEaddr+count >> 8)); // MSB Wire.write((int)(EEaddr+count & 0xFF)); // LSB Wire.endTransmission(); Wire.requestFrom(I2CAddr,30); for (byte j = 0; j < 30; j++) { count+=1; if ((count<=swidth*sheight) && Wire.available()) SendData(~Wire.read()); } } while (count < swidth*sheight); } void RA_NokiaLCD::DrawImage(int swidth, int sheight, byte x, byte y, const prog_uchar *iPtr) { int count = 0; SetBox(x,y,swidth-1+x,sheight-1+y); SendCMD(0x2c); do { for (byte j = 0; j < 30; j++) { count+=1; if (count<=swidth*sheight) if (LCDID==0) SendColor12Bit(pgm_read_byte_near(iPtr++)); else if (LCDID==1 || LCDID==2) SendColor16Bit(pgm_read_byte_near(iPtr++)); else SendData(~pgm_read_byte_near(iPtr++)); } } while (count < swidth*sheight); } void RA_NokiaLCD::DrawGraph(byte x, byte y) { // Draws the main screen graph Clear(DefaultBGColor,0,y,131,y+50); Clear(DefaultFGColor,x,y,x,y+50); for (byte i=6; i<=131; i+=3) { PutPixel(GraphDotLineColor, i, y+25); } DrawSingleGraph(T1TempColor,x,y,InternalMemory.T1Pointer_read()); DrawSingleGraph(T2TempColor,x,y,InternalMemory.T1Pointer_read()+120); DrawSingleGraph(T3TempColor,x,y,InternalMemory.T1Pointer_read()+240); DrawSingleGraph(PHColor,x,y,InternalMemory.T1Pointer_read()+360); } void RA_NokiaLCD::DrawOption(int Option, byte Selected, byte x, byte y, char *unit, char *subunit, byte maxdigits) { byte x1,x2=0,x3=0; char text[10]=""; char temp[10]=""; byte bcolor, fcolor, width; byte offset[6] = {0, 6, 6, 12, 18, 24}; itoa(Option,text,10); if (Option >= 10000) { x1 = x+24; } else if (Option > 999) { x1 = x+18; } else if (Option > 99) { x1 = x+12; } else if (Option < 100 && Option > 9) { x1 = x+6; } else if (Option < 10) { x1 = x; if ( (strcmp(unit,"")==0) && (strcmp(subunit,"")==0) ) { text[0]=0x30; itoa(Option,temp,10); strcat(text,temp); x1 = x+6; // Option=10; //Just to offset the prefix "0" when # is < 10 } } x2 = x1; width = offset[maxdigits]+5; if ( strcmp(unit,"") !=0 ) { x2 += 8; width += 8; } if ( strcmp(subunit,"") !=0 ) { x3 = x2; // if there is no unit, move the subunit over if ( strcmp(unit,"") == 0 ) { x3 += 5; } x2 += 5; width += 5; } bcolor = DefaultBGColor; fcolor = DefaultFGColor; Clear(DefaultBGColor, x-1, y-8, x+width, y+15); if (Selected) { bcolor = SelectionBGColor; fcolor = SelectionFGColor; DrawText(DefaultFGColor,DefaultBGColor, x+((x2-x-12)/2), y-8, " ^ "); DrawText(DefaultFGColor,DefaultBGColor, x+((x2-x-12)/2), y+8, " ` "); } // should always print text at X and clear to X1 Clear(bcolor,x-1,y-2,x2+5,y+8); DrawText(fcolor,bcolor,x,y,text); DrawText(fcolor,bcolor,x3,y-5,subunit); DrawText(fcolor,bcolor,x2,y,unit); if ( strcmp(subunit,"") != 0 ) { Clear(DefaultBGColor, x1-2, y-5, x2+6, y-3); } } /* * Make sure that the text to be displayed(char *option) * is not longer then the length argument otherwise it will overflow. * Maximum text length is currently 5(five) characters! */ void RA_NokiaLCD::DrawSelect(char *option, bool selected, byte x, byte y, byte length) { byte offset[6] = {0, 6, 6, 12, 18, 24}; byte x2 = offset[length>5? 5: length] + x; byte bcolor = DefaultBGColor; byte fcolor = DefaultFGColor; Clear(DefaultBGColor, x - 1, y - 8, x2 + 5, y + 15); if (selected) { bcolor = SelectionBGColor; fcolor = SelectionFGColor; DrawText(DefaultFGColor, DefaultBGColor, x + ((x2 - x - 12) / 2), y - 8, " ^ "); DrawText(DefaultFGColor, DefaultBGColor, x + ((x2 - x - 12) / 2), y + 8, " ` "); } Clear(bcolor, x - 1, y - 2, x2 + 5, y + 8); DrawText(fcolor, bcolor, x, y, option); } void RA_NokiaLCD::DrawCancel(bool Selected) { byte bcolor; Clear(BtnBorderColor,14,109,59,126); if ( Selected ) { bcolor = BtnActiveColor; } else { //bcolor = COLOR_LIGHTSTEELBLUE; bcolor = BtnInactiveColor; } Clear(bcolor,15,110,58,125); DrawText(DefaultFGColor,bcolor,20,115,"Cancel"); } void RA_NokiaLCD::DrawOK(bool Selected) { byte bcolor; Clear(BtnBorderColor,74,109,119,126); if ( Selected ) { bcolor = BtnActiveColor; } else { //bcolor = COLOR_LIGHTSTEELBLUE; bcolor = BtnInactiveColor; } Clear(bcolor,75,110,118,125); DrawText(DefaultFGColor,bcolor,92,115,"Ok"); } void RA_NokiaLCD::DrawCalibrate(int i, byte x, byte y) { char text[10] = {0}; Clear(DefaultBGColor, x, y, x+20, y+10); itoa(i,text,10); strcat(text , " "); DrawText(CalibrateColor, DefaultBGColor, x, y, text); } #endif // __SAM3X8E__