Wim Huiskamp / PT6312

Dependents:   mbed_PT6312

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Font_7Seg.h Source File

Font_7Seg.h

00001 /* mbed VFD Font Library, for Princeton PT6312 VFD controller as used in Cyberhome DVD462 and C2233
00002  * Copyright (c) 2015, v01: WH, Initial version, Test DVD462 and C2233
00003  *               2015, v02: WH, Added symbols
00004  *
00005  * Permission is hereby granted, free of charge, to any person obtaining a copy
00006  * of this software and associated documentation files (the "Software"), to deal
00007  * in the Software without restriction, including without limitation the rights
00008  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00009  * copies of the Software, and to permit persons to whom the Software is
00010  * furnished to do so, subject to the following conditions:
00011  *
00012  * The above copyright notice and this permission notice shall be included in
00013  * all copies or substantial portions of the Software.
00014  *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00018  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00020  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00021  * THE SOFTWARE.
00022  */
00023 #ifndef MBED_FONT_7SEG_H
00024 #define MBED_FONT_7SEG_H
00025 
00026 // Select one of the testboards for Princeton PT6312 VFD controller
00027 #include "PT6312_Config.h"
00028 
00029 #if (DVD462_TEST == 1) 
00030 // Segment bit positions for 7 Segment display using the DVD462 mapping for PT6312
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 // In this specific case grids 2,3 and 4 have two 7 segment digits, grid 5 hase one. Unfortunetely the patterns for the second digits
00035 // of grid 3 and 4 are shifted by one bit position.
00036 //
00037 #define S7_D    0x0001
00038 #define S7_E    0x0002
00039 #define S7_C    0x0004
00040 #define S7_G    0x0008 
00041 #define S7_F    0x0010
00042 #define S7_B    0x0020
00043 #define S7_A    0x0040
00044 
00045 //Mask for blending out and setting 7 segments digits
00046 #define MASK_7S_ALL = (S7_D | S7_E | S7_C | S7_G | S7_F | S7_B | S7_A}
00047 
00048 
00049 //Icons Grid 1
00050 #define S7_MP3  0x0800
00051 #define S7_CD   0x1000
00052 #define S7_V    0x2000
00053 #define S7_S    0x4000
00054 #define S7_DVD  0x8000
00055 #define S7_ICON_GR1 (S7_MP3 | S7_CD | S7_V | S7_S | S7_DVD)
00056 
00057 //Icons Grid 2
00058 #define S7_DDD  0x4000
00059 #define S7_DTS  0x8000
00060 #define S7_ICON_GR2 (S7_DDD | S7_DTS)
00061 
00062 //Icons Grid 3
00063 #define S7_COL5 0x0080
00064 #define S7_ICON_GR3 (S7_COL5)
00065 
00066 //Icons Grid 4
00067 #define S7_COL3 0x0080
00068 #define S7_ICON_GR4 (S7_COL3)
00069 
00070 //Icons Grid 5
00071 #define S7_ARW  0x0100
00072 #define S7_ALL  0x0200
00073 #define S7_PSE  0x0400
00074 #define S7_PLY  0x0800
00075 #define S7_PBC  0x8000
00076 #define S7_ICON_GR5 (S7_ARW | S7_ALL | S7_PSE | S7_PLY | S7_PBC)
00077 
00078 //Icons Grid 6 (Piechart)
00079 #define S7_P1   0x0004
00080 #define S7_P2   0x0008
00081 #define S7_P3   0x0010
00082 #define S7_P4   0x0020
00083 #define S7_P5   0x0040
00084 #define S7_P6   0x0080
00085 #define S7_P7   0x0100
00086 #define S7_P8   0x0200
00087 #define S7_P9   0x0400
00088 #define S7_P10  0x0800
00089 #define S7_P11  0x1000
00090 #define S7_P12  0x2000
00091 #define S7_P13  0x4000
00092 #define S7_ICON_GR6 (S7_P1 | S7_P2 | S7_P3 | S7_P4 | S7_P5 | S7_P6 | S7_P7 | S7_P8 | S7_P9 | S7_P10 | S7_P11 | S7_P12 | S7_P13)
00093 
00094 //Mask for blending out and restoring Icons
00095 extern const char MASK_ICON_GRID[][2]; 
00096 #endif
00097 
00098 #if (C2233_TEST == 1) 
00099 // Segment bit positions for 7 Segment display using the C2233 mapping for PT6312
00100 // Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_7S const table below 
00101 // will be adapted automatically according to the bit-to-segment mapping. Obviously this will only work when the segment
00102 // mapping is identical for every digit position. This will be the case unless the hardware designer really hates software developers.
00103 // In this specific case grids 2,3 and 4 have two 7 segment digits, grid 5 hase one. Unfortunetely the patterns for the second digits
00104 // of grid 3 and 4 are shifted by one bit position.
00105 //
00106 #define S7_D    0x0001
00107 #define S7_E    0x0002
00108 #define S7_C    0x0004
00109 #define S7_G    0x0008 
00110 #define S7_F    0x0010
00111 #define S7_B    0x0020
00112 #define S7_A    0x0040
00113 
00114 //Mask for blending out and setting 7 segments digits
00115 #define MASK_7S_ALL = (S7_D | S7_E | S7_C | S7_G | S7_F | S7_B | S7_A}
00116 
00117 
00118 //Icons Grid 1
00119 //none
00120 #define S7_ICON_GR1 (0)
00121 
00122 //Icons Grid 2
00123 #define S7_MP3  0x4000
00124 #define S7_PBC  0x8000
00125 #define S7_ICON_GR2 (S7_MP3 | S7_PBC)
00126 
00127 //Icons Grid 3
00128 #define S7_COL5 0x0080
00129 #define S7_CAM  0x8000
00130 #define S7_ICON_GR3 (S7_COL5 | S7_CAM)
00131 
00132 //Icons Grid 4
00133 #define S7_COL3 0x0080
00134 #define S7_DDD  0x8000
00135 #define S7_ICON_GR4 (S7_COL3 | S7_DDD)
00136 
00137 //Icons Grid 5
00138 #define S7_ARW  0x0100
00139 #define S7_ALL  0x0200
00140 #define S7_PSE  0x0400
00141 #define S7_PLY  0x0800
00142 #define S7_CD   0x1000
00143 #define S7_V    0x2000
00144 #define S7_S    0x4000
00145 #define S7_DTS  0x8000
00146 #define S7_ICON_GR5 (S7_ARW | S7_ALL | S7_PSE | S7_PLY | S7_CD | S7_V | S7_S | S7_DTS)
00147 
00148 //Icons Grid 6 (Piechart)
00149 #define S7_P1   0x0004
00150 #define S7_P2   0x0008
00151 #define S7_P3   0x0010
00152 #define S7_P4   0x0020
00153 #define S7_P5   0x0040
00154 #define S7_P6   0x0080
00155 #define S7_P7   0x0100
00156 #define S7_P8   0x0200
00157 #define S7_P9   0x0400
00158 #define S7_P10  0x0800
00159 #define S7_P11  0x1000
00160 #define S7_P12  0x2000
00161 #define S7_P13  0x4000
00162 #define S7_DVD  0x8000
00163 #define S7_ICON_GR6 (S7_P1 | S7_P2 | S7_P3 | S7_P4 | S7_P5 | S7_P6 | S7_P7 | S7_P8 | S7_P9 | S7_P10 | S7_P11 | S7_P12 | S7_P13 |S7_DVD)
00164 
00165 //Mask for blending out and restoring Icons
00166 extern const char MASK_ICON_GRID[][2]; 
00167 #endif
00168 
00169 
00170 
00171 // ASCII Font definitions for segments in each character
00172 //
00173 //32 0x20  Symbols
00174 #define C7_SPC  ()
00175 
00176 //48 0x30  Digits
00177 #define C7_0    (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F)
00178 #define C7_1    (S7_B | S7_C)
00179 #define C7_2    (S7_A | S7_B | S7_D | S7_E | S7_G)
00180 #define C7_3    (S7_A | S7_B | S7_C | S7_D | S7_G)
00181 #define C7_4    (S7_B | S7_C | S7_F | S7_G)
00182 #define C7_5    (S7_A | S7_C | S7_D | S7_F | S7_G)
00183 #define C7_6    (S7_A | S7_C | S7_D | S7_E | S7_F | S7_G)
00184 #define C7_7    (S7_A | S7_B | S7_C)
00185 #define C7_8    (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G)
00186 #define C7_9    (S7_A | S7_B | S7_C | S7_D | S7_F | S7_G)
00187 //64 0x40  Upper case alphabet
00188 #define C7_A    (S7_A | S7_B | S7_C | S7_E | S7_F | S7_G )
00189 #define C7_B    (S7_C | S7_D | S7_E | S7_F | S7_G)
00190 #define C7_C    (S7_A | S7_D | S7_E | S7_F)
00191 #define C7_D    (S7_B | S7_C | S7_D | S7_E | S7_G)
00192 #define C7_E    (S7_A | S7_D | S7_E | S7_F | S7_G)
00193 #define C7_F    (S7_A | S7_E | S7_F | S7_G)
00194 
00195 #define C7_G    (S7_A | S7_C | S7_D | S7_E | S7_F)
00196 #define C7_H    (S7_B | S7_C | S7_E | S7_F | S7_G)
00197 #define C7_I    (S7_B | S7_C)
00198 #define C7_J    (S7_B | S7_C | S7_D | S7_E)
00199 #define C7_L    (S7_D | S7_E | S7_F)
00200 #define C7_M    (S7_C | S7_E | S7_G)
00201 #define C7_N    (S7_C | S7_E | S7_G)
00202 #define C7_O    (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F)
00203 #define C7_P    (S7_A | S7_B | S7_E | S7_F | S7_G)
00204 #define C7_Q    (S7_A | S7_B | S7_C | S7_F | S7_G)
00205 #define C7_R    (S7_E | S7_G)
00206 #define C7_S    (S7_A | S7_C | S7_D | S7_F | S7_G)
00207 #define C7_T    (S7_D | S7_E | S7_F | S7_G)
00208 #define C7_U    (S7_B | S7_C | S7_D | S7_E | S7_F)
00209 #define C7_Y    (S7_B | S7_C | S7_D | S7_F | S7_G)
00210 #define C7_Z    (S7_A | S7_B | S7_D | S7_E | S7_G)
00211 
00212 //97 0x61  Lower case alphabet
00213 #define C7_a     C7_A
00214 #define C7_b     C7_B
00215 #define C7_c     C7_C
00216 #define C7_d     C7_D
00217 #define C7_e     C7_E
00218 #define C7_f     C7_H
00219 
00220 #define C7_g     C7_G
00221 #define C7_h     C7_H
00222 #define C7_i     C7_I
00223 #define C7_j     C7_J
00224 #define C7_l     C7_L
00225 #define C7_m     C7_M
00226 #define C7_n     C7_N
00227 #define C7_o     C7_O
00228 #define C7_p     C7_P
00229 #define C7_q     C7_Q
00230 #define C7_r     C7_R
00231 #define C7_s     C7_S
00232 #define C7_t     C7_T
00233 #define C7_u     C7_U
00234 #define C7_y     C7_Y
00235 #define C7_z     C7_Z
00236 
00237 
00238 //User Defined Characters (some examples)
00239                                                                           
00240 // Font data selection for transmission to PT6512 memory
00241 #define LO(x)  ( x & 0xFF)
00242 #define HI(x)  ((x >> 8) & 0xFF)
00243 
00244 
00245 // ASCII Font definition table
00246 //
00247 //#define FONT_7S_START     0x20
00248 //#define FONT_7S_END       0x7F
00249 //#define FONT_7S_NR_CHARS (FONT_7S_END - FONT_7S_START + 1)
00250 extern const char FONT_7S[]; 
00251 
00252 #endif