├── spark.json ├── README.md ├── firmware ├── examples │ ├── OLED-Cube.cpp │ └── Micro-OLED-Shield-Example.cpp ├── SparkFunMicroOLED.h ├── SparkFunMicroOLED.cpp └── SparkFunMicroOLEDFonts.h └── LICENSE /spark.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SparkFunMicroOLED", 3 | "author": "Jim Lindblom ", 4 | "license": "GPL v3", 5 | "version": "1.3.0", 6 | "description": "A library to drive the SparkFun Photon Micro OLED shield." 7 | } 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## SparkFun Photon Micro OLED Shield Library 2 | 3 | Firmware library SparkFun's Photon Micro OLED Shield. 4 | 5 | About 6 | ------------------- 7 | 8 | This is a firmware library for [SparkFun's Photon Micro OLED Shield](https://www.sparkfun.com/products/13628). 9 | 10 | ![Photon Micro OLED Shield](https://cdn.sparkfun.com//assets/parts/1/1/0/1/5/13628-04a.jpg) 11 | 12 | 13 | With a bit of extra setup, it'll also work with the [Micro OELD Breakout](https://www.sparkfun.com/products/13003). 14 | 15 | You can use this library to draw pixels, lines, circles, squares, and text on the micro OLED's 64x48 display. 16 | 17 | Repository Contents 18 | ------------------- 19 | 20 | * **/firmware** - Source files for the library (.cpp, .h). 21 | * **/firmware/examples** - Example sketches for the library (.cpp). Run these from the Particle IDE. 22 | * **spark.json** - General library properties for the Particel library manager. 23 | 24 | Example Usage 25 | ------------------- 26 | 27 | Include the library, declare a MicroOLED object, and set the display up with these snippets of code: 28 | 29 | #include "SparkFunMicroOLED.h" // Include the SFE_MicroOLED library 30 | ... 31 | ////////////////////////// 32 | // MicroOLED Definition // 33 | ////////////////////////// 34 | #define PIN_RESET D7 // Connect RST to pin 7 (req. for SPI and I2C) 35 | #define PIN_DC D3 // Connect DC to pin 3 (required for SPI) 36 | #define PIN_CS A2 // Connect CS to pin A2 (required for SPI) 37 | 38 | ////////////////////////////////// 39 | // MicroOLED Object Declaration // 40 | ////////////////////////////////// 41 | // Declare a MicroOLED object. The parameters include: 42 | // 1 - Mode: Should be either MODE_SPI or MODE_I2C 43 | // 2 - Reset pin: Any digital pin 44 | // 3 - D/C pin: Any digital pin (SPI mode only) 45 | // 4 - CS pin: Any digital pin (SPI mode only, 10 recommended) 46 | MicroOLED oled(MODE_SPI, PIN_RESET, PIN_DC, PIN_CS); 47 | ... 48 | void setup() 49 | { 50 | oled.begin(); // Initialize the OLED 51 | oled.clear(ALL); // Clear the OLED's internal display buffer 52 | oled.display(); // Display whatever is in the firmware display buffer (SparkFun logo by default) 53 | } 54 | 55 | Check out the example files in the [examples directory](https://github.com/sparkfun/SparkFun_Photon_Micro_OLED_Shield_Library/tree/master/firmware/examples) for more guidance. 56 | 57 | ### Recommended Components 58 | 59 | * [Particle Photon](https://www.sparkfun.com/products/13345) 60 | * [SparkFun Photon Micro OLED Shield](https://www.sparkfun.com/products/13628) 61 | 62 | ### Generating Images 63 | 64 | * [LCD Assistant](http://en.radzio.dxp.pl/bitmap_converter/) - Useful tool for generating images 65 | 66 | License Information 67 | ------------------- 68 | 69 | This product is _**open source**_! 70 | 71 | Please review the LICENSE.md file for license information. 72 | 73 | If you have any questions or concerns on licensing, please contact techsupport@sparkfun.com. 74 | 75 | Distributed as-is; no warranty is given. 76 | 77 | - Your friends at SparkFun. 78 | -------------------------------------------------------------------------------- /firmware/examples/OLED-Cube.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MicroOLED_Hello.ino 3 | SFE_MicroOLED Hello World Demo 4 | Jim Lindblom @ SparkFun Electronics 5 | Original Creation Date: June 22, 2015 6 | 7 | This sketch draws a 3-D cube on the SparkFun Photon Micro OLED shield. 8 | It'll rotate as fast as it can. 9 | 10 | Hardware Connections: 11 | We'll be using the SPI interface on the MicroOLED, though it 12 | also supports I2C (and a really messy parallel). If you want 13 | to swap in I2C, read through the comments to find out how. 14 | 15 | (The Shield already does this for you, but a SparkFun Micro OLED will 16 | also work with this library.) 17 | 18 | MicroOLED ------------- Photon 19 | GND ------------------- GND 20 | VDD ------------------- 3.3V (VCC) 21 | D1/MOSI ----------------- A5 (don't change) 22 | D0/SCK ------------------ A3 (don't change) 23 | D2 24 | D/C ------------------- D6 (can be any digital pin) 25 | RST ------------------- D7 (can be any digital pin) 26 | CS ------------------- A2 (can be any digital pin) 27 | 28 | Development environment specifics: 29 | IDE: Particle Build 30 | Hardware Platform: Particle Photon 31 | SparkFun Photon Micro OLED Shield 32 | 33 | This code is beerware; if you see me (or any other SparkFun 34 | employee) at the local, and you've found our code helpful, 35 | please buy us a round! 36 | 37 | Distributed as-is; no warranty is given. 38 | *******************************************************************************/ 39 | #include "SparkFunMicroOLED/SparkFunMicroOLED.h" // Include Micro OLED library 40 | #include "math.h" 41 | 42 | ////////////////////////// 43 | // MicroOLED Definition // 44 | ////////////////////////// 45 | #define PIN_RESET D7 // Connect RST to pin 7 (req. for SPI and I2C) 46 | #define PIN_DC D6 // Connect DC to pin 6 (required for SPI) 47 | #define PIN_CS A2 // Connect CS to pin A2 (required for SPI) 48 | 49 | ////////////////////////////////// 50 | // MicroOLED Object Declaration // 51 | ////////////////////////////////// 52 | // Declare a MicroOLED object. The parameters include: 53 | // 1 - Mode: Should be either MODE_SPI or MODE_I2C 54 | // 2 - Reset pin: Any digital pin 55 | // 3 - D/C pin: Any digital pin (SPI mode only) 56 | // 4 - CS pin: Any digital pin (SPI mode only, 10 recommended) 57 | MicroOLED oled(MODE_SPI, PIN_RESET, PIN_DC, PIN_CS); 58 | //MicroOLED uOLED(MODE_I2C, PIN_RESET); // Example I2C declaration 59 | 60 | // I2C is great, but will result in a much slower update rate. The 61 | // slower framerate may be a worthwhile tradeoff, if you need more 62 | // pins, though. 63 | 64 | //////////////////// 65 | // Cube Variables // 66 | //////////////////// 67 | #define SHAPE_SIZE 600 68 | #define ROTATION_SPEED 0 // ms delay between cube draws 69 | 70 | int SCREEN_WIDTH = oled.getLCDWidth(); 71 | int SCREEN_HEIGHT = oled.getLCDHeight(); 72 | 73 | float d = 3; 74 | float px[] = { -d, d, d, -d, -d, d, d, -d }; 75 | float py[] = { -d, -d, d, d, -d, -d, d, d }; 76 | float pz[] = { -d, -d, -d, -d, d, d, d, d }; 77 | 78 | float p2x[] = {0,0,0,0,0,0,0,0}; 79 | float p2y[] = {0,0,0,0,0,0,0,0}; 80 | 81 | float r[] = {0,0,0}; 82 | 83 | 84 | void setup() 85 | { 86 | // These three lines of code are all you need to initialize the 87 | // OLED and print the splash screen. 88 | 89 | // Before you can start using the OLED, call begin() to init 90 | // all of the pins and configure the OLED. 91 | oled.begin(); 92 | // clear(ALL) will clear out the OLED's graphic memory. 93 | // clear(PAGE) will clear the Arduino's display buffer. 94 | oled.clear(ALL); // Clear the display's memory (gets rid of artifacts) 95 | // To actually draw anything on the display, you must call the 96 | // display() function. 97 | } 98 | 99 | void loop() 100 | { 101 | drawCube(); 102 | delay(ROTATION_SPEED); 103 | } 104 | 105 | void drawCube() 106 | { 107 | r[0]=r[0]+M_PI/180.0; // Add a degree 108 | r[1]=r[1]+M_PI/180.0; // Add a degree 109 | r[2]=r[2]+M_PI/180.0; // Add a degree 110 | if (r[0] >= 360.0*M_PI/180.0) r[0] = 0; 111 | if (r[1] >= 360.0*M_PI/180.0) r[1] = 0; 112 | if (r[2] >= 360.0*M_PI/180.0) r[2] = 0; 113 | 114 | for (int i=0;i<8;i++) 115 | { 116 | float px2 = px[i]; 117 | float py2 = cos(r[0])*py[i] - sin(r[0])*pz[i]; 118 | float pz2 = sin(r[0])*py[i] + cos(r[0])*pz[i]; 119 | 120 | float px3 = cos(r[1])*px2 + sin(r[1])*pz2; 121 | float py3 = py2; 122 | float pz3 = -sin(r[1])*px2 + cos(r[1])*pz2; 123 | 124 | float ax = cos(r[2])*px3 - sin(r[2])*py3; 125 | float ay = sin(r[2])*px3 + cos(r[2])*py3; 126 | float az = pz3-150; 127 | 128 | p2x[i] = SCREEN_WIDTH/2+ax*SHAPE_SIZE/az; 129 | p2y[i] = SCREEN_HEIGHT/2+ay*SHAPE_SIZE/az; 130 | } 131 | 132 | oled.clear(PAGE); 133 | for (int i=0;i<3;i++) 134 | { 135 | oled.line(p2x[i],p2y[i],p2x[i+1],p2y[i+1]); 136 | oled.line(p2x[i+4],p2y[i+4],p2x[i+5],p2y[i+5]); 137 | oled.line(p2x[i],p2y[i],p2x[i+4],p2y[i+4]); 138 | } 139 | oled.line(p2x[3],p2y[3],p2x[0],p2y[0]); 140 | oled.line(p2x[7],p2y[7],p2x[4],p2y[4]); 141 | oled.line(p2x[3],p2y[3],p2x[7],p2y[7]); 142 | oled.display(); 143 | } 144 | -------------------------------------------------------------------------------- /firmware/SparkFunMicroOLED.h: -------------------------------------------------------------------------------- 1 | /* 2 | MicroOLED Arduino Library 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | #ifndef SPARKFUN_MICRO_OLED_H 18 | #define SPARKFUN_MICRO_OLED_H 19 | 20 | #include 21 | #include 22 | #include "application.h" 23 | 24 | #define swap(a, b) { uint8_t t = a; a = b; b = t; } 25 | #define _BV(x) (1 << x) 26 | #define pgm_read_byte(x) (*(x)) 27 | #define pgm_read_word(x) (*(x)) 28 | #define pgm_read_float(x) (*(x)) 29 | 30 | #define DC_DEFAULT D6 31 | #define RST_DEFAULT D7 32 | #define CS_DEFAULT A2 33 | #define MODE_DEFAULT MODE_SPI 34 | 35 | #define I2C_ADDRESS_SA0_0 0b0111100 36 | #define I2C_ADDRESS_SA0_1 0b0111101 37 | #define I2C_COMMAND 0x00 38 | #define I2C_DATA 0x40 39 | 40 | #define BLACK 0 41 | #define WHITE 1 42 | 43 | #define LCDWIDTH 64 44 | #define LCDHEIGHT 48 45 | #define FONTHEADERSIZE 6 46 | 47 | #define NORM 0 48 | #define XOR 1 49 | 50 | #define PAGE 0 51 | #define ALL 1 52 | 53 | #define WIDGETSTYLE0 0 54 | #define WIDGETSTYLE1 1 55 | #define WIDGETSTYLE2 2 56 | 57 | #define SETCONTRAST 0x81 58 | #define DISPLAYALLONRESUME 0xA4 59 | #define DISPLAYALLON 0xA5 60 | #define NORMALDISPLAY 0xA6 61 | #define INVERTDISPLAY 0xA7 62 | #define DISPLAYOFF 0xAE 63 | #define DISPLAYON 0xAF 64 | #define SETDISPLAYOFFSET 0xD3 65 | #define SETCOMPINS 0xDA 66 | #define SETVCOMDESELECT 0xDB 67 | #define SETDISPLAYCLOCKDIV 0xD5 68 | #define SETPRECHARGE 0xD9 69 | #define SETMULTIPLEX 0xA8 70 | #define SETLOWCOLUMN 0x00 71 | #define SETHIGHCOLUMN 0x10 72 | #define SETSTARTLINE 0x40 73 | #define MEMORYMODE 0x20 74 | #define COMSCANINC 0xC0 75 | #define COMSCANDEC 0xC8 76 | #define SEGREMAP 0xA0 77 | #define CHARGEPUMP 0x8D 78 | #define EXTERNALVCC 0x01 79 | #define SWITCHCAPVCC 0x02 80 | 81 | // Scroll 82 | #define ACTIVATESCROLL 0x2F 83 | #define DEACTIVATESCROLL 0x2E 84 | #define SETVERTICALSCROLLAREA 0xA3 85 | #define RIGHTHORIZONTALSCROLL 0x26 86 | #define LEFT_HORIZONTALSCROLL 0x27 87 | #define VERTICALRIGHTHORIZONTALSCROLL 0x29 88 | #define VERTICALLEFTHORIZONTALSCROLL 0x2A 89 | 90 | typedef enum CMD { 91 | CMD_CLEAR, //0 92 | CMD_INVERT, //1 93 | CMD_CONTRAST, //2 94 | CMD_DISPLAY, //3 95 | CMD_SETCURSOR, //4 96 | CMD_PIXEL, //5 97 | CMD_LINE, //6 98 | CMD_LINEH, //7 99 | CMD_LINEV, //8 100 | CMD_RECT, //9 101 | CMD_RECTFILL, //10 102 | CMD_CIRCLE, //11 103 | CMD_CIRCLEFILL, //12 104 | CMD_DRAWCHAR, //13 105 | CMD_DRAWBITMAP, //14 106 | CMD_GETLCDWIDTH, //15 107 | CMD_GETLCDHEIGHT, //16 108 | CMD_SETCOLOR, //17 109 | CMD_SETDRAWMODE //18 110 | } commCommand_t; 111 | 112 | typedef enum COMM_MODE{ 113 | MODE_SPI, 114 | MODE_I2C 115 | } micro_oled_mode; 116 | 117 | class MicroOLED : public Print 118 | { 119 | public: 120 | MicroOLED(micro_oled_mode mode = MODE_DEFAULT, uint8_t rst = RST_DEFAULT, uint8_t dc = DC_DEFAULT, uint8_t cs = CS_DEFAULT); 121 | 122 | void begin(void); 123 | virtual size_t write(uint8_t); 124 | 125 | // RAW LCD functions 126 | void command(uint8_t c); 127 | void data(uint8_t c); 128 | void setColumnAddress(uint8_t add); 129 | void setPageAddress(uint8_t add); 130 | 131 | // LCD Draw functions 132 | void clear(uint8_t mode); 133 | void clear(uint8_t mode, uint8_t c); 134 | void invert(bool inv); 135 | void contrast(uint8_t contrast); 136 | void display(void); 137 | void setCursor(uint8_t x, uint8_t y); 138 | void pixel(uint8_t x, uint8_t y); 139 | void pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode); 140 | void line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1); 141 | void line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color, uint8_t mode); 142 | void lineH(uint8_t x, uint8_t y, uint8_t width); 143 | void lineH(uint8_t x, uint8_t y, uint8_t width, uint8_t color, uint8_t mode); 144 | void lineV(uint8_t x, uint8_t y, uint8_t height); 145 | void lineV(uint8_t x, uint8_t y, uint8_t height, uint8_t color, uint8_t mode); 146 | void rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height); 147 | void rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color , uint8_t mode); 148 | void rectFill(uint8_t x, uint8_t y, uint8_t width, uint8_t height); 149 | void rectFill(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color , uint8_t mode); 150 | void circle(uint8_t x, uint8_t y, uint8_t radius); 151 | void circle(uint8_t x, uint8_t y, uint8_t radius, uint8_t color, uint8_t mode); 152 | void circleFill(uint8_t x0, uint8_t y0, uint8_t radius); 153 | void circleFill(uint8_t x0, uint8_t y0, uint8_t radius, uint8_t color, uint8_t mode); 154 | void drawChar(const uint8_t x, const uint8_t y, const uint8_t c); 155 | void drawChar(const uint8_t x, const uint8_t y, const uint8_t c,const uint8_t color, const uint8_t mode); 156 | void drawBitmap(const uint8_t * bitArray); 157 | 158 | uint8_t getLCDWidth(void); 159 | uint8_t getLCDHeight(void); 160 | void setColor(const uint8_t color); 161 | void setDrawMode(const uint8_t mode); 162 | 163 | // Font functions 164 | uint8_t getFontWidth(void); 165 | uint8_t getFontHeight(void); 166 | uint8_t getTotalFonts(void); 167 | uint8_t getFontType(void); 168 | uint8_t setFontType(const uint8_t type); 169 | uint8_t getFontStartChar(void); 170 | uint8_t getFontTotalChar(void); 171 | 172 | // LCD Rotate Scroll functions 173 | void scrollRight(const uint8_t start, const uint8_t stop); 174 | void scrollLeft(uint8_t start, uint8_t stop); 175 | void scrollVertRight(uint8_t start, uint8_t stop); 176 | void scrollVertLeft(uint8_t start, uint8_t stop); 177 | void scrollStop(void); 178 | void flipVertical(const bool flip); 179 | void flipHorizontal(const bool flip); 180 | 181 | private: 182 | uint8_t csPin, dcPin, rstPin; 183 | uint8_t wrPin, rdPin, dPins[8]; 184 | volatile uint8_t *wrport, *wrreg, *rdport, *rdreg; 185 | uint8_t wrpinmask, rdpinmask; 186 | micro_oled_mode interface; 187 | uint8_t foreColor,drawMode,fontWidth, fontHeight, fontType, fontStartChar, fontTotalChar, cursorX, cursorY; 188 | uint16_t fontMapWidth; 189 | static const unsigned char *fontsPointer[]; 190 | 191 | void setup(micro_oled_mode mode, uint8_t rst, uint8_t dc, uint8_t cs); 192 | 193 | // Communication 194 | void spiTransfer(uint8_t data); 195 | void spiSetup(); 196 | void i2cSetup(); 197 | void i2cWrite(uint8_t address, uint8_t control, uint8_t data); 198 | }; 199 | #endif 200 | -------------------------------------------------------------------------------- /firmware/examples/Micro-OLED-Shield-Example.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Micro-OLED-Shield-Example.ino 3 | SparkFun Micro OLED Library Hello World Example 4 | Jim Lindblom @ SparkFun Electronics 5 | Original Creation Date: June 22, 2015 6 | 7 | This sketch prints a friendly, recognizable logo on the OLED Shield, then 8 | goes on to demo the Micro OLED library's functionality drawing pixels, 9 | lines, shapes, and text. 10 | 11 | Hardware Connections: 12 | This sketch was written specifically for the Photon Micro OLED Shield, 13 | which does all the wiring for you. If you have a Micro OLED breakout, 14 | use the following hardware setup: 15 | 16 | MicroOLED ------------- Photon 17 | GND ------------------- GND 18 | VDD ------------------- 3.3V (VCC) 19 | D1/MOSI ----------------- A5 (don't change) 20 | D0/SCK ------------------ A3 (don't change) 21 | D2 22 | D/C ------------------- D6 (can be any digital pin) 23 | RST ------------------- D7 (can be any digital pin) 24 | CS ------------------- A2 (can be any digital pin) 25 | 26 | Development environment specifics: 27 | IDE: Particle Build 28 | Hardware Platform: Particle Photon 29 | SparkFun Photon Micro OLED Shield 30 | 31 | This code is beerware; if you see me (or any other SparkFun 32 | employee) at the local, and you've found our code helpful, 33 | please buy us a round! 34 | 35 | Distributed as-is; no warranty is given. 36 | *******************************************************************************/ 37 | #include "SparkFunMicroOLED/SparkFunMicroOLED.h" // Include MicroOLED library 38 | #include "math.h" 39 | 40 | ////////////////////////////////// 41 | // MicroOLED Object Declaration // 42 | ////////////////////////////////// 43 | // Declare a MicroOLED object. If no parameters are supplied, default pins are 44 | // used, which will work for the Photon Micro OLED Shield (RST=D7, DC=D6, CS=A2) 45 | MicroOLED oled; 46 | //MicroOLED oled(MODE_I2C, D7, 0); // Example I2C declaration RST=D7, DC=LOW (0) 47 | 48 | //SYSTEM_MODE(MANUAL); 49 | 50 | void setup() 51 | { 52 | Serial.begin(9600); 53 | oled.begin(); // Initialize the OLED 54 | oled.clear(ALL); // Clear the display's internal memory 55 | oled.display(); // Display what's in the buffer (splashscreen) 56 | delay(1000); // Delay 1000 ms 57 | randomSeed(analogRead(A0) + analogRead(A1)); 58 | } 59 | 60 | void loop() 61 | { 62 | pixelExample(); // Run the pixel example function 63 | lineExample(); // Then the line example function 64 | shapeExample(); // Then the shape example 65 | textExamples(); // Finally the text example 66 | } 67 | 68 | void pixelExample() 69 | { 70 | printTitle("Pixels", 1); 71 | 72 | for (int i=0; i<512; i++) 73 | { 74 | oled.pixel(random(oled.getLCDWidth()), random(oled.getLCDHeight())); 75 | oled.display(); 76 | } 77 | } 78 | 79 | void lineExample() 80 | { 81 | int middleX = oled.getLCDWidth() / 2; 82 | int middleY = oled.getLCDHeight() / 2; 83 | int xEnd, yEnd; 84 | int lineWidth = min(middleX, middleY); 85 | 86 | printTitle("Lines!", 1); 87 | 88 | for (int i=0; i<3; i++) 89 | { 90 | for (int deg=0; deg<360; deg+=15) 91 | { 92 | xEnd = lineWidth * cos(deg * M_PI / 180.0); 93 | yEnd = lineWidth * sin(deg * M_PI / 180.0); 94 | 95 | oled.line(middleX, middleY, middleX + xEnd, middleY + yEnd); 96 | oled.display(); 97 | delay(10); 98 | } 99 | for (int deg=0; deg<360; deg+=15) 100 | { 101 | xEnd = lineWidth * cos(deg * M_PI / 180.0); 102 | yEnd = lineWidth * sin(deg * M_PI / 180.0); 103 | 104 | oled.line(middleX, middleY, middleX + xEnd, middleY + yEnd, BLACK, NORM); 105 | oled.display(); 106 | delay(10); 107 | } 108 | } 109 | } 110 | 111 | void shapeExample() 112 | { 113 | printTitle("Shapes!", 0); 114 | 115 | // Silly pong demo. It takes a lot of work to fake pong... 116 | int paddleW = 3; // Paddle width 117 | int paddleH = 15; // Paddle height 118 | // Paddle 0 (left) position coordinates 119 | int paddle0_Y = (oled.getLCDHeight() / 2) - (paddleH / 2); 120 | int paddle0_X = 2; 121 | // Paddle 1 (right) position coordinates 122 | int paddle1_Y = (oled.getLCDHeight() / 2) - (paddleH / 2); 123 | int paddle1_X = oled.getLCDWidth() - 3 - paddleW; 124 | int ball_rad = 2; // Ball radius 125 | // Ball position coordinates 126 | int ball_X = paddle0_X + paddleW + ball_rad; 127 | int ball_Y = random(1 + ball_rad, oled.getLCDHeight() - ball_rad);//paddle0_Y + ball_rad; 128 | int ballVelocityX = 1; // Ball left/right velocity 129 | int ballVelocityY = 1; // Ball up/down velocity 130 | int paddle0Velocity = -1; // Paddle 0 velocity 131 | int paddle1Velocity = 1; // Paddle 1 velocity 132 | 133 | //while(ball_X >= paddle0_X + paddleW - 1) 134 | while ((ball_X - ball_rad > 1) && 135 | (ball_X + ball_rad < oled.getLCDWidth() - 2)) 136 | { 137 | // Increment ball's position 138 | ball_X+=ballVelocityX; 139 | ball_Y+=ballVelocityY; 140 | // Check if the ball is colliding with the left paddle 141 | if (ball_X - ball_rad < paddle0_X + paddleW) 142 | { 143 | // Check if ball is within paddle's height 144 | if ((ball_Y > paddle0_Y) && (ball_Y < paddle0_Y + paddleH)) 145 | { 146 | ball_X++; // Move ball over one to the right 147 | ballVelocityX = -ballVelocityX; // Change velocity 148 | } 149 | } 150 | // Check if the ball hit the right paddle 151 | if (ball_X + ball_rad > paddle1_X) 152 | { 153 | // Check if ball is within paddle's height 154 | if ((ball_Y > paddle1_Y) && (ball_Y < paddle1_Y + paddleH)) 155 | { 156 | ball_X--; // Move ball over one to the left 157 | ballVelocityX = -ballVelocityX; // change velocity 158 | } 159 | } 160 | // Check if the ball hit the top or bottom 161 | if ((ball_Y <= ball_rad) || (ball_Y >= (oled.getLCDHeight() - ball_rad - 1))) 162 | { 163 | // Change up/down velocity direction 164 | ballVelocityY = -ballVelocityY; 165 | } 166 | // Move the paddles up and down 167 | paddle0_Y += paddle0Velocity; 168 | paddle1_Y += paddle1Velocity; 169 | // Change paddle 0's direction if it hit top/bottom 170 | if ((paddle0_Y <= 1) || (paddle0_Y > oled.getLCDHeight() - 2 - paddleH)) 171 | { 172 | paddle0Velocity = -paddle0Velocity; 173 | } 174 | // Change paddle 1's direction if it hit top/bottom 175 | if ((paddle1_Y <= 1) || (paddle1_Y > oled.getLCDHeight() - 2 - paddleH)) 176 | { 177 | paddle1Velocity = -paddle1Velocity; 178 | } 179 | 180 | // Draw the Pong Field 181 | oled.clear(PAGE); // Clear the page 182 | // Draw an outline of the screen: 183 | oled.rect(0, 0, oled.getLCDWidth() - 1, oled.getLCDHeight()); 184 | // Draw the center line 185 | oled.rectFill(oled.getLCDWidth()/2 - 1, 0, 2, oled.getLCDHeight()); 186 | // Draw the Paddles: 187 | oled.rectFill(paddle0_X, paddle0_Y, paddleW, paddleH); 188 | oled.rectFill(paddle1_X, paddle1_Y, paddleW, paddleH); 189 | // Draw the ball: 190 | oled.circle(ball_X, ball_Y, ball_rad); 191 | // Actually draw everything on the screen: 192 | oled.display(); 193 | delay(25); // Delay for visibility 194 | } 195 | delay(1000); 196 | } 197 | 198 | void textExamples() 199 | { 200 | printTitle("Text!", 1); 201 | 202 | // Demonstrate font 0. 5x8 font 203 | oled.clear(PAGE); // Clear the screen 204 | oled.setFontType(0); // Set font to type 0 205 | oled.setCursor(0, 0); // Set cursor to top-left 206 | // There are 255 possible characters in the font 0 type. 207 | // Lets run through all of them and print them out! 208 | for (int i=0; i<=255; i++) 209 | { 210 | // You can write byte values and they'll be mapped to 211 | // their ASCII equivalent character. 212 | oled.write(i); // Write a byte out as a character 213 | oled.display(); // Draw on the screen 214 | delay(10); // Wait 10ms 215 | // We can only display 60 font 0 characters at a time. 216 | // Every 60 characters, pause for a moment. Then clear 217 | // the page and start over. 218 | if ((i%60 == 0) && (i != 0)) 219 | { 220 | delay(500); // Delay 500 ms 221 | oled.clear(PAGE); // Clear the page 222 | oled.setCursor(0, 0); // Set cursor to top-left 223 | } 224 | } 225 | delay(500); // Wait 500ms before next example 226 | 227 | // Demonstrate font 1. 8x16. Let's use the print function 228 | // to display every character defined in this font. 229 | oled.setFontType(1); // Set font to type 1 230 | oled.clear(PAGE); // Clear the page 231 | oled.setCursor(0, 0); // Set cursor to top-left 232 | // Print can be used to print a string to the screen: 233 | oled.print(" !\"#$%&'()*+,-./01234"); 234 | oled.display(); // Refresh the display 235 | delay(1000); // Delay a second and repeat 236 | oled.clear(PAGE); 237 | oled.setCursor(0, 0); 238 | oled.print("56789:;<=>?@ABCDEFGHI"); 239 | oled.display(); 240 | delay(1000); 241 | oled.clear(PAGE); 242 | oled.setCursor(0, 0); 243 | oled.print("JKLMNOPQRSTUVWXYZ[\\]^"); 244 | oled.display(); 245 | delay(1000); 246 | oled.clear(PAGE); 247 | oled.setCursor(0, 0); 248 | oled.print("_`abcdefghijklmnopqrs"); 249 | oled.display(); 250 | delay(1000); 251 | oled.clear(PAGE); 252 | oled.setCursor(0, 0); 253 | oled.print("tuvwxyz{|}~"); 254 | oled.display(); 255 | delay(1000); 256 | 257 | // Demonstrate font 2. 10x16. Only numbers and '.' are defined. 258 | // This font looks like 7-segment displays. 259 | // Lets use this big-ish font to display readings from the 260 | // analog pins. 261 | for (int i=0; i<25; i++) 262 | { 263 | oled.clear(PAGE); // Clear the display 264 | oled.setCursor(0, 0); // Set cursor to top-left 265 | oled.setFontType(0); // Smallest font 266 | oled.print("A0:"); // Print "A0" 267 | oled.setFontType(2); // 7-segment font 268 | oled.print(analogRead(A0)); // Print a0 reading 269 | oled.setCursor(0, 16); // Set cursor to top-middle-left 270 | oled.setFontType(0); // Repeat 271 | oled.print("A1:"); 272 | oled.setFontType(2); 273 | oled.print(analogRead(A1)); 274 | oled.setCursor(0, 32); 275 | oled.setFontType(0); 276 | oled.print("A7:"); 277 | oled.setFontType(2); 278 | oled.print(analogRead(A7)); 279 | oled.display(); 280 | delay(100); 281 | } 282 | 283 | // Demonstrate font 3. 12x48. Stopwatch demo. 284 | oled.setFontType(3); // Use the biggest font 285 | int ms = 0; 286 | int s = 0; 287 | while (s <= 50) 288 | { 289 | oled.clear(PAGE); // Clear the display 290 | oled.setCursor(0, 0); // Set cursor to top-left 291 | if (s < 10) 292 | oled.print("00"); // Print "00" if s is 1 digit 293 | else if (s < 100) 294 | oled.print("0"); // Print "0" if s is 2 digits 295 | oled.print(s); // Print s's value 296 | oled.print(":"); // Print ":" 297 | oled.print(ms); // Print ms value 298 | oled.display(); // Draw on the screen 299 | ms++; // Increment ms 300 | if (ms >= 10) // If ms is >= 10 301 | { 302 | ms = 0; // Set ms back to 0 303 | s++; // and increment s 304 | } 305 | delay(1); 306 | } 307 | } 308 | 309 | // Center and print a small title 310 | // This function is quick and dirty. Only works for titles one 311 | // line long. 312 | void printTitle(String title, int font) 313 | { 314 | int middleX = oled.getLCDWidth() / 2; 315 | int middleY = oled.getLCDHeight() / 2; 316 | 317 | oled.clear(PAGE); 318 | oled.setFontType(font); 319 | // Try to set the cursor in the middle of the screen 320 | oled.setCursor(middleX - (oled.getFontWidth() * (title.length()/2)), 321 | middleY - (oled.getFontWidth() / 2)); 322 | // Print the title: 323 | oled.print(title); 324 | oled.display(); 325 | delay(1500); 326 | oled.clear(PAGE); 327 | } 328 | -------------------------------------------------------------------------------- /firmware/SparkFunMicroOLED.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | MicroOLED Arduino Library 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | #include "SparkFunMicroOLED.h" 18 | #include "SparkFunMicroOLEDFonts.h" 19 | #include "math.h" 20 | 21 | // Change the total fonts included 22 | #define TOTALFONTS 7 23 | #define recvLEN 100 24 | char serInStr[recvLEN]; // TODO - need to fix a value so that this will not take up too much memory. 25 | uint8_t serCmd[recvLEN]; 26 | 27 | // Add the font name as declared in the header file. Remove as many as possible to get conserve FLASH memory. 28 | const unsigned char *MicroOLED::fontsPointer[]={ 29 | font5x7 30 | ,font8x16 31 | ,sevensegment 32 | ,fontlargenumber 33 | ,space01 34 | ,space02 35 | ,space03 36 | }; 37 | 38 | #define I2C_FREQ 400000L 39 | 40 | /** \brief MicroOLED screen buffer. 41 | 42 | Page buffer 64 x 48 divided by 8 = 384 bytes 43 | Page buffer is required because in SPI mode, the host cannot read the SSD1306's GDRAM of the controller. This page buffer serves as a scratch RAM for graphical functions. All drawing function will first be drawn on this page buffer, only upon calling display() function will transfer the page buffer to the actual LCD controller's memory. 44 | */ 45 | static uint8_t screenmemory [] = { 46 | /* LCD Memory organised in 64 horizontal pixel and 6 rows of byte 47 | B B .............B ----- 48 | y y .............y \ 49 | t t .............t \ 50 | e e .............e \ 51 | 0 1 .............63 \ 52 | \ 53 | D0 D0.............D0 \ 54 | D1 D1.............D1 / ROW 0 55 | D2 D2.............D2 / 56 | D3 D3.............D3 / 57 | D4 D4.............D4 / 58 | D5 D5.............D5 / 59 | D6 D6.............D6 / 60 | D7 D7.............D7 ---- 61 | */ 62 | //SparkFun Electronics LOGO 63 | 64 | // ROW0, BYTE0 to BYTE63 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF8, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 67 | 0xFF, 0xFF, 0xFF, 0x0F, 0x07, 0x07, 0x06, 0x06, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 68 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 | 70 | // ROW1, BYTE64 to BYTE127 71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 72 | 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, 0x07, 0x0F, 0x3F, 0x3F, 0xFF, 0xFF, 0xFF, 73 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFC, 0xFC, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xE0, 74 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 75 | 76 | // ROW2, BYTE128 to BYTE191 77 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 78 | 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF1, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xF0, 0xFD, 0xFF, 79 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 80 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 81 | 82 | // ROW3, BYTE192 to BYTE255 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 84 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 85 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x07, 0x01, 86 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 87 | 88 | // ROW4, BYTE256 to BYTE319 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 90 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x1F, 0x0F, 0x0F, 0x0F, 0x0F, 91 | 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 92 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 93 | 94 | // ROW5, BYTE320 to BYTE383 95 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 96 | 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 97 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 98 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 99 | }; 100 | 101 | MicroOLED::MicroOLED(micro_oled_mode mode, uint8_t rst, uint8_t dc, uint8_t cs) 102 | { 103 | if (mode == MODE_SPI) 104 | setup(mode, rst, dc, cs); 105 | else if (mode == MODE_I2C) 106 | setup(mode, rst, dc, cs); 107 | } 108 | 109 | void MicroOLED::setup(micro_oled_mode mode, uint8_t rst, uint8_t dc, uint8_t cs) 110 | { 111 | rstPin = rst; 112 | dcPin = dc; 113 | csPin = cs; 114 | interface = mode; 115 | } 116 | 117 | /** \brief Initialisation of MicroOLED Library. 118 | 119 | Setup IO pins for SPI port then send initialisation commands to the SSD1306 controller inside the OLED. 120 | */ 121 | void MicroOLED::begin() { 122 | // default 5x7 font 123 | setFontType(0); 124 | setColor(WHITE); 125 | setDrawMode(NORM); 126 | setCursor(0,0); 127 | 128 | pinMode(rstPin, OUTPUT); 129 | 130 | if (interface == MODE_SPI) 131 | { 132 | spiSetup(); 133 | pinMode(dcPin, OUTPUT); 134 | } 135 | else if (interface == MODE_I2C) 136 | { 137 | if (dcPin == 0) 138 | dcPin = I2C_ADDRESS_SA0_0; 139 | else 140 | dcPin = I2C_ADDRESS_SA0_1; 141 | i2cSetup(); 142 | } 143 | 144 | digitalWrite(rstPin, HIGH); 145 | // VDD (3.3V) goes high at start, lets just chill for 5 ms 146 | delay(5); 147 | // bring reset low 148 | digitalWrite(rstPin, LOW); 149 | 150 | 151 | // wait 10ms 152 | delay(10); 153 | // bring out of reset 154 | pinMode(rstPin,INPUT_PULLUP); 155 | //digitalWrite(rstPin, HIGH); 156 | 157 | // Init sequence for 64x48 OLED module 158 | command(DISPLAYOFF); // 0xAE 159 | 160 | command(SETDISPLAYCLOCKDIV); // 0xD5 161 | command(0x80); // the suggested ratio 0x80 162 | 163 | command(SETMULTIPLEX); // 0xA8 164 | command(0x2F); 165 | 166 | command(SETDISPLAYOFFSET); // 0xD3 167 | command(0x0); // no offset 168 | 169 | command(SETSTARTLINE | 0x0); // line #0 170 | 171 | command(CHARGEPUMP); // enable charge pump 172 | command(0x14); 173 | 174 | command(NORMALDISPLAY); // 0xA6 175 | command(DISPLAYALLONRESUME); // 0xA4 176 | 177 | command(SEGREMAP | 0x1); 178 | command(COMSCANDEC); 179 | 180 | command(SETCOMPINS); // 0xDA 181 | command(0x12); 182 | 183 | command(SETCONTRAST); // 0x81 184 | command(0x8F); 185 | 186 | command(SETPRECHARGE); // 0xd9 187 | command(0xF1); 188 | 189 | command(SETVCOMDESELECT); // 0xDB 190 | command(0x40); 191 | 192 | command(DISPLAYON); //--turn on oled panel 193 | clear(ALL); // Erase hardware memory inside the OLED controller to avoid random data in memory. 194 | } 195 | 196 | /** \brief SPI command. 197 | 198 | Setup DC and SS pins, then send command via SPI to SSD1306 controller. 199 | */ 200 | void MicroOLED::command(uint8_t c) { 201 | 202 | if (interface == MODE_SPI) 203 | { 204 | digitalWrite(dcPin, LOW); 205 | digitalWrite(csPin, LOW); 206 | spiTransfer(c); 207 | digitalWrite(csPin, HIGH); 208 | } 209 | else if (interface == MODE_I2C) 210 | { 211 | i2cWrite(dcPin, I2C_COMMAND, c); 212 | } 213 | } 214 | 215 | /** \brief SPI data. 216 | 217 | Setup DC and SS pins, then send data via SPI to SSD1306 controller. 218 | */ 219 | void MicroOLED::data(uint8_t c) { 220 | 221 | if (interface == MODE_SPI) 222 | { 223 | digitalWrite(dcPin, HIGH); 224 | digitalWrite(csPin, LOW); 225 | spiTransfer(c); 226 | digitalWrite(csPin, HIGH); 227 | } 228 | else if (interface == MODE_I2C) 229 | { 230 | i2cWrite(dcPin, I2C_DATA, c); 231 | } 232 | } 233 | 234 | /** \brief Set SSD1306 page address. 235 | 236 | Send page address command and address to the SSD1306 OLED controller. 237 | */ 238 | void MicroOLED::setPageAddress(uint8_t add) { 239 | add=0xb0|add; 240 | command(add); 241 | return; 242 | } 243 | 244 | /** \brief Set SSD1306 column address. 245 | 246 | Send column address command and address to the SSD1306 OLED controller. 247 | */ 248 | void MicroOLED::setColumnAddress(uint8_t add) { 249 | command((0x10|(add >> 4)) + 0x02); 250 | command((0x0f & add)); 251 | return; 252 | } 253 | 254 | /** \brief Clear screen buffer or SSD1306's memory. 255 | 256 | To clear GDRAM inside the LCD controller, pass in the variable mode = ALL and to clear screen page buffer pass in the variable mode = PAGE. 257 | */ 258 | void MicroOLED::clear(uint8_t mode) { 259 | // uint8_t page=6, col=0x40; 260 | if (mode == ALL) { 261 | for (int i=0; i < 8; ++i) { 262 | setPageAddress(i); 263 | setColumnAddress(0); 264 | for (int j = 0; j < 0x80; j++) { 265 | data(0); 266 | } 267 | } 268 | } 269 | else 270 | { 271 | memset(screenmemory,0,384); // (64 x 48) / 8 = 384 272 | //display(); 273 | } 274 | } 275 | 276 | /** \brief Clear or replace screen buffer or SSD1306's memory with a character. 277 | 278 | To clear GDRAM inside the LCD controller, pass in the variable mode = ALL with c character and to clear screen page buffer, pass in the variable mode = PAGE with c character. 279 | */ 280 | void MicroOLED::clear(uint8_t mode, uint8_t c) { 281 | //uint8_t page=6, col=0x40; 282 | if (mode == ALL) { 283 | for (int i = 0; i< 8; ++i) { 284 | setPageAddress(i); 285 | setColumnAddress(0); 286 | for (int j= 0; j < 0x80; j++) { 287 | data(c); 288 | } 289 | } 290 | } 291 | else 292 | { 293 | memset(screenmemory,c,384); // (64 x 48) / 8 = 384 294 | display(); 295 | } 296 | } 297 | 298 | /** \brief Invert display. 299 | 300 | The WHITE color of the display will turn to BLACK and the BLACK will turn to WHITE. 301 | */ 302 | void MicroOLED::invert(bool inv) { 303 | if (inv) 304 | command(INVERTDISPLAY); 305 | else 306 | command(NORMALDISPLAY); 307 | } 308 | 309 | /** \brief Set contrast. 310 | 311 | OLED contract value from 0 to 255. Note: Contrast level is not very obvious. 312 | */ 313 | void MicroOLED::contrast(uint8_t contrast) { 314 | command(SETCONTRAST); // 0x81 315 | command(contrast); 316 | } 317 | 318 | /** \brief Transfer display memory. 319 | 320 | Bulk move the screen buffer to the SSD1306 controller's memory so that images/graphics drawn on the screen buffer will be displayed on the OLED. 321 | */ 322 | void MicroOLED::display(void) { 323 | uint8_t i, j; 324 | 325 | for (i=0; i < 6; ++i) { 326 | setPageAddress(i); 327 | setColumnAddress(0); 328 | for (j = 0; j < 0x40; j++) { 329 | data(screenmemory[i * 0x40 + j]); 330 | } 331 | } 332 | } 333 | 334 | /** \brief Override Arduino's Print. 335 | 336 | Arduino's print overridden so that we can use uView.print(). 337 | */ 338 | size_t MicroOLED::write(uint8_t c) 339 | { 340 | if (c == '\n') { 341 | cursorY += fontHeight; 342 | cursorX = 0; 343 | } else if (c == '\r') { 344 | // skip 345 | } else { 346 | drawChar(cursorX, cursorY, c, foreColor, drawMode); 347 | cursorX += fontWidth+1; 348 | if ((cursorX > (LCDWIDTH - fontWidth))) { 349 | cursorY += fontHeight; 350 | cursorX = 0; 351 | } 352 | } 353 | return 1; 354 | } 355 | 356 | /** \brief Set cursor position. 357 | 358 | MicroOLED's cursor position to x,y. 359 | */ 360 | void MicroOLED::setCursor(uint8_t x, uint8_t y) { 361 | cursorX = x; 362 | cursorY = y; 363 | } 364 | 365 | /** \brief Draw pixel. 366 | 367 | Draw pixel using the current fore color and current draw mode in the screen buffer's x,y position. 368 | */ 369 | void MicroOLED::pixel(uint8_t x, uint8_t y) { 370 | pixel(x, y, foreColor, drawMode); 371 | } 372 | 373 | /** \brief Draw pixel with color and mode. 374 | 375 | Draw color pixel in the screen buffer's x,y position with NORM or XOR draw mode. 376 | */ 377 | void MicroOLED::pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode) { 378 | if ((x < 0) || (x >= LCDWIDTH) || (y < 0) || (y >= LCDHEIGHT)) 379 | return; 380 | 381 | if (mode==XOR) { 382 | if (color==WHITE) 383 | screenmemory[x+ (y / 8)*LCDWIDTH] ^= _BV((y % 8)); 384 | } 385 | else { 386 | if (color==WHITE) 387 | screenmemory[x+ (y / 8) * LCDWIDTH] |= _BV((y % 8)); 388 | else 389 | screenmemory[x+ (y / 8) * LCDWIDTH] &= ~_BV((y % 8)); 390 | } 391 | 392 | //display(); 393 | } 394 | 395 | /** \brief Draw line. 396 | 397 | Draw line using current fore color and current draw mode from x0,y0 to x1,y1 of the screen buffer. 398 | */ 399 | void MicroOLED::line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) { 400 | line(x0, y0, x1, y1, foreColor, drawMode); 401 | } 402 | 403 | /** \brief Draw line with color and mode. 404 | 405 | Draw line using color and mode from x0,y0 to x1,y1 of the screen buffer. 406 | */ 407 | void MicroOLED::line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color, uint8_t mode) { 408 | uint8_t steep = abs(y1 - y0) > abs(x1 - x0); 409 | if (steep) { 410 | swap(x0, y0); 411 | swap(x1, y1); 412 | } 413 | 414 | if (x0 > x1) { 415 | swap(x0, x1); 416 | swap(y0, y1); 417 | } 418 | 419 | uint8_t dx, dy; 420 | dx = x1 - x0; 421 | dy = abs(y1 - y0); 422 | 423 | int8_t err = dx / 2; 424 | int8_t ystep; 425 | 426 | if (y0 < y1) { 427 | ystep = 1; 428 | } else { 429 | ystep = -1;} 430 | 431 | for (; x0 < x1; x0++) { 432 | if (steep) { 433 | pixel(y0, x0, color, mode); 434 | } else { 435 | pixel(x0, y0, color, mode); 436 | } 437 | err -= dy; 438 | if (err < 0) { 439 | y0 += ystep; 440 | err += dx; 441 | } 442 | } 443 | } 444 | 445 | /** \brief Draw horizontal line. 446 | 447 | Draw horizontal line using current fore color and current draw mode from x,y to x+width,y of the screen buffer. 448 | */ 449 | void MicroOLED::lineH(uint8_t x, uint8_t y, uint8_t width) { 450 | line(x, y, x + width, y, foreColor, drawMode); 451 | } 452 | 453 | /** \brief Draw horizontal line with color and mode. 454 | 455 | Draw horizontal line using color and mode from x,y to x+width,y of the screen buffer. 456 | */ 457 | void MicroOLED::lineH(uint8_t x, uint8_t y, uint8_t width, uint8_t color, uint8_t mode) { 458 | line(x, y, x + width, y, color, mode); 459 | } 460 | 461 | /** \brief Draw vertical line. 462 | 463 | Draw vertical line using current fore color and current draw mode from x,y to x,y+height of the screen buffer. 464 | */ 465 | void MicroOLED::lineV(uint8_t x, uint8_t y, uint8_t height) { 466 | line(x, y, x, y + height, foreColor, drawMode); 467 | } 468 | 469 | /** \brief Draw vertical line with color and mode. 470 | 471 | Draw vertical line using color and mode from x,y to x,y+height of the screen buffer. 472 | */ 473 | void MicroOLED::lineV(uint8_t x, uint8_t y, uint8_t height, uint8_t color, uint8_t mode) { 474 | line(x, y, x, y + height, color, mode); 475 | } 476 | 477 | /** \brief Draw rectangle. 478 | 479 | Draw rectangle using current fore color and current draw mode from x,y to x+width,y+height of the screen buffer. 480 | */ 481 | void MicroOLED::rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height) { 482 | rect(x, y, width, height, foreColor, drawMode); 483 | } 484 | 485 | /** \brief Draw rectangle with color and mode. 486 | 487 | Draw rectangle using color and mode from x,y to x+width,y+height of the screen buffer. 488 | */ 489 | void MicroOLED::rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color , uint8_t mode) { 490 | uint8_t tempHeight; 491 | 492 | lineH(x, y, width, color, mode); 493 | lineH(x, y + height - 1, width, color, mode); 494 | 495 | tempHeight = height - 2; 496 | 497 | // skip drawing vertical lines to avoid overlapping of pixel that will 498 | // affect XOR plot if no pixel in between horizontal lines 499 | if (tempHeight<1) return; 500 | 501 | lineV(x,y + 1, tempHeight, color, mode); 502 | lineV(x + width - 1, y + 1, tempHeight, color, mode); 503 | } 504 | 505 | /** \brief Draw filled rectangle. 506 | 507 | Draw filled rectangle using current fore color and current draw mode from x,y to x+width,y+height of the screen buffer. 508 | */ 509 | void MicroOLED::rectFill(uint8_t x, uint8_t y, uint8_t width, uint8_t height) { 510 | rectFill(x, y, width, height, foreColor, drawMode); 511 | } 512 | 513 | /** \brief Draw filled rectangle with color and mode. 514 | 515 | Draw filled rectangle using color and mode from x,y to x+width,y+height of the screen buffer. 516 | */ 517 | void MicroOLED::rectFill(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color , uint8_t mode) { 518 | // TODO - need to optimise the memory map draw so that this function will not call pixel one by one 519 | const unsigned short until = x + width; 520 | for (unsigned short i = x; i < until; ++i) { 521 | lineV(i, y, height, color, mode); 522 | } 523 | } 524 | 525 | /** \brief Draw circle. 526 | 527 | Draw circle with radius using current fore color and current draw mode at x,y of the screen buffer. 528 | */ 529 | void MicroOLED::circle(uint8_t x0, uint8_t y0, uint8_t radius) { 530 | circle(x0, y0, radius, foreColor, drawMode); 531 | } 532 | 533 | /** \brief Draw circle with color and mode. 534 | 535 | Draw circle with radius using color and mode at x,y of the screen buffer. 536 | */ 537 | void MicroOLED::circle(uint8_t x0, uint8_t y0, uint8_t radius, uint8_t color, uint8_t mode) { 538 | //TODO - find a way to check for no overlapping of pixels so that XOR draw mode will work perfectly 539 | int8_t f = 1 - radius; 540 | int8_t ddF_x = 1; 541 | int8_t ddF_y = -2 * radius; 542 | int8_t x = 0; 543 | int8_t y = radius; 544 | 545 | pixel(x0, y0 + radius, color, mode); 546 | pixel(x0, y0 - radius, color, mode); 547 | pixel(x0 + radius, y0, color, mode); 548 | pixel(x0 - radius, y0, color, mode); 549 | 550 | while (x < y) { 551 | if (f >= 0) { 552 | y--; 553 | ddF_y += 2; 554 | f += ddF_y; 555 | } 556 | x++; 557 | ddF_x += 2; 558 | f += ddF_x; 559 | 560 | pixel(x0 + x, y0 + y, color, mode); 561 | pixel(x0 - x, y0 + y, color, mode); 562 | pixel(x0 + x, y0 - y, color, mode); 563 | pixel(x0 - x, y0 - y, color, mode); 564 | 565 | pixel(x0 + y, y0 + x, color, mode); 566 | pixel(x0 - y, y0 + x, color, mode); 567 | pixel(x0 + y, y0 - x, color, mode); 568 | pixel(x0 - y, y0 - x, color, mode); 569 | 570 | } 571 | } 572 | 573 | /** \brief Draw filled circle. 574 | 575 | Draw filled circle with radius using current fore color and current draw mode at x,y of the screen buffer. 576 | */ 577 | void MicroOLED::circleFill(uint8_t x0, uint8_t y0, uint8_t radius) { 578 | circleFill(x0, y0, radius, foreColor, drawMode); 579 | } 580 | 581 | /** \brief Draw filled circle with color and mode. 582 | 583 | Draw filled circle with radius using color and mode at x,y of the screen buffer. 584 | */ 585 | void MicroOLED::circleFill(uint8_t x0, uint8_t y0, uint8_t radius, uint8_t color, uint8_t mode) { 586 | // TODO - - find a way to check for no overlapping of pixels so that XOR draw mode will work perfectly 587 | int8_t f = 1 - radius; 588 | int8_t ddF_x = 1; 589 | int8_t ddF_y = -2 * radius; 590 | int8_t x = 0; 591 | int8_t y = radius; 592 | 593 | // Temporary disable fill circle for XOR mode. 594 | if (mode == XOR) return; 595 | 596 | const uint8_t until_a = y0 + radius; 597 | for (uint8_t i = y0 - radius; i <= until_a; ++i) { 598 | pixel(x0, i, color, mode); 599 | } 600 | 601 | while (x < y) { 602 | if (f >= 0) { 603 | y--; 604 | ddF_y += 2; 605 | f += ddF_y; 606 | } 607 | x++; 608 | ddF_x += 2; 609 | f += ddF_x; 610 | 611 | const uint8_t until_b = y0 + y; 612 | for (uint8_t i = y0-y; i <= until_b; ++i) { 613 | pixel(x0 + x, i, color, mode); 614 | pixel(x0 - x, i, color, mode); 615 | } 616 | const uint8_t until_c = y0 + x; 617 | for (uint8_t i = y0 - x; i <= until_c; ++i) { 618 | pixel(x0 + y, i, color, mode); 619 | pixel(x0 - y, i, color, mode); 620 | } 621 | } 622 | } 623 | 624 | /** \brief Get LCD height. 625 | 626 | The height of the LCD return as byte. 627 | */ 628 | uint8_t MicroOLED::getLCDHeight(void) { 629 | return LCDHEIGHT; 630 | } 631 | 632 | /** \brief Get LCD width. 633 | 634 | The width of the LCD return as byte. 635 | */ 636 | uint8_t MicroOLED::getLCDWidth(void) { 637 | return LCDWIDTH; 638 | } 639 | 640 | /** \brief Get font width. 641 | 642 | The cucrrent font's width return as byte. 643 | */ 644 | uint8_t MicroOLED::getFontWidth(void) { 645 | return fontWidth; 646 | } 647 | 648 | /** \brief Get font height. 649 | 650 | The current font's height return as byte. 651 | */ 652 | uint8_t MicroOLED::getFontHeight(void) { 653 | return fontHeight; 654 | } 655 | 656 | /** \brief Get font starting character. 657 | 658 | Return the starting ASCII character of the currnet font, not all fonts start with ASCII character 0. Custom fonts can start from any ASCII character. 659 | */ 660 | uint8_t MicroOLED::getFontStartChar(void) { 661 | return fontStartChar; 662 | } 663 | 664 | /** \brief Get font total characters. 665 | 666 | Return the total characters of the current font. 667 | */ 668 | uint8_t MicroOLED::getFontTotalChar(void) { 669 | return fontTotalChar; 670 | } 671 | 672 | /** \brief Get total fonts. 673 | 674 | Return the total number of fonts loaded into the MicroOLED's flash memory. 675 | */ 676 | uint8_t MicroOLED::getTotalFonts(void) { 677 | return TOTALFONTS; 678 | } 679 | 680 | /** \brief Get font type. 681 | 682 | Return the font type number of the current font. 683 | */ 684 | uint8_t MicroOLED::getFontType(void) { 685 | return fontType; 686 | } 687 | 688 | /** \brief Set font type. 689 | 690 | Set the current font type number, ie changing to different fonts base on the type provided. 691 | */ 692 | uint8_t MicroOLED::setFontType(const uint8_t type) { 693 | if ((type >= TOTALFONTS) || (type < 0)) 694 | return false; 695 | 696 | fontType = type; 697 | fontWidth = pgm_read_byte(fontsPointer[fontType] + 0); 698 | fontHeight = pgm_read_byte(fontsPointer[fontType] + 1); 699 | fontStartChar = pgm_read_byte(fontsPointer[fontType] + 2); 700 | fontTotalChar = pgm_read_byte(fontsPointer[fontType] + 3); 701 | fontMapWidth = (pgm_read_byte(fontsPointer[fontType] + 4) * 100)+pgm_read_byte(fontsPointer[fontType] + 5); // two bytes values into integer 16 702 | return true; 703 | } 704 | 705 | /** \brief Set color. 706 | 707 | Set the current draw's color. Only WHITE and BLACK available. 708 | */ 709 | void MicroOLED::setColor(const uint8_t color) { 710 | foreColor = color; 711 | } 712 | 713 | /** \brief Set draw mode. 714 | 715 | Set current draw mode with NORM or XOR. 716 | */ 717 | void MicroOLED::setDrawMode(const uint8_t mode) { 718 | drawMode = mode; 719 | } 720 | 721 | /** \brief Draw character. 722 | 723 | Draw character c using current color and current draw mode at x,y. 724 | */ 725 | void MicroOLED::drawChar(const uint8_t x, const uint8_t y, const uint8_t c) { 726 | drawChar(x, y, c, foreColor, drawMode); 727 | } 728 | 729 | /** \brief Draw character with color and mode. 730 | 731 | Draw character c using color and draw mode at x,y. 732 | */ 733 | void MicroOLED::drawChar(const uint8_t x, const uint8_t y, const uint8_t c, const uint8_t color, const uint8_t mode) { 734 | // TODO - New routine to take font of any height, at the moment limited to font height in multiple of 8 pixels 735 | 736 | uint8_t rowsToDraw,row, tempC; 737 | uint8_t i, j, temp; 738 | uint16_t charPerBitmapRow, charColPositionOnBitmap, charRowPositionOnBitmap, charBitmapStartPosition; 739 | 740 | if ((c < fontStartChar) || (c > (fontStartChar+fontTotalChar - 1))) // no bitmap for the required c 741 | return; 742 | 743 | tempC=c-fontStartChar; 744 | 745 | // each row (in datasheet is call page) is 8 bits high, 16 bit high character will have 2 rows to be drawn 746 | rowsToDraw=fontHeight/8; // 8 is LCD's page size, see SSD1306 datasheet 747 | if (rowsToDraw <= 1) rowsToDraw = 1; 748 | 749 | // the following draw function can draw anywhere on the screen, but SLOW pixel by pixel draw 750 | if (rowsToDraw == 1) { 751 | for (i = 0; i < fontWidth + 1; ++i) { 752 | if (i == fontWidth) // this is done in a weird way because for 5x7 font, there is no margin, this code add a margin after col 5 753 | temp=0; 754 | else 755 | temp=pgm_read_byte(fontsPointer[fontType] + FONTHEADERSIZE + (tempC * fontWidth) + i); 756 | 757 | for (j = 0; j < 8; j++) { // 8 is the LCD's page height (see datasheet for explanation) 758 | if (temp & 0x1) { 759 | pixel(x + i, y + j, color, mode); 760 | } 761 | else { 762 | pixel(x + i, y + j, !color, mode); 763 | } 764 | 765 | temp >>= 1; 766 | } 767 | } 768 | return; 769 | } 770 | 771 | // font height over 8 bit 772 | // take character "0" ASCII 48 as example 773 | charPerBitmapRow = fontMapWidth / fontWidth; // 256/8 =32 char per row 774 | charColPositionOnBitmap = tempC % charPerBitmapRow; // =16 775 | charRowPositionOnBitmap = int (tempC/charPerBitmapRow); // =1 776 | charBitmapStartPosition = (charRowPositionOnBitmap * fontMapWidth * (fontHeight / 8)) + (charColPositionOnBitmap * fontWidth) ; 777 | 778 | // each row on LCD is 8 bit height (see datasheet for explanation) 779 | for(row = 0; row < rowsToDraw; row++) { 780 | for (i = 0; i < fontWidth; ++i) { 781 | temp=pgm_read_byte(fontsPointer[fontType]+FONTHEADERSIZE + (charBitmapStartPosition + i + (row * fontMapWidth))); 782 | for (j = 0; j < 8; j++) { // 8 is the LCD's page height (see datasheet for explanation) 783 | if (temp & 0x1) { 784 | pixel(x + i, y + j + (row * 8), color, mode); 785 | } 786 | else { 787 | pixel(x + i, y + j + (row * 8), !color, mode); 788 | } 789 | temp >>=1; 790 | } 791 | } 792 | } 793 | 794 | } 795 | 796 | /* 797 | Draw Bitmap image on screen. The array for the bitmap can be stored in the Arduino file, so user don't have to mess with the library files. 798 | To use, create uint8_t array that is 64x48 pixels (384 bytes). Then call .drawBitmap and pass it the array. 799 | */ 800 | void MicroOLED::drawBitmap(const uint8_t * bitArray) 801 | { 802 | for (int i=0; i<(LCDWIDTH * LCDHEIGHT / 8); ++i) 803 | screenmemory[i] = bitArray[i]; 804 | } 805 | 806 | /** \brief Stop scrolling. 807 | 808 | Stop the scrolling of graphics on the OLED. 809 | */ 810 | void MicroOLED::scrollStop(void){ 811 | command(DEACTIVATESCROLL); 812 | } 813 | 814 | /** \brief Right scrolling. 815 | 816 | Set row start to row stop on the OLED to scroll right. Refer to http://learn.microview.io/intro/general-overview-of-microview.html for explanation of the rows. 817 | */ 818 | void MicroOLED::scrollRight(const uint8_t start, const uint8_t stop){ 819 | if (stop < start) // stop must be larger or equal to start 820 | return; 821 | scrollStop(); // need to disable scrolling before starting to avoid memory corrupt 822 | command(RIGHTHORIZONTALSCROLL); 823 | command(0x00); 824 | command(start); 825 | command(0x7); // scroll speed frames , TODO 826 | command(stop); 827 | command(0x00); 828 | command(0xFF); 829 | command(ACTIVATESCROLL); 830 | } 831 | 832 | /** \brief Vertical flip. 833 | 834 | Flip the graphics on the OLED vertically. 835 | */ 836 | void MicroOLED::flipVertical(const bool flip) { 837 | if (flip) { 838 | command(COMSCANINC); 839 | } 840 | else { 841 | command(COMSCANDEC); 842 | } 843 | } 844 | 845 | /** \brief Horizontal flip. 846 | 847 | Flip the graphics on the OLED horizontally. 848 | */ 849 | void MicroOLED::flipHorizontal(const bool flip) { 850 | if (flip) { 851 | command(SEGREMAP | 0x0); 852 | } 853 | else { 854 | command(SEGREMAP | 0x1); 855 | } 856 | } 857 | 858 | void MicroOLED::spiSetup() 859 | { 860 | pinMode(MOSI, OUTPUT); 861 | pinMode(SCK, OUTPUT); 862 | 863 | pinMode(csPin, OUTPUT); 864 | digitalWrite(csPin, HIGH); 865 | 866 | SPI.setClockDivider(SPI_CLOCK_DIV2); 867 | //SPI.setDataMode(SPI_MODE0); 868 | pinMode(csPin, OUTPUT); 869 | //pinMode(10, OUTPUT); // Required for setting into Master mode 870 | digitalWrite(csPin, HIGH); 871 | SPI.begin(); 872 | pinMode(SCK, OUTPUT); 873 | pinMode(MOSI, OUTPUT); 874 | } 875 | 876 | void MicroOLED::spiTransfer(uint8_t data) 877 | { 878 | SPI.transfer(data); 879 | } 880 | 881 | void MicroOLED::i2cSetup() 882 | { 883 | Wire.setSpeed(CLOCK_SPEED_400KHZ); 884 | Wire.begin(); 885 | } 886 | 887 | void MicroOLED::i2cWrite(uint8_t address, uint8_t dc, uint8_t data) 888 | { 889 | Wire.beginTransmission(address); 890 | Wire.write(dc); // If data = 0, if command = 0x40 891 | Wire.write(data); 892 | Wire.endTransmission(); 893 | } 894 | -------------------------------------------------------------------------------- /firmware/SparkFunMicroOLEDFonts.h: -------------------------------------------------------------------------------- 1 | /* 2 | MicroView Arduino Library 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SPARKFUN_MICRO_OLED_FONTS_H 19 | #define SPARKFUN_MICRO_OLED_FONTS_H 20 | 21 | // Standard ASCII 5x7 font 22 | static const unsigned char font5x7[] = { 23 | // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) 24 | 5,8,0,255,12,75, 25 | 0x00, 0x00, 0x00, 0x00, 0x00, 26 | 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 27 | 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 28 | 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 29 | 0x18, 0x3C, 0x7E, 0x3C, 0x18, 30 | 0x1C, 0x57, 0x7D, 0x57, 0x1C, 31 | 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 32 | 0x00, 0x18, 0x3C, 0x18, 0x00, 33 | 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 34 | 0x00, 0x18, 0x24, 0x18, 0x00, 35 | 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 36 | 0x30, 0x48, 0x3A, 0x06, 0x0E, 37 | 0x26, 0x29, 0x79, 0x29, 0x26, 38 | 0x40, 0x7F, 0x05, 0x05, 0x07, 39 | 0x40, 0x7F, 0x05, 0x25, 0x3F, 40 | 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 41 | 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 42 | 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 43 | 0x14, 0x22, 0x7F, 0x22, 0x14, 44 | 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 45 | 0x06, 0x09, 0x7F, 0x01, 0x7F, 46 | 0x00, 0x66, 0x89, 0x95, 0x6A, 47 | 0x60, 0x60, 0x60, 0x60, 0x60, 48 | 0x94, 0xA2, 0xFF, 0xA2, 0x94, 49 | 0x08, 0x04, 0x7E, 0x04, 0x08, 50 | 0x10, 0x20, 0x7E, 0x20, 0x10, 51 | 0x08, 0x08, 0x2A, 0x1C, 0x08, 52 | 0x08, 0x1C, 0x2A, 0x08, 0x08, 53 | 0x1E, 0x10, 0x10, 0x10, 0x10, 54 | 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 55 | 0x30, 0x38, 0x3E, 0x38, 0x30, 56 | 0x06, 0x0E, 0x3E, 0x0E, 0x06, 57 | 0x00, 0x00, 0x00, 0x00, 0x00, 58 | 0x00, 0x00, 0x5F, 0x00, 0x00, 59 | 0x00, 0x07, 0x00, 0x07, 0x00, 60 | 0x14, 0x7F, 0x14, 0x7F, 0x14, 61 | 0x24, 0x2A, 0x7F, 0x2A, 0x12, 62 | 0x23, 0x13, 0x08, 0x64, 0x62, 63 | 0x36, 0x49, 0x56, 0x20, 0x50, 64 | 0x00, 0x08, 0x07, 0x03, 0x00, 65 | 0x00, 0x1C, 0x22, 0x41, 0x00, 66 | 0x00, 0x41, 0x22, 0x1C, 0x00, 67 | 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 68 | 0x08, 0x08, 0x3E, 0x08, 0x08, 69 | 0x00, 0x80, 0x70, 0x30, 0x00, 70 | 0x08, 0x08, 0x08, 0x08, 0x08, 71 | 0x00, 0x00, 0x60, 0x60, 0x00, 72 | 0x20, 0x10, 0x08, 0x04, 0x02, 73 | 0x3E, 0x51, 0x49, 0x45, 0x3E, 74 | 0x00, 0x42, 0x7F, 0x40, 0x00, 75 | 0x72, 0x49, 0x49, 0x49, 0x46, 76 | 0x21, 0x41, 0x49, 0x4D, 0x33, 77 | 0x18, 0x14, 0x12, 0x7F, 0x10, 78 | 0x27, 0x45, 0x45, 0x45, 0x39, 79 | 0x3C, 0x4A, 0x49, 0x49, 0x31, 80 | 0x41, 0x21, 0x11, 0x09, 0x07, 81 | 0x36, 0x49, 0x49, 0x49, 0x36, 82 | 0x46, 0x49, 0x49, 0x29, 0x1E, 83 | 0x00, 0x00, 0x14, 0x00, 0x00, 84 | 0x00, 0x40, 0x34, 0x00, 0x00, 85 | 0x00, 0x08, 0x14, 0x22, 0x41, 86 | 0x14, 0x14, 0x14, 0x14, 0x14, 87 | 0x00, 0x41, 0x22, 0x14, 0x08, 88 | 0x02, 0x01, 0x59, 0x09, 0x06, 89 | 0x3E, 0x41, 0x5D, 0x59, 0x4E, 90 | 0x7C, 0x12, 0x11, 0x12, 0x7C, 91 | 0x7F, 0x49, 0x49, 0x49, 0x36, 92 | 0x3E, 0x41, 0x41, 0x41, 0x22, 93 | 0x7F, 0x41, 0x41, 0x41, 0x3E, 94 | 0x7F, 0x49, 0x49, 0x49, 0x41, 95 | 0x7F, 0x09, 0x09, 0x09, 0x01, 96 | 0x3E, 0x41, 0x41, 0x51, 0x73, 97 | 0x7F, 0x08, 0x08, 0x08, 0x7F, 98 | 0x00, 0x41, 0x7F, 0x41, 0x00, 99 | 0x20, 0x40, 0x41, 0x3F, 0x01, 100 | 0x7F, 0x08, 0x14, 0x22, 0x41, 101 | 0x7F, 0x40, 0x40, 0x40, 0x40, 102 | 0x7F, 0x02, 0x1C, 0x02, 0x7F, 103 | 0x7F, 0x04, 0x08, 0x10, 0x7F, 104 | 0x3E, 0x41, 0x41, 0x41, 0x3E, 105 | 0x7F, 0x09, 0x09, 0x09, 0x06, 106 | 0x3E, 0x41, 0x51, 0x21, 0x5E, 107 | 0x7F, 0x09, 0x19, 0x29, 0x46, 108 | 0x26, 0x49, 0x49, 0x49, 0x32, 109 | 0x03, 0x01, 0x7F, 0x01, 0x03, 110 | 0x3F, 0x40, 0x40, 0x40, 0x3F, 111 | 0x1F, 0x20, 0x40, 0x20, 0x1F, 112 | 0x3F, 0x40, 0x38, 0x40, 0x3F, 113 | 0x63, 0x14, 0x08, 0x14, 0x63, 114 | 0x03, 0x04, 0x78, 0x04, 0x03, 115 | 0x61, 0x59, 0x49, 0x4D, 0x43, 116 | 0x00, 0x7F, 0x41, 0x41, 0x41, 117 | 0x02, 0x04, 0x08, 0x10, 0x20, 118 | 0x00, 0x41, 0x41, 0x41, 0x7F, 119 | 0x04, 0x02, 0x01, 0x02, 0x04, 120 | 0x40, 0x40, 0x40, 0x40, 0x40, 121 | 0x00, 0x03, 0x07, 0x08, 0x00, 122 | 0x20, 0x54, 0x54, 0x78, 0x40, 123 | 0x7F, 0x28, 0x44, 0x44, 0x38, 124 | 0x38, 0x44, 0x44, 0x44, 0x28, 125 | 0x38, 0x44, 0x44, 0x28, 0x7F, 126 | 0x38, 0x54, 0x54, 0x54, 0x18, 127 | 0x00, 0x08, 0x7E, 0x09, 0x02, 128 | 0x18, 0xA4, 0xA4, 0x9C, 0x78, 129 | 0x7F, 0x08, 0x04, 0x04, 0x78, 130 | 0x00, 0x44, 0x7D, 0x40, 0x00, 131 | 0x20, 0x40, 0x40, 0x3D, 0x00, 132 | 0x7F, 0x10, 0x28, 0x44, 0x00, 133 | 0x00, 0x41, 0x7F, 0x40, 0x00, 134 | 0x7C, 0x04, 0x78, 0x04, 0x78, 135 | 0x7C, 0x08, 0x04, 0x04, 0x78, 136 | 0x38, 0x44, 0x44, 0x44, 0x38, 137 | 0xFC, 0x18, 0x24, 0x24, 0x18, 138 | 0x18, 0x24, 0x24, 0x18, 0xFC, 139 | 0x7C, 0x08, 0x04, 0x04, 0x08, 140 | 0x48, 0x54, 0x54, 0x54, 0x24, 141 | 0x04, 0x04, 0x3F, 0x44, 0x24, 142 | 0x3C, 0x40, 0x40, 0x20, 0x7C, 143 | 0x1C, 0x20, 0x40, 0x20, 0x1C, 144 | 0x3C, 0x40, 0x30, 0x40, 0x3C, 145 | 0x44, 0x28, 0x10, 0x28, 0x44, 146 | 0x4C, 0x90, 0x90, 0x90, 0x7C, 147 | 0x44, 0x64, 0x54, 0x4C, 0x44, 148 | 0x00, 0x08, 0x36, 0x41, 0x00, 149 | 0x00, 0x00, 0x77, 0x00, 0x00, 150 | 0x00, 0x41, 0x36, 0x08, 0x00, 151 | 0x02, 0x01, 0x02, 0x04, 0x02, 152 | 0x3C, 0x26, 0x23, 0x26, 0x3C, 153 | 0x1E, 0xA1, 0xA1, 0x61, 0x12, 154 | 0x3A, 0x40, 0x40, 0x20, 0x7A, 155 | 0x38, 0x54, 0x54, 0x55, 0x59, 156 | 0x21, 0x55, 0x55, 0x79, 0x41, 157 | 0x21, 0x54, 0x54, 0x78, 0x41, 158 | 0x21, 0x55, 0x54, 0x78, 0x40, 159 | 0x20, 0x54, 0x55, 0x79, 0x40, 160 | 0x0C, 0x1E, 0x52, 0x72, 0x12, 161 | 0x39, 0x55, 0x55, 0x55, 0x59, 162 | 0x39, 0x54, 0x54, 0x54, 0x59, 163 | 0x39, 0x55, 0x54, 0x54, 0x58, 164 | 0x00, 0x00, 0x45, 0x7C, 0x41, 165 | 0x00, 0x02, 0x45, 0x7D, 0x42, 166 | 0x00, 0x01, 0x45, 0x7C, 0x40, 167 | 0xF0, 0x29, 0x24, 0x29, 0xF0, 168 | 0xF0, 0x28, 0x25, 0x28, 0xF0, 169 | 0x7C, 0x54, 0x55, 0x45, 0x00, 170 | 0x20, 0x54, 0x54, 0x7C, 0x54, 171 | 0x7C, 0x0A, 0x09, 0x7F, 0x49, 172 | 0x32, 0x49, 0x49, 0x49, 0x32, 173 | 0x32, 0x48, 0x48, 0x48, 0x32, 174 | 0x32, 0x4A, 0x48, 0x48, 0x30, 175 | 0x3A, 0x41, 0x41, 0x21, 0x7A, 176 | 0x3A, 0x42, 0x40, 0x20, 0x78, 177 | 0x00, 0x9D, 0xA0, 0xA0, 0x7D, 178 | 0x39, 0x44, 0x44, 0x44, 0x39, 179 | 0x3D, 0x40, 0x40, 0x40, 0x3D, 180 | 0x3C, 0x24, 0xFF, 0x24, 0x24, 181 | 0x48, 0x7E, 0x49, 0x43, 0x66, 182 | 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, 183 | 0xFF, 0x09, 0x29, 0xF6, 0x20, 184 | 0xC0, 0x88, 0x7E, 0x09, 0x03, 185 | 0x20, 0x54, 0x54, 0x79, 0x41, 186 | 0x00, 0x00, 0x44, 0x7D, 0x41, 187 | 0x30, 0x48, 0x48, 0x4A, 0x32, 188 | 0x38, 0x40, 0x40, 0x22, 0x7A, 189 | 0x00, 0x7A, 0x0A, 0x0A, 0x72, 190 | 0x7D, 0x0D, 0x19, 0x31, 0x7D, 191 | 0x26, 0x29, 0x29, 0x2F, 0x28, 192 | 0x26, 0x29, 0x29, 0x29, 0x26, 193 | 0x30, 0x48, 0x4D, 0x40, 0x20, 194 | 0x38, 0x08, 0x08, 0x08, 0x08, 195 | 0x08, 0x08, 0x08, 0x08, 0x38, 196 | 0x2F, 0x10, 0xC8, 0xAC, 0xBA, 197 | 0x2F, 0x10, 0x28, 0x34, 0xFA, 198 | 0x00, 0x00, 0x7B, 0x00, 0x00, 199 | 0x08, 0x14, 0x2A, 0x14, 0x22, 200 | 0x22, 0x14, 0x2A, 0x14, 0x08, 201 | 0xAA, 0x00, 0x55, 0x00, 0xAA, 202 | 0xAA, 0x55, 0xAA, 0x55, 0xAA, 203 | 0x00, 0x00, 0x00, 0xFF, 0x00, 204 | 0x10, 0x10, 0x10, 0xFF, 0x00, 205 | 0x14, 0x14, 0x14, 0xFF, 0x00, 206 | 0x10, 0x10, 0xFF, 0x00, 0xFF, 207 | 0x10, 0x10, 0xF0, 0x10, 0xF0, 208 | 0x14, 0x14, 0x14, 0xFC, 0x00, 209 | 0x14, 0x14, 0xF7, 0x00, 0xFF, 210 | 0x00, 0x00, 0xFF, 0x00, 0xFF, 211 | 0x14, 0x14, 0xF4, 0x04, 0xFC, 212 | 0x14, 0x14, 0x17, 0x10, 0x1F, 213 | 0x10, 0x10, 0x1F, 0x10, 0x1F, 214 | 0x14, 0x14, 0x14, 0x1F, 0x00, 215 | 0x10, 0x10, 0x10, 0xF0, 0x00, 216 | 0x00, 0x00, 0x00, 0x1F, 0x10, 217 | 0x10, 0x10, 0x10, 0x1F, 0x10, 218 | 0x10, 0x10, 0x10, 0xF0, 0x10, 219 | 0x00, 0x00, 0x00, 0xFF, 0x10, 220 | 0x10, 0x10, 0x10, 0x10, 0x10, 221 | 0x10, 0x10, 0x10, 0xFF, 0x10, 222 | 0x00, 0x00, 0x00, 0xFF, 0x14, 223 | 0x00, 0x00, 0xFF, 0x00, 0xFF, 224 | 0x00, 0x00, 0x1F, 0x10, 0x17, 225 | 0x00, 0x00, 0xFC, 0x04, 0xF4, 226 | 0x14, 0x14, 0x17, 0x10, 0x17, 227 | 0x14, 0x14, 0xF4, 0x04, 0xF4, 228 | 0x00, 0x00, 0xFF, 0x00, 0xF7, 229 | 0x14, 0x14, 0x14, 0x14, 0x14, 230 | 0x14, 0x14, 0xF7, 0x00, 0xF7, 231 | 0x14, 0x14, 0x14, 0x17, 0x14, 232 | 0x10, 0x10, 0x1F, 0x10, 0x1F, 233 | 0x14, 0x14, 0x14, 0xF4, 0x14, 234 | 0x10, 0x10, 0xF0, 0x10, 0xF0, 235 | 0x00, 0x00, 0x1F, 0x10, 0x1F, 236 | 0x00, 0x00, 0x00, 0x1F, 0x14, 237 | 0x00, 0x00, 0x00, 0xFC, 0x14, 238 | 0x00, 0x00, 0xF0, 0x10, 0xF0, 239 | 0x10, 0x10, 0xFF, 0x10, 0xFF, 240 | 0x14, 0x14, 0x14, 0xFF, 0x14, 241 | 0x10, 0x10, 0x10, 0x1F, 0x00, 242 | 0x00, 0x00, 0x00, 0xF0, 0x10, 243 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 244 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 245 | 0xFF, 0xFF, 0xFF, 0x00, 0x00, 246 | 0x00, 0x00, 0x00, 0xFF, 0xFF, 247 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 248 | 0x38, 0x44, 0x44, 0x38, 0x44, 249 | 0x7C, 0x2A, 0x2A, 0x3E, 0x14, 250 | 0x7E, 0x02, 0x02, 0x06, 0x06, 251 | 0x02, 0x7E, 0x02, 0x7E, 0x02, 252 | 0x63, 0x55, 0x49, 0x41, 0x63, 253 | 0x38, 0x44, 0x44, 0x3C, 0x04, 254 | 0x40, 0x7E, 0x20, 0x1E, 0x20, 255 | 0x06, 0x02, 0x7E, 0x02, 0x02, 256 | 0x99, 0xA5, 0xE7, 0xA5, 0x99, 257 | 0x1C, 0x2A, 0x49, 0x2A, 0x1C, 258 | 0x4C, 0x72, 0x01, 0x72, 0x4C, 259 | 0x30, 0x4A, 0x4D, 0x4D, 0x30, 260 | 0x30, 0x48, 0x78, 0x48, 0x30, 261 | 0xBC, 0x62, 0x5A, 0x46, 0x3D, 262 | 0x3E, 0x49, 0x49, 0x49, 0x00, 263 | 0x7E, 0x01, 0x01, 0x01, 0x7E, 264 | 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 265 | 0x44, 0x44, 0x5F, 0x44, 0x44, 266 | 0x40, 0x51, 0x4A, 0x44, 0x40, 267 | 0x40, 0x44, 0x4A, 0x51, 0x40, 268 | 0x00, 0x00, 0xFF, 0x01, 0x03, 269 | 0xE0, 0x80, 0xFF, 0x00, 0x00, 270 | 0x08, 0x08, 0x6B, 0x6B, 0x08, 271 | 0x36, 0x12, 0x36, 0x24, 0x36, 272 | 0x06, 0x0F, 0x09, 0x0F, 0x06, 273 | 0x00, 0x00, 0x18, 0x18, 0x00, 274 | 0x00, 0x00, 0x10, 0x10, 0x00, 275 | 0x30, 0x40, 0xFF, 0x01, 0x01, 276 | 0x00, 0x1F, 0x01, 0x01, 0x1E, 277 | 0x00, 0x19, 0x1D, 0x17, 0x12, 278 | 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 279 | 0x00, 0x00, 0x00, 0x00, 0x00 280 | }; 281 | 282 | 283 | static const unsigned char font8x16[] = { 284 | // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) 285 | 8,16,32,96,2,56, 286 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 287 | 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xBE, 0x90, 0xD0, 0xBE, 0x90, 0x00, 288 | 0x00, 0x1C, 0x62, 0xFF, 0xC2, 0x80, 0x00, 0x00, 0x0C, 0x12, 0x92, 0x4C, 0xB0, 0x88, 0x06, 0x00, 289 | 0x80, 0x7C, 0x62, 0xB2, 0x1C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x00, 0x00, 290 | 0x00, 0xE0, 0x18, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x18, 0xE0, 0x00, 0x00, 291 | 0x00, 0x24, 0x18, 0x7E, 0x18, 0x24, 0x00, 0x00, 0x80, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x00, 292 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 293 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x60, 0x18, 0x06, 0x00, 0x00, 294 | 0xF8, 0x04, 0xC2, 0x32, 0x0C, 0xF8, 0x00, 0x00, 0x00, 0x04, 0x04, 0xFE, 0x00, 0x00, 0x00, 0x00, 295 | 0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x02, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00, 296 | 0xC0, 0xA0, 0x98, 0x84, 0xFE, 0x80, 0x80, 0x00, 0x00, 0x1E, 0x12, 0x12, 0x22, 0xC2, 0x00, 0x00, 297 | 0xF8, 0x44, 0x22, 0x22, 0x22, 0xC0, 0x00, 0x00, 0x00, 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00, 298 | 0x00, 0x8C, 0x52, 0x22, 0x52, 0x8C, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x26, 0xF8, 0x00, 0x00, 299 | 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 300 | 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 301 | 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00, 302 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 303 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 304 | 0x00, 0x04, 0x04, 0x0F, 0x04, 0x03, 0x00, 0x00, 0x04, 0x02, 0x01, 0x03, 0x04, 0x04, 0x03, 0x00, 305 | 0x03, 0x04, 0x04, 0x04, 0x05, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 306 | 0x00, 0x03, 0x06, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x06, 0x03, 0x00, 0x00, 307 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 308 | 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 309 | 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 310 | 0x01, 0x03, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00, 311 | 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 312 | 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 313 | 0x01, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 314 | 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 315 | 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00, 316 | 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x04, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 317 | 0x04, 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 318 | 0xF8, 0x04, 0x72, 0x8A, 0xFA, 0x84, 0x78, 0x00, 0x00, 0xC0, 0x38, 0x06, 0x38, 0xC0, 0x00, 0x00, 319 | 0x00, 0xFE, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 320 | 0xFE, 0x02, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 321 | 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x22, 0xE2, 0x00, 0x00, 322 | 0xFE, 0x20, 0x20, 0x20, 0x20, 0xFE, 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x00, 0x00, 323 | 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0xFE, 0x40, 0xB0, 0x08, 0x04, 0x02, 0x00, 0x00, 324 | 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0C, 0x70, 0x80, 0x70, 0x0C, 0xFE, 0x00, 325 | 0xFE, 0x0C, 0x30, 0xC0, 0x00, 0xFE, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, 326 | 0xFE, 0x42, 0x42, 0x42, 0x22, 0x1C, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, 327 | 0x00, 0xFE, 0x42, 0x42, 0xA2, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x42, 0x42, 0x80, 0x00, 0x00, 328 | 0x02, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x02, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 329 | 0x06, 0x38, 0xC0, 0x00, 0xC0, 0x38, 0x06, 0x00, 0x3E, 0xC0, 0xF0, 0x0E, 0xF0, 0xC0, 0x3E, 0x00, 330 | 0x00, 0x06, 0x98, 0x60, 0x98, 0x06, 0x00, 0x00, 0x00, 0x06, 0x18, 0xE0, 0x18, 0x06, 0x00, 0x00, 331 | 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x02, 0x02, 0x02, 0x02, 0x00, 332 | 0x00, 0x06, 0x18, 0x60, 0x80, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00, 333 | 0x40, 0x30, 0x0C, 0x0C, 0x30, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 334 | 0x01, 0x02, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x06, 0x00, 335 | 0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 336 | 0x07, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 337 | 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00, 338 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00, 339 | 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00, 340 | 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x00, 341 | 0x07, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 342 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0C, 0x12, 0x11, 0x10, 0x00, 343 | 0x00, 0x07, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 344 | 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 345 | 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 346 | 0x00, 0x06, 0x01, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 347 | 0x06, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x00, 348 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 349 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 350 | 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 351 | 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 352 | 0x00, 0xE0, 0x10, 0x10, 0x10, 0xFE, 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x00, 0x00, 353 | 0x00, 0x20, 0xFC, 0x22, 0x22, 0x22, 0x02, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 354 | 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, 355 | 0x00, 0x10, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, 356 | 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0x10, 0xF0, 0x20, 0x10, 0xF0, 0x00, 357 | 0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xE0, 0x00, 0x00, 358 | 0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 359 | 0x00, 0xF0, 0x20, 0x10, 0x10, 0x70, 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0x90, 0x20, 0x00, 0x00, 360 | 0x00, 0x20, 0x20, 0xFC, 0x20, 0x20, 0x20, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 361 | 0x00, 0x70, 0x80, 0x00, 0x80, 0x70, 0x00, 0x00, 0xF0, 0x00, 0xC0, 0x30, 0xC0, 0x00, 0xF0, 0x00, 362 | 0x00, 0x30, 0xC0, 0xC0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0xC0, 0x00, 0x80, 0x70, 0x00, 0x00, 363 | 0x00, 0x10, 0x10, 0x90, 0x50, 0x30, 0x00, 0x00, 0x00, 0x80, 0x80, 0x7E, 0x02, 0x02, 0x00, 0x00, 364 | 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x7E, 0x80, 0x80, 0x00, 0x00, 365 | 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 366 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, 367 | 0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 368 | 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 369 | 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x24, 0x24, 0x22, 0x1F, 0x00, 0x00, 370 | 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x00, 371 | 0x20, 0x20, 0x20, 0x20, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00, 372 | 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 373 | 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 374 | 0x00, 0x3F, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x3F, 0x00, 0x00, 375 | 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 376 | 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, 377 | 0x00, 0x00, 0x03, 0x04, 0x03, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x01, 0x06, 0x01, 0x00, 378 | 0x00, 0x06, 0x01, 0x01, 0x06, 0x00, 0x00, 0x00, 0x20, 0x20, 0x31, 0x0E, 0x03, 0x00, 0x00, 0x00, 379 | 0x00, 0x06, 0x05, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x00, 0x00, 380 | 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 381 | 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 382 | }; 383 | 384 | static const unsigned char fontlargenumber[] = { 385 | // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) 386 | 12,48,48,11,1,32, 387 | 0x00, 0xC0, 0xF8, 0x7C, 0x3E, 0x3E, 0xFC, 0xF8, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 388 | 0x78, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x7C, 0x3C, 0x3E, 0x3E, 0xFE, 0xFC, 389 | 0xE0, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x3E, 0x3E, 0x3E, 0xFE, 0xF8, 0xC0, 0x00, 0x00, 0x00, 0x00, 390 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x3E, 391 | 0x3E, 0x3E, 0x3E, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFC, 0x3E, 0x3E, 0x3E, 392 | 0xFC, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0xFE, 0xFE, 0x00, 0x00, 393 | 0x00, 0x00, 0xC0, 0xF8, 0xFE, 0x3E, 0x7E, 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFC, 394 | 0x7E, 0x3E, 0xFE, 0xF8, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0xC0, 0x00, 395 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0xF9, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 396 | 0x00, 0x00, 0x07, 0x03, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 397 | 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 398 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 399 | 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 400 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFC, 401 | 0x7F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 402 | 0x00, 0xFE, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 403 | 0x3F, 0x7F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 404 | 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 405 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8, 406 | 0xFC, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFE, 0x3F, 0x03, 0x00, 0xFF, 0xFF, 407 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x3E, 0x7E, 0xFC, 0xF8, 0xE0, 0x00, 0x00, 0x00, 0x00, 408 | 0x00, 0xFF, 0xFF, 0x80, 0xF0, 0x7C, 0x7C, 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 409 | 0x80, 0xF8, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x9F, 0xFF, 0xF8, 0xFE, 0x1F, 410 | 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 411 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0xFC, 412 | 0x7F, 0x03, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 413 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 414 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0F, 0xFF, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xE7, 0xE0, 415 | 0xE0, 0xE0, 0xFF, 0xFF, 0xE0, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 416 | 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0x00, 0x00, 417 | 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFC, 0x3F, 418 | 0x03, 0x03, 0x1F, 0xFF, 0xFC, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x3E, 0x3E, 0x0F, 0x01, 419 | 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 420 | 0x07, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 421 | 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x0F, 0x00, 0x00, 0x00, 0x00, 422 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x7F, 0x00, 0x00, 0x00, 423 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xFF, 0xFF, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 424 | 0x00, 0x00, 0xC0, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x80, 425 | 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 426 | 0x00, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 427 | 0x00, 0x00, 0x80, 0xFC, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 428 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1F, 0x3F, 0x7C, 0x7C, 0x3F, 0x1F, 0x03, 0x00, 0x00, 0x00, 429 | 0x00, 0x00, 0x7C, 0x7C, 0x7C, 0x7F, 0x7F, 0x7C, 0x7C, 0x7C, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7C, 430 | 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x7E, 0x7C, 0x7C, 0x7E, 0x1F, 0x07, 431 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00, 432 | 0x00, 0x1F, 0x3E, 0x7C, 0x7C, 0x3E, 0x1F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1F, 433 | 0x7F, 0x7C, 0x7C, 0x3F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00, 434 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1F, 0x3F, 0x7E, 0x7C, 0x7E, 0x3F, 0x1F, 0x01, 0x00, 0x00, 435 | 0x00, 0x00, 0x3E, 0x7C, 0x7C, 0x7E, 0x3F, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 436 | 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 437 | }; 438 | 439 | 440 | static const unsigned char sevensegment [] = { 441 | // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) 442 | 10,16,46,12,1,20, 443 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 444 | 0x00, 0x00, 0x00, 0x00, 0x78, 0xFC, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02, 0xFC, 0x78, 0x00, 0x00, 445 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7E, 0x00, 0x00, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 446 | 0xFC, 0x78, 0x00, 0x00, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0xFC, 0x78, 0x7E, 0xFF, 0x00, 0x80, 447 | 0x80, 0x80, 0x80, 0x00, 0xFF, 0x7E, 0x78, 0xFC, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0x00, 0x00, 448 | 0x78, 0xFC, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x03, 0x03, 449 | 0x03, 0x02, 0xFC, 0x78, 0x78, 0xFC, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0xFC, 0x78, 0x78, 0xFC, 450 | 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0xFC, 0x78, 0x00, 0x00, 0x00, 0x60, 0xF0, 0xF0, 0x60, 0x00, 451 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x3F, 0x40, 0xC0, 452 | 0xC0, 0xC0, 0xC0, 0x40, 0x3F, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7E, 453 | 0x1C, 0x3E, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 0x00, 0x00, 0x00, 0x00, 0x41, 0xC1, 0xC1, 0xC1, 454 | 0xC1, 0x41, 0x3E, 0x1C, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF, 0x7E, 0x00, 0x00, 455 | 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 0x3E, 0x1C, 0x1C, 0x3E, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 456 | 0x3E, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7E, 0x1C, 0x3E, 0x41, 0xC1, 457 | 0xC1, 0xC1, 0xC1, 0x41, 0x3E, 0x1C, 0x00, 0x00, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 0x3E, 0x1C 458 | }; 459 | 460 | static const unsigned char space01[] = { 461 | // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) 462 | 22,16,48,2,0,44, 463 | 0xFC, 0xFC, 0xC0, 0xC0, 0xF3, 0xF3, 0x3C, 0x3C, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x3C, 0x3C, 464 | 0xF3, 0xF3, 0xC0, 0xC0, 0xFC, 0xFC, 0x00, 0x00, 0xC0, 0xC0, 0xF3, 0xF3, 0x3C, 0x3C, 0xF0, 0xF0, 465 | 0xF0, 0xF0, 0xF0, 0xF0, 0x3C, 0x3C, 0xF3, 0xF3, 0xC0, 0xC0, 0x00, 0x00, 0x03, 0x03, 0xCF, 0xCF, 466 | 0x3F, 0x3F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x3F, 0x3F, 0xCF, 0xCF, 467 | 0x03, 0x03, 0x3F, 0x3F, 0x03, 0x03, 0x3F, 0x3F, 0xCF, 0xCF, 0xCF, 0xCF, 0x0F, 0x0F, 0xCF, 0xCF, 468 | 0xCF, 0xCF, 0x3F, 0x3F, 0x03, 0x03, 0x3F, 0x3F, 469 | }; 470 | 471 | 472 | static const unsigned char space02[] = { 473 | // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) 474 | 24,16,48,2,0,48, 475 | 0xF0, 0xF0, 0xFC, 0xFC, 0xFC, 0xFC, 0x3C, 0x3C, 0x3F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 476 | 0x3C, 0x3C, 0xFC, 0xFC, 0xFC, 0xFC, 0xF0, 0xF0, 0xF0, 0xF0, 0xFC, 0xFC, 0xFC, 0xFC, 0x3C, 0x3C, 477 | 0x3F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 0x3C, 0x3C, 0xFC, 0xFC, 0xFC, 0xFC, 0xF0, 0xF0, 478 | 0xC3, 0xC3, 0xC3, 0xC3, 0x33, 0x33, 0x3F, 0x3F, 0x0F, 0x0F, 0x33, 0x33, 0x33, 0x33, 0x0F, 0x0F, 479 | 0x3F, 0x3F, 0x33, 0x33, 0xC3, 0xC3, 0xC3, 0xC3, 0x03, 0x03, 0x33, 0x33, 0xFF, 0xFF, 0xCF, 0xCF, 480 | 0x0F, 0x0F, 0x33, 0x33, 0x33, 0x33, 0x0F, 0x0F, 0xCF, 0xCF, 0xFF, 0xFF, 0x33, 0x33, 0x03, 0x03 481 | }; 482 | 483 | 484 | static const unsigned char space03[] = { 485 | // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) 486 | 16,16,48,2,0,32, 487 | 0xC0, 0xC0, 0xF0, 0xF0, 0x3C, 0x3C, 0xFF, 0xFF, 0xFF, 0xFF, 0x3C, 0x3C, 0xF0, 0xF0, 0xC0, 0xC0, 488 | 0xC0, 0xC0, 0xF0, 0xF0, 0x3C, 0x3C, 0xFF, 0xFF, 0xFF, 0xFF, 0x3C, 0x3C, 0xF0, 0xF0, 0xC0, 0xC0, 489 | 0xC3, 0xC3, 0x33, 0x33, 0xCF, 0xCF, 0x33, 0x33, 0x33, 0x33, 0xCF, 0xCF, 0x33, 0x33, 0xC3, 0xC3, 490 | 0x33, 0x33, 0xCF, 0xCF, 0x03, 0x03, 0x0F, 0x0F, 0x0F, 0x0F, 0x03, 0x03, 0xCF, 0xCF, 0x33, 0x33 491 | }; 492 | 493 | #endif 494 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU 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 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | 676 | --------------------------------------------------------------------------------