Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Nucleo_LCD_mcufriend_test
Fork of 24_TFT_STMNUCLEO by
Revision 30:ede1a0a32e04, committed 2016-11-09
- Comitter:
- rlanghbv
- Date:
- Wed Nov 09 09:33:04 2016 +0000
- Parent:
- 29:060b167a46ba
- Commit message:
- first commit
Changed in this revision
diff -r 060b167a46ba -r ede1a0a32e04 fonts.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fonts.h Wed Nov 09 09:33:04 2016 +0000
@@ -0,0 +1,354 @@
+/** \file fonts.h
+ * \brief Fixed-width fonts for use with the SSD1289 LCD controller library and mbed
+ *
+ * Original work by Henning Karlsen in his UTFT display library for Arduino/chipKIT.
+ * \sa Comments in ssd1289.h
+ *
+ * This header provides 3 fixed-width fonts - 2 with all printable characters from the
+ * ASCII table and one 7-segment font with only the numbers 0-9. The smallest font is
+ * 8px wide and 12px tall, the big font is 16x16 pixels, and the 7-segment font is the
+ * biggest.
+ *
+ * If none of the provided fonts is suitable for your reuqirements, you can provide
+ * your own font, if the following rules are followed:
+ *
+ * 1) The library is not designed to deal with TrueType or Postscript fonts. Only
+ * fixed-width fonts can be used.
+ *
+ * 2) The font data should include only printable characters. For example, the provided
+ * fonts show either only numbers (7-segment), or contain the Latin-1 characters in
+ * the ASCII table starting from position 32 (the space character ' ').
+ *
+ * 3) No characters can be skipped. If you start with capital 'A' and wish to include
+ * small-case letters in your font as well, then all the characters in between 'A'
+ * and 'z' must be included in the font. If you WISH TO AVOID PRINTING a specific
+ * caracter, do not skip it, but include the appropriate amount of empty (0) bits
+ * to make-up for the "hidden" value.
+ *
+ * 4) Every pixel in the character is represented by a bit. It is not required, that a
+ * character is represented by a full number of bytes; however if the last character
+ * in the font does not end in a full byte, then add the appropriate 0 bits as fillers.
+ * For example a character in a 10x18 font (10px wide, 18px high) has 180 bits, which
+ * is 22 bytes and 4 remaining bits per character. If all whole sum of the bits of
+ * each character in the font is not evenly divisible by 8, then add as many 0 bits to
+ * the last character in the font, until this condition is satisfied.
+ *
+ * 5) The font array must start with the following 4 bytes before the first byte of the
+ * first character in the font: a) the width of the characters; b) the height of the
+ * characters; c) the offset of the first character in the font (the number of the
+ * first character as found in the ASCII table); and d) total number of characters in
+ * the font (placeholders for "hidden" characters are counted as well).
+ *
+ * As example let's continue the aforementioned 10x18 font. This would mean that each
+ * character is 10 bits wide and 18 tall. To design a character, 0s and 1s are used in
+ * a grid with the character dimensions, where 0 represents and empty, "background color"
+ * pixel, while 1 represents a "foreground" pixel. So to print "0" on the screen, the
+ * character data might look like the following:
+ * \code
+ * 0000000000
+ * 0111111110
+ * 0111111110
+ * 0110000110
+ * 0110000110
+ * 0110000110
+ * 0110000110
+ * 0110000110
+ * 0110000110
+ * 0110000110
+ * 0110000110
+ * 0110000110
+ * 0110000110
+ * 0110000110
+ * 0111111110
+ * 0111111110
+ * 0000000000
+ * 0000000000
+ * \endcode
+ * When all characters in the font have their bit grids, just place them in order one after
+ * another, and remove the "new lines" - you will have the whole font array in one very very
+ * long line. Start from the beginning of this line and break it up in pieces of 1 byte (8
+ * bits). Our "0" will look at first something like:
+ * \code
+ * 000000000001111111100111111110011000011001100001100110000110011000011001100001100110000110011000011001100001100110000110011000011001100001100111111110011111111000000000000000000000
+ * \endcode
+ * and after breaking up
+ * \code
+ * 00000000
+ * 00011111
+ * 11100111
+ * 11111001
+ * 10000110
+ * 01100001
+ * 10011000
+ * 01100110
+ * 00011001
+ * 10000110
+ * 01100001
+ * 10011000
+ * 01100110
+ * 00011001
+ * 10000110
+ * 01100001
+ * 10011000
+ * 01100111
+ * 11111001
+ * 11111110
+ * 00000000
+ * 00000000
+ * 0000
+ * \endcode
+ * If this were the last character int the font array, just add the four 0 bits to fill-up
+ * to a full byte, otherwise concatenate the first four bits from the next character, etc.,
+ * etc. When you have all te bytes for the font, convert them to hexadecimal format for
+ * more compact representation.
+ *
+ * The new font array is almost done. In order to satisfy requirement #5, prepend the
+ * following 4 bytes to the beginning of the array: 0x0A for the font width; 0x12 for the
+ * font height; 0x20 for offset, if the first character in the font is <space>, or 0x60 if
+ * "0" is the first character; and 0x?? for the total number of characters in the font.
+ * That's it, the font is done. Just use the array name with the #SetFont(const char*)
+ * function as with the fonts contained in this header file.
+ *
+ * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
+ * Copyright (C)2012 Todor Todorov.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to:
+ *
+ * Free Software Foundation, Inc.
+ * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
+ */
+#ifndef SSD1289_FONTS_H
+#define SSD1289_FONTS_H
+
+/** Small font, 8x12 pixels, <space> 1st character, 95 total characters */
+const char Font8x12[] = {
+ 0x08,0x0C,0x20,0x5F,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // <Space>
+ 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, // !
+ 0x00,0x28,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // "
+ 0x00,0x00,0x28,0x28,0xFC,0x28,0x50,0xFC,0x50,0x50,0x00,0x00, // #
+ 0x00,0x20,0x78,0xA8,0xA0,0x60,0x30,0x28,0xA8,0xF0,0x20,0x00, // $
+ 0x00,0x00,0x48,0xA8,0xB0,0x50,0x28,0x34,0x54,0x48,0x00,0x00, // %
+ 0x00,0x00,0x20,0x50,0x50,0x78,0xA8,0xA8,0x90,0x6C,0x00,0x00, // &
+ 0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
+ 0x00,0x04,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x04,0x00, // (
+ 0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x00, // )
+ 0x00,0x00,0x00,0x20,0xA8,0x70,0x70,0xA8,0x20,0x00,0x00,0x00, // *
+ 0x00,0x00,0x20,0x20,0x20,0xF8,0x20,0x20,0x20,0x00,0x00,0x00, // +
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80, // ,
+ 0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, // -
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00, // .
+ 0x00,0x08,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x00, // /
+ 0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, // 0
+ 0x00,0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // 1
+ 0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x40,0x80,0xF8,0x00,0x00, // 2
+ 0x00,0x00,0x70,0x88,0x08,0x30,0x08,0x08,0x88,0x70,0x00,0x00, // 3
+ 0x00,0x00,0x10,0x30,0x50,0x50,0x90,0x78,0x10,0x18,0x00,0x00, // 4
+ 0x00,0x00,0xF8,0x80,0x80,0xF0,0x08,0x08,0x88,0x70,0x00,0x00, // 5
+ 0x00,0x00,0x70,0x90,0x80,0xF0,0x88,0x88,0x88,0x70,0x00,0x00, // 6
+ 0x00,0x00,0xF8,0x90,0x10,0x20,0x20,0x20,0x20,0x20,0x00,0x00, // 7
+ 0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x00,0x00, // 8
+ 0x00,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x48,0x70,0x00,0x00, // 9
+ 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x20,0x00,0x00, // :
+ 0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x20,0x00, // ;
+ 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, // <
+ 0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x00,0x00, // =
+ 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, // >
+ 0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x20,0x00,0x20,0x00,0x00, // ?
+ 0x00,0x00,0x70,0x88,0x98,0xA8,0xA8,0xB8,0x80,0x78,0x00,0x00, // @
+ 0x00,0x00,0x20,0x20,0x30,0x50,0x50,0x78,0x48,0xCC,0x00,0x00, // A
+ 0x00,0x00,0xF0,0x48,0x48,0x70,0x48,0x48,0x48,0xF0,0x00,0x00, // B
+ 0x00,0x00,0x78,0x88,0x80,0x80,0x80,0x80,0x88,0x70,0x00,0x00, // C
+ 0x00,0x00,0xF0,0x48,0x48,0x48,0x48,0x48,0x48,0xF0,0x00,0x00, // D
+ 0x00,0x00,0xF8,0x48,0x50,0x70,0x50,0x40,0x48,0xF8,0x00,0x00, // E
+ 0x00,0x00,0xF8,0x48,0x50,0x70,0x50,0x40,0x40,0xE0,0x00,0x00, // F
+ 0x00,0x00,0x38,0x48,0x80,0x80,0x9C,0x88,0x48,0x30,0x00,0x00, // G
+ 0x00,0x00,0xCC,0x48,0x48,0x78,0x48,0x48,0x48,0xCC,0x00,0x00, // H
+ 0x00,0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00, // I
+ 0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0xE0,0x00, // J
+ 0x00,0x00,0xEC,0x48,0x50,0x60,0x50,0x50,0x48,0xEC,0x00,0x00, // K
+ 0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x44,0xFC,0x00,0x00, // L
+ 0x00,0x00,0xD8,0xD8,0xD8,0xD8,0xA8,0xA8,0xA8,0xA8,0x00,0x00, // M
+ 0x00,0x00,0xDC,0x48,0x68,0x68,0x58,0x58,0x48,0xE8,0x00,0x00, // N
+ 0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, // O
+ 0x00,0x00,0xF0,0x48,0x48,0x70,0x40,0x40,0x40,0xE0,0x00,0x00, // P
+ 0x00,0x00,0x70,0x88,0x88,0x88,0x88,0xE8,0x98,0x70,0x18,0x00, // Q
+ 0x00,0x00,0xF0,0x48,0x48,0x70,0x50,0x48,0x48,0xEC,0x00,0x00, // R
+ 0x00,0x00,0x78,0x88,0x80,0x60,0x10,0x08,0x88,0xF0,0x00,0x00, // S
+ 0x00,0x00,0xF8,0xA8,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // T
+ 0x00,0x00,0xCC,0x48,0x48,0x48,0x48,0x48,0x48,0x30,0x00,0x00, // U
+ 0x00,0x00,0xCC,0x48,0x48,0x50,0x50,0x30,0x20,0x20,0x00,0x00, // V
+ 0x00,0x00,0xA8,0xA8,0xA8,0x70,0x50,0x50,0x50,0x50,0x00,0x00, // W
+ 0x00,0x00,0xD8,0x50,0x50,0x20,0x20,0x50,0x50,0xD8,0x00,0x00, // X
+ 0x00,0x00,0xD8,0x50,0x50,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // Y
+ 0x00,0x00,0xF8,0x90,0x10,0x20,0x20,0x40,0x48,0xF8,0x00,0x00, // Z
+ 0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, // [
+ 0x00,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x00,0x00, // <Backslash>
+ 0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, // ]
+ 0x00,0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ^
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, // _
+ 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
+ 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x38,0x48,0x3C,0x00,0x00, // a
+ 0x00,0x00,0xC0,0x40,0x40,0x70,0x48,0x48,0x48,0x70,0x00,0x00, // b
+ 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x40,0x40,0x38,0x00,0x00, // c
+ 0x00,0x00,0x18,0x08,0x08,0x38,0x48,0x48,0x48,0x3C,0x00,0x00, // d
+ 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x78,0x40,0x38,0x00,0x00, // e
+ 0x00,0x00,0x1C,0x20,0x20,0x78,0x20,0x20,0x20,0x78,0x00,0x00, // f
+ 0x00,0x00,0x00,0x00,0x00,0x3C,0x48,0x30,0x40,0x78,0x44,0x38, // g
+ 0x00,0x00,0xC0,0x40,0x40,0x70,0x48,0x48,0x48,0xEC,0x00,0x00, // h
+ 0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x70,0x00,0x00, // i
+ 0x00,0x00,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0xE0, // j
+ 0x00,0x00,0xC0,0x40,0x40,0x5C,0x50,0x70,0x48,0xEC,0x00,0x00, // k
+ 0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00, // l
+ 0x00,0x00,0x00,0x00,0x00,0xF0,0xA8,0xA8,0xA8,0xA8,0x00,0x00, // m
+ 0x00,0x00,0x00,0x00,0x00,0xF0,0x48,0x48,0x48,0xEC,0x00,0x00, // n
+ 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x30,0x00,0x00, // o
+ 0x00,0x00,0x00,0x00,0x00,0xF0,0x48,0x48,0x48,0x70,0x40,0xE0, // p
+ 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x1C, // q
+ 0x00,0x00,0x00,0x00,0x00,0xD8,0x60,0x40,0x40,0xE0,0x00,0x00, // r
+ 0x00,0x00,0x00,0x00,0x00,0x78,0x40,0x30,0x08,0x78,0x00,0x00, // s
+ 0x00,0x00,0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00, // t
+ 0x00,0x00,0x00,0x00,0x00,0xD8,0x48,0x48,0x48,0x3C,0x00,0x00, // u
+ 0x00,0x00,0x00,0x00,0x00,0xEC,0x48,0x50,0x30,0x20,0x00,0x00, // v
+ 0x00,0x00,0x00,0x00,0x00,0xA8,0xA8,0x70,0x50,0x50,0x00,0x00, // w
+ 0x00,0x00,0x00,0x00,0x00,0xD8,0x50,0x20,0x50,0xD8,0x00,0x00, // x
+ 0x00,0x00,0x00,0x00,0x00,0xEC,0x48,0x50,0x30,0x20,0x20,0xC0, // y
+ 0x00,0x00,0x00,0x00,0x00,0x78,0x10,0x20,0x20,0x78,0x00,0x00, // z
+ 0x00,0x18,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x18,0x00, // {
+ 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, // |
+ 0x00,0x60,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0x60,0x00, // }
+ 0x40,0xA4,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ~
+};
+
+/** Big font, 16x16 pixels, <space> 1st character, 95 total characters */
+const char Font16x16[] = {
+ 0x10,0x10,0x20,0x5F,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // <Space>
+ 0x00,0x00,0x00,0x00,0x07,0x00,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00, // !
+ 0x00,0x00,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x06,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // "
+ 0x00,0x00,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x7F,0xFE,0x7F,0xFE,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x7F,0xFE,0x7F,0xFE,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x00,0x00, // #
+ 0x00,0x00,0x02,0x40,0x02,0x40,0x0F,0xF8,0x1F,0xF8,0x1A,0x40,0x1A,0x40,0x1F,0xF0,0x0F,0xF8,0x02,0x58,0x02,0x58,0x1F,0xF8,0x1F,0xF0,0x02,0x40,0x02,0x40,0x00,0x00, // $
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x10,0x0E,0x30,0x0E,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x70,0x0C,0x70,0x08,0x70,0x00,0x00,0x00,0x00,0x00,0x00, // %
+ 0x00,0x00,0x00,0x00,0x0F,0x00,0x19,0x80,0x19,0x80,0x19,0x80,0x0F,0x00,0x0F,0x08,0x0F,0x98,0x19,0xF8,0x18,0xF0,0x18,0xE0,0x19,0xF0,0x0F,0x98,0x00,0x00,0x00,0x00, // &
+ 0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
+ 0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x07,0x00,0x03,0x80,0x01,0xC0,0x00,0xF0,0x00,0x00,0x00,0x00, // (
+ 0x00,0x00,0x00,0x00,0x0F,0x00,0x03,0x80,0x01,0xC0,0x00,0xE0,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x0F,0x00,0x00,0x00,0x00,0x00, // )
+ 0x00,0x00,0x00,0x00,0x01,0x80,0x11,0x88,0x09,0x90,0x07,0xE0,0x07,0xE0,0x3F,0xFC,0x3F,0xFC,0x07,0xE0,0x07,0xE0,0x09,0x90,0x11,0x88,0x01,0x80,0x00,0x00,0x00,0x00, // *
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x0F,0xF0,0x0F,0xF0,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // +
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x0E,0x00,0x00,0x00, // ,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // -
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00, // ,
+ 0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x06,0x00,0x0E,0x00,0x1C,0x00,0x38,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, // /
+
+ 0x00,0x00,0x00,0x00,0x0F,0xF0,0x1C,0x38,0x1C,0x78,0x1C,0xF8,0x1C,0xF8,0x1D,0xB8,0x1D,0xB8,0x1F,0x38,0x1F,0x38,0x1E,0x38,0x1C,0x38,0x0F,0xF0,0x00,0x00,0x00,0x00, // 0
+ 0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x80,0x1F,0x80,0x1F,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x1F,0xF0,0x00,0x00,0x00,0x00, // 1
+ 0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x38,0x00,0x38,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x38,0x1C,0x38,0x1F,0xF8,0x00,0x00,0x00,0x00, // 2
+ 0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x38,0x00,0x38,0x00,0x70,0x03,0xC0,0x03,0xC0,0x00,0x70,0x00,0x38,0x1C,0x38,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // 3
+ 0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0xE0,0x03,0xE0,0x06,0xE0,0x0C,0xE0,0x18,0xE0,0x1F,0xF8,0x1F,0xF8,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x03,0xF8,0x00,0x00,0x00,0x00, // 4
+ 0x00,0x00,0x00,0x00,0x1F,0xF8,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1F,0xE0,0x1F,0xF0,0x00,0x78,0x00,0x38,0x1C,0x38,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // 5
+ 0x00,0x00,0x00,0x00,0x03,0xE0,0x07,0x00,0x0E,0x00,0x1C,0x00,0x1C,0x00,0x1F,0xF0,0x1F,0xF8,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x0F,0xF0,0x00,0x00,0x00,0x00, // 6
+ 0x00,0x00,0x00,0x00,0x1F,0xFC,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x00,0x1C,0x00,0x38,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00, // 7
+ 0x00,0x00,0x00,0x00,0x0F,0xF0,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1F,0x38,0x07,0xE0,0x07,0xE0,0x1C,0xF8,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x0F,0xF0,0x00,0x00,0x00,0x00, // 8
+ 0x00,0x00,0x00,0x00,0x0F,0xF0,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1F,0xF8,0x0F,0xF8,0x00,0x38,0x00,0x38,0x00,0x70,0x00,0xE0,0x07,0xC0,0x00,0x00,0x00,0x00, // 9
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // :
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ;
+ 0x00,0x00,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x00,0x1C,0x00,0x1C,0x00,0x0E,0x00,0x07,0x00,0x03,0x80,0x01,0xC0,0x00,0xE0,0x00,0x70,0x00,0x00, // <
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFC,0x3F,0xFC,0x00,0x00,0x00,0x00,0x3F,0xFC,0x3F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // =
+ 0x00,0x00,0x1C,0x00,0x0E,0x00,0x07,0x00,0x03,0x80,0x01,0xC0,0x00,0xE0,0x00,0x70,0x00,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x00,0x1C,0x00,0x00,0x00, // >
+ 0x00,0x00,0x03,0xC0,0x0F,0xF0,0x1E,0x78,0x18,0x38,0x00,0x38,0x00,0x70,0x00,0xE0,0x01,0xC0,0x01,0xC0,0x00,0x00,0x00,0x00,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x00,0x00, // ?
+
+ 0x00,0x00,0x0F,0xF8,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xFC,0x1C,0xFC,0x1C,0xFC,0x1C,0xFC,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1F,0xF0,0x07,0xF8,0x00,0x00, // @
+ 0x00,0x00,0x00,0x00,0x03,0xC0,0x07,0xE0,0x0E,0x70,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1F,0xF8,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x00,0x00,0x00,0x00, // A
+ 0x00,0x00,0x00,0x00,0x1F,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0F,0xF0,0x0F,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x1F,0xF0,0x00,0x00,0x00,0x00, // B
+ 0x00,0x00,0x00,0x00,0x07,0xF0,0x0E,0x38,0x1C,0x38,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x38,0x0E,0x38,0x07,0xF0,0x00,0x00,0x00,0x00, // C
+ 0x00,0x00,0x00,0x00,0x1F,0xE0,0x0E,0x70,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x70,0x1F,0xE0,0x00,0x00,0x00,0x00, // D
+ 0x00,0x00,0x00,0x00,0x1F,0xF8,0x0E,0x18,0x0E,0x08,0x0E,0x00,0x0E,0x30,0x0F,0xF0,0x0F,0xF0,0x0E,0x30,0x0E,0x00,0x0E,0x08,0x0E,0x18,0x1F,0xF8,0x00,0x00,0x00,0x00, // E
+ 0x00,0x00,0x00,0x00,0x1F,0xF8,0x0E,0x18,0x0E,0x08,0x0E,0x00,0x0E,0x30,0x0F,0xF0,0x0F,0xF0,0x0E,0x30,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1F,0x00,0x00,0x00,0x00,0x00, // F
+ 0x00,0x00,0x00,0x00,0x07,0xF0,0x0E,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x1C,0xF8,0x1C,0x38,0x1C,0x38,0x0E,0x38,0x07,0xF8,0x00,0x00,0x00,0x00, // G
+ 0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1F,0xF0,0x1F,0xF0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x00,0x00,0x00,0x00, // H
+ 0x00,0x00,0x00,0x00,0x0F,0xE0,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x0F,0xE0,0x00,0x00,0x00,0x00, // I
+ 0x00,0x00,0x00,0x00,0x01,0xFC,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x38,0x70,0x38,0x70,0x38,0x70,0x38,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // J
+ 0x00,0x00,0x00,0x00,0x1E,0x38,0x0E,0x38,0x0E,0x70,0x0E,0xE0,0x0F,0xC0,0x0F,0x80,0x0F,0x80,0x0F,0xC0,0x0E,0xE0,0x0E,0x70,0x0E,0x38,0x1E,0x38,0x00,0x00,0x00,0x00, // K
+ 0x00,0x00,0x00,0x00,0x1F,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x08,0x0E,0x18,0x0E,0x38,0x1F,0xF8,0x00,0x00,0x00,0x00, // L
+ 0x00,0x00,0x00,0x00,0x1C,0x1C,0x1E,0x3C,0x1F,0x7C,0x1F,0xFC,0x1F,0xFC,0x1D,0xDC,0x1C,0x9C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x00,0x00,0x00,0x00, // M
+ 0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x1C,0x1E,0x1C,0x1F,0x1C,0x1F,0x9C,0x1D,0xDC,0x1C,0xFC,0x1C,0x7C,0x1C,0x3C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x00,0x00,0x00,0x00, // N
+ 0x00,0x00,0x00,0x00,0x03,0xE0,0x07,0xF0,0x0E,0x38,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x0E,0x38,0x07,0xF0,0x03,0xE0,0x00,0x00,0x00,0x00, // O
+
+ 0x00,0x00,0x00,0x00,0x1F,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0F,0xF0,0x0F,0xF0,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1F,0x00,0x00,0x00,0x00,0x00, // P
+ 0x00,0x00,0x00,0x00,0x03,0xE0,0x0F,0x78,0x0E,0x38,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x7C,0x1C,0xFC,0x0F,0xF8,0x0F,0xF8,0x00,0x38,0x00,0xFC,0x00,0x00, // Q
+ 0x00,0x00,0x00,0x00,0x1F,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0F,0xF0,0x0F,0xF0,0x0E,0x70,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x1E,0x38,0x00,0x00,0x00,0x00, // R
+ 0x00,0x00,0x00,0x00,0x0F,0xF0,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x00,0x0F,0xE0,0x07,0xF0,0x00,0x38,0x1C,0x38,0x1C,0x38,0x1C,0x38,0x0F,0xF0,0x00,0x00,0x00,0x00, // S
+ 0x00,0x00,0x00,0x00,0x1F,0xFC,0x19,0xCC,0x11,0xC4,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x07,0xF0,0x00,0x00,0x00,0x00, // T
+ 0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // U
+ 0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0E,0xE0,0x07,0xC0,0x03,0x80,0x00,0x00,0x00,0x00, // V
+ 0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x0F,0xF8,0x0F,0xF8,0x07,0x70,0x07,0x70,0x00,0x00,0x00,0x00, // W
+ 0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0E,0xE0,0x07,0xC0,0x03,0x80,0x03,0x80,0x07,0xC0,0x0E,0xE0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x00,0x00,0x00,0x00, // X
+ 0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0E,0xE0,0x07,0xC0,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x0F,0xE0,0x00,0x00,0x00,0x00, // Y
+ 0x00,0x00,0x00,0x00,0x1F,0xF8,0x1C,0x38,0x18,0x38,0x10,0x70,0x00,0xE0,0x01,0xC0,0x03,0x80,0x07,0x00,0x0E,0x08,0x1C,0x18,0x1C,0x38,0x1F,0xF8,0x00,0x00,0x00,0x00, // Z
+ 0x00,0x00,0x00,0x00,0x07,0xF0,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0xF0,0x00,0x00,0x00,0x00, // [
+ 0x00,0x00,0x00,0x00,0x10,0x00,0x18,0x00,0x1C,0x00,0x0E,0x00,0x07,0x00,0x03,0x80,0x01,0xC0,0x00,0xE0,0x00,0x70,0x00,0x38,0x00,0x1C,0x00,0x07,0x00,0x00,0x00,0x00, // <Backslash>
+ 0x00,0x00,0x00,0x00,0x07,0xF0,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x07,0xF0,0x00,0x00,0x00,0x00, // ]
+ 0x00,0x00,0x01,0x80,0x03,0xC0,0x07,0xE0,0x0E,0x70,0x1C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ^
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0x7F,0xFF, // _
+
+ 0x00,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x00,0x70,0x00,0x70,0x0F,0xF0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xD8,0x00,0x00,0x00,0x00, // a
+ 0x00,0x00,0x00,0x00,0x1E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0F,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x1B,0xF0,0x00,0x00,0x00,0x00, // b
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x70,0x1C,0x00,0x1C,0x00,0x1C,0x70,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // c
+ 0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x70,0x00,0x70,0x00,0x70,0x0F,0xF0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xD8,0x00,0x00,0x00,0x00, // d
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x70,0x1F,0xF0,0x1C,0x00,0x1C,0x70,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // e
+ 0x00,0x00,0x00,0x00,0x03,0xE0,0x07,0x70,0x07,0x70,0x07,0x00,0x07,0x00,0x1F,0xE0,0x1F,0xE0,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x1F,0xC0,0x00,0x00,0x00,0x00, // f
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xD8,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xF0,0x07,0xF0,0x00,0x70,0x1C,0x70,0x0F,0xE0, // g
+ 0x00,0x00,0x00,0x00,0x1E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0xF0,0x0F,0x38,0x0F,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x1E,0x38,0x00,0x00,0x00,0x00, // h
+ 0x00,0x00,0x00,0x00,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x00,0x00,0x0F,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x0F,0xF8,0x00,0x00,0x00,0x00, // i
+ 0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x00,0x03,0xF0,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x1C,0x70,0x0C,0xF0,0x07,0xE0, // j
+ 0x00,0x00,0x00,0x00,0x1E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x38,0x0E,0x70,0x0E,0xE0,0x0F,0xC0,0x0E,0xE0,0x0E,0x70,0x0E,0x38,0x1E,0x38,0x00,0x00,0x00,0x00, // k
+ 0x00,0x00,0x00,0x00,0x0F,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x0F,0xF8,0x00,0x00,0x00,0x00, // l
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF8,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x1C,0x9C,0x00,0x00,0x00,0x00, // m
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x00,0x00,0x00,0x00, // n
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // o
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0xF0,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0F,0xF0,0x0E,0x00,0x0E,0x00,0x1F,0x00, // p
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xB0,0x38,0xE0,0x38,0xE0,0x38,0xE0,0x38,0xE0,0x38,0xE0,0x1F,0xE0,0x00,0xE0,0x00,0xE0,0x01,0xF0, // q
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0xF0,0x0F,0xF8,0x0F,0x38,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1F,0x00,0x00,0x00,0x00,0x00, // r
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xE0,0x1C,0x30,0x1C,0x30,0x0F,0x80,0x03,0xE0,0x18,0x70,0x18,0x70,0x0F,0xE0,0x00,0x00,0x00,0x00, // s
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x07,0x00,0x1F,0xF0,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x70,0x07,0x70,0x03,0xE0,0x00,0x00,0x00,0x00, // t
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0F,0xD8,0x00,0x00,0x00,0x00, // u
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x1C,0x70,0x0E,0xE0,0x07,0xC0,0x03,0x80,0x00,0x00,0x00,0x00, // v
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x9C,0x1C,0x9C,0x0F,0xF8,0x07,0x70,0x07,0x70,0x00,0x00,0x00,0x00, // w
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0xE0,0x1C,0xE0,0x0F,0xC0,0x07,0x80,0x07,0x80,0x0F,0xC0,0x1C,0xE0,0x1C,0xE0,0x00,0x00,0x00,0x00, // x
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x07,0xF0,0x03,0xE0,0x00,0xE0,0x01,0xC0,0x1F,0x80, // y
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xE0,0x18,0xE0,0x11,0xC0,0x03,0x80,0x07,0x00,0x0E,0x20,0x1C,0x60,0x1F,0xE0,0x00,0x00,0x00,0x00, // z
+ 0x00,0x00,0x00,0x00,0x01,0xF8,0x03,0x80,0x03,0x80,0x03,0x80,0x07,0x00,0x1C,0x00,0x1C,0x00,0x07,0x00,0x03,0x80,0x03,0x80,0x03,0x80,0x01,0xF8,0x00,0x00,0x00,0x00, // {
+ 0x00,0x00,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x00,0x00, // |
+ 0x00,0x00,0x00,0x00,0x1F,0x80,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x00,0xE0,0x00,0x38,0x00,0x38,0x00,0xE0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00, // }
+ 0x00,0x00,0x00,0x00,0x1F,0x1C,0x3B,0x9C,0x39,0xDC,0x38,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // ~
+};
+
+/** 7-segment font, only digits 0-9, 10 total characters */
+const char Font7Segment[] = {
+ 0x20,0x32,0x30,0x0A,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x0C,0xFF,0xFE,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x38,0x00,0x00,0x18,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x38,0x00,0x00,0x18,0x3E,0x00,0x00,0x78,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x1E,0x00,0x00,0xF0,0x0C,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 1
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x00,0xFF,0xFE,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x01,0xFF,0xFE,0x18,0x03,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x27,0xFF,0xFF,0xC0,0x39,0xFF,0xFF,0x00,0x3E,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x0C,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 2
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x00,0xFF,0xFE,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x01,0xFF,0xFE,0x18,0x03,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 3
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x0C,0x00,0x00,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x39,0xFF,0xFE,0x18,0x23,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 4
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x0C,0xFF,0xFE,0x00,0x1E,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x39,0xFF,0xFE,0x00,0x23,0xFF,0xFF,0x80,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 5
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x0C,0xFF,0xFE,0x00,0x1E,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x39,0xFF,0xFE,0x00,0x23,0xFF,0xFF,0x80,0x0F,0xFF,0xFF,0xE0,0x27,0xFF,0xFF,0xC0,0x39,0xFF,0xFF,0x18,0x3E,0x00,0x00,0x78,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x1E,0x00,0x00,0xF0,0x0C,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 6
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x00,0xFF,0xFE,0xF0,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 7
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x0C,0xFF,0xFE,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x39,0xFF,0xFE,0x18,0x23,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x27,0xFF,0xFF,0xC0,0x39,0xFF,0xFF,0x18,0x3E,0x00,0x00,0x78,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x1E,0x00,0x00,0xF0,0x0C,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 8
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x60,0x0C,0xFF,0xFE,0xF0,0x1E,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3F,0x00,0x01,0xF8,0x3E,0x00,0x00,0x78,0x39,0xFF,0xFE,0x18,0x23,0xFF,0xFF,0x88,0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0x18,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x00,0xF0,0x00,0xFF,0xFE,0x60,0x01,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x00,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 9
+};
+
+#endif /* SSD1289_FONTS_H */
\ No newline at end of file
diff -r 060b167a46ba -r ede1a0a32e04 hx8340bs.cpp
--- a/hx8340bs.cpp Mon Jun 30 17:29:42 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +0,0 @@
-/*
- * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
- * Copyright (C)2012 Todor Todorov.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to:
- *
- * Free Software Foundation, Inc.
- * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
- *
- *********************************************************************/
-#include "hx8340bs.h"
-#include "helpers.h"
-
-HX8340S_LCD::HX8340S_LCD( PinName CS, PinName RESET, PinName SCL, PinName SDI, PinName BL, backlight_t blType, float defaultBackLightLevel )
- : LCD( 176, 220, CS, NC, RESET, BL, blType, defaultBackLightLevel ), _lcd_pin_scl( SCL ), _lcd_pin_sdi( SDI )
-{
-}
-
-void HX8340S_LCD::Initialize( orientation_t orientation, colordepth_t colors )
-{
- _orientation = orientation;
- _colorDepth = colors;
-
- wait_ms( 100 );
- _lcd_pin_reset = HIGH;
- wait_ms( 5 );
- _lcd_pin_reset = LOW;
- wait_ms( 15 );
- _lcd_pin_reset = HIGH;
- _lcd_pin_cs = HIGH;
- _lcd_pin_scl = HIGH;
- _lcd_pin_sdi = HIGH;
- if ( _lcd_pin_bl != 0 )
- *_lcd_pin_bl = HIGH;
- else if ( _bl_pwm != 0 )
- *_bl_pwm = _bl_pwm_default;
- wait_ms( 55 );
-
- Activate();
- WriteCmd( 0xC1 ); // SETEXTCMD
- WriteByteData( 0xFF );
- WriteByteData( 0x83 );
- WriteByteData( 0x40 );
-
- WriteCmd( 0x11 ); // SLPOUT
- wait_ms( 160 );
-
- WriteCmd( 0xCA );
- WriteByteData( 0x70 );
- WriteByteData( 0x00 );
- WriteByteData( 0xD9 );
-
- WriteCmd( 0xB0 ); // SETOSC
- WriteByteData( 0x01 );
- WriteByteData( 0x11 );
-
- WriteCmd( 0xC9 );
- WriteByteData( 0x90 );
- WriteByteData( 0x49 );
- WriteByteData( 0x10 );
- WriteByteData( 0x28 );
- WriteByteData( 0x28 );
- WriteByteData( 0x10 );
- WriteByteData( 0x00 );
- WriteByteData( 0x06 );
- wait_ms( 20 );
-
- WriteCmd( 0xC2 ); // SETGAMMAP
- WriteByteData( 0x60 );
- WriteByteData( 0x71 );
- WriteByteData( 0x01 );
- WriteByteData( 0x0E );
- WriteByteData( 0x05 );
- WriteByteData( 0x02 );
- WriteByteData( 0x09 );
- WriteByteData( 0x31 );
- WriteByteData( 0x0A );
-
- WriteCmd( 0xc3 ); // SETGAMMAN
- WriteByteData( 0x67 );
- WriteByteData( 0x30 );
- WriteByteData( 0x61 );
- WriteByteData( 0x17 );
- WriteByteData( 0x48 );
- WriteByteData( 0x07 );
- WriteByteData( 0x05 );
- WriteByteData( 0x33 );
- wait_ms( 10 );
-
- WriteCmd( 0xB5 ); // SETPWCTR5
- WriteByteData( 0x35 );
- WriteByteData( 0x20 );
- WriteByteData( 0x45 );
-
- WriteCmd( 0xB4 ); // SETPWCTR4
- WriteByteData( 0x33 );
- WriteByteData( 0x25 );
- WriteByteData( 0x4c );
- wait_ms( 10 );
-
- WriteCmd( 0x3A ); // COLMOD == color depth: 0x05 => 16bit, 0x06 => 18bit
- WriteByteData( _colorDepth == RGB16 ? 0x05 : 0x06 );
-
- WriteCmd( 0x36 ); // MADCTL
- switch ( _orientation )
- {
- case LANDSCAPE: WriteByteData( 0xB8 ); break;
- case PORTRAIT_REV: WriteByteData( 0xDC ); break;
- case LANDSCAPE_REV: WriteByteData( 0x6C ); break;
- case PORTRAIT:
- default: WriteByteData( 0x08 ); break;
- }
-
- WriteCmd( 0x29 ); // DISPON
- wait_ms( 10 );
-
- ClearXY();
- Deactivate();
-}
-
-void HX8340S_LCD::Sleep( void )
-{
- Activate();
- WriteCmd( 0x28 );
- wait_ms( 10 );
- WriteCmd( 0x10 );
- wait_ms( 125 );
- LCD::Sleep();
- Deactivate();
-}
-
-void HX8340S_LCD::WakeUp( void )
-{
- Activate();
- WriteCmd( 0x29 );
- wait_ms( 10 );
- WriteCmd( 0x11 );
- wait_ms( 125 );
- LCD::WakeUp();
- Deactivate();
-}
-
-void HX8340S_LCD::WriteCmd( unsigned short cmd )
-{
- _lcd_pin_sdi = LOW;
- pulseLow( _lcd_pin_scl );
- serializeByte( cmd & 0xFF );
-}
-
-void HX8340S_LCD::WriteData( unsigned short data )
-{
- _lcd_pin_sdi = HIGH;
- pulseLow( _lcd_pin_scl );
- serializeByte( ( data >> 8 ) & 0xFF );
- _lcd_pin_sdi = HIGH;
- pulseLow( _lcd_pin_scl );
- serializeByte( data & 0xFF );
-}
-
-void HX8340S_LCD::WriteByteData( unsigned char data )
-{
- _lcd_pin_sdi = HIGH;
- pulseLow( _lcd_pin_scl );
- serializeByte( data );
-}
-
-void HX8340S_LCD::SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 )
-{
- WriteCmdData( 0x2A, x1 ); // CASET
- WriteData( x2 );
- WriteCmdData( 0x2B, y1 ); // PASET
- WriteData( y2 );
- WriteCmd( 0x2C ); // RAMWR
-}
-
-void HX8340S_LCD::SetPixelColor( unsigned int color, colordepth_t mode )
-{
- unsigned char r = 0, g = 0, b = 0;
- unsigned short clr;
- if ( _colorDepth == RGB16 )
- {
- switch ( mode )
- {
- case RGB16:
- WriteData( color & 0xFFFF );
- break;
- case RGB18:
- r = ( color >> 10 ) & 0xF8;
- g = ( color >> 4 ) & 0xFC;
- b = ( color >> 1 ) & 0x1F;
- clr = ( ( r | ( g >> 5 ) ) << 8 ) | ( ( g << 3 ) | b );
- WriteData( clr );
- break;
- case RGB24:
- r = ( color >> 16 ) & 0xF8;
- g = ( color >> 8 ) & 0xFC;
- b = color & 0xF8;
- clr = ( ( r | ( g >> 5 ) ) << 8 ) | ( ( g << 3 ) | ( b >> 3 ) );
- WriteData( clr );
- break;
- }
- }
- else if ( _colorDepth == RGB18 )
- {
- switch ( mode )
- {
- case RGB16:
- r = ( ( color >> 8 ) & 0xF8 ) | ( ( color & 0x8000 ) >> 13 );
- g = ( color >> 3 ) & 0xFC;
- b = ( ( color << 3 ) & 0xFC ) | ( ( color >> 3 ) & 0x01 );
- break;
- case RGB18:
- b = ( color << 2 ) & 0xFC;
- g = ( color >> 4 ) & 0xFC;
- r = ( color >> 10 ) & 0xFC;
- break;
- case RGB24:
- r = ( color >> 16 ) & 0xFC;
- g = ( color >> 8 ) & 0xFC;
- b = color & 0xFC;
- break;
- }
- WriteByteData( r );
- WriteByteData( g );
- WriteByteData( b );
- }
-}
-
-void HX8340S_LCD::serializeByte( unsigned char data )
-{
- for ( int i = 0; i < 8; i++ )
- {
- if ( data & 0x80 ) _lcd_pin_sdi = HIGH;
- else _lcd_pin_sdi = LOW;
- pulseLow( _lcd_pin_scl );
- data = data << 1;
- }
-}
diff -r 060b167a46ba -r ede1a0a32e04 hx8340bs.h
--- a/hx8340bs.h Mon Jun 30 17:29:42 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/** \file hx8340b.h
- * \brief mbed TFT LCD controller for displays with the HX8340-B IC (serial interface).
- * \copyright GNU Public License, v2. or later
- *
- * A known display with this type of controller chip is the ITDB02-2.2SP
- * from http://imall.iteadstudio.com
- *
- * This library is based on the Arduino/chipKIT UTFT library by Henning
- * Karlsen, http://henningkarlsen.com/electronics/library.php?id=52
- *
- * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
- *
- * Copyright (C)2012 Todor Todorov.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to:
- *
- * Free Software Foundation, Inc.
- * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
- *
- *********************************************************************/
-#ifndef TFTLCD_HX8340B_H
-#define TFTLCD_HX8340B_H
-
-#include "lcd_base.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Represents a LCD instance.
- *
- * This is the utility class, through which the display can be manipulated
- * and graphics objects can be shown to the user. A known display, which
- * works with this library is the ITDB02-2.2SP from iTeadStudio - a RGB TFT
- * with 176x220 pixels resolution and 65K/256K colors, using serial interface.
- *
- * The display needs 4 or 5 pins to work with mbed. As it uses +3.3V for power
- * and logic, as well as the backlight, interfacing could happen directly
- * to the mbed without the need of shields or level shifters as with Arduino.
- *
- * How to use:
- * \code
- * // include the library, this will also pull in the header for the provided fonts
- * #include "hx8340bs.h"
- *
- * // create the lcd instance
- * HX8340S_LCD lcd( p14, p13, p12, p11 ); // control pins
- *
- * int main()
- * {
- * // initialize display - place it in standard portrait mode and set background to black and
- * // foreground to white color.
- * lcd.Initialize();
- * // set current font to the smallest 8x12 pixels font.
- * lcd.SetFont( Font8x12 );
- * // print something on the screen
- * lcd.Print( "Hello, World!", CENTER, 25 ); // align text to center horizontally and use starndard colors
- *
- * while ( 1 ) { }
- * }
- *
- * \endcode
- * \version 0.1
- * \author Todor Todorov
- */
-class HX8340S_LCD : public LCD
-{
-public:
- /** Creates a new instance of the class.
- *
- * \param CS Pin for the ChipSelect signal.
- * \param RESET Pin for the RESET line.
- * \param SCL Pin for the serial clock signal.
- * \param SDI Pin for the serial data signal.
- * \param BL Pin for controlling the backlight. By default not used.
- * \param blType The backlight type, the default is to utilize the pin - if supplied - as a simple on/off switch
- * \param defaultBacklightLevel If using PWM to control backlight, this would be the default brightness in percent after LCD initialization.
- */
- HX8340S_LCD( PinName CS, PinName RESET, PinName SCL, PinName SDI, PinName BL = NC, backlight_t blType = Constant, float defaultBackLightLevel = 1.0 );
-
- /** Initialize display.
- *
- * Wakes up the display from sleep, initializes power parameters.
- * This function must be called first, befor any painting on the
- * display is done, otherwise the positioning of graphical elements
- * will not work properly and any paynt operation will not be visible
- * or produce garbage.
- *
- * \param oritentation The display orientation, landscape is default.
- * \param colors The correct color depth to use for the pixel data.
- */
- virtual void Initialize( orientation_t orientation = LANDSCAPE, colordepth_t colors = RGB16 );
-
- /** Puts the display to sleep.
- *
- * When the display is in sleep mode, its power consumption is
- * minimized. Before new pixel data can be written to the display
- * memory, the controller needs to be brought out of sleep mode.
- * \sa #WakeUp( void );
- * \remarks The result of this operation might not be exactly as
- * expected. Putting the display to sleep will cause the
- * controller to switch to the standard color of the LCD,
- * so depending on whether the display is normally white,
- * or normally dark, the screen might or might not go
- * dark. Additional power saving can be achieved, if
- * the backlight of the used display is not hardwired on
- * the PCB and can be controlled via the BL pin.
- */
- virtual void Sleep( void );
-
- /** Wakes up the display from sleep mode.
- *
- * This function needs to be called before any other, when the
- * display has been put into sleep mode by a previois call to
- * #Sleep( void ).
- */
- virtual void WakeUp( void );
-
-protected:
- /** Sends a command to the display.
- *
- * \param cmd The display command.
- * \remarks Commands are controller-specific and this function needs to
- * be implemented separately for each available controller.
- */
- virtual void WriteCmd( unsigned short cmd );
-
- /** Sends pixel data to the display.
- *
- * \param data The display data.
- * \remarks Sendin data is controller-specific and this function needs to
- * be implemented separately for each available controller.
- */
- virtual void WriteData( unsigned short data );
-
- /** Writes a single byte of pixel data to the display.
- *
- * \param data The data to be written.
- * \remarks Sendin data is controller-specific and this function needs to
- * be implemented separately for each available controller.
- */
- virtual void WriteByteData( unsigned char data );
-
- /** Assigns a chunk of the display memory to receive data.
- *
- * When data is sent to the display after this function completes, the opertion will
- * start from the begining of the assigned address (pixel position) and the pointer
- * will be automatically incremented so that the next data write operation will continue
- * with the next pixel from the memory block. If more data is written than available
- * pixels, at the end of the block the pointer will jump back to its beginning and
- * commence again, until the next address change command is sent to the display.
- *
- * \param x1 The X coordinate of the pixel at the beginning of the block.
- * \param y1 The Y coordinate of the pixel at the beginning of the block.
- * \param x2 The X coordinate of the pixel at the end of the block.
- * \param y2 The Y coordinate of the pixel at the end of the block.
- * \remarks Addressing commands are controller-specific and this function needs to be
- * implemented separately for each available controller.
- */
- virtual void SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 );
-
- /** Sets the color of the pixel at the address pointer of the controller.
- *
- * This function is to be provided by each implementation separately in
- * order to account for different color depth used by the controller.
- * \param color The color of the pixel.
- * \param mode The depth (palette) of the color.
- */
- virtual void SetPixelColor( unsigned int color, colordepth_t mode = RGB24 );
-
-private:
- void serializeByte( unsigned char data );
-
-private:
- DigitalOut _lcd_pin_scl, _lcd_pin_sdi;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* TFTLCD_HX8340B_H */
diff -r 060b167a46ba -r ede1a0a32e04 ili9325.cpp
--- a/ili9325.cpp Mon Jun 30 17:29:42 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,311 +0,0 @@
-/*
- * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
- * Copyright (C)2012-2013 Todor Todorov.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to:
- *
- * Free Software Foundation, Inc.
- * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
- *
- *********************************************************************/
-#include "ili9325.h"
-#include "helpers.h"
-
-ILI9328_LCD::ILI9328_LCD( PinName CS, PinName RESET, PinName RS, PinName WR, BusOut* DATA_PORT, PinName BL, PinName RD, backlight_t blType, float defaultBackLightLevel )
- : LCD( 240, 320, CS, RS, RESET, BL, blType, defaultBackLightLevel ), _lcd_pin_wr( WR )
-{
- _lcd_port = DATA_PORT;
- if ( RD != NC ) _lcd_pin_rd = new DigitalOut( RD );
- else _lcd_pin_rd = 0;
-}
-
-void ILI9328_LCD::Initialize( orientation_t orientation, colordepth_t colors )
-{
- _orientation = orientation;
- _colorDepth = colors;
-
- _lcd_pin_reset = HIGH;
- wait_ms( 10 );
- _lcd_pin_reset = LOW;
- wait_ms( 10 );
- _lcd_pin_reset = HIGH;
- wait_ms( 10 );
- _lcd_pin_cs = HIGH;
- if ( _lcd_pin_bl != 0 )
- *_lcd_pin_bl = HIGH;
- else if ( _bl_pwm != 0 )
- *_bl_pwm = _bl_pwm_default;
- if ( _lcd_pin_rd != 0 )
- *_lcd_pin_rd = HIGH;
- _lcd_pin_wr = HIGH;
- wait_ms( 5 );
-
- Activate();
-
- short drivOut = 0;
- short entryMod = 0;
- short gateScan = 0x2700;
- switch ( _orientation )
- {
- case LANDSCAPE:
- drivOut = 0x0100;
- entryMod |= 0x0038;
- gateScan |= 0x0000;
- break;
-
- case LANDSCAPE_REV:
- drivOut = 0x0000;
- entryMod |= 0x0038;
- gateScan |= 0x8000;
- break;
-
- case PORTRAIT_REV:
- drivOut = 0x0000;
- entryMod |= 0x0030;
- gateScan |= 0x0000;
- break;
-
- case PORTRAIT:
- default:
- drivOut = 0x0100;
- entryMod |= 0x0030;
- gateScan |= 0x8000;
- break;
- }
- switch ( _colorDepth )
- {
- case RGB18:
- entryMod |= 0x9000;
- break;
-
- case RGB16:
- default:
- entryMod |= 0x1030;
- break;
- }
-
- //WriteCmdData( 0xE5, 0xFFFF ); // set SRAM internal timing
- WriteCmdData( 0x0001,0x0100);//0x01, drivOut ); // set Driver Output Control
- WriteCmdData( 0x0002,0x0700 ); // set 1 line inversion
- WriteCmdData( 0x0003,entryMod );//0x03, entryMod ); // set GRAM write direction and BGR=1.
- //WriteCmdData( 0x04, 0x0000 ); // Resize register
- WriteCmdData( 0x0008,0x0302 ); // set the back porch and front porch
- WriteCmdData( 0x0009,0x0000 ); // set non-display area refresh cycle ISC[3:0]
- WriteCmdData( 0x000A,0x0008 ); // FMARK function
- //WriteCmdData( 0x0C, 0x0000 ); // RGB interface setting
- //WriteCmdData( 0x0D, 0x0000 ); // Frame marker Position
- //WriteCmdData( 0x0F, 0x0000 ); // RGB interface polarity
- // ----------- Power On sequence ----------- //
- WriteCmdData( 0x0010,0x0790 ); // SAP, BT[3:0], AP, DSTB, SLP, STB
- WriteCmdData( 0x0011,0x0005 ); // DC1[2:0], DC0[2:0], VC[2:0]
- WriteCmdData( 0x0012,0x0000 ); // VREG1OUT voltage
- WriteCmdData( 0x0013,0x000 ); // VDV[4:0] for VCOM amplitude
- //WriteCmdData( 0x07, 0x0001 );
- //wait_ms( 50 ); // Dis-charge capacitor power voltage
- WriteCmdData( 0x0010,0x12B0 ); // SAP, BT[3:0], AP, DSTB, SLP, STB
- WriteCmdData( 0x0011,0x0007 ); // Set DC1[2:0], DC0[2:0], VC[2:0]
- //wait_ms( 50 ); // Delay 50ms
- WriteCmdData( 0x0012,0x008C ); // 0012
- //wait_ms( 50 ); // Delay 50ms
- WriteCmdData( 0x0013,0x1700 ); // VDV[4:0] for VCOM amplitude
- WriteCmdData( 0x0029,0x0022 ); // 04 VCM[5:0] for VCOMH
- //WriteCmdData( 0x2B, 0x00FD ); // Set Frame Rate
- //wait_ms( 50 ); // Delay 50ms
- //WriteCmdData( 0x20, 0x0000 ); // GRAM horizontal Address
- //WriteCmdData( 0x21, 0x0000 ); // GRAM Vertical Address
- // ----------- Adjust the Gamma Curve ----------//
- WriteCmdData( 0x0030,0x0000 );
- WriteCmdData( 0x0031,0x0505 );
- WriteCmdData( 0x0032,0x0205 );
- WriteCmdData( 0x0035,0x0206 );
- WriteCmdData( 0x0036,0x0408 );
- WriteCmdData( 0x0037,0x0000 );
- WriteCmdData( 0x0038,0x0504 );
- WriteCmdData( 0x0039,0x0206 );
- WriteCmdData( 0x003C,0x0206 );
- WriteCmdData( 0x003D,0x0408 );
- //------------------ Set GRAM area ---------------//
- WriteCmdData( 0x50, 0x0000 ); // Horizontal GRAM Start Address
- WriteCmdData( 0x51, 0x00EF ); // Horizontal GRAM End Address
- WriteCmdData( 0x52, 0x0000 ); // Vertical GRAM Start Address
- WriteCmdData( 0x53, 0x013F ); // Vertical GRAM Start Address
- WriteCmdData( 0x60, gateScan ); // Gate Scan Line (0xA700)
- WriteCmdData( 0x0061,0x0001 ); // NDL,VLE, REV
- //WriteCmdData( 0x6A, 0x0000 ); // set scrolling line
- //-------------- Partial Display Control ---------//
- //WriteCmdData( 0x80, 0x0000 );
- //WriteCmdData( 0x81, 0x0000 );
- //WriteCmdData( 0x82, 0x0000 );
- //WriteCmdData( 0x83, 0x0000 );
- //WriteCmdData( 0x84, 0x0000 );
- //WriteCmdData( 0x85, 0x0000 );
- //-------------- Panel Control -------------------//
- WriteCmdData( 0x90, 0x0033 );
- //WriteCmdData( 0x92, 0x0000 );
- WriteCmdData( 0x0007,0x0133 ); // 262K color and display ON
-
- Deactivate();
-}
-
-void ILI9328_LCD::Sleep( void )
-{
- Activate();
- WriteCmdData( 0x10, 0x1692 ); // enter sleep mode
- wait_ms( 50 );
- LCD::Sleep();
- Deactivate();
-}
-
-void ILI9328_LCD::WakeUp( void )
-{
- Activate();
- WriteCmdData( 0x10, 0x1690 ); // exit sleep mode
- wait_ms( 50 );
- LCD::WakeUp();
- Deactivate();
-}
-
-void ILI9328_LCD::WriteCmd( unsigned short cmd )
-{
-
- unsigned short u,l;
- u = (cmd>>8) & 0xFF;
- l = cmd & 0xFF;
-
-//New
- _lcd_pin_cs = LOW;
-//
- _lcd_pin_rs = LOW;
-
-//New
- *_lcd_pin_rd = HIGH;
- _lcd_pin_wr = HIGH;
-//
- _lcd_port->write( u );
- pulseLow( _lcd_pin_wr );
-
- _lcd_port->write( l );
- pulseLow( _lcd_pin_wr );
-
-//New
- _lcd_pin_cs = HIGH;
-//
-}
-
-void ILI9328_LCD::WriteData( unsigned short data )
-{
- unsigned short u,l;
- u = (data>>8) & 0xFF;
- l = data & 0xFF;
-
-//New
- _lcd_pin_cs = LOW;
-//
- _lcd_pin_rs = HIGH;
-//New
- *_lcd_pin_rd = HIGH;
- _lcd_pin_wr = HIGH;
-//
- _lcd_port->write( u );
- pulseLow( _lcd_pin_wr );
-
- _lcd_port->write( l );
- pulseLow( _lcd_pin_wr );
-
-//New
- _lcd_pin_cs = HIGH;
-//
-}
-
-void ILI9328_LCD::SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 )
-{
- switch ( _orientation )
- {
- case LANDSCAPE:
- case LANDSCAPE_REV:
- WriteCmdData( 0x20, y1 );
- WriteCmdData( 0x21, x1 );
- WriteCmdData( 0x50, y1 );
- WriteCmdData( 0x52, x1 );
- WriteCmdData( 0x51, y2 );
- WriteCmdData( 0x53, x2 );
- break;
-
- case PORTRAIT_REV:
- case PORTRAIT:
- default:
- WriteCmdData( 0x20, x1 );
- WriteCmdData( 0x21, y1 );
- WriteCmdData( 0x50, x1 );
- WriteCmdData( 0x52, y1 );
- WriteCmdData( 0x51, x2 );
- WriteCmdData( 0x53, y2 );
- break;
- }
- WriteCmd( 0x22 );
-}
-
-void ILI9328_LCD::SetPixelColor( unsigned int color, colordepth_t mode )
-{
- unsigned char r, g, b;
- unsigned short clr;
- r = g = b = 0;
- if ( _colorDepth == RGB16 )
- {
- switch ( mode )
- {
- case RGB16:
- WriteData( color & 0xFFFF );
- break;
- case RGB18:
- r = ( color >> 10 ) & 0xF8;
- g = ( color >> 4 ) & 0xFC;
- b = ( color >> 1 ) & 0x1F;
- clr = ( ( r | ( g >> 5 ) ) << 8 ) | ( ( g << 3 ) | b );
- WriteData( clr );
- break;
- case RGB24:
- r = ( color >> 16 ) & 0xF8;
- g = ( color >> 8 ) & 0xFC;
- b = color & 0xF8;
- clr = ( ( r | ( g >> 5 ) ) << 8 ) | ( ( g << 3 ) | ( b >> 3 ) );
- WriteData( clr );
- break;
- }
- }
- else if ( _colorDepth == RGB18 )
- {
- switch ( mode )
- {
- case RGB16:
- r = ( ( color >> 8 ) & 0xF8 ) | ( ( color & 0x8000 ) >> 13 );
- g = ( color >> 3 ) & 0xFC;
- b = ( ( color << 3 ) & 0xFC ) | ( ( color >> 3 ) & 0x01 );
- break;
- case RGB18:
- b = ( color << 2 ) & 0xFC;
- g = ( color >> 4 ) & 0xFC;
- r = ( color >> 10 ) & 0xFC;
- break;
- case RGB24:
- r = ( color >> 16 ) & 0xFC;
- g = ( color >> 8 ) & 0xFC;
- b = color & 0xFC;
- break;
- }
- clr = ( r << 8 ) | ( g << 2 ) | ( b >> 4 );
- WriteData( clr );
- WriteData( b << 4 );
- }
-}
diff -r 060b167a46ba -r ede1a0a32e04 ili9325.h
--- a/ili9325.h Mon Jun 30 17:29:42 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/** \file ili9328.h
- * \brief mbed LCD driver for displays with the ILI9328 controller.
- * \copyright GNU Public License, v2. or later
- *
- * This library is based on the Arduino/chipKIT UTFT library by Henning
- * Karlsen, http://henningkarlsen.com/electronics/library.php?id=52
- *
- * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
- *
- * Copyright (C)2012-2013 Todor Todorov.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to:
- *
- * Free Software Foundation, Inc.
- * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
- *
- *********************************************************************/
-#ifndef TFTLCD_ILI9328_H
-#define TFTLCD_ILI9328_H
-
-#include "lcd_base.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Represents a LCD instance.
- *
- * This is the utility class, through which the display can be manipulated
- * and graphics objects can be shown to the user. A known display, which
- * works with this library is the INANBO-T24-ILI9328-V11 - a RGB TFT
- * with 240x320 pixels resolution and 65K/262K colors, using 8/16-bit interface.
- *
- * The display works with a supply voltage of 2.8-3.3 volts for both logic and
- * backlight. It can be driven in 8bit or 16bit interface mode. (Current
- * version of the driver works only in 16bit mode for now.)
- *
- * How to use:
- * \code
- * // include the library, this will also pull in the header for the provided fonts
- * #include "ili9328.h"
- *
- * // prepare the data bus for writing commands and pixel data
- * BusOut dataBus( p30, p29, p28, p27, p26, p25, p24, p23, p22, p21, p20, p19, p18, p17, p16, p15 ); // 16 pins
- * // create the lcd instance
- * ILI9328_LCD lcd( p14, p13, p12, p11, &dataBus ); // control pins and data bus
- *
- * int main()
- * {
- * // initialize display - place it in standard portrait mode and set background to black and
- * // foreground to white color.
- * lcd.Initialize();
- * // set current font to the smallest 8x12 pixels font.
- * lcd.SetFont( Font8x12 );
- * // print something on the screen
- * lcd.Print( "Hello, World!", CENTER, 25 ); // align text to center horizontally and use starndard colors
- *
- * while ( 1 ) { }
- * }
- *
- * \endcode
- * \version 0.1
- * \author Todor Todorov
- */
-class ILI9328_LCD : public LCD
-{
-public:
- /** Creates a new instance of the class.
- *
- * \param CS Pin for the ChipSelect signal.
- * \param RESET Pin for the RESET line.
- * \param RS Pin for the RS signal.
- * \param WR Pin for the WR signal.
- * \param DATA_PORT Address of the data bus for transfer of commands and pixel data.
- * \param BL Pin for controlling the backlight. By default not used.
- * \param RD Pin for the RD signal. This line is not needed by the driver, so if you would like to
- * use the pin on the mbed for something else, just pull-up the respective pin on the LCD high,
- * and do not assign a value to this parameter when creating the controller instance.
- * \param blType The backlight type, the default is to utilize the pin - if supplied - as a simple on/off switch
- * \param defaultBacklightLevel If using PWM to control backlight, this would be the default brightness in percent after LCD initialization.
- */
- ILI9328_LCD( PinName CS, PinName RESET, PinName RS, PinName WR, BusOut* DATA_PORT, PinName BL = NC, PinName RD = NC, backlight_t blType = Constant, float defaultBackLightLevel = 1.0 );
-
- /** Initialize display.
- *
- * Wakes up the display from sleep, initializes power parameters.
- * This function must be called first, befor any painting on the
- * display is done, otherwise the positioning of graphical elements
- * will not work properly and any paynt operation will not be visible
- * or produce garbage.
- *
- * \param oritentation The display orientation, landscape is default.
- * \param colors The correct color depth to use for the pixel data. Value is disregarded.
- */
- virtual void Initialize( orientation_t orientation = LANDSCAPE, colordepth_t colors = RGB16 );
-
- /** Puts the display to sleep.
- *
- * When the display is in sleep mode, its power consumption is
- * minimized. Before new pixel data can be written to the display
- * memory, the controller needs to be brought out of sleep mode.
- * \sa #WakeUp( void );
- * \remarks The result of this operation might not be exactly as
- * expected. Putting the display to sleep will cause the
- * controller to switch to the standard color of the LCD,
- * so depending on whether the display is normally white,
- * or normally dark, the screen might or might not go
- * dark. Additional power saving can be achieved, if
- * the backlight of the used display is not hardwired on
- * the PCB and can be controlled via the BL pin.
- */
- virtual void Sleep( void );
-
- /** Wakes up the display from sleep mode.
- *
- * This function needs to be called before any other, when the
- * display has been put into sleep mode by a previois call to
- * #Sleep( void ).
- */
- virtual void WakeUp( void );
-
-protected:
- /** Sends a command to the display.
- *
- * \param cmd The display command.
- * \remarks Commands are controller-specific and this function needs to
- * be implemented separately for each available controller.
- */
- virtual void WriteCmd( unsigned short cmd );
-
- /** Sends pixel data to the display.
- *
- * \param data The display data.
- * \remarks Sending data is controller-specific and this function needs to
- * be implemented separately for each available controller.
- */
- virtual void WriteData( unsigned short data );
-
- /** Assigns a chunk of the display memory to receive data.
- *
- * When data is sent to the display after this function completes, the opertion will
- * start from the begining of the assigned address (pixel position) and the pointer
- * will be automatically incremented so that the next data write operation will continue
- * with the next pixel from the memory block. If more data is written than available
- * pixels, at the end of the block the pointer will jump back to its beginning and
- * commence again, until the next address change command is sent to the display.
- *
- * \param x1 The X coordinate of the pixel at the beginning of the block.
- * \param y1 The Y coordinate of the pixel at the beginning of the block.
- * \param x2 The X coordinate of the pixel at the end of the block.
- * \param y2 The Y coordinate of the pixel at the end of the block.
- * \remarks Addressing commands are controller-specific and this function needs to be
- * implemented separately for each available controller.
- */
- virtual void SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 );
-
- /** Sets the color of the pixel at the address pointer of the controller.
- *
- * This function is to be provided by each implementation separately in
- * order to account for different color depth used by the controller.
- * \param color The color of the pixel.
- * \param mode The depth (palette) of the color.
- */
- virtual void SetPixelColor( unsigned int color, colordepth_t mode = RGB24 );
-
-private:
- DigitalOut _lcd_pin_wr;
- BusOut* _lcd_port;
- DigitalOut* _lcd_pin_bl;
- DigitalOut* _lcd_pin_rd;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* TFTLCD_ILI9328_H */
diff -r 060b167a46ba -r ede1a0a32e04 ili9328.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ili9328.cpp Wed Nov 09 09:33:04 2016 +0000
@@ -0,0 +1,311 @@
+/*
+ * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
+ * Copyright (C)2012-2013 Todor Todorov.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to:
+ *
+ * Free Software Foundation, Inc.
+ * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
+ *
+ *********************************************************************/
+#include "ili9328.h"
+#include "helpers.h"
+
+ILI9328_LCD::ILI9328_LCD( PinName CS, PinName RESET, PinName RS, PinName WR, BusOut* DATA_PORT, PinName BL, PinName RD, backlight_t blType, float defaultBackLightLevel )
+ : LCD( 240, 320, CS, RS, RESET, BL, blType, defaultBackLightLevel ), _lcd_pin_wr( WR )
+{
+ _lcd_port = DATA_PORT;
+ if ( RD != NC ) _lcd_pin_rd = new DigitalOut( RD );
+ else _lcd_pin_rd = 0;
+}
+
+void ILI9328_LCD::Initialize( orientation_t orientation, colordepth_t colors )
+{
+ _orientation = orientation;
+ _colorDepth = colors;
+
+ _lcd_pin_reset = HIGH;
+ wait_ms( 10 );
+ _lcd_pin_reset = LOW;
+ wait_ms( 10 );
+ _lcd_pin_reset = HIGH;
+ wait_ms( 10 );
+ _lcd_pin_cs = HIGH;
+ if ( _lcd_pin_bl != 0 )
+ *_lcd_pin_bl = HIGH;
+ else if ( _bl_pwm != 0 )
+ *_bl_pwm = _bl_pwm_default;
+ if ( _lcd_pin_rd != 0 )
+ *_lcd_pin_rd = HIGH;
+ _lcd_pin_wr = HIGH;
+ wait_ms( 5 );
+
+ Activate();
+
+ short drivOut = 0;
+ short entryMod = 0;
+ short gateScan = 0x2700;
+ switch ( _orientation )
+ {
+ case LANDSCAPE:
+ drivOut = 0x0100;
+ entryMod |= 0x0038;
+ gateScan |= 0x0000;
+ break;
+
+ case LANDSCAPE_REV:
+ drivOut = 0x0000;
+ entryMod |= 0x0038;
+ gateScan |= 0x8000;
+ break;
+
+ case PORTRAIT_REV:
+ drivOut = 0x0000;
+ entryMod |= 0x0030;
+ gateScan |= 0x0000;
+ break;
+
+ case PORTRAIT:
+ default:
+ drivOut = 0x0100;
+ entryMod |= 0x0030;
+ gateScan |= 0x8000;
+ break;
+ }
+ switch ( _colorDepth )
+ {
+ case RGB18:
+ entryMod |= 0x9000;
+ break;
+
+ case RGB16:
+ default:
+ entryMod |= 0x1030;
+ break;
+ }
+
+ //WriteCmdData( 0xE5, 0xFFFF ); // set SRAM internal timing
+ WriteCmdData( 0x0001,0x0100);//0x01, drivOut ); // set Driver Output Control
+ WriteCmdData( 0x0002,0x0700 ); // set 1 line inversion
+ WriteCmdData( 0x0003,entryMod );//0x03, entryMod ); // set GRAM write direction and BGR=1.
+ //WriteCmdData( 0x04, 0x0000 ); // Resize register
+ WriteCmdData( 0x0008,0x0302 ); // set the back porch and front porch
+ WriteCmdData( 0x0009,0x0000 ); // set non-display area refresh cycle ISC[3:0]
+ WriteCmdData( 0x000A,0x0008 ); // FMARK function
+ //WriteCmdData( 0x0C, 0x0000 ); // RGB interface setting
+ //WriteCmdData( 0x0D, 0x0000 ); // Frame marker Position
+ //WriteCmdData( 0x0F, 0x0000 ); // RGB interface polarity
+ // ----------- Power On sequence ----------- //
+ WriteCmdData( 0x0010,0x0790 ); // SAP, BT[3:0], AP, DSTB, SLP, STB
+ WriteCmdData( 0x0011,0x0005 ); // DC1[2:0], DC0[2:0], VC[2:0]
+ WriteCmdData( 0x0012,0x0000 ); // VREG1OUT voltage
+ WriteCmdData( 0x0013,0x000 ); // VDV[4:0] for VCOM amplitude
+ //WriteCmdData( 0x07, 0x0001 );
+ //wait_ms( 50 ); // Dis-charge capacitor power voltage
+ WriteCmdData( 0x0010,0x12B0 ); // SAP, BT[3:0], AP, DSTB, SLP, STB
+ WriteCmdData( 0x0011,0x0007 ); // Set DC1[2:0], DC0[2:0], VC[2:0]
+ //wait_ms( 50 ); // Delay 50ms
+ WriteCmdData( 0x0012,0x008C ); // 0012
+ //wait_ms( 50 ); // Delay 50ms
+ WriteCmdData( 0x0013,0x1700 ); // VDV[4:0] for VCOM amplitude
+ WriteCmdData( 0x0029,0x0022 ); // 04 VCM[5:0] for VCOMH
+ //WriteCmdData( 0x2B, 0x00FD ); // Set Frame Rate
+ //wait_ms( 50 ); // Delay 50ms
+ //WriteCmdData( 0x20, 0x0000 ); // GRAM horizontal Address
+ //WriteCmdData( 0x21, 0x0000 ); // GRAM Vertical Address
+ // ----------- Adjust the Gamma Curve ----------//
+ WriteCmdData( 0x0030,0x0000 );
+ WriteCmdData( 0x0031,0x0505 );
+ WriteCmdData( 0x0032,0x0205 );
+ WriteCmdData( 0x0035,0x0206 );
+ WriteCmdData( 0x0036,0x0408 );
+ WriteCmdData( 0x0037,0x0000 );
+ WriteCmdData( 0x0038,0x0504 );
+ WriteCmdData( 0x0039,0x0206 );
+ WriteCmdData( 0x003C,0x0206 );
+ WriteCmdData( 0x003D,0x0408 );
+ //------------------ Set GRAM area ---------------//
+ WriteCmdData( 0x50, 0x0000 ); // Horizontal GRAM Start Address
+ WriteCmdData( 0x51, 0x00EF ); // Horizontal GRAM End Address
+ WriteCmdData( 0x52, 0x0000 ); // Vertical GRAM Start Address
+ WriteCmdData( 0x53, 0x013F ); // Vertical GRAM Start Address
+ WriteCmdData( 0x60, gateScan ); // Gate Scan Line (0xA700)
+ WriteCmdData( 0x0061,0x0001 ); // NDL,VLE, REV
+ //WriteCmdData( 0x6A, 0x0000 ); // set scrolling line
+ //-------------- Partial Display Control ---------//
+ //WriteCmdData( 0x80, 0x0000 );
+ //WriteCmdData( 0x81, 0x0000 );
+ //WriteCmdData( 0x82, 0x0000 );
+ //WriteCmdData( 0x83, 0x0000 );
+ //WriteCmdData( 0x84, 0x0000 );
+ //WriteCmdData( 0x85, 0x0000 );
+ //-------------- Panel Control -------------------//
+ WriteCmdData( 0x90, 0x0033 );
+ //WriteCmdData( 0x92, 0x0000 );
+ WriteCmdData( 0x0007,0x0133 ); // 262K color and display ON
+
+ Deactivate();
+}
+
+void ILI9328_LCD::Sleep( void )
+{
+ Activate();
+ WriteCmdData( 0x10, 0x1692 ); // enter sleep mode
+ wait_ms( 50 );
+ LCD::Sleep();
+ Deactivate();
+}
+
+void ILI9328_LCD::WakeUp( void )
+{
+ Activate();
+ WriteCmdData( 0x10, 0x1690 ); // exit sleep mode
+ wait_ms( 50 );
+ LCD::WakeUp();
+ Deactivate();
+}
+
+void ILI9328_LCD::WriteCmd( unsigned short cmd )
+{
+
+ unsigned short u,l;
+ u = (cmd>>8) & 0xFF;
+ l = cmd & 0xFF;
+
+//New
+ _lcd_pin_cs = LOW;
+//
+ _lcd_pin_rs = LOW;
+
+//New
+ *_lcd_pin_rd = HIGH;
+ _lcd_pin_wr = HIGH;
+//
+ _lcd_port->write( u );
+ pulseLow( _lcd_pin_wr );
+
+ _lcd_port->write( l );
+ pulseLow( _lcd_pin_wr );
+
+//New
+ _lcd_pin_cs = HIGH;
+//
+}
+
+void ILI9328_LCD::WriteData( unsigned short data )
+{
+ unsigned short u,l;
+ u = (data>>8) & 0xFF;
+ l = data & 0xFF;
+
+//New
+ _lcd_pin_cs = LOW;
+//
+ _lcd_pin_rs = HIGH;
+//New
+ *_lcd_pin_rd = HIGH;
+ _lcd_pin_wr = HIGH;
+//
+ _lcd_port->write( u );
+ pulseLow( _lcd_pin_wr );
+
+ _lcd_port->write( l );
+ pulseLow( _lcd_pin_wr );
+
+//New
+ _lcd_pin_cs = HIGH;
+//
+}
+
+void ILI9328_LCD::SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 )
+{
+ switch ( _orientation )
+ {
+ case LANDSCAPE:
+ case LANDSCAPE_REV:
+ WriteCmdData( 0x20, y1 );
+ WriteCmdData( 0x21, x1 );
+ WriteCmdData( 0x50, y1 );
+ WriteCmdData( 0x52, x1 );
+ WriteCmdData( 0x51, y2 );
+ WriteCmdData( 0x53, x2 );
+ break;
+
+ case PORTRAIT_REV:
+ case PORTRAIT:
+ default:
+ WriteCmdData( 0x20, x1 );
+ WriteCmdData( 0x21, y1 );
+ WriteCmdData( 0x50, x1 );
+ WriteCmdData( 0x52, y1 );
+ WriteCmdData( 0x51, x2 );
+ WriteCmdData( 0x53, y2 );
+ break;
+ }
+ WriteCmd( 0x22 );
+}
+
+void ILI9328_LCD::SetPixelColor( unsigned int color, colordepth_t mode )
+{
+ unsigned char r, g, b;
+ unsigned short clr;
+ r = g = b = 0;
+ if ( _colorDepth == RGB16 )
+ {
+ switch ( mode )
+ {
+ case RGB16:
+ WriteData( color & 0xFFFF );
+ break;
+ case RGB18:
+ r = ( color >> 10 ) & 0xF8;
+ g = ( color >> 4 ) & 0xFC;
+ b = ( color >> 1 ) & 0x1F;
+ clr = ( ( r | ( g >> 5 ) ) << 8 ) | ( ( g << 3 ) | b );
+ WriteData( clr );
+ break;
+ case RGB24:
+ r = ( color >> 16 ) & 0xF8;
+ g = ( color >> 8 ) & 0xFC;
+ b = color & 0xF8;
+ clr = ( ( r | ( g >> 5 ) ) << 8 ) | ( ( g << 3 ) | ( b >> 3 ) );
+ WriteData( clr );
+ break;
+ }
+ }
+ else if ( _colorDepth == RGB18 )
+ {
+ switch ( mode )
+ {
+ case RGB16:
+ r = ( ( color >> 8 ) & 0xF8 ) | ( ( color & 0x8000 ) >> 13 );
+ g = ( color >> 3 ) & 0xFC;
+ b = ( ( color << 3 ) & 0xFC ) | ( ( color >> 3 ) & 0x01 );
+ break;
+ case RGB18:
+ b = ( color << 2 ) & 0xFC;
+ g = ( color >> 4 ) & 0xFC;
+ r = ( color >> 10 ) & 0xFC;
+ break;
+ case RGB24:
+ r = ( color >> 16 ) & 0xFC;
+ g = ( color >> 8 ) & 0xFC;
+ b = color & 0xFC;
+ break;
+ }
+ clr = ( r << 8 ) | ( g << 2 ) | ( b >> 4 );
+ WriteData( clr );
+ WriteData( b << 4 );
+ }
+}
diff -r 060b167a46ba -r ede1a0a32e04 ili9328.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ili9328.h Wed Nov 09 09:33:04 2016 +0000
@@ -0,0 +1,186 @@
+/** \file ili9328.h
+ * \brief mbed LCD driver for displays with the ILI9328 controller.
+ * \copyright GNU Public License, v2. or later
+ *
+ * This library is based on the Arduino/chipKIT UTFT library by Henning
+ * Karlsen, http://henningkarlsen.com/electronics/library.php?id=52
+ *
+ * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
+ *
+ * Copyright (C)2012-2013 Todor Todorov.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to:
+ *
+ * Free Software Foundation, Inc.
+ * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
+ *
+ *********************************************************************/
+#ifndef TFTLCD_ILI9328_H
+#define TFTLCD_ILI9328_H
+
+#include "lcd_base.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Represents a LCD instance.
+ *
+ * This is the utility class, through which the display can be manipulated
+ * and graphics objects can be shown to the user. A known display, which
+ * works with this library is the INANBO-T24-ILI9328-V11 - a RGB TFT
+ * with 240x320 pixels resolution and 65K/262K colors, using 8/16-bit interface.
+ *
+ * The display works with a supply voltage of 2.8-3.3 volts for both logic and
+ * backlight. It can be driven in 8bit or 16bit interface mode. (Current
+ * version of the driver works only in 16bit mode for now.)
+ *
+ * How to use:
+ * \code
+ * // include the library, this will also pull in the header for the provided fonts
+ * #include "ili9328.h"
+ *
+ * // prepare the data bus for writing commands and pixel data
+ * BusOut dataBus( p30, p29, p28, p27, p26, p25, p24, p23, p22, p21, p20, p19, p18, p17, p16, p15 ); // 16 pins
+ * // create the lcd instance
+ * ILI9328_LCD lcd( p14, p13, p12, p11, &dataBus ); // control pins and data bus
+ *
+ * int main()
+ * {
+ * // initialize display - place it in standard portrait mode and set background to black and
+ * // foreground to white color.
+ * lcd.Initialize();
+ * // print something on the screen
+ * lcd.Print( "Hello, World!", CENTER, 25 ); // align text to center horizontally and use starndard colors
+ *
+ * while ( 1 ) { }
+ * }
+ *
+ * \endcode
+ * \version 0.1
+ * \author Todor Todorov
+ */
+class ILI9328_LCD : public LCD
+{
+public:
+ /** Creates a new instance of the class.
+ *
+ * \param CS Pin for the ChipSelect signal.
+ * \param RESET Pin for the RESET line.
+ * \param RS Pin for the RS signal.
+ * \param WR Pin for the WR signal.
+ * \param DATA_PORT Address of the data bus for transfer of commands and pixel data.
+ * \param BL Pin for controlling the backlight. By default not used.
+ * \param RD Pin for the RD signal. This line is not needed by the driver, so if you would like to
+ * use the pin on the mbed for something else, just pull-up the respective pin on the LCD high,
+ * and do not assign a value to this parameter when creating the controller instance.
+ * \param blType The backlight type, the default is to utilize the pin - if supplied - as a simple on/off switch
+ * \param defaultBacklightLevel If using PWM to control backlight, this would be the default brightness in percent after LCD initialization.
+ */
+ ILI9328_LCD( PinName CS, PinName RESET, PinName RS, PinName WR, BusOut* DATA_PORT, PinName BL = NC, PinName RD = NC, backlight_t blType = Constant, float defaultBackLightLevel = 1.0 );
+
+ /** Initialize display.
+ *
+ * Wakes up the display from sleep, initializes power parameters.
+ * This function must be called first, befor any painting on the
+ * display is done, otherwise the positioning of graphical elements
+ * will not work properly and any paynt operation will not be visible
+ * or produce garbage.
+ *
+ * \param oritentation The display orientation, landscape is default.
+ * \param colors The correct color depth to use for the pixel data. Value is disregarded.
+ */
+ virtual void Initialize( orientation_t orientation = LANDSCAPE, colordepth_t colors = RGB16 );
+
+ /** Puts the display to sleep.
+ *
+ * When the display is in sleep mode, its power consumption is
+ * minimized. Before new pixel data can be written to the display
+ * memory, the controller needs to be brought out of sleep mode.
+ * \sa #WakeUp( void );
+ * \remarks The result of this operation might not be exactly as
+ * expected. Putting the display to sleep will cause the
+ * controller to switch to the standard color of the LCD,
+ * so depending on whether the display is normally white,
+ * or normally dark, the screen might or might not go
+ * dark. Additional power saving can be achieved, if
+ * the backlight of the used display is not hardwired on
+ * the PCB and can be controlled via the BL pin.
+ */
+ virtual void Sleep( void );
+
+ /** Wakes up the display from sleep mode.
+ *
+ * This function needs to be called before any other, when the
+ * display has been put into sleep mode by a previois call to
+ * #Sleep( void ).
+ */
+ virtual void WakeUp( void );
+
+protected:
+ /** Sends a command to the display.
+ *
+ * \param cmd The display command.
+ * \remarks Commands are controller-specific and this function needs to
+ * be implemented separately for each available controller.
+ */
+ virtual void WriteCmd( unsigned short cmd );
+
+ /** Sends pixel data to the display.
+ *
+ * \param data The display data.
+ * \remarks Sending data is controller-specific and this function needs to
+ * be implemented separately for each available controller.
+ */
+ virtual void WriteData( unsigned short data );
+
+ /** Assigns a chunk of the display memory to receive data.
+ *
+ * When data is sent to the display after this function completes, the opertion will
+ * start from the begining of the assigned address (pixel position) and the pointer
+ * will be automatically incremented so that the next data write operation will continue
+ * with the next pixel from the memory block. If more data is written than available
+ * pixels, at the end of the block the pointer will jump back to its beginning and
+ * commence again, until the next address change command is sent to the display.
+ *
+ * \param x1 The X coordinate of the pixel at the beginning of the block.
+ * \param y1 The Y coordinate of the pixel at the beginning of the block.
+ * \param x2 The X coordinate of the pixel at the end of the block.
+ * \param y2 The Y coordinate of the pixel at the end of the block.
+ * \remarks Addressing commands are controller-specific and this function needs to be
+ * implemented separately for each available controller.
+ */
+ virtual void SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 );
+
+ /** Sets the color of the pixel at the address pointer of the controller.
+ *
+ * This function is to be provided by each implementation separately in
+ * order to account for different color depth used by the controller.
+ * \param color The color of the pixel.
+ * \param mode The depth (palette) of the color.
+ */
+ virtual void SetPixelColor( unsigned int color, colordepth_t mode = RGB24 );
+
+private:
+ DigitalOut _lcd_pin_wr;
+ BusOut* _lcd_port;
+ DigitalOut* _lcd_pin_bl;
+ DigitalOut* _lcd_pin_rd;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TFTLCD_ILI9328_H */
diff -r 060b167a46ba -r ede1a0a32e04 lcd_base.cpp
--- a/lcd_base.cpp Mon Jun 30 17:29:42 2014 +0000
+++ b/lcd_base.cpp Wed Nov 09 09:33:04 2016 +0000
@@ -21,13 +21,14 @@
*********************************************************************/
#include "lcd_base.h"
#include "helpers.h"
-
+
LCD::LCD( unsigned short width, unsigned short height ,PinName CS, PinName RS, PinName RESET, PinName BL, backlight_t blType, float defaultBacklight )
: _disp_width( width ), _disp_height( height ), _lcd_pin_cs( CS ), _lcd_pin_rs( RS ), _lcd_pin_reset( RESET ), _bl_type( blType )
{
SetForeground();
SetBackground();
- _font = &TerminusFont;
+// _font = &TerminusFont;
+ _font = &TerminusBigFont;
if ( defaultBacklight < 0 ) _bl_pwm_default = 0;
else if ( defaultBacklight > 1.0 ) _bl_pwm_default = 1.0;
else _bl_pwm_default = defaultBacklight;
@@ -55,7 +56,7 @@
_bl_pwm = 0;
}
}
-
+
void LCD::Sleep( void )
{
if ( _lcd_pin_bl != 0 )
@@ -63,7 +64,7 @@
else if ( _bl_pwm != 0 )
*_bl_pwm = 0;
}
-
+
void LCD::WakeUp( void )
{
if ( _lcd_pin_bl != 0 )
@@ -71,52 +72,54 @@
else if ( _bl_pwm != 0 )
*_bl_pwm = _bl_pwm_current;
}
-
+
inline
void LCD::SetForeground( unsigned int color )
{
_foreground = color;
}
-
+
inline
void LCD::SetBackground( unsigned int color )
{
_background = color;
}
-
+
void LCD::SetFont( const font_t *font )
{
_font = font;
}
-
-inline
+
+//inline
+unsigned short LCD::GetHeight( void )
+{
+ if ( _orientation == LANDSCAPE || _orientation == LANDSCAPE_REV ) return _disp_width;
+ return _disp_height;
+}
+
+
+//inline
unsigned short LCD::GetWidth( void )
{
if ( _orientation == LANDSCAPE || _orientation == LANDSCAPE_REV ) return _disp_height;
return _disp_width;
}
-
-inline
-unsigned short LCD::GetHeight( void )
-{
- if ( _orientation == LANDSCAPE || _orientation == LANDSCAPE_REV ) return _disp_width;
- return _disp_height;
-}
-
-inline
+
+
+//inline
uint8_t LCD::GetFontWidth( void )
{
if ( _font != 0 ) return _font->Width;
return 0;
}
-
+
inline
uint8_t LCD::GetFontHeight( void )
{
if ( _font != 0 ) return _font->Height;
return 0;
}
-
+
void LCD::SetBacklightLevel( float level )
{
switch ( _bl_type )
@@ -136,7 +139,7 @@
break;
}
}
-
+
void LCD::FillScreen( int color )
{
unsigned int rgb = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
@@ -146,13 +149,13 @@
SetPixelColor( rgb );
Deactivate();
}
-
+
inline
void LCD::ClearScreen( void )
{
FillScreen( -1 );
}
-
+
void LCD::DrawPixel( unsigned short x, unsigned short y, int color )
{
Activate();
@@ -161,12 +164,12 @@
color == -2 ? _foreground : color );
Deactivate();
}
-
+
void LCD::DrawLine( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
{
double delta, tx, ty;
-
+
if ( ( ( x2 - x1 ) < 0 ) )
{
swap( ushort, x1, x2 )
@@ -177,7 +180,7 @@
swap( ushort, x1, x2 )
swap( ushort, y1, y2 )
}
-
+
if ( y1 == y2 )
{
if ( x1 > x2 )
@@ -243,23 +246,84 @@
Deactivate();
}
}
-
+void LCD::DrawTriangle( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned short x3, unsigned short y3, int color )
+{
+// if ( x1 > x2 ) swap( ushort, x1, x2 )
+// if ( y1 > y2 ) swap( ushort, y1, y2 )
+
+ DrawLine( x1, y1, x2, y2, color );
+ DrawLine( x2, y2, x3, y3, color );
+ DrawLine( x3, y3, x1, y1, color );
+}
+
+void LCD::FillTriangle( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned short x3, unsigned short y3, int color )
+{
+ int dx1, dx2, dx3;
+ int sx1, sx2, sy;
+
+
+ if ( y1 > y2 ) { swap( ushort, y1, y2 ); swap( ushort, x1, x2 ); }
+ if ( y2 > y3 ) { swap( ushort, y3, y2 ); swap( ushort, x3, x2 ); }
+ if ( y1 > y2 ) { swap( ushort, y1, y2 ); swap( ushort, x1, x2 ); }
+
+ sx2= x1 * 1000; // Use fixed point math for x axis values
+ sx1 = sx2;
+ sy=y1;
+
+ // Calculate interpolation deltas
+ if (y2-y1 > 0) dx1=((x2-x1)*1000)/(y2-y1);
+ else dx1=0;
+ if (y3-y1 > 0) dx2=((x3-x1)*1000)/(y3-y1);
+ else dx2=0;
+ if (y3-y2 > 0) dx3=((x3-x2)*1000)/(y3-y2);
+ else dx3=0;
+
+ // Render scanlines (horizontal lines are the fastest rendering method)
+ if (dx1 > dx2)
+ {
+ for(; sy<=y2; sy++, sx1+=dx2, sx2+=dx1)
+ {
+ DrawHLine(sx1/1000, sy, (sx2-sx1)/1000, color);
+ }
+ sx2 = x2*1000;
+ sy = y2;
+ for(; sy<=y3; sy++, sx1+=dx2, sx2+=dx3)
+ {
+ DrawHLine(sx1/1000, sy, (sx2-sx1)/1000, color);
+ }
+ }
+ else
+ {
+ for(; sy<=y2; sy++, sx1+=dx1, sx2+=dx2)
+ {
+ DrawHLine(sx1/1000, sy, (sx2-sx1)/1000, color);
+ }
+ sx1 = x2*1000;
+ sy = y2;
+ for(; sy<=y3; sy++, sx1+=dx3, sx2+=dx2)
+ {
+ DrawHLine(sx1/1000, sy, (sx2-sx1)/1000, color);
+ }
+ }
+
+}
+
void LCD::DrawRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
{
if ( x1 > x2 ) swap( ushort, x1, x2 )
if ( y1 > y2 ) swap( ushort, y1, y2 )
-
+
DrawHLine( x1, y1, x2 - x1, color );
DrawHLine( x1, y2, x2 - x1, color );
DrawVLine( x1, y1, y2 - y1, color );
DrawVLine( x2, y1, y2 - y1, color );
}
-
+
void LCD::DrawRoundRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
{
if ( x1 > x2 ) swap( ushort, x1, x2 )
if ( y1 > y2 ) swap( ushort, y1, y2 )
-
+
if ( ( x2 - x1 ) > 4 && ( y2 - y1 ) > 4 )
{
DrawPixel( x1 + 1, y1 + 1, color );
@@ -272,24 +336,24 @@
DrawVLine( x2, y1 + 2, y2 - y1 - 4, color );
}
}
-
+
void LCD::FillRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
{
if ( x1 > x2 ) swap( ushort, x1, x2 );
if ( y1 > y2 ) swap( ushort, y1, y2 );
-
+
for ( int i = 0; i < ( ( y2 - y1 ) / 2 ) + 1; i++ )
{
DrawHLine( x1, y1 + i, x2 - x1, color );
DrawHLine( x1, y2 - i, x2 - x1, color );
}
}
-
+
void LCD::FillRoundRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
{
if ( x1 > x2 ) swap( ushort, x1, x2 )
if ( y1 > y2 ) swap( ushort, y1, y2 )
-
+
if ( ( x2 - x1 ) > 4 && ( y2 - y1 ) > 4 )
{
for ( int i = 0; i < ( ( y2 - y1 ) / 2 ) + 1; i++ )
@@ -300,12 +364,12 @@
DrawHLine( x1 + 2, y1 + i, x2 - x1 - 4, color );
DrawHLine( x1 + 2, y2 - i, x2 - x1 - 4, color );
break;
-
+
case 1:
DrawHLine( x1 + 1, y1 + i, x2 - x1 - 2, color );
DrawHLine( x1 + 1, y2 - i, x2 - x1 - 2, color );
break;
-
+
default:
DrawHLine( x1, y1 + i, x2 - x1, color );
DrawHLine( x1, y2 - i, x2 - x1, color );
@@ -314,7 +378,7 @@
}
}
}
-
+
void LCD::DrawCircle( unsigned short x, unsigned short y, unsigned short radius, int color )
{
int f = 1 - radius;
@@ -323,7 +387,7 @@
int x1 = 0;
int y1 = radius;
unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
-
+
Activate();
SetXY( x, y + radius, x, y + radius );
SetPixelColor( usedColor );
@@ -333,7 +397,7 @@
SetPixelColor( usedColor );
SetXY( x - radius, y, x - radius, y );
SetPixelColor( usedColor );
-
+
while ( x1 < y1 )
{
if ( f >= 0 )
@@ -364,7 +428,7 @@
}
Deactivate();
}
-
+
void LCD::FillCircle( unsigned short x, unsigned short y, unsigned short radius, int color )
{
unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
@@ -378,34 +442,34 @@
}
Deactivate();
}
-
+
void LCD::Print( const char *str, unsigned short x, unsigned short y, int fgColor, int bgColor, unsigned short deg )
{
int stl, i;
-
+
stl = strlen( str );
-
+
if ( x == RIGHT )
x = GetWidth() - ( stl * _font->Width );
if ( x == CENTER )
x = ( GetWidth() - ( stl * _font->Width ) ) / 2;
-
+
for ( i = 0; i < stl; i++ )
if ( deg == 0 )
PrintChar( *str++, x + ( i * ( _font->Width ) ), y, fgColor, bgColor );
else
RotateChar( *str++, x, y, i, fgColor, bgColor, deg );
}
-
+
void LCD::DrawBitmap( unsigned short x, unsigned short y, const bitmap_t* img, unsigned char scale )
{
int tx, ty, tc, tsx, tsy;
-
+
Activate();
if ( scale == 1 )
{
SetXY( x, y, x + img->Width - 1, y + img->Height - 1 );
-
+
if ( img->Format == RGB16 )
{
const unsigned short *pixel = ( const unsigned short* ) img->PixelData;
@@ -458,13 +522,13 @@
}
Deactivate();
}
-
+
void LCD::DrawBitmap( unsigned short x, unsigned short y, const bitmap_t* img, unsigned short deg, unsigned short rox, unsigned short roy )
{
int tx, ty, newx, newy;
double radian;
radian = deg * 0.0175;
-
+
if ( deg == 0 )
DrawBitmap( x, y, img );
else
@@ -502,32 +566,32 @@
Deactivate();
}
}
-
+
inline
void LCD::Activate( void )
{
_lcd_pin_cs = LOW;
}
-
+
inline
void LCD::Deactivate( void )
{
_lcd_pin_cs = HIGH;
}
-
+
inline
void LCD::WriteCmdData( unsigned short cmd, unsigned short data )
{
WriteCmd( cmd );
WriteData( data );
}
-
+
inline
void LCD::ClearXY( void )
{
SetXY( 0, 0, GetWidth() - 1, GetHeight() - 1 );
}
-
+
void LCD::DrawHLine( unsigned short x, unsigned short y, unsigned short len, int color )
{
unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
@@ -538,7 +602,7 @@
SetPixelColor( usedColor );
Deactivate();
}
-
+
void LCD::DrawVLine( unsigned short x, unsigned short y, unsigned short len, int color )
{
unsigned int usedColor = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
@@ -549,7 +613,7 @@
SetPixelColor( usedColor );
Deactivate();
}
-
+
void LCD::PrintChar( char c, unsigned short x, unsigned short y, int fgColor, int bgColor )
{
uint8_t i, ch;
@@ -562,7 +626,7 @@
if ( position == -1 ) position = 0; // will print space character
Activate();
-
+
SetXY( x, y, x + _font->Width - 1, y + _font->Height - 1 );
for ( j = 0; j < totalCharBytes; j++ )
@@ -577,7 +641,7 @@
}
Deactivate();
}
-
+
void LCD::RotateChar( char c, unsigned short x, unsigned short y, int pos, int fgColor, int bgColor, unsigned short deg )
{
uint8_t i, j, ch;
@@ -587,7 +651,7 @@
unsigned int usedColorFG = fgColor == -1 ? _background : fgColor == -2 ? _foreground : ( unsigned int ) fgColor;
unsigned int usedColorBG = bgColor == -1 ? _background : bgColor == -2 ? _foreground : ( unsigned int ) bgColor;
-
+
int16_t position = _font->Position[ c - _font->Offset ];
if ( position == -1 ) position = 0; // will print space character
@@ -602,15 +666,15 @@
{
newx = x + ( ( ( i + ( zz * 8 ) + ( pos * _font->Width ) ) * cos( radian ) ) - ( ( j ) * sin( radian ) ) );
newy = y + ( ( ( j ) * cos( radian ) ) + ( ( i + ( zz * 8 ) + ( pos * _font->Width ) ) * sin( radian ) ) );
-
+
SetXY( newx, newy, newx + 1, newy + 1 );
-
+
if ( ( ch & ( 1 << ( 7 - i ) ) ) != 0 ) SetPixelColor( usedColorFG );
else SetPixelColor( usedColorBG );
}
}
position += ( _font->Width / 8 );
}
-
+
Deactivate();
-}
+}
\ No newline at end of file
diff -r 060b167a46ba -r ede1a0a32e04 lcd_base.h
--- a/lcd_base.h Mon Jun 30 17:29:42 2014 +0000
+++ b/lcd_base.h Wed Nov 09 09:33:04 2016 +0000
@@ -30,14 +30,14 @@
*********************************************************************/
#ifndef TFTLCD_BASE_H
#define TFTLCD_BASE_H
-
+
#include "mbed.h"
#include "terminus.h"
-
+
#ifdef __cplusplus
extern "C" {
#endif
-
+
/** \def RGB(r,g,b)
* \brief Creates a RGB color from distinct bytes for the red, green and blue components.
*
@@ -81,8 +81,8 @@
* \brief Shorthand for RGB( 255, 255, 0 )
*/
#define COLOR_YELLOW RGB( 0xFF, 0xFF, 0x00 )
-
-
+
+
/** \enum Orientation_enum
* \brief Display orientation.
*/
@@ -97,7 +97,7 @@
* \brief Convenience shortcut for display orientation.
*/
typedef enum Orientation_enum orientation_t;
-
+
/** \enum ColorDepth_enum
* \brief Color depth
*/
@@ -111,7 +111,7 @@
* \brief Convenience shortcut for display color depth.
*/
typedef enum ColorDepth_enum colordepth_t;
-
+
/** \enum Alignment_enum
* \brief Horizontal text alignment on the line.
*/
@@ -125,7 +125,7 @@
* \brief Convenience shortcut for text alignment.
*/
typedef enum Alignment_enum align_t;
-
+
///** \struct Font_struct
// * \brief Describes fonts and their properties.
// * \sa Comments in fonts.h
@@ -142,7 +142,7 @@
// * \brief Convenience shortcut for fonts properties.
// */
//typedef struct Font_struct font_metrics_t;
-
+
/** \struct Bitmap_struct
* \brief Describes an image.
*/
@@ -157,7 +157,7 @@
* \brief Convenience shortcut bitmap type.
*/
typedef struct Bitmap_struct bitmap_t;
-
+
/** \struct BacklightPwmCtrl_enum
* \brief Type of backlight control for the LCD.
*
@@ -185,8 +185,8 @@
* \brief Convenience shortcut for the backlight control type.
*/
typedef BacklightPwmCtrl_enum backlight_t;
-
-
+
+
/** Base class for LCD implementations.
*
* All separate LCD controller implementations have to subclass this one.
@@ -197,7 +197,7 @@
class LCD
{
public:
-
+
/** Initialize display.
*
* Wakes up the display from sleep, initializes power parameters.
@@ -340,6 +340,33 @@
* \param color The color to use for painting. -1 indicated background, -2 foreground, or custom color.
*/
virtual void DrawRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color = -2 );
+
+ /** Paints a Triangle.
+ *
+ * \param x1
+ * \param y1
+ * \param x2
+ * \param y2
+ * \param x3
+ * \param y3
+ * \param color The color to use for painting. -1 indicated background, -2 foreground, or custom color.
+ */
+ virtual void DrawTriangle( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned short x3, unsigned short y3, int color = -2 );
+
+ /** Draw a Triangle and fill the color.
+ *
+ * \param x1
+ * \param y1
+ * \param x2
+ * \param y2
+ * \param x3
+ * \param y3
+ * \param color The color to use for painting. -1 indicated background, -2 foreground, or custom color.
+ */
+
+
+ virtual void FillTriangle( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned short x3, unsigned short y3, int color = -2 );
+
/** Paints a rectangle and fills it with the paint color.
*
@@ -567,7 +594,7 @@
* \param deg The angle at which to rotate.
*/
virtual void RotateChar( char c, unsigned short x, unsigned short y, int pos, int fgColor = -2, int bgColor = -1, unsigned short deg = 0 );
-
+
protected:
unsigned short _disp_width, _disp_height;
DigitalOut _lcd_pin_cs, _lcd_pin_rs, _lcd_pin_reset;
@@ -580,9 +607,9 @@
backlight_t _bl_type;
float _bl_pwm_default, _bl_pwm_current;
};
-
+
#ifdef __cplusplus
}
#endif
-
-#endif /* TFTLCD_BASE_H */
+
+#endif /* TFTLCD_BASE_H */
\ No newline at end of file
diff -r 060b167a46ba -r ede1a0a32e04 ssd1289.cpp
--- a/ssd1289.cpp Mon Jun 30 17:29:42 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +0,0 @@
-/*
- * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
- * Copyright (C)2012 Todor Todorov.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to:
- *
- * Free Software Foundation, Inc.
- * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
- *
- *********************************************************************/
-#include "ssd1289.h"
-#include "helpers.h"
-
-SSD1289_LCD::SSD1289_LCD( PinName CS, PinName RESET, PinName RS, PinName WR, BusOut* DATA_PORT, PinName BL, PinName RD, backlight_t blType, float defaultBackLightLevel )
- : LCD( 240, 320, CS, RS, RESET, BL, blType, defaultBackLightLevel ), _lcd_pin_wr( WR )
-{
- _lcd_port = DATA_PORT;
- if ( RD != NC ) _lcd_pin_rd = new DigitalOut( RD );
- else _lcd_pin_rd = 0;
-}
-
-void SSD1289_LCD::Initialize( orientation_t orientation, colordepth_t colors )
-{
- _orientation = orientation;
- _colorDepth = colors;
-
- _lcd_pin_reset = HIGH;
- wait_ms( 5 );
- _lcd_pin_reset = LOW;
- wait_ms( 15 );
- _lcd_pin_reset = HIGH;
- _lcd_pin_cs = HIGH;
- if ( _lcd_pin_bl != 0 )
- *_lcd_pin_bl = HIGH;
- else if ( _bl_pwm != 0 )
- *_bl_pwm = _bl_pwm_default;
- if ( _lcd_pin_rd != 0 )
- *_lcd_pin_rd = HIGH;
- _lcd_pin_wr = HIGH;
- wait_ms( 15 );
-
- Activate();
- WriteCmdData( 0x00, 0x0001 ); // oscillator: 1 = on, 0 = off
- wait_ms( 1 );
- WriteCmdData( 0x03, 0xA8A4 ); // power control
- wait_ms( 1 );
- WriteCmdData( 0x0C, 0x0000 ); // power control 2
- wait_ms( 1 );
- WriteCmdData( 0x0D, 0x080C ); // power control 3
- wait_ms( 1 );
- WriteCmdData( 0x0E, 0x2B00 ); // power control 4
- wait_ms( 1 );
- WriteCmdData( 0x1E, 0x00B7 ); // power control 5
- wait_ms( 1 );
- WriteCmdData( 0x02, 0x0600 ); // driving waveform control
- wait_ms( 1 );
- WriteCmdData( 0x10, 0x0000 ); // sleep mode: 0 = exit, 1 = enter
- wait_ms( 1 );
- if ( _colorDepth == RGB16 )
- {
- switch ( _orientation )
- {
- case LANDSCAPE: // works
- WriteCmdData( 0x01, 0x293F ); // driver output control
- wait_ms( 1 );
- WriteCmdData( 0x11, 0x6078 ); // entry mode
- break;
-
- case PORTRAIT_REV: // works
- WriteCmdData( 0x01, 0x693F ); // driver output control
- wait_ms( 1 );
- WriteCmdData( 0x11, 0x6070 ); // entry mode
- break;
-
- case LANDSCAPE_REV: // works
- WriteCmdData( 0x01, 0x6B3F ); // driver output control
- wait_ms( 1 );
- WriteCmdData( 0x11, 0x6078 ); // entry mode
- break;
-
- case PORTRAIT: // works
- default:
- WriteCmdData( 0x01, 0x2B3F ); // driver output control
- wait_ms( 1 );
- WriteCmdData( 0x11, 0x6070 ); // entry mode
- break;
- }
- }
- else if ( _colorDepth == RGB18 )
- {
- switch ( _orientation )
- {
- case LANDSCAPE: // works
- WriteCmdData( 0x01, 0x293F ); // driver output control
- wait_ms( 1 );
- WriteCmdData( 0x11, 0x4078 ); // entry mode
- break;
-
- case PORTRAIT_REV: // works
- WriteCmdData( 0x01, 0x693F ); // driver output control
- wait_ms( 1 );
- WriteCmdData( 0x11, 0x4070 ); // entry mode
- break;
-
- case LANDSCAPE_REV: // works
- WriteCmdData( 0x01, 0x6B3F ); // driver output control
- wait_ms( 1 );
- WriteCmdData( 0x11, 0x4078 ); // entry mode
- break;
-
- case PORTRAIT: // works
- default:
- WriteCmdData( 0x01, 0x2B3F ); // driver output control
- wait_ms( 1 );
- WriteCmdData( 0x11, 0x4070 ); // entry mode
- break;
- }
- }
- wait_ms( 1 );
- WriteCmdData( 0x05, 0x0000 ); // compare register
- wait_ms( 1 );
- WriteCmdData( 0x06, 0x0000 ); // compare register
- wait_ms( 1 );
- WriteCmdData( 0x16, 0xEF1C ); // horizontal porch
- wait_ms( 1 );
- WriteCmdData( 0x17, 0x0003 ); // vertical porch
- wait_ms( 1 );
- WriteCmdData( 0x07, 0x0233 ); // display control
- wait_ms( 1 );
- WriteCmdData( 0x0B, 0x0000 ); // frame cycle control
- wait_ms( 1 );
- WriteCmdData( 0x0F, 0x0000 ); // gate scan position
- wait_ms( 1 );
- WriteCmdData( 0x41, 0x0000 ); // vertical scroll control
- wait_ms( 1 );
- WriteCmdData( 0x42, 0x0000 ); // vertical scroll control
- wait_ms( 1 );
- WriteCmdData( 0x48, 0x0000 ); // 1st screen driving position
- wait_ms( 1 );
- WriteCmdData( 0x49, 0x013F ); // 1st screen driving position
- wait_ms( 1 );
- WriteCmdData( 0x4A, 0x0000 ); // 2nd screen driving position
- wait_ms( 1 );
- WriteCmdData( 0x4B, 0x0000 ); // 2nd screen driving position
- wait_ms( 1 );
- WriteCmdData( 0x44, 0xEF00 ); // horizontal ram address position
- wait_ms( 1 );
- WriteCmdData( 0x45, 0x0000 ); // vertical ram address position
- wait_ms( 1 );
- WriteCmdData( 0x46, 0x013F ); // vertical ram address position
- wait_ms( 1 );
- WriteCmdData( 0x30, 0x0707 ); // gamma control
- wait_ms( 1 );
- WriteCmdData( 0x31, 0x0204 ); // gamma control
- wait_ms( 1 );
- WriteCmdData( 0x32, 0x0204 ); // gamma control
- wait_ms( 1 );
- WriteCmdData( 0x33, 0x0502 ); // gamma control
- wait_ms( 1 );
- WriteCmdData( 0x34, 0x0507 ); // gamma control
- wait_ms( 1 );
- WriteCmdData( 0x35, 0x0204 ); // gamma control
- wait_ms( 1 );
- WriteCmdData( 0x36, 0x0204 ); // gamma control
- wait_ms( 1 );
- WriteCmdData( 0x37, 0x0502 ); // gamma control
- wait_ms( 1 );
- WriteCmdData( 0x3A, 0x0302 ); // gamma control
- wait_ms( 1 );
- WriteCmdData( 0x3B, 0x0302 ); // gamma control
- wait_ms( 1 );
- WriteCmdData( 0x23, 0x0000 ); // GRAM write mask for red and green pins
- wait_ms( 1 );
- WriteCmdData( 0x24, 0x0000 ); // GRAM write mask for blue pins
- wait_ms( 1 );
- WriteCmdData( 0x25, 0x8000 ); // frame frequency control
- wait_ms( 1 );
- WriteCmdData( 0x4e, 0x0000 ); // ram address set
- wait_ms( 1 );
- WriteCmdData( 0x4f, 0x0000 ); // ram address set
- wait_ms( 1 );
- WriteCmd( 0x22 ); // write GRAM
- Deactivate();
-}
-
-void SSD1289_LCD::Sleep( void )
-{
- WriteCmdData( 0x10, 0x0001 ); // sleep mode: 0 = exit, 1 = enter
- LCD::Sleep();
-}
-
-void SSD1289_LCD::WakeUp( void )
-{
- WriteCmdData( 0x10, 0x0000 ); // sleep mode: 0 = exit, 1 = enter
- LCD::WakeUp();
-}
-
-void SSD1289_LCD::WriteCmd( unsigned short cmd )
-{
- _lcd_pin_rs = LOW;
- _lcd_port->write( cmd );
- pulseLow( _lcd_pin_wr );
-}
-
-void SSD1289_LCD::WriteData( unsigned short data )
-{
- _lcd_pin_rs = HIGH;
- _lcd_port->write( data );
- pulseLow( _lcd_pin_wr );
-}
-
-void SSD1289_LCD::SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 )
-{
- if ( _orientation == PORTRAIT || _orientation == PORTRAIT_REV )
- {
- WriteCmdData( 0x44, ( x2 << 8 ) + x1 );
- WriteCmdData( 0x45, y1 );
- WriteCmdData( 0x46, y2 );
- WriteCmdData( 0x4e, x1 );
- WriteCmdData( 0x4f, y1 );
- }
- else
- {
- WriteCmdData( 0x44, ( y2 << 8 ) + y1 );
- WriteCmdData( 0x45, x1 );
- WriteCmdData( 0x46, x2 );
- WriteCmdData( 0x4e, y1 );
- WriteCmdData( 0x4f, x1 );
- }
- WriteCmd( 0x22 );
-}
-
-void SSD1289_LCD::SetPixelColor( unsigned int color, colordepth_t mode )
-{
- unsigned char r, g, b;
- unsigned short clr;
- if ( _colorDepth == RGB16 )
- {
- switch ( mode )
- {
- case RGB16:
- WriteData( color & 0xFFFF );
- break;
- case RGB18:
- r = ( color >> 10 ) & 0xF8;
- g = ( color >> 4 ) & 0xFC;
- b = ( color >> 1 ) & 0x1F;
- clr = ( ( r | ( g >> 5 ) ) << 8 ) | ( ( g << 3 ) | b );
- WriteData( clr );
- break;
- case RGB24:
- r = ( color >> 16 ) & 0xF8;
- g = ( color >> 8 ) & 0xFC;
- b = color & 0xF8;
- clr = ( ( r | ( g >> 5 ) ) << 8 ) | ( ( g << 3 ) | ( b >> 3 ) );
- WriteData( clr );
- break;
- }
- }
- else if ( _colorDepth == RGB18 )
- {
- switch ( mode )
- {
- case RGB16:
- r = ( ( color >> 8 ) & 0xF8 ) | ( ( color & 0x8000 ) >> 13 );
- g = ( color >> 3 ) & 0xFC;
- b = ( ( color << 3 ) & 0xFC ) | ( ( color >> 3 ) & 0x01 );
- WriteData( ( r << 8 ) | g );
- WriteData( b );
- break;
- case RGB18:
- b = ( color << 2 ) & 0xFC;
- g = ( color >> 4 ) & 0xFC;
- r = ( color >> 10 ) & 0xFC;
- WriteData( ( r << 8 ) | g );
- WriteData( b );
- break;
- case RGB24:
- r = ( color >> 16 ) & 0xFC;
- g = ( color >> 8 ) & 0xFC;
- b = color & 0xFC;
- WriteData( ( r << 8 ) | g );
- WriteData( b );
- break;
- }
- }
-}
diff -r 060b167a46ba -r ede1a0a32e04 ssd1289.h
--- a/ssd1289.h Mon Jun 30 17:29:42 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/** \file ssd1289.h
- * \brief mbed TFT LCD controller for displays with the SSD1289 IC.
- * \copyright GNU Public License, v2. or later
- *
- * A known display with this type of controller chip is the ITDB02-3.2S
- * from http://imall.iteadstudio.com
- *
- * This library is based on the Arduino/chipKIT UTFT library by Henning
- * Karlsen, http://henningkarlsen.com/electronics/library.php?id=52
- *
- * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
- *
- * Copyright (C)2012 Todor Todorov.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to:
- *
- * Free Software Foundation, Inc.
- * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
- *
- *********************************************************************/
-#ifndef TFTLCD_SSD1289_H
-#define TFTLCD_SSD1289_H
-
-#include "lcd_base.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Represents a LCD instance.
- *
- * This is the utility class, through which the display can be manipulated
- * and graphics objects can be shown to the user. A known display, which
- * works with this library is the ITDB02-3.2S from iTeadStudio - a RGB TFT
- * with 240x320 pixels resolution and 65K colors, using 16-bit interface.
- *
- * The display needs 20 to 22 pins to work with mbed, so it is possibly not
- * the best of choices out there, but other than that it uses +3.3V for
- * power and logic, as well as the backlight, thus can be interfaced directly
- * to the mbed without the need of shields or level shifters as with Arduino.
- *
- * How to use:
- * \code
- * // include the library, this will also pull in the header for the provided fonts
- * #include "ssd1289.h"
- *
- * // prepare the data bus for writing commands and pixel data
- * BusOut dataBus( p30, p29, p28, p27, p26, p25, p24, p23, p22, p21, p20, p19, p18, p17, p16, p15 ); // 16 pins
- * // create the lcd instance
- * SSD1289_LCD lcd( p14, p13, p12, p11, &dataBus ); // control pins and data bus
- *
- * int main()
- * {
- * // initialize display - place it in standard portrait mode and set background to black and
- * // foreground to white color.
- * lcd.Initialize();
- * // set current font to the smallest 8x12 pixels font.
- * lcd.SetFont( Font8x12 );
- * // print something on the screen
- * lcd.Print( "Hello, World!", CENTER, 25 ); // align text to center horizontally and use starndard colors
- *
- * while ( 1 ) { }
- * }
- *
- * \endcode
- * \version 0.1
- * \author Todor Todorov
- */
-class SSD1289_LCD : public LCD
-{
-public:
- /** Creates a new instance of the class.
- *
- * \param CS Pin for the ChipSelect signal.
- * \param RESET Pin for the RESET line.
- * \param RS Pin for the RS signal.
- * \param WR Pin for the WR signal.
- * \param DATA_PORT Address of the data bus for transfer of commands and pixel data.
- * \param BL Pin for controlling the backlight. By default not used.
- * \param RD Pin for the RD signal. This line is not needed by the driver, so if you would like to
- * use the pin on the mbed for something else, just pull-up the respective pin on the LCD high,
- * and do not assign a value to this parameter when creating the controller instance.
- * \param blType The backlight type, the default is to utilize the pin - if supplied - as a simple on/off switch
- * \param defaultBacklightLevel If using PWM to control backlight, this would be the default brightness in percent after LCD initialization.
- */
- SSD1289_LCD( PinName CS, PinName RESET, PinName RS, PinName WR, BusOut* DATA_PORT, PinName BL = NC, PinName RD = NC, backlight_t blType = Constant, float defaultBackLightLevel = 1.0 );
-
- /** Initialize display.
- *
- * Wakes up the display from sleep, initializes power parameters.
- * This function must be called first, befor any painting on the
- * display is done, otherwise the positioning of graphical elements
- * will not work properly and any paynt operation will not be visible
- * or produce garbage.
- *
- * \param oritentation The display orientation, landscape is default.
- * \param colors The correct color depth to use for the pixel data. Value is disregarded.
- */
- virtual void Initialize( orientation_t orientation = LANDSCAPE, colordepth_t colors = RGB16 );
-
- /** Puts the display to sleep.
- *
- * When the display is in sleep mode, its power consumption is
- * minimized. Before new pixel data can be written to the display
- * memory, the controller needs to be brought out of sleep mode.
- * \sa #WakeUp( void );
- * \remarks The result of this operation might not be exactly as
- * expected. Putting the display to sleep will cause the
- * controller to switch to the standard color of the LCD,
- * so depending on whether the display is normally white,
- * or normally dark, the screen might or might not go
- * dark. Additional power saving can be achieved, if
- * the backlight of the used display is not hardwired on
- * the PCB and can be controlled via the BL pin.
- */
- virtual void Sleep( void );
-
- /** Wakes up the display from sleep mode.
- *
- * This function needs to be called before any other, when the
- * display has been put into sleep mode by a previois call to
- * #Sleep( void ).
- */
- virtual void WakeUp( void );
-
-protected:
- /** Sends a command to the display.
- *
- * \param cmd The display command.
- * \remarks Commands are controller-specific and this function needs to
- * be implemented separately for each available controller.
- */
- virtual void WriteCmd( unsigned short cmd );
-
- /** Sends pixel data to the display.
- *
- * \param data The display data.
- * \remarks Sending data is controller-specific and this function needs to
- * be implemented separately for each available controller.
- */
- virtual void WriteData( unsigned short data );
-
- /** Assigns a chunk of the display memory to receive data.
- *
- * When data is sent to the display after this function completes, the opertion will
- * start from the begining of the assigned address (pixel position) and the pointer
- * will be automatically incremented so that the next data write operation will continue
- * with the next pixel from the memory block. If more data is written than available
- * pixels, at the end of the block the pointer will jump back to its beginning and
- * commence again, until the next address change command is sent to the display.
- *
- * \param x1 The X coordinate of the pixel at the beginning of the block.
- * \param y1 The Y coordinate of the pixel at the beginning of the block.
- * \param x2 The X coordinate of the pixel at the end of the block.
- * \param y2 The Y coordinate of the pixel at the end of the block.
- * \remarks Addressing commands are controller-specific and this function needs to be
- * implemented separately for each available controller.
- */
- virtual void SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 );
-
- /** Sets the color of the pixel at the address pointer of the controller.
- *
- * This function is to be provided by each implementation separately in
- * order to account for different color depth used by the controller.
- * \param color The color of the pixel.
- * \param mode The depth (palette) of the color.
- */
- virtual void SetPixelColor( unsigned int color, colordepth_t mode = RGB24 );
-
-private:
- DigitalOut _lcd_pin_wr;
- BusOut* _lcd_port;
- DigitalOut* _lcd_pin_bl;
- DigitalOut* _lcd_pin_rd;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* TFTLCD_SSD1289_H */
diff -r 060b167a46ba -r ede1a0a32e04 st7735.cpp
--- a/st7735.cpp Mon Jun 30 17:29:42 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,289 +0,0 @@
-/*
- * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
- * Copyright (C)2012 Todor Todorov.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to:
- *
- * Free Software Foundation, Inc.
- * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
- *
- *********************************************************************/
-#include "st7735.h"
-#include "helpers.h"
-
-ST7735_LCD::ST7735_LCD( PinName CS, PinName RESET, PinName RS, PinName SCL, PinName SDA, PinName BL, backlight_t blType, float defaultBackLightLevel )
- : LCD( 128, 160, CS, RS, RESET, BL, blType, defaultBackLightLevel ), _lcd_pin_scl( SCL ), _lcd_pin_sda( SDA )
-{
-}
-
-void ST7735_LCD::Initialize( orientation_t orientation, colordepth_t colors )
-{
- _orientation = orientation;
- _colorDepth = colors;
-
- wait_ms( 100 );
- _lcd_pin_reset = HIGH;
- wait_ms( 5 );
- _lcd_pin_reset = LOW;
- wait_ms( 15 );
- _lcd_pin_reset = HIGH;
- _lcd_pin_cs = HIGH;
- _lcd_pin_rs = HIGH;
- _lcd_pin_scl = HIGH;
- _lcd_pin_sda = HIGH;
- if ( _lcd_pin_bl != 0 )
- *_lcd_pin_bl = HIGH;
- else if ( _bl_pwm != 0 )
- *_bl_pwm = _bl_pwm_default;
- wait_ms( 55 );
-
- Activate();
- WriteCmd( 0x01 ); // SW reset
- wait_ms( 120 );
-
- WriteCmd( 0x11 ); // sleep out
- wait_ms( 120 );
-
- WriteCmd( 0xB1 ); // frame control 1
- WriteByteData( 0x01 );
- WriteByteData( 0x2C );
- WriteByteData( 0x2D );
-
- WriteCmd( 0xB2 ); // frame control 2
- WriteByteData( 0x01 );
- WriteByteData( 0x2C );
- WriteByteData( 0x2D );
-
- WriteCmd( 0xB3 ); // frame control 3
- WriteByteData( 0x01 );
- WriteByteData( 0x2C );
- WriteByteData( 0x2D );
- WriteByteData( 0x01 );
- WriteByteData( 0x2C );
- WriteByteData( 0x2D );
-
- WriteCmd( 0xB4 ); // column inversion
- //WriteByteData( 0x07 );
- WriteByteData( 0x00 );
-
- // ST7735R Power Sequence
- WriteCmd( 0xC0 ); // power control 1
- WriteByteData( 0xA2 );
- WriteByteData( 0x02 );
- WriteByteData( 0x84 );
-
- WriteCmd( 0xC1 ); // power control 2
- WriteByteData( 0xC5 );
-
- WriteCmd( 0xC2 ); // power control 3
- WriteByteData( 0x0A );
- WriteByteData( 0x00 );
-
- WriteCmd( 0xC3 ); // power control 4
- WriteByteData( 0x8A );
- WriteByteData( 0x2A );
-
- WriteCmd( 0xC4 ); // power control 5
- WriteByteData( 0x8A );
- WriteByteData( 0xEE );
-
- WriteCmd( 0xC5 ); // voltage control 1
- WriteByteData( 0x0E );
-
- // ST7735R Gamma Sequence
- WriteCmd( 0xE0 ); // gamma positive
- WriteByteData( 0x0F );
- WriteByteData( 0x1A );
- WriteByteData( 0x0F );
- WriteByteData( 0x18 );
- WriteByteData( 0x2F );
- WriteByteData( 0x28 );
- WriteByteData( 0x20 );
- WriteByteData( 0x22 );
- WriteByteData( 0x1F );
- WriteByteData( 0x1B );
- WriteByteData( 0x23 );
- WriteByteData( 0x37 );
- WriteByteData( 0x00 );
- WriteByteData( 0x07 );
- WriteByteData( 0x02 );
- WriteByteData( 0x10 );
-
- WriteCmd( 0xE1 ); // gamma negative
- WriteByteData( 0x0F );
- WriteByteData( 0x1B );
- WriteByteData( 0x0F );
- WriteByteData( 0x17 );
- WriteByteData( 0x33 );
- WriteByteData( 0x2C );
- WriteByteData( 0x29 );
- WriteByteData( 0x2E );
- WriteByteData( 0x30 );
- WriteByteData( 0x30 );
- WriteByteData( 0x39 );
- WriteByteData( 0x3F );
- WriteByteData( 0x00 );
- WriteByteData( 0x07 );
- WriteByteData( 0x03 );
- WriteByteData( 0x10 );
-
- WriteCmd( 0x2A ); // set column address
- WriteByteData( 0x00 );
- WriteByteData( 0x00 );
- WriteByteData( 0x00 );
- WriteByteData( 0x7F );
-
- WriteCmd( 0x2B ); // set row address
- WriteByteData( 0x00 );
- WriteByteData( 0x00 );
- WriteByteData( 0x00 );
- WriteByteData( 0x9F );
-
- WriteCmd( 0xF0 ); // enable extensions command
- WriteByteData( 0x01 );
-
- WriteCmd( 0xF6 ); // disable ram power save mode
- WriteByteData( 0x00 );
-
- WriteCmd( 0x3A ); // interface pixel format (color mode): 0x05 => RGB16, 0x06 => RGB18
- WriteByteData( _colorDepth == RGB16 ? 0x05 : 0x06 );
-
- WriteCmd( 0x36 ); //MX, MY, RGB mode
- switch ( _orientation )
- {
- case LANDSCAPE: WriteByteData( 0x6C ); break;
- case PORTRAIT_REV: WriteByteData( 0xDC ); break;
- case LANDSCAPE_REV: WriteByteData( 0xB8 ); break;
- case PORTRAIT:
- default: WriteByteData( 0x08 ); break;
- }
-
- WriteCmd( 0x29 ); // display on
-
- Deactivate();
-}
-
-void ST7735_LCD::Sleep( void )
-{
- Activate();
- WriteCmd( 0x28 );
- wait_ms( 10 );
- WriteCmd( 0x10 );
- wait_ms( 125 );
- LCD::Sleep();
- Deactivate();
-}
-
-void ST7735_LCD::WakeUp( void )
-{
- Activate();
- WriteCmd( 0x29 );
- wait_ms( 10 );
- WriteCmd( 0x11 );
- wait_ms( 125 );
- LCD::WakeUp();
- Deactivate();
-}
-
-void ST7735_LCD::WriteCmd( unsigned short cmd )
-{
- _lcd_pin_rs = LOW;
- serializeByte( cmd & 0xFF );
-}
-
-void ST7735_LCD::WriteData( unsigned short data )
-{
- _lcd_pin_rs = HIGH;
- serializeByte( ( data >> 8 ) & 0xFF );
- serializeByte( data & 0xFF );
-}
-
-void ST7735_LCD::WriteByteData( unsigned char data )
-{
- _lcd_pin_rs = HIGH;
- serializeByte( data );
-}
-
-void ST7735_LCD::SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 )
-{
- WriteCmdData( 0x2a, x1 );
- WriteData( x2 );
- WriteCmdData( 0x2b, y1 );
- WriteData( y2 );
- WriteCmd( 0x2c );
-}
-
-void ST7735_LCD::SetPixelColor( unsigned int color, colordepth_t mode )
-{
- unsigned char r = 0, g = 0, b = 0;
- unsigned short clr;
- if ( _colorDepth == RGB16 )
- {
- switch ( mode )
- {
- case RGB16:
- WriteData( color & 0xFFFF );
- break;
- case RGB18:
- r = ( color >> 10 ) & 0xF8;
- g = ( color >> 4 ) & 0xFC;
- b = ( color >> 1 ) & 0x1F;
- clr = ( ( r | ( g >> 5 ) ) << 8 ) | ( ( g << 3 ) | b );
- WriteData( clr );
- break;
- case RGB24:
- r = ( color >> 16 ) & 0xF8;
- g = ( color >> 8 ) & 0xFC;
- b = color & 0xF8;
- clr = ( ( r | ( g >> 5 ) ) << 8 ) | ( ( g << 3 ) | ( b >> 3 ) );
- WriteData( clr );
- break;
- }
- }
- else if ( _colorDepth == RGB18 )
- {
- switch ( mode )
- {
- case RGB16:
- r = ( ( color >> 8 ) & 0xF8 ) | ( ( color & 0x8000 ) >> 13 );
- g = ( color >> 3 ) & 0xFC;
- b = ( ( color << 3 ) & 0xFC ) | ( ( color >> 3 ) & 0x01 );
- break;
- case RGB18:
- b = ( color << 2 ) & 0xFC;
- g = ( color >> 4 ) & 0xFC;
- r = ( color >> 10 ) & 0xFC;
- break;
- case RGB24:
- r = ( color >> 16 ) & 0xFC;
- g = ( color >> 8 ) & 0xFC;
- b = color & 0xFC;
- break;
- }
- WriteByteData( r );
- WriteByteData( g );
- WriteByteData( b );
- }
-}
-
-void ST7735_LCD::serializeByte( unsigned char data )
-{
- for ( int i = 0; i < 8; i++ )
- {
- if ( data & 0x80 ) _lcd_pin_sda = HIGH;
- else _lcd_pin_sda = LOW;
- pulseLow( _lcd_pin_scl );
- data = data << 1;
- }
-}
diff -r 060b167a46ba -r ede1a0a32e04 st7735.h
--- a/st7735.h Mon Jun 30 17:29:42 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/** \file st7735.h
- * \brief mbed TFT LCD controller for displays with the ST7735 IC.
- * \copyright GNU Public License, v2. or later
- *
- * A known display with this type of controller chip is the ITDB02-1.8SP
- * from http://imall.iteadstudio.com
- *
- * This library is based on the Arduino/chipKIT UTFT library by Henning
- * Karlsen, http://henningkarlsen.com/electronics/library.php?id=52
- *
- * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
- *
- * Copyright (C)2012 Todor Todorov.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to:
- *
- * Free Software Foundation, Inc.
- * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
- *
- *********************************************************************/
-#ifndef TFTLCD_ST7735_H
-#define TFTLCD_ST7735_H
-
-#include "lcd_base.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Represents a LCD instance.
- *
- * This is the utility class, through which the display can be manipulated
- * and graphics objects can be shown to the user. A known display, which
- * works with this library is the ITDB02-1.8SP from iTeadStudio - a RGB TFT
- * with 128x160 pixels resolution and 262K colors, using serail interface.
- *
- * The display needs 5 or 6 pins to work with mbed, uses +3.3V for backlight,
- * power and logic, thus can be interfaced directly to the mbed kit without
- * the need of shields or level shifters as with Arduino.
- *
- * How to use:
- * \code
- * // include the library, this will also pull in the header for the provided fonts
- * #include "st7735.h"
- *
- * // create the lcd instance
- * ST7735_LCD lcd( p14, p13, p12, p11, p10 ); // control pins
- *
- * int main()
- * {
- * // initialize display - place it in standard portrait mode and set background to black and
- * // foreground to white color.
- * lcd.Initialize();
- * // set current font to the smallest 8x12 pixels font.
- * lcd.SetFont( Font8x12 );
- * // print something on the screen
- * lcd.Print( "Hello, World!", CENTER, 25 ); // align text to center horizontally and use starndard colors
- *
- * while ( 1 ) { }
- * }
- *
- * \endcode
- * \version 0.1
- * \author Todor Todorov
- */
-class ST7735_LCD : public LCD
-{
-public:
- /** Creates a new instance of the class.
- *
- * \param CS Pin for the ChipSelect signal.
- * \param RESET Pin for the RESET line.
- * \param RS Pin for the RS signal.
- * \param SCL Pin for the serial clock line.
- * \param SDA Pin for the serial data line.
- * \param BL Pin for controlling the backlight. By default not used.
- * \param blType The backlight type, the default is to utilize the pin - if supplied - as a simple on/off switch
- * \param defaultBacklightLevel If using PWM to control backlight, this would be the default brightness in percent after LCD initialization.
- */
- ST7735_LCD( PinName CS, PinName RESET, PinName RS, PinName SCL, PinName SDA, PinName BL = NC, backlight_t blType = Constant, float defaultBackLightLevel = 1.0 );
-
- /** Initialize display.
- *
- * Wakes up the display from sleep, initializes power parameters.
- * This function must be called first, befor any painting on the
- * display is done, otherwise the positioning of graphical elements
- * will not work properly and any paynt operation will not be visible
- * or produce garbage.
- *
- * \param oritentation The display orientation, landscape is default.
- * \param colors The correct color depth to use for the pixel data.
- */
- virtual void Initialize( orientation_t orientation = LANDSCAPE, colordepth_t colors = RGB16 );
-
- /** Puts the display to sleep.
- *
- * When the display is in sleep mode, its power consumption is
- * minimized. Before new pixel data can be written to the display
- * memory, the controller needs to be brought out of sleep mode.
- * \sa #WakeUp( void );
- * \remarks The result of this operation might not be exactly as
- * expected. Putting the display to sleep will cause the
- * controller to switch to the standard color of the LCD,
- * so depending on whether the display is normally white,
- * or normally dark, the screen might or might not go
- * dark. Additional power saving can be achieved, if
- * the backlight of the used display is not hardwired on
- * the PCB and can be controlled via the BL pin.
- */
- virtual void Sleep( void );
-
- /** Wakes up the display from sleep mode.
- *
- * This function needs to be called before any other, when the
- * display has been put into sleep mode by a previois call to
- * #Sleep( void ).
- */
- virtual void WakeUp( void );
-
-protected:
- /** Sends a command to the display.
- *
- * \param cmd The display command.
- * \remarks Commands are controller-specific and this function needs to
- * be implemented separately for each available controller.
- */
- virtual void WriteCmd( unsigned short cmd );
-
- /** Sends pixel data to the display.
- *
- * \param data The display data.
- * \remarks Sendin data is controller-specific and this function needs to
- * be implemented separately for each available controller.
- */
- virtual void WriteData( unsigned short data );
-
- /** Writes a single byte of pixel data to the display.
- *
- * \param data The data to be written.
- * \remarks Sendin data is controller-specific and this function needs to
- * be implemented separately for each available controller.
- */
- virtual void WriteByteData( unsigned char data );
-
- /** Assigns a chunk of the display memory to receive data.
- *
- * When data is sent to the display after this function completes, the opertion will
- * start from the begining of the assigned address (pixel position) and the pointer
- * will be automatically incremented so that the next data write operation will continue
- * with the next pixel from the memory block. If more data is written than available
- * pixels, at the end of the block the pointer will jump back to its beginning and
- * commence again, until the next address change command is sent to the display.
- *
- * \param x1 The X coordinate of the pixel at the beginning of the block.
- * \param y1 The Y coordinate of the pixel at the beginning of the block.
- * \param x2 The X coordinate of the pixel at the end of the block.
- * \param y2 The Y coordinate of the pixel at the end of the block.
- * \remarks Addressing commands are controller-specific and this function needs to be
- * implemented separately for each available controller.
- */
- virtual void SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 );
-
- /** Sets the color of the pixel at the address pointer of the controller.
- *
- * This function is to be provided by each implementation separately in
- * order to account for different color depth used by the controller.
- * \param color The color of the pixel.
- * \param mode The depth (palette) of the color.
- */
- virtual void SetPixelColor( unsigned int color, colordepth_t mode = RGB24 );
-
-private:
- void serializeByte( unsigned char data );
-
-private:
- DigitalOut _lcd_pin_scl, _lcd_pin_sda;
- DigitalOut* _lcd_pin_bl;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* TFTLCD_ST7735_H */
