Trying i2c LCD using TextLCD library

Fork of TextLCD by Wim Huiskamp

Committer:
rtandil
Date:
Mon Apr 10 07:48:10 2017 +0000
Revision:
42:9585a1cce408
First try

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rtandil 42:9585a1cce408 1 /* mbed TextLCD Library, for LCDs based on HD44780 controllers
rtandil 42:9585a1cce408 2 * Copyright (c) 2015, WH
rtandil 42:9585a1cce408 3 * 2015, v01: WH, AR. Added UTF8 decode tables for Cyrilic font (by Andriy Ribalko).
rtandil 42:9585a1cce408 4 *
rtandil 42:9585a1cce408 5 * Permission is hereby granted, free of charge, to any person obtaining a copy
rtandil 42:9585a1cce408 6 * of this software and associated documentation files (the "Software"), to deal
rtandil 42:9585a1cce408 7 * in the Software without restriction, including without limitation the rights
rtandil 42:9585a1cce408 8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
rtandil 42:9585a1cce408 9 * copies of the Software, and to permit persons to whom the Software is
rtandil 42:9585a1cce408 10 * furnished to do so, subject to the following conditions:
rtandil 42:9585a1cce408 11 *
rtandil 42:9585a1cce408 12 * The above copyright notice and this permission notice shall be included in
rtandil 42:9585a1cce408 13 * all copies or substantial portions of the Software.
rtandil 42:9585a1cce408 14 *
rtandil 42:9585a1cce408 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
rtandil 42:9585a1cce408 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
rtandil 42:9585a1cce408 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
rtandil 42:9585a1cce408 18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
rtandil 42:9585a1cce408 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
rtandil 42:9585a1cce408 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
rtandil 42:9585a1cce408 21 * THE SOFTWARE.
rtandil 42:9585a1cce408 22 */
rtandil 42:9585a1cce408 23 #ifndef MBED_TEXTLCDUTF8_INC
rtandil 42:9585a1cce408 24 #define MBED_TEXTLCDUTF8_INC
rtandil 42:9585a1cce408 25
rtandil 42:9585a1cce408 26 #include "TextLCD_Config.h"
rtandil 42:9585a1cce408 27
rtandil 42:9585a1cce408 28 #if(LCD_UTF8_FONT == 1)
rtandil 42:9585a1cce408 29 // Code by Andriy Ribalko
rtandil 42:9585a1cce408 30 // UTF8 conversion, please add other tables for your language
rtandil 42:9585a1cce408 31 // See wikipedia.org/wiki/UTF-8 and www.utf8-chartable.de
rtandil 42:9585a1cce408 32
rtandil 42:9585a1cce408 33 //The two tables below are used to map UTF8 codes onto character codes for an LCD controller that
rtandil 42:9585a1cce408 34 //supports a specific fonttable. The UTF codes for a specific language like Cyrilic are between 0x0400 and 0x04FF.
rtandil 42:9585a1cce408 35
rtandil 42:9585a1cce408 36 //Select one table for a specific controller and language
rtandil 42:9585a1cce408 37
rtandil 42:9585a1cce408 38 #if(0)
rtandil 42:9585a1cce408 39 //Table for controller xxxx
rtandil 42:9585a1cce408 40 //The two tables below are used to map Cyrilic/Russian UTF8 codes onto character codes for an LCD controller that
rtandil 42:9585a1cce408 41 //supports a Cyrilic fonttable. The UTF codes for Cyrilic are between 0x0400 and 0x04FF
rtandil 42:9585a1cce408 42
rtandil 42:9585a1cce408 43 #define UTF_FIRST 0x0400
rtandil 42:9585a1cce408 44 #define UTF_LAST 0x04FF
rtandil 42:9585a1cce408 45 #define UTF_SEQ_REC_FIRST utf_seq_rec_first_cyr
rtandil 42:9585a1cce408 46 #define UTF_SEQ_REC_LAST utf_seq_rec_last_cyr
rtandil 42:9585a1cce408 47 #define UTF_SEQ_RECODE utf_seq_recode_cyr
rtandil 42:9585a1cce408 48 #define UTF_RND_RECODE utf_rnd_recode_cyr
rtandil 42:9585a1cce408 49
rtandil 42:9585a1cce408 50 #define utf_seq_rec_first_cyr 0x0410 //UTF code of first symbol in sequential table UTF_recode
rtandil 42:9585a1cce408 51 #define utf_seq_rec_last_cyr 0x044F //UTF code of last symbol in sequential table UTF_recode
rtandil 42:9585a1cce408 52
rtandil 42:9585a1cce408 53 const char utf_seq_recode_cyr[] = {
rtandil 42:9585a1cce408 54 0x41,0xa0,0x42,0xa1, 0xe0,0x45,0xa3,0xa4, 0xa5,0xa6,0x4b,0xa7, 0x4d,0x48,0x4f,0xa8, //Upper case Cyrillic
rtandil 42:9585a1cce408 55 0x50,0x43,0x54,0xa9, 0xaa,0x58,0xe1,0xab, 0xac,0xe2,0xad,0xae, 0x62,0xaf,0xb0,0xb1,
rtandil 42:9585a1cce408 56 0x61,0xb2,0xb3,0xb4, 0xe3,0x65,0xb6,0xb7, 0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0x6f,0xbe, //Lower case Cyrillic
rtandil 42:9585a1cce408 57 0x70,0x63,0xbf,0x79, 0xe4,0x78,0xe5,0xc0, 0xc1,0xe6,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7
rtandil 42:9585a1cce408 58 };
rtandil 42:9585a1cce408 59
rtandil 42:9585a1cce408 60 //Two dimensional table for some non-sequential symbol decoding (RUS/UKR)
rtandil 42:9585a1cce408 61 //U+0401 --> 0xa2 (ミ�), U+0451 --> 0xb5 (ム�), U+0406 --> 0x49 (ミ�), U+0456 --> 0x69 (ム�)
rtandil 42:9585a1cce408 62 const short int utf_rnd_recode_cyr [5][2]= {
rtandil 42:9585a1cce408 63 {0x0401, 0xa2},
rtandil 42:9585a1cce408 64 {0x0451, 0xb5},
rtandil 42:9585a1cce408 65 {0x0406, 0x49},
rtandil 42:9585a1cce408 66 {0x0456, 0x69},
rtandil 42:9585a1cce408 67 {0} //Last element table zero
rtandil 42:9585a1cce408 68 };
rtandil 42:9585a1cce408 69 #endif
rtandil 42:9585a1cce408 70
rtandil 42:9585a1cce408 71 #if(LCD_UTF8_CYR_B == 1)
rtandil 42:9585a1cce408 72 //ROM_B Table for controller SSD1803 and US2066
rtandil 42:9585a1cce408 73 //The two tables below are used to map Cyrilic/Russian UTF8 codes onto character codes for an LCD controller that
rtandil 42:9585a1cce408 74 //supports a Cyrilic fonttable. The UTF codes for Cyrilic are between 0x0400 and 0x04FF
rtandil 42:9585a1cce408 75
rtandil 42:9585a1cce408 76 #define UTF_FIRST 0x0400
rtandil 42:9585a1cce408 77 #define UTF_LAST 0x04FF
rtandil 42:9585a1cce408 78 #define UTF_SEQ_REC_FIRST utf_seq_rec_first_cyr
rtandil 42:9585a1cce408 79 #define UTF_SEQ_REC_LAST utf_seq_rec_last_cyr
rtandil 42:9585a1cce408 80 #define UTF_SEQ_RECODE utf_seq_recode_cyr
rtandil 42:9585a1cce408 81 #define UTF_RND_RECODE utf_rnd_recode_cyr
rtandil 42:9585a1cce408 82
rtandil 42:9585a1cce408 83 #define utf_seq_rec_first_cyr 0x0410 //UTF code of first symbol in sequential table UTF_recode
rtandil 42:9585a1cce408 84 #define utf_seq_rec_last_cyr 0x044F //UTF code of last symbol in sequential table UTF_recode
rtandil 42:9585a1cce408 85 const char utf_seq_recode_cyr[] = {
rtandil 42:9585a1cce408 86 0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87, 0x88,0x89,0x8A,0x8B, 0x8C,0x8D,0x8E,0x8F, //Upper case Cyrillic
rtandil 42:9585a1cce408 87 0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97, 0x98,0x99,0x9A,0x9B, 0x9C,0x9D,0x9E,0x9F,
rtandil 42:9585a1cce408 88 0x61,0x81,0x62,0x83, 0x84,0x65,0x86,0x87, 0x88,0x89,0x6B,0x8B, 0x6D,0x69,0x6F,0x8F, //Lower case Cyrillic (~Upper)
rtandil 42:9585a1cce408 89 0x70,0x63,0x92,0x79, 0x94,0x95,0x96,0x97, 0x98,0x99,0x9A,0x9B, 0x9C,0x9D,0x9E,0x9F
rtandil 42:9585a1cce408 90 };
rtandil 42:9585a1cce408 91
rtandil 42:9585a1cce408 92 //Two dimensional table for some non-sequential symbol decoding (RUS/UKR)
rtandil 42:9585a1cce408 93 //U+0400 --> 0xC8 (E)
rtandil 42:9585a1cce408 94 //U+0401 --> 0xCB (ミ�)
rtandil 42:9585a1cce408 95 //U+0405 --> 0x53 (S)
rtandil 42:9585a1cce408 96 //U+0406 --> 0x49 (ミ�)
rtandil 42:9585a1cce408 97 //U+0407 --> 0xCF (ミ�)
rtandil 42:9585a1cce408 98 //U+0408 --> 0x4A (J)
rtandil 42:9585a1cce408 99 //U+0450 --> 0xE8 ( )
rtandil 42:9585a1cce408 100 //U+0451 --> 0xEB (ム�)
rtandil 42:9585a1cce408 101 //U+0456 --> 0x69 (ム�)
rtandil 42:9585a1cce408 102 //U+0457 --> 0xCF (ム�)
rtandil 42:9585a1cce408 103 //U+0458 --> 0x6A (j)
rtandil 42:9585a1cce408 104 const short int utf_rnd_recode_cyr [][2]= {
rtandil 42:9585a1cce408 105 {0x0400, 0xC8},
rtandil 42:9585a1cce408 106 {0x0401, 0xCB},
rtandil 42:9585a1cce408 107 {0x0405, 0x53},
rtandil 42:9585a1cce408 108 {0x0406, 0x49},
rtandil 42:9585a1cce408 109 {0x0407, 0xCF},
rtandil 42:9585a1cce408 110 {0x0408, 0x4A},
rtandil 42:9585a1cce408 111 {0x0450, 0xE8},
rtandil 42:9585a1cce408 112 {0x0451, 0xEB},
rtandil 42:9585a1cce408 113 {0x0456, 0x69},
rtandil 42:9585a1cce408 114 {0x0457, 0xCF},
rtandil 42:9585a1cce408 115 {0x0458, 0x6A},
rtandil 42:9585a1cce408 116 {0 , 0} //Last element table zero
rtandil 42:9585a1cce408 117 };
rtandil 42:9585a1cce408 118 #endif
rtandil 42:9585a1cce408 119
rtandil 42:9585a1cce408 120
rtandil 42:9585a1cce408 121 //end UTF conversion
rtandil 42:9585a1cce408 122 #endif
rtandil 42:9585a1cce408 123
rtandil 42:9585a1cce408 124 #endif