Library for TM1640 LED controller Initial version

Dependents:   mbed_TM1640

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Font_7Seg.cpp Source File

Font_7Seg.cpp

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 #include "Font_7Seg.h"
00023 
00024 // Select one of the testboards for TM1640 LED controller
00025 #if (LM1640_TEST == 1) 
00026 
00027 //Mask for blending out and restoring Icons
00028 const char MASK_ICON_GRID[] = {
00029                                 LO(S7_ICON_GR1),
00030                                 LO(S7_ICON_GR2),
00031                                 LO(S7_ICON_GR3),
00032                                 LO(S7_ICON_GR4),
00033                                 LO(S7_ICON_GR5),
00034                                 LO(S7_ICON_GR6),
00035                                 LO(S7_ICON_GR7),
00036                                 LO(S7_ICON_GR8),
00037                                 
00038                                 LO(S7_ICON_GR9),
00039                                 LO(S7_ICON_GR10),
00040                                 LO(S7_ICON_GR11),
00041                                 LO(S7_ICON_GR12),
00042                                 LO(S7_ICON_GR13),
00043                                 LO(S7_ICON_GR14),
00044                                 LO(S7_ICON_GR15),
00045                                 LO(S7_ICON_GR16)                                
00046                               };
00047 
00048 // ASCII Font definition table for transmission to TM1640
00049 //
00050 //#define FONT_7S_START     0x20
00051 //#define FONT_7S_END       0x7F
00052 //#define FONT_7S_NR_CHARS (FONT_7_END - FONT_7S_START + 1)
00053 
00054 #if (SHOW_ASCII == 1)
00055 //display all ASCII characters
00056 const short FONT_7S[]  = { 
00057                              C7_SPC, //32 0x20, Space
00058                              C7_EXC,
00059                              C7_QTE,
00060                              C7_HSH,
00061                              C7_DLR,
00062                              C7_PCT,
00063                              C7_AMP,
00064                              C7_ACC,
00065                              C7_LBR,
00066                              C7_RBR,                   
00067                              C7_MLT,                            
00068                              C7_PLS,
00069                              C7_CMA,
00070                              C7_MIN,
00071                              C7_DPT,                             
00072                              C7_RS,
00073                              C7_0,   //48 0x30
00074                              C7_1,
00075                              C7_2,
00076                              C7_3,
00077                              C7_4,                   
00078                              C7_5,
00079                              C7_6,
00080                              C7_7,
00081                              C7_8,
00082                              C7_9,
00083                              C7_COL, //58 0x3A
00084                              C7_SCL,
00085                              C7_LT,
00086                              C7_EQ,
00087                              C7_GT,
00088                              C7_QM,                             
00089                              C7_AT,  //64 0x40
00090                              C7_A,   //65 0x41, A
00091                              C7_B,
00092                              C7_C,
00093                              C7_D,
00094                              C7_E,
00095                              C7_F,
00096                              C7_G,
00097                              C7_H,
00098                              C7_I,
00099                              C7_J,                   
00100                              C7_K,
00101                              C7_L,
00102                              C7_M,
00103                              C7_N,
00104                              C7_O,
00105                              C7_P,
00106                              C7_Q,
00107                              C7_R,
00108                              C7_S,
00109                              C7_T,
00110                              C7_U,
00111                              C7_V,
00112                              C7_W,
00113                              C7_X,
00114                              C7_Y,
00115                              C7_Z,   //90 0x5A, Z
00116                              C7_SBL, //91 0x5B
00117                              C7_LS,
00118                              C7_SBR,
00119                              C7_PWR,
00120                              C7_UDS,  
00121                              C7_ACC,                             
00122                              C7_A,   //97 0x61, A replacing a
00123                              C7_B,
00124                              C7_C,
00125                              C7_D,
00126                              C7_E,
00127                              C7_F,
00128                              C7_G,
00129                              C7_H,
00130                              C7_I,
00131                              C7_J,                   
00132                              C7_K,
00133                              C7_L,
00134                              C7_M,
00135                              C7_N,
00136                              C7_O,
00137                              C7_P,
00138                              C7_Q,
00139                              C7_R,
00140                              C7_S,
00141                              C7_T,
00142                              C7_U,
00143                              C7_V,
00144                              C7_W,
00145                              C7_X,
00146                              C7_Y,
00147                              C7_Z,   // 122 0x7A, Z replacing z
00148                              C7_CBL, // 123 0x7B
00149                              C7_OR,
00150                              C7_CBR,
00151                              C7_TLD,
00152                              C7_DEL  // 127                             
00153                         };
00154  
00155 #else
00156 //display only digits and hex characters
00157 const short FONT_7S[] = { 
00158                            C7_0, //48 0x30
00159                            C7_1,
00160                            C7_2,
00161                            C7_3,
00162                            C7_4,                   
00163                            C7_5,
00164                            C7_6,
00165                            C7_7,
00166                            C7_8,
00167                            C7_9,
00168                            C7_A, //65 0x41, A
00169                            C7_B,
00170                            C7_C,
00171                            C7_D,
00172                            C7_E,
00173                            C7_F
00174                         };// 127
00175 #endif
00176   
00177 #endif