Library for TM1640 LED controller Initial version
Embed:
(wiki syntax)
Show/hide line numbers
Font_7Seg.h
00001 /* mbed LED Font Library, for TM1640 LED Controller 00002 * Copyright (c) 2016, v01: WH, Initial version, Test in LM1640 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a copy 00005 * of this software and associated documentation files (the "Software"), to deal 00006 * in the Software without restriction, including without limitation the rights 00007 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 * copies of the Software, and to permit persons to whom the Software is 00009 * furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included in 00012 * all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00019 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00020 * THE SOFTWARE. 00021 */ 00022 #ifndef MBED_FONT_7SEG_H 00023 #define MBED_FONT_7SEG_H 00024 00025 // Select one of the testboards for TM1640 controller 00026 #include "TM1640_Config.h" 00027 00028 #if ((LM1640_TEST == 1) || (TM1640_TEST == 1)) 00029 // Segment bit positions for 7 Segment display using the LM1640 mapping for TM1640 00030 // Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_7S const table below 00031 // will be adapted automatically according to the bit-to-segment mapping. Obviously this will only work when the segment 00032 // mapping is identical for every digit position. This will be the case unless the hardware designer really hates software developers. 00033 // 00034 // A 00035 // ----- 00036 // | | 00037 // F | | B 00038 // | G | 00039 // ----- 00040 // | | 00041 // E | | C 00042 // | | 00043 // ----- * DP 00044 // D 00045 // 00046 #define S7_A 0x0001 00047 #define S7_B 0x0002 00048 #define S7_C 0x0004 00049 #define S7_D 0x0008 00050 #define S7_E 0x0010 00051 #define S7_F 0x0020 00052 #define S7_G 0x0040 00053 #define S7_DP 0x0080 00054 00055 //Mask for blending out and setting 7 segments digits 00056 #define MASK_7S_ALL = (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G} 00057 00058 //Icons Grid 1 00059 #define S7_DP1 0x0080 00060 #define S7_ICON_GR1 (0x0000) 00061 //#define S7_ICON_GR1 (S7_DP1) 00062 00063 //Icons Grid 2 00064 #define S7_DP2 0x0080 00065 #define S7_ICON_GR2 (0x0000) 00066 //#define S7_ICON_GR2 (S7_DP2) 00067 00068 //Icons Grid 3 00069 #define S7_DP3 0x0080 00070 #define S7_ICON_GR3 (0x0000) 00071 //#define S7_ICON_GR3 (S7_LD3 | S7_DP3) 00072 00073 //Icons Grid 4 00074 #define S7_DP4 0x0080 00075 #define S7_ICON_GR4 (0x0000) 00076 //#define S7_ICON_GR4 (S7_DP4) 00077 00078 //Icons Grid 5 00079 #define S7_DP5 0x0080 00080 #define S7_ICON_GR5 (0x0000) 00081 //#define S7_ICON_GR5 (S7_DP5) 00082 00083 //Icons Grid 6 00084 #define S7_DP6 0x0080 00085 #define S7_ICON_GR6 (0x0000) 00086 //#define S7_ICON_GR6 (S7_DP6) 00087 00088 //Icons Grid 7 00089 #define S7_DP7 0x0080 00090 #define S7_ICON_GR7 (0x0000) 00091 //#define S7_ICON_GR7 (S7_DP7) 00092 00093 //Icons Grid 8 00094 #define S7_DP8 0x0080 00095 #define S7_ICON_GR8 (0x0000) 00096 //#define S7_ICON_GR8 (S7_DP8) 00097 00098 //Icons Grid 9 00099 #define S7_DP9 0x0080 00100 #define S7_ICON_GR9 (0x0000) 00101 //#define S7_ICON_GR9 (S7_DP9) 00102 00103 //Icons Grid 10 00104 #define S7_DP10 0x0080 00105 #define S7_ICON_GR10 (0x0000) 00106 //#define S7_ICON_GR10 (S7_DP10) 00107 00108 //Icons Grid 11 00109 #define S7_DP11 0x0080 00110 #define S7_ICON_GR11 (0x0000) 00111 //#define S7_ICON_GR11 (S7_DP11) 00112 00113 //Icons Grid 12 00114 #define S7_DP12 0x0080 00115 #define S7_ICON_GR12 (0x0000) 00116 //#define S7_ICON_GR12 (S7_DP12) 00117 00118 //Icons Grid 13 00119 #define S7_DP13 0x0080 00120 #define S7_ICON_GR13 (0x0000) 00121 //#define S7_ICON_GR13 (S7_DP13) 00122 00123 //Icons Grid 14 00124 #define S7_DP14 0x0080 00125 #define S7_ICON_GR14 (0x0000) 00126 //#define S7_ICON_GR14 (S7_DP14) 00127 00128 //Icons Grid 15 00129 #define S7_DP15 0x0080 00130 #define S7_ICON_GR15 (0x0000) 00131 //#define S7_ICON_GR15 (S7_DP15) 00132 00133 //Icons Grid 16 00134 #define S7_DP16 0x0080 00135 #define S7_ICON_GR16 (0x0000) 00136 //#define S7_ICON_GR16 (S7_DP16) 00137 00138 //Mask for blending out and restoring Icons 00139 extern const char MASK_ICON_GRID[]; 00140 #endif 00141 00142 00143 // ASCII Font definitions for segments in each character 00144 // 00145 //32 0x20 Symbols 00146 #define C7_SPC (0x0000) 00147 #define C7_EXC (S7_B | S7_C) //! 00148 #define C7_QTE (S7_B | S7_F) //" 00149 #define C7_HSH (S7_C | S7_D | S7_E | S7_G) //# 00150 #define C7_DLR (S7_A | S7_C | S7_D | S7_F | S7_G) //$ 00151 #define C7_PCT (S7_C | S7_F) //% 00152 #define C7_AMP (S7_A | S7_C | S7_D | S7_E | S7_F | S7_G) //& 00153 #define C7_ACC (S7_B) //' 00154 #define C7_LBR (S7_A | S7_D | S7_E | S7_F) //( 00155 #define C7_RBR (S7_A | S7_B | S7_C | S7_D) //) 00156 #define C7_MLT (S7_B | S7_C | S7_E | S7_F | S7_G) //* 00157 #define C7_PLS (S7_B | S7_C | S7_G) //+ 00158 #define C7_CMA (S7_DP) 00159 #define C7_MIN (S7_G) 00160 #define C7_DPT (S7_DP) 00161 #define C7_RS (S7_B | S7_E | S7_G) // / 00162 00163 //48 0x30 Digits 00164 #define C7_0 (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F) 00165 #define C7_1 (S7_B | S7_C) 00166 #define C7_2 (S7_A | S7_B | S7_D | S7_E | S7_G) 00167 #define C7_3 (S7_A | S7_B | S7_C | S7_D | S7_G) 00168 #define C7_4 (S7_B | S7_C | S7_F | S7_G) 00169 #define C7_5 (S7_A | S7_C | S7_D | S7_F | S7_G) 00170 #define C7_6 (S7_A | S7_C | S7_D | S7_E | S7_F | S7_G) 00171 #define C7_7 (S7_A | S7_B | S7_C) 00172 #define C7_8 (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G) 00173 #define C7_9 (S7_A | S7_B | S7_C | S7_D | S7_F | S7_G) 00174 00175 //58 0x3A 00176 #define C7_COL (S7_D | S7_G) // : 00177 #define C7_SCL (S7_D | S7_G) // ; 00178 #define C7_LT (S7_D | S7_E | S7_G) // < 00179 #define C7_EQ (S7_D | S7_G) // = 00180 #define C7_GT (S7_C | S7_D | S7_G) // > 00181 #define C7_QM (S7_A | S7_B | S7_E | S7_G) // ? 00182 #define C7_AT (S7_A | S7_B | S7_C | S7_D | S7_E | S7_G) // @ 00183 00184 //65 0x41 Upper case alphabet 00185 #define C7_A (S7_A | S7_B | S7_C | S7_E | S7_F | S7_G ) 00186 #define C7_B (S7_C | S7_D | S7_E | S7_F | S7_G) 00187 #define C7_C (S7_A | S7_D | S7_E | S7_F) 00188 #define C7_D (S7_B | S7_C | S7_D | S7_E | S7_G) 00189 #define C7_E (S7_A | S7_D | S7_E | S7_F | S7_G) 00190 #define C7_F (S7_A | S7_E | S7_F | S7_G) 00191 00192 #define C7_G (S7_A | S7_C | S7_D | S7_E | S7_F) 00193 #define C7_H (S7_B | S7_C | S7_E | S7_F | S7_G) 00194 #define C7_I (S7_B | S7_C) 00195 #define C7_J (S7_B | S7_C | S7_D | S7_E) 00196 #define C7_K (S7_B | S7_C | S7_E | S7_F | S7_G) 00197 #define C7_L (S7_D | S7_E | S7_F) 00198 #define C7_M (S7_A | S7_C | S7_E) 00199 #define C7_N (S7_A | S7_B | S7_C | S7_E | S7_F) 00200 #define C7_O (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F) 00201 #define C7_P (S7_A | S7_B | S7_E | S7_F | S7_G) 00202 #define C7_Q (S7_A | S7_B | S7_C | S7_F | S7_G) 00203 #define C7_R (S7_E | S7_G ) 00204 #define C7_S (S7_A | S7_C | S7_D | S7_F | S7_G) 00205 #define C7_T (S7_D | S7_E | S7_F | S7_G) 00206 #define C7_U (S7_B | S7_C | S7_D | S7_E | S7_F) 00207 #define C7_V (S7_B | S7_C | S7_D | S7_E | S7_F) 00208 #define C7_W (S7_B | S7_D | S7_F) 00209 #define C7_X (S7_B | S7_C | S7_E | S7_F | S7_G) 00210 #define C7_Y (S7_B | S7_C | S7_D | S7_F | S7_G) 00211 #define C7_Z (S7_A | S7_B | S7_D | S7_E | S7_G) 00212 00213 //91 0x5B 00214 #define C7_SBL (S7_A | S7_D | S7_E | S7_F) // [ 00215 #define C7_LS (S7_C | S7_F | S7_G) // left slash 00216 #define C7_SBR (S7_A | S7_B | S7_C | S7_D) // ] 00217 #define C7_PWR (S7_A | S7_B | S7_F) // ^ 00218 #define C7_UDS (S7_D) // _ 00219 #define C7_DSH (S7_F) // ` 00220 00221 //97 0x61 Lower case alphabet 00222 #define C7_a C7_A 00223 #define C7_b C7_B 00224 #define C7_c C7_C 00225 #define C7_d C7_D 00226 #define C7_e C7_E 00227 #define C7_f C7_H 00228 00229 #define C7_g C7_G 00230 #define C7_h C7_H 00231 #define C7_i C7_I 00232 #define C7_j C7_J 00233 #define C7_k C7_K 00234 #define C7_l C7_L 00235 #define C7_m C7_M 00236 //#define C7_n C7_N 00237 #define C7_n (S7_C | S7_E | S7_G) 00238 //#define C7_o C7_O 00239 #define C7_o (S7_C | S7_D | S7_E | S7_G) 00240 #define C7_p C7_P 00241 #define C7_q C7_Q 00242 //#define C7_r C7_R 00243 #define C7_r (S7_E | S7_G) 00244 #define C7_s C7_S 00245 #define C7_t C7_T 00246 #define C7_u C7_U 00247 #define C7_v C7_V 00248 #define C7_w C7_W 00249 #define C7_x C7_X 00250 #define C7_y C7_Y 00251 #define C7_z C7_Z 00252 00253 //123 0x7B 00254 #define C7_CBL (S7_A | S7_D | S7_E | S7_F) // { 00255 #define C7_OR (S7_B | S7_C) // | 00256 #define C7_CBR (S7_A | S7_B | S7_C | S7_D) // } 00257 #define C7_TLD (S7_B | S7_E | S7_G ) // ~ 00258 #define C7_DEL (0x0000) 00259 00260 00261 //User Defined Characters (some examples) 00262 #define C7_DGR (S7_A | S7_B | S7_F | S7_G) //Degrees 00263 00264 // Font data selection for transmission to TM1640 memory 00265 #define LO(x) ( x & 0xFF) 00266 #define HI(x) ((x >> 8) & 0xFF) 00267 00268 00269 // ASCII Font definition table 00270 // 00271 #define FONT_7S_START 0x20 00272 #define FONT_7S_END 0x7F 00273 //#define FONT_7S_NR_CHARS (FONT_7S_END - FONT_7S_START + 1) 00274 extern const short FONT_7S[]; 00275 00276 #endif
Generated on Wed Jul 13 2022 03:36:07 by 1.7.2