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