Wim Huiskamp / TM1637

Dependents:   mbed_TM1637 TM1637_test

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