Wim Huiskamp / PT6311

Dependents:   mbed_PT6311

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Font_16Seg.h Source File

Font_16Seg.h

00001 /* mbed VFD Font Library, for Princeton PT6311 VFD controller as used in VFDEM2
00002  * Copyright (c) 2016, v01: WH, Initial version for VFDEM2
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_16SEG_H
00023 #define MBED_FONT_16SEG_H
00024 
00025 // Select one of the testboards for Princeton PT6312 VFD controller
00026 #include "PT6311_Config.h"
00027 
00028 #if (VFDEM2_TEST == 1) 
00029 //#if (1) 
00030 // Segment bit positions for 14 or 16 Segment display using the VFDEM2 mapping for PT6311
00031 // Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_16S 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 //           A1   A2
00036 //          ---- ----
00037 //         |H\ J|  /K|     
00038 //       F |  \ | /  | B    
00039 //         |G1 \|/ G2|     
00040 //          --- + ---
00041 //         |   /|\   |     
00042 //       E |  / | \  | C    
00043 //         |N/ M|  \L|     
00044 //          ---- ----    * DP
00045 //           D1   D2
00046 //
00047 #define S16_D1   0x0004  // Assuming 2 part D segment
00048 #define S16_D2   0x0004
00049 #define S16_E    0x0008
00050 #define S16_N    0x0010
00051 #define S16_M    0x0020
00052 #define S16_L    0x0040
00053 #define S16_C    0x0080
00054 #define S16_G2   0x0100  // 2 part G segment
00055 #define S16_G1   0x0200
00056 #define S16_F    0x0400
00057 #define S16_H    0x0800
00058 #define S16_J    0x1000 
00059 #define S16_K    0x2000
00060 #define S16_B    0x4000
00061 #define S16_A1   0x8000  // Assuming 2 part A segment
00062 #define S16_A2   0x8000
00063 
00064 #define S16_S    0x0000  // NA
00065 
00066 //Icons All Grids
00067 //#define S16_DP   0x8000  // Assuming single DP segment
00068 
00069 //Icons Grid 1
00070 #define S16_CIR  0x0008
00071 #define S16_PIE_R 0x0010
00072 #define S16_PIE_G 0x0020
00073 #define S16_PIE_B 0x0040
00074 #define S16_STP  0x0080
00075 #define S16_PSE  0x0100
00076 #define S16_PLY  0x0200
00077 #define S16_RR   0x0400
00078 #define S16_LL   0x0800
00079 #define S16_PCM  0x1000
00080 #define S16_DTS  0x2000
00081 #define S16_MIC  0x4000
00082 #define S16_DLB  0x8000
00083 #define S16_ICON_GR1  (S16_CIR | S16_PIE_R | S16_PIE_G | S16_PIE_B | S16_STP | S16_PSE | S16_PLY | S16_RR | S16_LL | S16_PCM | S16_DTS | S16_MIC | S16_DLB)
00084 
00085 //Icons Grid 2
00086 #define S16_REC  0x0001
00087 #define S16_ICON_GR2  (S16_REC)
00088 
00089 //Icons Grid 3
00090 #define S16_PRG  0x0001
00091 #define S16_RND  0x0002
00092 #define S16_ICON_GR3  (S16_PRG | S16_RND)
00093 
00094 //Icons Grid 4
00095 #define S16_DP8  0x0001
00096 #define S16_COL8 0x0002
00097 #define S16_ICON_GR4  (S16_DP8 | S16_COL8)
00098 
00099 //Icons Grid 5
00100 #define S16_ANG  0x0001
00101 #define S16_ZM   0x0002
00102 #define S16_ICON_GR5  (S16_ANG | S16_ZM)
00103 
00104 //Icons Grid 6
00105 #define S16_PBC  0x0001
00106 #define S16_COL6 0x0002
00107 #define S16_ICON_GR6  (S16_PBC | S16_COL6)
00108 
00109 //Icons Grid 7
00110 #define S16_ICON_GR7  (0x0000)
00111 
00112 //Icons Grid 8
00113 #define S16_ICON_GR8  (0x0000)
00114 
00115 //Icons Grid 9
00116 #define S16_ICON_GR9  (0x0000)
00117 
00118 //Icons Grid 10
00119 #define S16_ICON_GR10 (0x0000)
00120 
00121 //Icons Grid 11
00122 #define S16_ICON_GR11 (0x0000)
00123 
00124 //Icons Grid 12
00125 #define S16_MP3  0x0008
00126 #define S16_CDDA 0x0010
00127 #define S16_SS   0x0020
00128 #define S16_VCD  0x0040
00129 #define S16_DVD  0x0080
00130 #define S16_ARW  0x0100
00131 #define S16_ONE  0x0200
00132 #define S16_ALL  0x0400
00133 #define S16_AA   0x0800
00134 #define S16_BB   0x1000
00135 #define S16_TTL  0x2000
00136 #define S16_CHP  0x4000
00137 #define S16_ICON_GR12 (S16_MP3 | S16_CDDA | S16_SS | S16_VCD | S16_DVD | S16_ARW | S16_ONE | S16_ALL | S16_AA | S16_BB | S16_TTL | S16_CHP)
00138 
00139 
00140 //Mask for blending out and restoring Icons
00141 extern const char MASK_ICON_GRID[][3]; 
00142 
00143 //One mask pattern will be sufficient assuming that all digits use the same mapping.
00144 //#define S16_ICON_MSK (S16_COL3)
00145 
00146 #endif
00147 
00148 
00149 // ASCII Font definitions for segments in each character
00150 //
00151 //32 0x20
00152 #define C16_SPC  (0x0000)    //Space
00153 #define C16_EXC  (S16_B | S16_C) //!
00154 #define C16_QTE  (S16_B | S16_F) //"
00155 #define C16_HSH  (S16_B | S16_C | S16_D1 | S16_D2 | S16_G1 | S16_G2 | S16_J | S16_M) //#
00156 #define C16_DLR  (S16_A1 | S16_A2 | S16_C | S16_D1 | S16_D2 | S16_F | S16_G1 | S16_G2 | S16_J | S16_M | S16_S) //$
00157 #define C16_PCT  (S16_C | S16_F | S16_K | S16_N | S16_S) //%
00158 //#define C16_AMP    (S16_A1 | S16_C | S16_D1 | S16_D2 | S16_E | S16_G1 | S16_J | S16_H | S16_L) // Not correct when J and M are linked
00159 #define C16_AMP  (S16_A1 | S16_A2 | S16_C | S16_D1 | S16_D2 | S16_H | S16_K | S16_L | S16_N | S16_S) //&
00160 #define C16_ACC  (S16_B) //'
00161 #define C16_LBR  (S16_K | S16_L) //(
00162 #define C16_RBR  (S16_H | S16_N) //)
00163 #define C16_MLT  (S16_G1 | S16_G2 | S16_J | S16_M | S16_K | S16_L | S16_H | S16_N | S16_S)  //*
00164 #define C16_PLS  (S16_G1 | S16_G2 | S16_J | S16_M | S16_S) //+
00165 #define C16_CMA  (S16_C) //,
00166 #define C16_MIN  (S16_G1 | S16_G2 | S16_S) //-
00167 #define C16_DOT  (S16_C) //.
00168 #define C16_RS   (S16_K | S16_N  | S16_S)  // /
00169 //48 0x30 digits
00170 #define C16_0    (S16_A1 | S16_A2 | S16_B | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_F)
00171 #define C16_1    (S16_B  | S16_C)
00172 #define C16_2    (S16_A1 | S16_A2 | S16_B | S16_D1 | S16_D2 | S16_E  | S16_G1 | S16_G2 | S16_S)
00173 #define C16_3    (S16_A1 | S16_A2 | S16_B | S16_C  | S16_D1 | S16_D2 | S16_G2 | S16_S)
00174 #define C16_4    (S16_B  | S16_C  | S16_F | S16_G1 | S16_G2 | S16_S)
00175 #define C16_5    (S16_A1 | S16_A2 | S16_C | S16_D1 | S16_D2 | S16_F | S16_G1 | S16_G2 | S16_S)
00176 #define C16_6    (S16_A1 | S16_A2 | S16_C | S16_D1 | S16_D2 | S16_E | S16_F  | S16_G1 | S16_G2 | S16_S)
00177 #define C16_7    (S16_A1 | S16_A2 | S16_B | S16_C)
00178 #define C16_8    (S16_A1 | S16_A2 | S16_B | S16_C  | S16_D1 | S16_D2 | S16_E | S16_F  | S16_G1 | S16_G2 | S16_S)
00179 #define C16_9    (S16_A1 | S16_A2 | S16_B | S16_C  | S16_D1 | S16_D2 | S16_F | S16_G1 | S16_G2 | S16_S)
00180 //58 0x3A
00181 #define C16_COL  (S16_D1 | S16_D2 | S16_G1 | S16_G2 | S16_S) // :
00182 #define C16_SCL  (S16_D1 | S16_D2 | S16_G1 | S16_G2 | S16_S) // ;
00183 #define C16_LT   (S16_K  | S16_L  | S16_S)               // <
00184 #define C16_EQ   (S16_D1 | S16_D2 | S16_G1 | S16_G2 | S16_S) // =
00185 #define C16_GT   (S16_H  | S16_N  | S16_S)               // >   
00186 //#define C16_QM   (S16_A1 | S16_A2 | S16_B | S16_G2 | S16_M) // Not correct when J and M are linked
00187 #define C16_QM   (S16_A1 | S16_A2 | S16_B | S16_G2 | S16_N | S16_S)  // ?
00188 //64 0x40
00189 //#define C16_AT   (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E | S16_G1  | S16_M | S16_S) // Not correct when J and M are linked
00190 #define C16_AT   (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_G1 | S16_S)  // @
00191 #define C16_A    (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_E  | S16_F  | S16_G1 | S16_G2 | S16_S)  // Upper case alphabet
00192 #define C16_B    (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_J  | S16_M  | S16_G2 | S16_S)
00193 #define C16_C    (S16_A1 | S16_A2 | S16_D1 | S16_D2 | S16_E  | S16_F)
00194 #define C16_D    (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_J  | S16_M  | S16_S)
00195 #define C16_E    (S16_A1 | S16_A2 | S16_D1 | S16_D2 | S16_E  | S16_F  | S16_G1 | S16_S)
00196 #define C16_F    (S16_A1 | S16_A2 | S16_E  | S16_F  | S16_G1 | S16_S)
00197 #define C16_G    (S16_A1 | S16_A2 | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_F  | S16_G2 | S16_S)
00198 #define C16_H    (S16_B  | S16_C  | S16_E  | S16_F  | S16_G1 | S16_G2 | S16_S)
00199 #define C16_I    (S16_A1 | S16_A2 | S16_D1 | S16_D2 | S16_J  | S16_M  | S16_S)
00200 #define C16_J    (S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E)
00201 #define C16_K    (S16_E  | S16_F  | S16_G1 | S16_K  | S16_L  | S16_S)
00202 #define C16_L    (S16_D1 | S16_D2 | S16_E  | S16_F)
00203 #define C16_M    (S16_B  | S16_C  | S16_E  | S16_F  | S16_H  | S16_K  | S16_S)
00204 #define C16_N    (S16_B  | S16_C  | S16_E  | S16_F  | S16_H  | S16_L  | S16_S)
00205 #define C16_O    (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_F)
00206 #define C16_P    (S16_A1 | S16_A2 | S16_B  | S16_E  | S16_F  | S16_G1 | S16_G2 | S16_S)
00207 #define C16_Q    (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_F  | S16_L)
00208 #define C16_R    (S16_A1 | S16_A2 | S16_B  | S16_E  | S16_F  | S16_G1 | S16_G2 | S16_L  | S16_S)
00209 #define C16_S    (S16_A1 | S16_A2 | S16_C  | S16_D1 | S16_D2 | S16_F  | S16_G1 | S16_G2 | S16_S)
00210 #define C16_T    (S16_A1 | S16_A2 | S16_J  | S16_M  | S16_S)
00211 #define C16_U    (S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_F)
00212 #define C16_V    (S16_E  | S16_F  | S16_N  | S16_K  | S16_S)
00213 #define C16_W    (S16_B  | S16_C  | S16_E  | S16_F  | S16_L  | S16_N  | S16_S)
00214 #define C16_X    (S16_H  | S16_K  | S16_L  | S16_N  | S16_S)
00215 //#define C16_Y    (S16_H | S16_K | S16_M | S16_S) // Not correct when J and M are linked
00216 #define C16_Y    (S16_B  | S16_C  | S16_D1 | S16_D2 | S16_F  | S16_G1 | S16_G2 | S16_S)
00217 #define C16_Z    (S16_A1 | S16_A2 | S16_D1 | S16_D2 | S16_K  | S16_N  | S16_S)
00218 //91 0x5B
00219 #define C16_SBL  (S16_A1 | S16_D1 | S16_E  | S16_F)  // [
00220 #define C16_LS   (S16_H  | S16_L  | S16_S)           // left slash
00221 #define C16_SBR  (S16_A2 | S16_B | S16_C | S16_D2)   // ]
00222 #define C16_PWR  (S16_L  | S16_N  | S16_S)           // ^
00223 #define C16_UDS  (S16_D1 | S16_D2)                   // _
00224 #define C16_DSH  (S16_H)                             // `  
00225 //97 0x61
00226 // a...z No defines provided. Just use the Upper case characters again
00227 //122
00228 
00229 //123 0x7B
00230 #define C16_CBL  (S16_G1 | S16_J  | S16_M  | S16_S)          // {
00231 #define C16_OR   (S16_J  | S16_M  | S16_S)                   // |
00232 #define C16_CBR  (S16_G2 | S16_J  | S16_M  | S16_S)          // }
00233 #define C16_TLD  (S16_B  | S16_E  | S16_G1 | S16_G2 | S16_S) // ~
00234 #define C16_DEL  (0x0000)
00235 
00236 //User Defined Characters (some examples)
00237 #define UDC16_SANDHR  (S16_A1 | S16_A2 | S16_D1 | S16_D2 | S16_H  | S16_K | S16_L | S16_N | S16_S)  //Sandhour
00238 #define UDC16_DGR     (S16_A  | S16_B  | S16_F | S16_G)  // degrees
00239 
00240 #if(0)
00241 #define UDC16_WHEEL0  (S16_G1 | S16_G2 | S16_S)  // -
00242 #define UDC16_WHEEL1  (S16_H  | S16_L  | S16_S)  /* \ */
00243 #define UDC16_WHEEL2  (S16_J  | S16_M  | S16_S)  // |
00244 #define UDC16_WHEEL3  (S16_K  | S16_N  | S16_S)  // /
00245 #define UDC16_WHEEL4  (S16_G1 | S16_G2 | S16_S)  // -
00246 #define UDC16_WHEEL5  (S16_H  | S16_L  | S16_S)  /* \ */
00247 #define UDC16_WHEEL6  (S16_J  | S16_M  | S16_S)  // |
00248 #define UDC16_WHEEL7  (S16_K  | S16_N  | S16_S)  // /
00249 #else
00250 #define UDC16_WHEEL0  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_G1 | S16_G2 | S16_S)  // -
00251 #define UDC16_WHEEL1  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_H  | S16_L  | S16_S)  /* \ */
00252 #define UDC16_WHEEL2  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_J  | S16_M  | S16_S)  // |
00253 #define UDC16_WHEEL3  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_K  | S16_N  | S16_S)  // /
00254 #define UDC16_WHEEL4  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_G1 | S16_G2 | S16_S)  // -
00255 #define UDC16_WHEEL5  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_H  | S16_L  | S16_S)  /* \ */
00256 #define UDC16_WHEEL6  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_J  | S16_M  | S16_S)  // |
00257 #define UDC16_WHEEL7  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_K  | S16_N  | S16_S)  // /
00258 #endif
00259 
00260 // Font data selection for transmission to PT6311 memory
00261 #define LO(x)  ( x & 0xFF)
00262 #define MD(x)  ((x >>  8) & 0xFF)
00263 #define HI(x)  ((x >> 16) & 0xFF)
00264 
00265 // ASCII Font definition table
00266 //
00267 #define FONT_16S_START     0x20
00268 #define FONT_16S_END       0x7F
00269 //#define FONT_16S16_LR_CHARS (FONT_16S16_END - FONT_16S16_START + 1)
00270 extern const short FONT_16S[]; 
00271 
00272 
00273 // Wheel animation definition table
00274 extern const int WHEEL_ANI[]; 
00275 #endif