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