TM1638 LED controller. Max 80 LEDs, Max 24 Key scan. Supports LED&KEY, QYF-TM1638 and JY-LKM1638 module.

Dependents:   mbed_TM1638 Otjimaniya RL0201-V1

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 TM1638 LED controller
00002  * Copyright (c) 2015, v01: WH, Initial version, Test in LEDKEY8
00003  *               2016, v02: WH, Added ASCII alphabet, changed fonttable into short
00004  *               2016, v03: WH, Added QYF-TM1638 and LKM1638 
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining a copy
00007  * of this software and associated documentation files (the "Software"), to deal
00008  * in the Software without restriction, including without limitation the rights
00009  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00010  * copies of the Software, and to permit persons to whom the Software is
00011  * furnished to do so, subject to the following conditions:
00012  *
00013  * The above copyright notice and this permission notice shall be included in
00014  * all copies or substantial portions of the Software.
00015  *
00016  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00019  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00020  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00021  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00022  * THE SOFTWARE.
00023  */
00024 #include "Font_7Seg.h"
00025 
00026 // Select one of the testboards for TM1638 LED controller
00027 #if ((LEDKEY8_TEST == 1) || (QYF_TEST == 1) || (LKM1638_TEST == 1))
00028 
00029 //Mask for blending out and restoring Icons
00030 const char MASK_ICON_GRID[][2] = {
00031                                    {LO(S7_ICON_GR1), HI(S7_ICON_GR1)},
00032                                    {LO(S7_ICON_GR2), HI(S7_ICON_GR2)},
00033                                    {LO(S7_ICON_GR3), HI(S7_ICON_GR3)},
00034                                    {LO(S7_ICON_GR4), HI(S7_ICON_GR4)},
00035                                    {LO(S7_ICON_GR5), HI(S7_ICON_GR5)},
00036                                    {LO(S7_ICON_GR6), HI(S7_ICON_GR6)},
00037                                    {LO(S7_ICON_GR7), HI(S7_ICON_GR7)},
00038                                    {LO(S7_ICON_GR8), HI(S7_ICON_GR8)}
00039                                  };
00040 
00041 // ASCII Font definition table for transmission to TM1638
00042 //
00043 //#define FONT_7S_START     0x20
00044 //#define FONT_7S_END       0x7F
00045 //#define FONT_7S_NR_CHARS (FONT_7_END - FONT_7S_START + 1)
00046 
00047 #if (SHOW_ASCII == 1)
00048 //display all ASCII characters
00049 const short FONT_7S[]  = { 
00050                              C7_SPC, //32 0x20, Space
00051                              C7_EXC,
00052                              C7_QTE,
00053                              C7_HSH,
00054                              C7_DLR,
00055                              C7_PCT,
00056                              C7_AMP,
00057                              C7_ACC,
00058                              C7_LBR,
00059                              C7_RBR,                   
00060                              C7_MLT,                            
00061                              C7_PLS,
00062                              C7_CMA,
00063                              C7_MIN,
00064                              C7_DPT,                             
00065                              C7_RS,
00066                              C7_0,   //48 0x30
00067                              C7_1,
00068                              C7_2,
00069                              C7_3,
00070                              C7_4,                   
00071                              C7_5,
00072                              C7_6,
00073                              C7_7,
00074                              C7_8,
00075                              C7_9,
00076                              C7_COL, //58 0x3A
00077                              C7_SCL,
00078                              C7_LT,
00079                              C7_EQ,
00080                              C7_GT,
00081                              C7_QM,                             
00082                              C7_AT,  //64 0x40
00083                              C7_A,   //65 0x41, A
00084                              C7_B,
00085                              C7_C,
00086                              C7_D,
00087                              C7_E,
00088                              C7_F,
00089                              C7_G,
00090                              C7_H,
00091                              C7_I,
00092                              C7_J,                   
00093                              C7_K,
00094                              C7_L,
00095                              C7_M,
00096                              C7_N,
00097                              C7_O,
00098                              C7_P,
00099                              C7_Q,
00100                              C7_R,
00101                              C7_S,
00102                              C7_T,
00103                              C7_U,
00104                              C7_V,
00105                              C7_W,
00106                              C7_X,
00107                              C7_Y,
00108                              C7_Z,   //90 0x5A, Z
00109                              C7_SBL, //91 0x5B
00110                              C7_LS,
00111                              C7_SBR,
00112                              C7_PWR,
00113                              C7_UDS,  
00114                              C7_ACC,                             
00115                              C7_A,   //97 0x61, A replacing a
00116                              C7_B,
00117                              C7_C,
00118                              C7_D,
00119                              C7_E,
00120                              C7_F,
00121                              C7_G,
00122                              C7_H,
00123                              C7_I,
00124                              C7_J,                   
00125                              C7_K,
00126                              C7_L,
00127                              C7_M,
00128                              C7_N,
00129                              C7_O,
00130                              C7_P,
00131                              C7_Q,
00132                              C7_R,
00133                              C7_S,
00134                              C7_T,
00135                              C7_U,
00136                              C7_V,
00137                              C7_W,
00138                              C7_X,
00139                              C7_Y,
00140                              C7_Z,   // 122 0x7A, Z replacing z
00141                              C7_CBL, // 123 0x7B
00142                              C7_OR,
00143                              C7_CBR,
00144                              C7_TLD,
00145                              C7_DEL  // 127                             
00146                         };
00147  
00148 #else
00149 //display only digits and hex characters
00150 const short FONT_7S[] = { 
00151                            C7_0, //48 0x30
00152                            C7_1,
00153                            C7_2,
00154                            C7_3,
00155                            C7_4,                   
00156                            C7_5,
00157                            C7_6,
00158                            C7_7,
00159                            C7_8,
00160                            C7_9,
00161                            C7_A, //65 0x41, A
00162                            C7_B,
00163                            C7_C,
00164                            C7_D,
00165                            C7_E,
00166                            C7_F
00167                         };// 127
00168 #endif
00169   
00170 #endif