Library for the Princeton PT6312 Vacuum Fluorescent Display (VFD) driver.
This library is documented here.
Font_7Seg.h@6:d3dc313a6840, 2016-01-20 (annotated)
- Committer:
- wim
- Date:
- Wed Jan 20 18:50:50 2016 +0000
- Revision:
- 6:d3dc313a6840
- Parent:
- 5:be9ec73af639
Rename Digit/Grid, added DVD462 code, added C2233 code, added fonts.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wim | 5:be9ec73af639 | 1 | /* mbed VFD Font Library, for Princeton PT6312 VFD controller as used in Cyberhome DVD462 and C2233 |
wim | 5:be9ec73af639 | 2 | * Copyright (c) 2015, v01: WH, Initial version, Test DVD462 and C2233 |
wim | 6:d3dc313a6840 | 3 | * 2015, v02: WH, Added symbols |
wim | 5:be9ec73af639 | 4 | * |
wim | 5:be9ec73af639 | 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
wim | 5:be9ec73af639 | 6 | * of this software and associated documentation files (the "Software"), to deal |
wim | 5:be9ec73af639 | 7 | * in the Software without restriction, including without limitation the rights |
wim | 5:be9ec73af639 | 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
wim | 5:be9ec73af639 | 9 | * copies of the Software, and to permit persons to whom the Software is |
wim | 5:be9ec73af639 | 10 | * furnished to do so, subject to the following conditions: |
wim | 5:be9ec73af639 | 11 | * |
wim | 5:be9ec73af639 | 12 | * The above copyright notice and this permission notice shall be included in |
wim | 5:be9ec73af639 | 13 | * all copies or substantial portions of the Software. |
wim | 5:be9ec73af639 | 14 | * |
wim | 5:be9ec73af639 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
wim | 5:be9ec73af639 | 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
wim | 5:be9ec73af639 | 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
wim | 5:be9ec73af639 | 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
wim | 5:be9ec73af639 | 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
wim | 5:be9ec73af639 | 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
wim | 5:be9ec73af639 | 21 | * THE SOFTWARE. |
wim | 5:be9ec73af639 | 22 | */ |
wim | 5:be9ec73af639 | 23 | #ifndef MBED_FONT_7SEG_H |
wim | 5:be9ec73af639 | 24 | #define MBED_FONT_7SEG_H |
wim | 5:be9ec73af639 | 25 | |
wim | 5:be9ec73af639 | 26 | // Select one of the testboards for Princeton PT6312 VFD controller |
wim | 5:be9ec73af639 | 27 | #include "PT6312_Config.h" |
wim | 5:be9ec73af639 | 28 | |
wim | 5:be9ec73af639 | 29 | #if (DVD462_TEST == 1) |
wim | 5:be9ec73af639 | 30 | // Segment bit positions for 7 Segment display using the DVD462 mapping for PT6312 |
wim | 5:be9ec73af639 | 31 | // Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_7S const table below |
wim | 5:be9ec73af639 | 32 | // will be adapted automatically according to the bit-to-segment mapping. Obviously this will only work when the segment |
wim | 5:be9ec73af639 | 33 | // mapping is identical for every digit position. This will be the case unless the hardware designer really hates software developers. |
wim | 5:be9ec73af639 | 34 | // 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 |
wim | 5:be9ec73af639 | 35 | // of grid 3 and 4 are shifted by one bit position. |
wim | 5:be9ec73af639 | 36 | // |
wim | 5:be9ec73af639 | 37 | #define S7_D 0x0001 |
wim | 5:be9ec73af639 | 38 | #define S7_E 0x0002 |
wim | 5:be9ec73af639 | 39 | #define S7_C 0x0004 |
wim | 5:be9ec73af639 | 40 | #define S7_G 0x0008 |
wim | 5:be9ec73af639 | 41 | #define S7_F 0x0010 |
wim | 5:be9ec73af639 | 42 | #define S7_B 0x0020 |
wim | 5:be9ec73af639 | 43 | #define S7_A 0x0040 |
wim | 5:be9ec73af639 | 44 | |
wim | 5:be9ec73af639 | 45 | //Mask for blending out and setting 7 segments digits |
wim | 5:be9ec73af639 | 46 | #define MASK_7S_ALL = (S7_D | S7_E | S7_C | S7_G | S7_F | S7_B | S7_A} |
wim | 5:be9ec73af639 | 47 | |
wim | 5:be9ec73af639 | 48 | |
wim | 5:be9ec73af639 | 49 | //Icons Grid 1 |
wim | 5:be9ec73af639 | 50 | #define S7_MP3 0x0800 |
wim | 5:be9ec73af639 | 51 | #define S7_CD 0x1000 |
wim | 5:be9ec73af639 | 52 | #define S7_V 0x2000 |
wim | 5:be9ec73af639 | 53 | #define S7_S 0x4000 |
wim | 5:be9ec73af639 | 54 | #define S7_DVD 0x8000 |
wim | 5:be9ec73af639 | 55 | #define S7_ICON_GR1 (S7_MP3 | S7_CD | S7_V | S7_S | S7_DVD) |
wim | 5:be9ec73af639 | 56 | |
wim | 5:be9ec73af639 | 57 | //Icons Grid 2 |
wim | 5:be9ec73af639 | 58 | #define S7_DDD 0x4000 |
wim | 5:be9ec73af639 | 59 | #define S7_DTS 0x8000 |
wim | 5:be9ec73af639 | 60 | #define S7_ICON_GR2 (S7_DDD | S7_DTS) |
wim | 5:be9ec73af639 | 61 | |
wim | 5:be9ec73af639 | 62 | //Icons Grid 3 |
wim | 5:be9ec73af639 | 63 | #define S7_COL5 0x0080 |
wim | 5:be9ec73af639 | 64 | #define S7_ICON_GR3 (S7_COL5) |
wim | 5:be9ec73af639 | 65 | |
wim | 5:be9ec73af639 | 66 | //Icons Grid 4 |
wim | 5:be9ec73af639 | 67 | #define S7_COL3 0x0080 |
wim | 5:be9ec73af639 | 68 | #define S7_ICON_GR4 (S7_COL3) |
wim | 5:be9ec73af639 | 69 | |
wim | 5:be9ec73af639 | 70 | //Icons Grid 5 |
wim | 5:be9ec73af639 | 71 | #define S7_ARW 0x0100 |
wim | 5:be9ec73af639 | 72 | #define S7_ALL 0x0200 |
wim | 5:be9ec73af639 | 73 | #define S7_PSE 0x0400 |
wim | 5:be9ec73af639 | 74 | #define S7_PLY 0x0800 |
wim | 5:be9ec73af639 | 75 | #define S7_PBC 0x8000 |
wim | 5:be9ec73af639 | 76 | #define S7_ICON_GR5 (S7_ARW | S7_ALL | S7_PSE | S7_PLY | S7_PBC) |
wim | 5:be9ec73af639 | 77 | |
wim | 5:be9ec73af639 | 78 | //Icons Grid 6 (Piechart) |
wim | 5:be9ec73af639 | 79 | #define S7_P1 0x0004 |
wim | 5:be9ec73af639 | 80 | #define S7_P2 0x0008 |
wim | 5:be9ec73af639 | 81 | #define S7_P3 0x0010 |
wim | 5:be9ec73af639 | 82 | #define S7_P4 0x0020 |
wim | 5:be9ec73af639 | 83 | #define S7_P5 0x0040 |
wim | 5:be9ec73af639 | 84 | #define S7_P6 0x0080 |
wim | 5:be9ec73af639 | 85 | #define S7_P7 0x0100 |
wim | 5:be9ec73af639 | 86 | #define S7_P8 0x0200 |
wim | 5:be9ec73af639 | 87 | #define S7_P9 0x0400 |
wim | 5:be9ec73af639 | 88 | #define S7_P10 0x0800 |
wim | 5:be9ec73af639 | 89 | #define S7_P11 0x1000 |
wim | 5:be9ec73af639 | 90 | #define S7_P12 0x2000 |
wim | 5:be9ec73af639 | 91 | #define S7_P13 0x4000 |
wim | 5:be9ec73af639 | 92 | #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) |
wim | 5:be9ec73af639 | 93 | |
wim | 5:be9ec73af639 | 94 | //Mask for blending out and restoring Icons |
wim | 5:be9ec73af639 | 95 | extern const char MASK_ICON_GRID[][2]; |
wim | 5:be9ec73af639 | 96 | #endif |
wim | 5:be9ec73af639 | 97 | |
wim | 5:be9ec73af639 | 98 | #if (C2233_TEST == 1) |
wim | 5:be9ec73af639 | 99 | // Segment bit positions for 7 Segment display using the C2233 mapping for PT6312 |
wim | 5:be9ec73af639 | 100 | // Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_7S const table below |
wim | 5:be9ec73af639 | 101 | // will be adapted automatically according to the bit-to-segment mapping. Obviously this will only work when the segment |
wim | 5:be9ec73af639 | 102 | // mapping is identical for every digit position. This will be the case unless the hardware designer really hates software developers. |
wim | 5:be9ec73af639 | 103 | // 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 |
wim | 5:be9ec73af639 | 104 | // of grid 3 and 4 are shifted by one bit position. |
wim | 5:be9ec73af639 | 105 | // |
wim | 5:be9ec73af639 | 106 | #define S7_D 0x0001 |
wim | 5:be9ec73af639 | 107 | #define S7_E 0x0002 |
wim | 5:be9ec73af639 | 108 | #define S7_C 0x0004 |
wim | 5:be9ec73af639 | 109 | #define S7_G 0x0008 |
wim | 5:be9ec73af639 | 110 | #define S7_F 0x0010 |
wim | 5:be9ec73af639 | 111 | #define S7_B 0x0020 |
wim | 5:be9ec73af639 | 112 | #define S7_A 0x0040 |
wim | 5:be9ec73af639 | 113 | |
wim | 5:be9ec73af639 | 114 | //Mask for blending out and setting 7 segments digits |
wim | 5:be9ec73af639 | 115 | #define MASK_7S_ALL = (S7_D | S7_E | S7_C | S7_G | S7_F | S7_B | S7_A} |
wim | 5:be9ec73af639 | 116 | |
wim | 5:be9ec73af639 | 117 | |
wim | 5:be9ec73af639 | 118 | //Icons Grid 1 |
wim | 5:be9ec73af639 | 119 | //none |
wim | 5:be9ec73af639 | 120 | #define S7_ICON_GR1 (0) |
wim | 5:be9ec73af639 | 121 | |
wim | 5:be9ec73af639 | 122 | //Icons Grid 2 |
wim | 5:be9ec73af639 | 123 | #define S7_MP3 0x4000 |
wim | 5:be9ec73af639 | 124 | #define S7_PBC 0x8000 |
wim | 5:be9ec73af639 | 125 | #define S7_ICON_GR2 (S7_MP3 | S7_PBC) |
wim | 5:be9ec73af639 | 126 | |
wim | 5:be9ec73af639 | 127 | //Icons Grid 3 |
wim | 5:be9ec73af639 | 128 | #define S7_COL5 0x0080 |
wim | 5:be9ec73af639 | 129 | #define S7_CAM 0x8000 |
wim | 5:be9ec73af639 | 130 | #define S7_ICON_GR3 (S7_COL5 | S7_CAM) |
wim | 5:be9ec73af639 | 131 | |
wim | 5:be9ec73af639 | 132 | //Icons Grid 4 |
wim | 5:be9ec73af639 | 133 | #define S7_COL3 0x0080 |
wim | 5:be9ec73af639 | 134 | #define S7_DDD 0x8000 |
wim | 5:be9ec73af639 | 135 | #define S7_ICON_GR4 (S7_COL3 | S7_DDD) |
wim | 5:be9ec73af639 | 136 | |
wim | 5:be9ec73af639 | 137 | //Icons Grid 5 |
wim | 5:be9ec73af639 | 138 | #define S7_ARW 0x0100 |
wim | 5:be9ec73af639 | 139 | #define S7_ALL 0x0200 |
wim | 5:be9ec73af639 | 140 | #define S7_PSE 0x0400 |
wim | 5:be9ec73af639 | 141 | #define S7_PLY 0x0800 |
wim | 5:be9ec73af639 | 142 | #define S7_CD 0x1000 |
wim | 5:be9ec73af639 | 143 | #define S7_V 0x2000 |
wim | 5:be9ec73af639 | 144 | #define S7_S 0x4000 |
wim | 5:be9ec73af639 | 145 | #define S7_DTS 0x8000 |
wim | 5:be9ec73af639 | 146 | #define S7_ICON_GR5 (S7_ARW | S7_ALL | S7_PSE | S7_PLY | S7_CD | S7_V | S7_S | S7_DTS) |
wim | 5:be9ec73af639 | 147 | |
wim | 5:be9ec73af639 | 148 | //Icons Grid 6 (Piechart) |
wim | 5:be9ec73af639 | 149 | #define S7_P1 0x0004 |
wim | 5:be9ec73af639 | 150 | #define S7_P2 0x0008 |
wim | 5:be9ec73af639 | 151 | #define S7_P3 0x0010 |
wim | 5:be9ec73af639 | 152 | #define S7_P4 0x0020 |
wim | 5:be9ec73af639 | 153 | #define S7_P5 0x0040 |
wim | 5:be9ec73af639 | 154 | #define S7_P6 0x0080 |
wim | 5:be9ec73af639 | 155 | #define S7_P7 0x0100 |
wim | 5:be9ec73af639 | 156 | #define S7_P8 0x0200 |
wim | 5:be9ec73af639 | 157 | #define S7_P9 0x0400 |
wim | 5:be9ec73af639 | 158 | #define S7_P10 0x0800 |
wim | 5:be9ec73af639 | 159 | #define S7_P11 0x1000 |
wim | 5:be9ec73af639 | 160 | #define S7_P12 0x2000 |
wim | 5:be9ec73af639 | 161 | #define S7_P13 0x4000 |
wim | 5:be9ec73af639 | 162 | #define S7_DVD 0x8000 |
wim | 5:be9ec73af639 | 163 | #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) |
wim | 5:be9ec73af639 | 164 | |
wim | 5:be9ec73af639 | 165 | //Mask for blending out and restoring Icons |
wim | 5:be9ec73af639 | 166 | extern const char MASK_ICON_GRID[][2]; |
wim | 5:be9ec73af639 | 167 | #endif |
wim | 5:be9ec73af639 | 168 | |
wim | 5:be9ec73af639 | 169 | |
wim | 5:be9ec73af639 | 170 | |
wim | 5:be9ec73af639 | 171 | // ASCII Font definitions for segments in each character |
wim | 5:be9ec73af639 | 172 | // |
wim | 6:d3dc313a6840 | 173 | //32 0x20 Symbols |
wim | 6:d3dc313a6840 | 174 | #define C7_SPC () |
wim | 6:d3dc313a6840 | 175 | |
wim | 5:be9ec73af639 | 176 | //48 0x30 Digits |
wim | 5:be9ec73af639 | 177 | #define C7_0 (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F) |
wim | 5:be9ec73af639 | 178 | #define C7_1 (S7_B | S7_C) |
wim | 5:be9ec73af639 | 179 | #define C7_2 (S7_A | S7_B | S7_D | S7_E | S7_G) |
wim | 5:be9ec73af639 | 180 | #define C7_3 (S7_A | S7_B | S7_C | S7_D | S7_G) |
wim | 5:be9ec73af639 | 181 | #define C7_4 (S7_B | S7_C | S7_F | S7_G) |
wim | 5:be9ec73af639 | 182 | #define C7_5 (S7_A | S7_C | S7_D | S7_F | S7_G) |
wim | 5:be9ec73af639 | 183 | #define C7_6 (S7_A | S7_C | S7_D | S7_E | S7_F | S7_G) |
wim | 5:be9ec73af639 | 184 | #define C7_7 (S7_A | S7_B | S7_C) |
wim | 5:be9ec73af639 | 185 | #define C7_8 (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G) |
wim | 5:be9ec73af639 | 186 | #define C7_9 (S7_A | S7_B | S7_C | S7_D | S7_F | S7_G) |
wim | 5:be9ec73af639 | 187 | //64 0x40 Upper case alphabet |
wim | 5:be9ec73af639 | 188 | #define C7_A (S7_A | S7_B | S7_C | S7_E | S7_F | S7_G ) |
wim | 5:be9ec73af639 | 189 | #define C7_B (S7_C | S7_D | S7_E | S7_F | S7_G) |
wim | 5:be9ec73af639 | 190 | #define C7_C (S7_A | S7_D | S7_E | S7_F) |
wim | 5:be9ec73af639 | 191 | #define C7_D (S7_B | S7_C | S7_D | S7_E | S7_G) |
wim | 5:be9ec73af639 | 192 | #define C7_E (S7_A | S7_D | S7_E | S7_F | S7_G) |
wim | 5:be9ec73af639 | 193 | #define C7_F (S7_A | S7_E | S7_F | S7_G) |
wim | 5:be9ec73af639 | 194 | |
wim | 6:d3dc313a6840 | 195 | #define C7_G (S7_A | S7_C | S7_D | S7_E | S7_F) |
wim | 5:be9ec73af639 | 196 | #define C7_H (S7_B | S7_C | S7_E | S7_F | S7_G) |
wim | 5:be9ec73af639 | 197 | #define C7_I (S7_B | S7_C) |
wim | 6:d3dc313a6840 | 198 | #define C7_J (S7_B | S7_C | S7_D | S7_E) |
wim | 5:be9ec73af639 | 199 | #define C7_L (S7_D | S7_E | S7_F) |
wim | 5:be9ec73af639 | 200 | #define C7_M (S7_C | S7_E | S7_G) |
wim | 5:be9ec73af639 | 201 | #define C7_N (S7_C | S7_E | S7_G) |
wim | 5:be9ec73af639 | 202 | #define C7_O (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F) |
wim | 5:be9ec73af639 | 203 | #define C7_P (S7_A | S7_B | S7_E | S7_F | S7_G) |
wim | 5:be9ec73af639 | 204 | #define C7_Q (S7_A | S7_B | S7_C | S7_F | S7_G) |
wim | 5:be9ec73af639 | 205 | #define C7_R (S7_E | S7_G) |
wim | 5:be9ec73af639 | 206 | #define C7_S (S7_A | S7_C | S7_D | S7_F | S7_G) |
wim | 5:be9ec73af639 | 207 | #define C7_T (S7_D | S7_E | S7_F | S7_G) |
wim | 5:be9ec73af639 | 208 | #define C7_U (S7_B | S7_C | S7_D | S7_E | S7_F) |
wim | 5:be9ec73af639 | 209 | #define C7_Y (S7_B | S7_C | S7_D | S7_F | S7_G) |
wim | 5:be9ec73af639 | 210 | #define C7_Z (S7_A | S7_B | S7_D | S7_E | S7_G) |
wim | 5:be9ec73af639 | 211 | |
wim | 5:be9ec73af639 | 212 | //97 0x61 Lower case alphabet |
wim | 5:be9ec73af639 | 213 | #define C7_a C7_A |
wim | 5:be9ec73af639 | 214 | #define C7_b C7_B |
wim | 5:be9ec73af639 | 215 | #define C7_c C7_C |
wim | 5:be9ec73af639 | 216 | #define C7_d C7_D |
wim | 5:be9ec73af639 | 217 | #define C7_e C7_E |
wim | 5:be9ec73af639 | 218 | #define C7_f C7_H |
wim | 5:be9ec73af639 | 219 | |
wim | 5:be9ec73af639 | 220 | #define C7_g C7_G |
wim | 5:be9ec73af639 | 221 | #define C7_h C7_H |
wim | 5:be9ec73af639 | 222 | #define C7_i C7_I |
wim | 5:be9ec73af639 | 223 | #define C7_j C7_J |
wim | 5:be9ec73af639 | 224 | #define C7_l C7_L |
wim | 5:be9ec73af639 | 225 | #define C7_m C7_M |
wim | 5:be9ec73af639 | 226 | #define C7_n C7_N |
wim | 5:be9ec73af639 | 227 | #define C7_o C7_O |
wim | 5:be9ec73af639 | 228 | #define C7_p C7_P |
wim | 5:be9ec73af639 | 229 | #define C7_q C7_Q |
wim | 5:be9ec73af639 | 230 | #define C7_r C7_R |
wim | 5:be9ec73af639 | 231 | #define C7_s C7_S |
wim | 5:be9ec73af639 | 232 | #define C7_t C7_T |
wim | 5:be9ec73af639 | 233 | #define C7_u C7_U |
wim | 5:be9ec73af639 | 234 | #define C7_y C7_Y |
wim | 5:be9ec73af639 | 235 | #define C7_z C7_Z |
wim | 5:be9ec73af639 | 236 | |
wim | 5:be9ec73af639 | 237 | |
wim | 5:be9ec73af639 | 238 | //User Defined Characters (some examples) |
wim | 5:be9ec73af639 | 239 | |
wim | 5:be9ec73af639 | 240 | // Font data selection for transmission to PT6512 memory |
wim | 5:be9ec73af639 | 241 | #define LO(x) ( x & 0xFF) |
wim | 5:be9ec73af639 | 242 | #define HI(x) ((x >> 8) & 0xFF) |
wim | 5:be9ec73af639 | 243 | |
wim | 5:be9ec73af639 | 244 | |
wim | 5:be9ec73af639 | 245 | // ASCII Font definition table |
wim | 5:be9ec73af639 | 246 | // |
wim | 5:be9ec73af639 | 247 | //#define FONT_7S_START 0x20 |
wim | 5:be9ec73af639 | 248 | //#define FONT_7S_END 0x7F |
wim | 5:be9ec73af639 | 249 | //#define FONT_7S_NR_CHARS (FONT_7S_END - FONT_7S_START + 1) |
wim | 5:be9ec73af639 | 250 | extern const char FONT_7S[]; |
wim | 5:be9ec73af639 | 251 | |
wim | 5:be9ec73af639 | 252 | #endif |