Wim Huiskamp / PT6318
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Font_7Seg.h Source File

Font_7Seg.h

00001 /* mbed Font Library, for PT6318 VFD Controller
00002  * Copyright (c) 2016, v01: WH, Initial version, Test in KUH8300
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 PT6318 controller
00026 //#include "PT6318.h"
00027 #include "PT6318_Config.h"
00028 
00029 #if (KUH8300_TEST == 1)
00030 // Segment bit positions for 7 Segment display using the KUH8300 mapping for PT6318
00031 // Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_7S const table below 
00032 // will be adapted automatically according to the bit-to-segment mapping. Obviously this will only work when the segment
00033 // mapping is identical for every digit position. This will be the case unless the hardware designer really hates software developers.
00034 //
00035 //            A
00036 //          -----
00037 //         |     |     
00038 //       F |     | B    
00039 //         |  G  |     
00040 //          -----
00041 //         |     |     
00042 //       E |     | C    
00043 //         |     |     
00044 //          -----   * DP
00045 //            D  
00046 //
00047 //Placeholders for remapping font to one of two digits per grid
00048 #define S7_A    0x0001
00049 #define S7_B    0x0002
00050 #define S7_C    0x0004
00051 #define S7_D    0x0008
00052 #define S7_E    0x0010
00053 #define S7_F    0x0020
00054 #define S7_G    0x0040 
00055 //#define S7_DP   0x0080 
00056 #define S7_DP   0x0004 
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 
00062 //Each Grid has 2 Digits in the KUH8300
00063 #define S7_D0   0x000001
00064 #define S7_E0   0x000002
00065 #define S7_C0   0x000004
00066 #define S7_G0   0x000008 
00067 #define S7_F0   0x000010
00068 #define S7_B0   0x000020
00069 #define S7_A0   0x000040
00070 #define S7_DP0  0x000000 
00071 
00072 #define S7_A1   0x000800
00073 #define S7_B1   0x001000
00074 #define S7_F1   0x002000
00075 #define S7_G1   0x004000 
00076 #define S7_C1   0x008000
00077 #define S7_E1   0x010000
00078 #define S7_D1   0x020000
00079 #define S7_DP1  0x000000 
00080 
00081 //Icons Grid 1
00082 #define S7_CAM  0x000080
00083 #define S7_DIG  0x000100
00084 #define S7_MONO 0x000200
00085 #define S7_PRG  0x000400
00086 #define S7_DTS  0x002000
00087 #define S7_MEM  0x004000
00088 #define S7_KHZ  0x008000
00089 #define S7_STR  0x010000
00090 #define S7_MHZ  0x020000
00091 #define S7_ICON_GR1 (S7_CAM | S7_DIG | S7_MONO | S7_PRG | S7_DTS | S7_MEM | S7_KHZ | S7_STR | S7_MHZ)
00092 
00093 //Icons Grid 2
00094 #define S7_KEY  0x000080
00095 #define S7_ALL  0x000100
00096 #define S7_DP6  0x000200
00097 #define S7_COL6 0x000400
00098 #define S7_ICON_GR2 (S7_KEY | S7_ALL | S7_DP6 | S7_COL6)
00099 
00100 //Icons Grid 3
00101 #define S7_ARW  0x000080
00102 #define S7_A_   0x000100
00103 #define S7_B_   0x000200
00104 #define S7_CD4A 0x000400
00105 #define S7_ICON_GR3 (S7_ARW | S7_A_ | S7_B_ | S7_CD4A)
00106 
00107 //Icons Grid 4
00108 #define S7_CHP  0x000080
00109 #define S7_N3   0x000100
00110 #define S7_L3   0x000200
00111 #define S7_HK3  0x000400
00112 #define S7_ICON_GR4 (S7_CHP | S7_N3 | S7_L3 | S7_HK3)
00113 
00114 //Icons Grid 5
00115 #define S7_TTL  0x000080
00116 #define S7_JM1  0x000100
00117 #define S7_HK2  0x000400
00118 #define S7_ICON_GR5 (S7_TTL | S7_JM1 | S7_HK2)
00119 
00120 //Icons Grid 6
00121 #define S7_PSE  0x000002
00122 #define S7_PLY  0x000004
00123 #define S7_PBC  0x000008
00124 #define S7_DVD  0x000010
00125 #define S7_CD   0x000020
00126 #define S7_V    0x000040
00127 #define S7_S    0x000080
00128 #define S7_ICON_GR6 (S7_PSE | S7_PLY | S7_PBC | S7_DVD | S7_CD | S7_V | S7_S)
00129 
00130 //Mask for blending out and restoring Icons
00131 extern const char MASK_ICON_GRID[][3]; 
00132 //extern const char MASK_ICON_GRID[][PT6318_BYTES_PER_GRID]; 
00133 #endif
00134 
00135 
00136 // ASCII Font definitions for segments in each character
00137 //
00138 //32 0x20  Symbols
00139 #define C7_SPC  (0x000000)
00140 #define C7_EXC  (S7_B | S7_C) //!
00141 #define C7_QTE  (S7_B | S7_F) //"
00142 #define C7_HSH  (S7_C | S7_D | S7_E | S7_G) //#
00143 #define C7_DLR  (S7_A | S7_C | S7_D | S7_F | S7_G) //$
00144 #define C7_PCT  (S7_C | S7_F) //%
00145 #define C7_AMP  (S7_A | S7_C | S7_D | S7_E | S7_F | S7_G) //&
00146 #define C7_ACC  (S7_B) //'
00147 #define C7_LBR  (S7_A | S7_D | S7_E | S7_F) //(
00148 #define C7_RBR  (S7_A | S7_B | S7_C | S7_D) //)
00149 #define C7_MLT  (S7_B | S7_C | S7_E | S7_F | S7_G)  //*
00150 #define C7_PLS  (S7_B | S7_C | S7_G) //+
00151 #define C7_CMA  (S7_DP)
00152 #define C7_MIN  (S7_G)
00153 #define C7_DPT  (S7_DP)
00154 #define C7_RS   (S7_B | S7_E  | S7_G)  // /
00155 
00156 //48 0x30  Digits
00157 #define C7_0    (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F)
00158 #define C7_1    (S7_B | S7_C)
00159 #define C7_2    (S7_A | S7_B | S7_D | S7_E | S7_G)
00160 #define C7_3    (S7_A | S7_B | S7_C | S7_D | S7_G)
00161 #define C7_4    (S7_B | S7_C | S7_F | S7_G)
00162 #define C7_5    (S7_A | S7_C | S7_D | S7_F | S7_G)
00163 #define C7_6    (S7_A | S7_C | S7_D | S7_E | S7_F | S7_G)
00164 #define C7_7    (S7_A | S7_B | S7_C)
00165 #define C7_8    (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G)
00166 #define C7_9    (S7_A | S7_B | S7_C | S7_D | S7_F | S7_G)
00167 
00168 //58 0x3A
00169 #define C7_COL  (S7_D | S7_G) // :
00170 #define C7_SCL  (S7_D | S7_G) // ;
00171 #define C7_LT   (S7_D | S7_E | S7_G)             // <
00172 #define C7_EQ   (S7_D | S7_G)                    // =
00173 #define C7_GT   (S7_C | S7_D | S7_G)             // >   
00174 #define C7_QM   (S7_A | S7_B | S7_E | S7_G)      // ?
00175 #define C7_AT   (S7_A | S7_B | S7_C | S7_D | S7_E  | S7_G)  // @
00176 
00177 //65 0x41  Upper case alphabet
00178 #define C7_A    (S7_A | S7_B | S7_C | S7_E | S7_F | S7_G )
00179 #define C7_B    (S7_C | S7_D | S7_E | S7_F | S7_G)
00180 #define C7_C    (S7_A | S7_D | S7_E | S7_F)
00181 #define C7_D    (S7_B | S7_C | S7_D | S7_E | S7_G)
00182 #define C7_E    (S7_A | S7_D | S7_E | S7_F | S7_G)
00183 #define C7_F    (S7_A | S7_E | S7_F | S7_G)
00184 
00185 #define C7_G    (S7_A | S7_C | S7_D | S7_E | S7_F)
00186 #define C7_H    (S7_B | S7_C | S7_E | S7_F | S7_G)
00187 #define C7_I    (S7_B | S7_C)
00188 #define C7_J    (S7_B | S7_C | S7_D | S7_E)
00189 #define C7_K    (S7_B | S7_C | S7_E | S7_F | S7_G)
00190 #define C7_L    (S7_D | S7_E | S7_F)
00191 #define C7_M    (S7_A | S7_C | S7_E)
00192 #define C7_N    (S7_A | S7_B | S7_C | S7_E | S7_F)
00193 #define C7_O    (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F)
00194 #define C7_P    (S7_A | S7_B | S7_E | S7_F | S7_G)
00195 #define C7_Q    (S7_A | S7_B | S7_C | S7_F | S7_G)
00196 #define C7_R    (S7_E | S7_G )
00197 #define C7_S    (S7_A | S7_C | S7_D | S7_F | S7_G)
00198 #define C7_T    (S7_D | S7_E | S7_F | S7_G)
00199 #define C7_U    (S7_B | S7_C | S7_D | S7_E | S7_F)
00200 #define C7_V    (S7_B | S7_C | S7_D | S7_E | S7_F)
00201 #define C7_W    (S7_B | S7_D | S7_F)
00202 #define C7_X    (S7_B | S7_C | S7_E | S7_F | S7_G)
00203 #define C7_Y    (S7_B | S7_C | S7_D | S7_F | S7_G)
00204 #define C7_Z    (S7_A | S7_B | S7_D | S7_E | S7_G)
00205 
00206 //91 0x5B
00207 #define C7_SBL  (S7_A | S7_D | S7_E | S7_F) // [
00208 #define C7_LS   (S7_C | S7_F | S7_G)        // left slash
00209 #define C7_SBR  (S7_A | S7_B | S7_C | S7_D) // ]
00210 #define C7_PWR  (S7_A | S7_B | S7_F)        // ^
00211 #define C7_UDS  (S7_D)                      // _
00212 #define C7_DSH  (S7_F)                      // `  
00213 
00214 //97 0x61  Lower case alphabet
00215 #define C7_a     C7_A
00216 #define C7_b     C7_B
00217 #define C7_c     C7_C
00218 #define C7_d     C7_D
00219 #define C7_e     C7_E
00220 #define C7_f     C7_H
00221 
00222 #define C7_g     C7_G
00223 #define C7_h     C7_H
00224 #define C7_i     C7_I
00225 #define C7_j     C7_J
00226 #define C7_k     C7_K
00227 #define C7_l     C7_L
00228 #define C7_m     C7_M
00229 //#define C7_n     C7_N
00230 #define C7_n    (S7_C | S7_E | S7_G)
00231 //#define C7_o     C7_O
00232 #define C7_o    (S7_C | S7_D | S7_E | S7_G)
00233 #define C7_p     C7_P
00234 #define C7_q     C7_Q
00235 //#define C7_r     C7_R
00236 #define C7_r    (S7_E | S7_G)
00237 #define C7_s     C7_S
00238 #define C7_t     C7_T
00239 #define C7_u     C7_U
00240 #define C7_v     C7_V
00241 #define C7_w     C7_W
00242 #define C7_x     C7_X
00243 #define C7_y     C7_Y
00244 #define C7_z     C7_Z
00245 
00246 //123 0x7B
00247 #define C7_CBL  (S7_A | S7_D | S7_E | S7_F)        // {
00248 #define C7_OR   (S7_B | S7_C)                      // |
00249 #define C7_CBR  (S7_A | S7_B | S7_C | S7_D)        // }
00250 #define C7_TLD  (S7_B | S7_E | S7_G )              // ~
00251 #define C7_DEL  (0x000000)
00252 
00253 
00254 //User Defined Characters (some examples)
00255 #define C7_DGR   (S7_A | S7_B | S7_F | S7_G)  //Degrees
00256                                                                          
00257 // Font data selection for transmission to PT6318 memory
00258 #define LO(x)  ( x & 0xFF)
00259 #define MD(x)  ((x >>  8) & 0xFF)
00260 #define HI(x)  ((x >> 16) & 0xFF)
00261 
00262 // ASCII Font definition table
00263 //
00264 #define FONT_7S_START     0x20
00265 #define FONT_7S_END       0x7F
00266 //#define FONT_7S_NR_CHARS (FONT_7S_END - FONT_7S_START + 1)
00267 extern const char FONT_7S[]; 
00268 
00269 #endif