Setup da Placa LCD Gian - Leite
Fork of TextLCD by
Embed:
(wiki syntax)
Show/hide line numbers
TextLCD_UTF8.inc
00001 /* mbed TextLCD Library, for LCDs based on HD44780 controllers 00002 * Copyright (c) 2015, WH 00003 * 2015, v01: WH, AR. Added UTF8 decode tables for Cyrilic font (by Andriy Ribalko). 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining a copy 00006 * of this software and associated documentation files (the "Software"), to deal 00007 * in the Software without restriction, including without limitation the rights 00008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00009 * copies of the Software, and to permit persons to whom the Software is 00010 * furnished to do so, subject to the following conditions: 00011 * 00012 * The above copyright notice and this permission notice shall be included in 00013 * all copies or substantial portions of the Software. 00014 * 00015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00021 * THE SOFTWARE. 00022 */ 00023 #ifndef MBED_TEXTLCDUTF8_INC 00024 #define MBED_TEXTLCDUTF8_INC 00025 00026 #include "TextLCD_Config.h" 00027 00028 #if(LCD_UTF8_FONT == 1) 00029 // Code by Andriy Ribalko 00030 // UTF8 conversion, please add other tables for your language 00031 // See wikipedia.org/wiki/UTF-8 and www.utf8-chartable.de 00032 00033 //The two tables below are used to map UTF8 codes onto character codes for an LCD controller that 00034 //supports a specific fonttable. The UTF codes for a specific language like Cyrilic are between 0x0400 and 0x04FF. 00035 00036 //Select one table for a specific controller and language 00037 00038 #if(0) 00039 //Table for controller xxxx 00040 //The two tables below are used to map Cyrilic/Russian UTF8 codes onto character codes for an LCD controller that 00041 //supports a Cyrilic fonttable. The UTF codes for Cyrilic are between 0x0400 and 0x04FF 00042 00043 #define UTF_FIRST 0x0400 00044 #define UTF_LAST 0x04FF 00045 #define UTF_SEQ_REC_FIRST utf_seq_rec_first_cyr 00046 #define UTF_SEQ_REC_LAST utf_seq_rec_last_cyr 00047 #define UTF_SEQ_RECODE utf_seq_recode_cyr 00048 #define UTF_RND_RECODE utf_rnd_recode_cyr 00049 00050 #define utf_seq_rec_first_cyr 0x0410 //UTF code of first symbol in sequential table UTF_recode 00051 #define utf_seq_rec_last_cyr 0x044F //UTF code of last symbol in sequential table UTF_recode 00052 00053 const char utf_seq_recode_cyr[] = { 00054 0x41,0xa0,0x42,0xa1, 0xe0,0x45,0xa3,0xa4, 0xa5,0xa6,0x4b,0xa7, 0x4d,0x48,0x4f,0xa8, //Upper case Cyrillic 00055 0x50,0x43,0x54,0xa9, 0xaa,0x58,0xe1,0xab, 0xac,0xe2,0xad,0xae, 0x62,0xaf,0xb0,0xb1, 00056 0x61,0xb2,0xb3,0xb4, 0xe3,0x65,0xb6,0xb7, 0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0x6f,0xbe, //Lower case Cyrillic 00057 0x70,0x63,0xbf,0x79, 0xe4,0x78,0xe5,0xc0, 0xc1,0xe6,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7 00058 }; 00059 00060 //Two dimensional table for some non-sequential symbol decoding (RUS/UKR) 00061 //U+0401 --> 0xa2 (Ё), U+0451 --> 0xb5 (ё), U+0406 --> 0x49 (І), U+0456 --> 0x69 (і) 00062 const short int utf_rnd_recode_cyr [5][2]= { 00063 {0x0401, 0xa2}, 00064 {0x0451, 0xb5}, 00065 {0x0406, 0x49}, 00066 {0x0456, 0x69}, 00067 {0} //Last element table zero 00068 }; 00069 #endif 00070 00071 #if(LCD_UTF8_CYR_B == 1) 00072 //ROM_B Table for controller SSD1803 and US2066 00073 //The two tables below are used to map Cyrilic/Russian UTF8 codes onto character codes for an LCD controller that 00074 //supports a Cyrilic fonttable. The UTF codes for Cyrilic are between 0x0400 and 0x04FF 00075 00076 #define UTF_FIRST 0x0400 00077 #define UTF_LAST 0x04FF 00078 #define UTF_SEQ_REC_FIRST utf_seq_rec_first_cyr 00079 #define UTF_SEQ_REC_LAST utf_seq_rec_last_cyr 00080 #define UTF_SEQ_RECODE utf_seq_recode_cyr 00081 #define UTF_RND_RECODE utf_rnd_recode_cyr 00082 00083 #define utf_seq_rec_first_cyr 0x0410 //UTF code of first symbol in sequential table UTF_recode 00084 #define utf_seq_rec_last_cyr 0x044F //UTF code of last symbol in sequential table UTF_recode 00085 const char utf_seq_recode_cyr[] = { 00086 0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87, 0x88,0x89,0x8A,0x8B, 0x8C,0x8D,0x8E,0x8F, //Upper case Cyrillic 00087 0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97, 0x98,0x99,0x9A,0x9B, 0x9C,0x9D,0x9E,0x9F, 00088 0x61,0x81,0x62,0x83, 0x84,0x65,0x86,0x87, 0x88,0x89,0x6B,0x8B, 0x6D,0x69,0x6F,0x8F, //Lower case Cyrillic (~Upper) 00089 0x70,0x63,0x92,0x79, 0x94,0x95,0x96,0x97, 0x98,0x99,0x9A,0x9B, 0x9C,0x9D,0x9E,0x9F 00090 }; 00091 00092 //Two dimensional table for some non-sequential symbol decoding (RUS/UKR) 00093 //U+0400 --> 0xC8 (E) 00094 //U+0401 --> 0xCB (Ё) 00095 //U+0405 --> 0x53 (S) 00096 //U+0406 --> 0x49 (І) 00097 //U+0407 --> 0xCF (І) 00098 //U+0408 --> 0x4A (J) 00099 //U+0450 --> 0xE8 ( ) 00100 //U+0451 --> 0xEB (ё) 00101 //U+0456 --> 0x69 (і) 00102 //U+0457 --> 0xCF (і) 00103 //U+0458 --> 0x6A (j) 00104 const short int utf_rnd_recode_cyr [][2]= { 00105 {0x0400, 0xC8}, 00106 {0x0401, 0xCB}, 00107 {0x0405, 0x53}, 00108 {0x0406, 0x49}, 00109 {0x0407, 0xCF}, 00110 {0x0408, 0x4A}, 00111 {0x0450, 0xE8}, 00112 {0x0451, 0xEB}, 00113 {0x0456, 0x69}, 00114 {0x0457, 0xCF}, 00115 {0x0458, 0x6A}, 00116 {0 , 0} //Last element table zero 00117 }; 00118 #endif 00119 00120 00121 //end UTF conversion 00122 #endif 00123 00124 #endif
Generated on Wed Jul 13 2022 17:39:29 by 1.7.2