TEST
Dependents: ADXL345Test ADXL345Test1
Fork of TM1638 by
Font_7Seg.h@4:b2bbdc58967e, 2016-01-31 (annotated)
- Committer:
- wim
- Date:
- Sun Jan 31 12:11:06 2016 +0000
- Revision:
- 4:b2bbdc58967e
- Parent:
- 2:532ce15ea9ec
Added QYF-TM1638 and LKM1638, refactoring of writeData()
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wim | 0:201dfacbe0e5 | 1 | /* mbed LED Font Library, for TM1638 LED Controller |
wim | 0:201dfacbe0e5 | 2 | * Copyright (c) 2015, v01: WH, Initial version, Test in LEDKEY8 |
wim | 4:b2bbdc58967e | 3 | * 2016, v02: WH, Added ASCII alphabet, changed fonttable into short |
wim | 4:b2bbdc58967e | 4 | * 2016, v03: WH, Added QYF-TM1638 and LKM1638 |
wim | 0:201dfacbe0e5 | 5 | * |
wim | 0:201dfacbe0e5 | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
wim | 0:201dfacbe0e5 | 7 | * of this software and associated documentation files (the "Software"), to deal |
wim | 0:201dfacbe0e5 | 8 | * in the Software without restriction, including without limitation the rights |
wim | 0:201dfacbe0e5 | 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
wim | 0:201dfacbe0e5 | 10 | * copies of the Software, and to permit persons to whom the Software is |
wim | 0:201dfacbe0e5 | 11 | * furnished to do so, subject to the following conditions: |
wim | 0:201dfacbe0e5 | 12 | * |
wim | 0:201dfacbe0e5 | 13 | * The above copyright notice and this permission notice shall be included in |
wim | 0:201dfacbe0e5 | 14 | * all copies or substantial portions of the Software. |
wim | 0:201dfacbe0e5 | 15 | * |
wim | 0:201dfacbe0e5 | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
wim | 0:201dfacbe0e5 | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
wim | 0:201dfacbe0e5 | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
wim | 0:201dfacbe0e5 | 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
wim | 0:201dfacbe0e5 | 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
wim | 0:201dfacbe0e5 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
wim | 0:201dfacbe0e5 | 22 | * THE SOFTWARE. |
wim | 0:201dfacbe0e5 | 23 | */ |
wim | 0:201dfacbe0e5 | 24 | #ifndef MBED_FONT_7SEG_H |
wim | 0:201dfacbe0e5 | 25 | #define MBED_FONT_7SEG_H |
wim | 0:201dfacbe0e5 | 26 | |
wim | 0:201dfacbe0e5 | 27 | // Select one of the testboards for TM1638 controller |
wim | 0:201dfacbe0e5 | 28 | #include "TM1638_Config.h" |
wim | 0:201dfacbe0e5 | 29 | |
wim | 0:201dfacbe0e5 | 30 | #if ((LEDKEY8_TEST == 1) || (TM1638_TEST == 1)) |
wim | 0:201dfacbe0e5 | 31 | // Segment bit positions for 7 Segment display using the LEDKEY8 mapping for TM1638 |
wim | 0:201dfacbe0e5 | 32 | // Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_7S const table below |
wim | 0:201dfacbe0e5 | 33 | // will be adapted automatically according to the bit-to-segment mapping. Obviously this will only work when the segment |
wim | 0:201dfacbe0e5 | 34 | // mapping is identical for every digit position. This will be the case unless the hardware designer really hates software developers. |
wim | 0:201dfacbe0e5 | 35 | // |
wim | 2:532ce15ea9ec | 36 | // A |
wim | 2:532ce15ea9ec | 37 | // ----- |
wim | 2:532ce15ea9ec | 38 | // | | |
wim | 2:532ce15ea9ec | 39 | // F | | B |
wim | 2:532ce15ea9ec | 40 | // | G | |
wim | 2:532ce15ea9ec | 41 | // ----- |
wim | 2:532ce15ea9ec | 42 | // | | |
wim | 2:532ce15ea9ec | 43 | // E | | C |
wim | 2:532ce15ea9ec | 44 | // | | |
wim | 2:532ce15ea9ec | 45 | // ----- * DP |
wim | 2:532ce15ea9ec | 46 | // D |
wim | 2:532ce15ea9ec | 47 | // |
wim | 0:201dfacbe0e5 | 48 | #define S7_A 0x0001 |
wim | 0:201dfacbe0e5 | 49 | #define S7_B 0x0002 |
wim | 0:201dfacbe0e5 | 50 | #define S7_C 0x0004 |
wim | 0:201dfacbe0e5 | 51 | #define S7_D 0x0008 |
wim | 0:201dfacbe0e5 | 52 | #define S7_E 0x0010 |
wim | 0:201dfacbe0e5 | 53 | #define S7_F 0x0020 |
wim | 0:201dfacbe0e5 | 54 | #define S7_G 0x0040 |
wim | 1:1f2453ed85d7 | 55 | #define S7_DP 0x0080 |
wim | 0:201dfacbe0e5 | 56 | |
wim | 0:201dfacbe0e5 | 57 | //Mask for blending out and setting 7 segments digits |
wim | 0:201dfacbe0e5 | 58 | #define MASK_7S_ALL = (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G} |
wim | 0:201dfacbe0e5 | 59 | |
wim | 0:201dfacbe0e5 | 60 | //Icons Grid 1 |
wim | 0:201dfacbe0e5 | 61 | #define S7_DP1 0x0080 |
wim | 0:201dfacbe0e5 | 62 | #define S7_LD1 0x0100 |
wim | 1:1f2453ed85d7 | 63 | #define S7_ICON_GR1 (S7_LD1) |
wim | 1:1f2453ed85d7 | 64 | //#define S7_ICON_GR1 (S7_LD1 | S7_DP1) |
wim | 0:201dfacbe0e5 | 65 | |
wim | 0:201dfacbe0e5 | 66 | //Icons Grid 2 |
wim | 0:201dfacbe0e5 | 67 | #define S7_DP2 0x0080 |
wim | 0:201dfacbe0e5 | 68 | #define S7_LD2 0x0100 |
wim | 1:1f2453ed85d7 | 69 | #define S7_ICON_GR2 (S7_LD2) |
wim | 1:1f2453ed85d7 | 70 | //#define S7_ICON_GR2 (S7_LD2 | S7_DP2) |
wim | 0:201dfacbe0e5 | 71 | |
wim | 0:201dfacbe0e5 | 72 | //Icons Grid 3 |
wim | 0:201dfacbe0e5 | 73 | #define S7_DP3 0x0080 |
wim | 0:201dfacbe0e5 | 74 | #define S7_LD3 0x0100 |
wim | 1:1f2453ed85d7 | 75 | #define S7_ICON_GR3 (S7_LD3) |
wim | 1:1f2453ed85d7 | 76 | //#define S7_ICON_GR3 (S7_LD3 | S7_DP3) |
wim | 0:201dfacbe0e5 | 77 | |
wim | 0:201dfacbe0e5 | 78 | //Icons Grid 4 |
wim | 0:201dfacbe0e5 | 79 | #define S7_DP4 0x0080 |
wim | 0:201dfacbe0e5 | 80 | #define S7_LD4 0x0100 |
wim | 1:1f2453ed85d7 | 81 | #define S7_ICON_GR4 (S7_LD4) |
wim | 1:1f2453ed85d7 | 82 | //#define S7_ICON_GR4 (S7_LD4 | S7_DP4) |
wim | 0:201dfacbe0e5 | 83 | |
wim | 0:201dfacbe0e5 | 84 | //Icons Grid 5 |
wim | 0:201dfacbe0e5 | 85 | #define S7_DP5 0x0080 |
wim | 0:201dfacbe0e5 | 86 | #define S7_LD5 0x0100 |
wim | 1:1f2453ed85d7 | 87 | #define S7_ICON_GR5 (S7_LD5) |
wim | 1:1f2453ed85d7 | 88 | //#define S7_ICON_GR5 (S7_LD5 | S7_DP5) |
wim | 0:201dfacbe0e5 | 89 | |
wim | 0:201dfacbe0e5 | 90 | //Icons Grid 6 |
wim | 0:201dfacbe0e5 | 91 | #define S7_DP6 0x0080 |
wim | 0:201dfacbe0e5 | 92 | #define S7_LD6 0x0100 |
wim | 1:1f2453ed85d7 | 93 | #define S7_ICON_GR6 (S7_LD6) |
wim | 1:1f2453ed85d7 | 94 | //#define S7_ICON_GR6 (S7_LD6 | S7_DP6) |
wim | 0:201dfacbe0e5 | 95 | |
wim | 0:201dfacbe0e5 | 96 | //Icons Grid 7 |
wim | 0:201dfacbe0e5 | 97 | #define S7_DP7 0x0080 |
wim | 0:201dfacbe0e5 | 98 | #define S7_LD7 0x0100 |
wim | 1:1f2453ed85d7 | 99 | #define S7_ICON_GR7 (S7_LD7) |
wim | 1:1f2453ed85d7 | 100 | //#define S7_ICON_GR7 (S7_LD7 | S7_DP7) |
wim | 0:201dfacbe0e5 | 101 | |
wim | 0:201dfacbe0e5 | 102 | //Icons Grid 8 |
wim | 0:201dfacbe0e5 | 103 | #define S7_DP8 0x0080 |
wim | 0:201dfacbe0e5 | 104 | #define S7_LD8 0x0100 |
wim | 1:1f2453ed85d7 | 105 | #define S7_ICON_GR8 (S7_LD8) |
wim | 1:1f2453ed85d7 | 106 | //#define S7_ICON_GR8 (S7_LD8 | S7_DP8) |
wim | 0:201dfacbe0e5 | 107 | |
wim | 0:201dfacbe0e5 | 108 | |
wim | 0:201dfacbe0e5 | 109 | //Mask for blending out and restoring Icons |
wim | 0:201dfacbe0e5 | 110 | extern const char MASK_ICON_GRID[][2]; |
wim | 0:201dfacbe0e5 | 111 | #endif |
wim | 0:201dfacbe0e5 | 112 | |
wim | 4:b2bbdc58967e | 113 | #if (QYF_TEST == 1) |
wim | 4:b2bbdc58967e | 114 | // Segment bit positions for 7 Segment display using the QYF mapping for TM1638 |
wim | 4:b2bbdc58967e | 115 | // This display module uses a single byte of each grid to drive a specific segment of all digits. |
wim | 4:b2bbdc58967e | 116 | // So the bits in byte 0 (Grid 1) drive all A-segments, the bits in byte 2 (Grid 2) drive all B-segments etc. |
wim | 4:b2bbdc58967e | 117 | // Bit0 is for the segment in Digit 8, Bit1 is for the segment in Digit 7 etc.. This bit manipulation is handled in _putc(). |
wim | 4:b2bbdc58967e | 118 | // |
wim | 4:b2bbdc58967e | 119 | // The ASCII character defines and the FONT_7S const table below will be adapted automatically according to the bit-to-segment mapping. |
wim | 4:b2bbdc58967e | 120 | // |
wim | 4:b2bbdc58967e | 121 | // A |
wim | 4:b2bbdc58967e | 122 | // ----- |
wim | 4:b2bbdc58967e | 123 | // | | |
wim | 4:b2bbdc58967e | 124 | // F | | B |
wim | 4:b2bbdc58967e | 125 | // | G | |
wim | 4:b2bbdc58967e | 126 | // ----- |
wim | 4:b2bbdc58967e | 127 | // | | |
wim | 4:b2bbdc58967e | 128 | // E | | C |
wim | 4:b2bbdc58967e | 129 | // | | |
wim | 4:b2bbdc58967e | 130 | // ----- * DP |
wim | 4:b2bbdc58967e | 131 | // D |
wim | 4:b2bbdc58967e | 132 | // |
wim | 4:b2bbdc58967e | 133 | //Generic segment placeholders |
wim | 4:b2bbdc58967e | 134 | #define S7_A 0x0001 |
wim | 4:b2bbdc58967e | 135 | #define S7_B 0x0002 |
wim | 4:b2bbdc58967e | 136 | #define S7_C 0x0004 |
wim | 4:b2bbdc58967e | 137 | #define S7_D 0x0008 |
wim | 4:b2bbdc58967e | 138 | #define S7_E 0x0010 |
wim | 4:b2bbdc58967e | 139 | #define S7_F 0x0020 |
wim | 4:b2bbdc58967e | 140 | #define S7_G 0x0040 |
wim | 4:b2bbdc58967e | 141 | #define S7_DP 0x0080 |
wim | 4:b2bbdc58967e | 142 | |
wim | 4:b2bbdc58967e | 143 | //Mask for blending out and setting 7 segments digits |
wim | 4:b2bbdc58967e | 144 | //#define MASK_7S_ALL = (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G} |
wim | 4:b2bbdc58967e | 145 | |
wim | 4:b2bbdc58967e | 146 | //Segments and Icons Grid 1 |
wim | 4:b2bbdc58967e | 147 | #define S7_A1 0x0080 |
wim | 4:b2bbdc58967e | 148 | #define S7_B1 0x0080 |
wim | 4:b2bbdc58967e | 149 | #define S7_C1 0x0080 |
wim | 4:b2bbdc58967e | 150 | #define S7_D1 0x0080 |
wim | 4:b2bbdc58967e | 151 | #define S7_E1 0x0080 |
wim | 4:b2bbdc58967e | 152 | #define S7_F1 0x0080 |
wim | 4:b2bbdc58967e | 153 | #define S7_G1 0x0080 |
wim | 4:b2bbdc58967e | 154 | #define S7_DP1 0x0080 |
wim | 4:b2bbdc58967e | 155 | #define S7_ICON_GR1 (0x0000) |
wim | 4:b2bbdc58967e | 156 | |
wim | 4:b2bbdc58967e | 157 | //Segments and Icons Grid 2 |
wim | 4:b2bbdc58967e | 158 | #define S7_A2 0x0040 |
wim | 4:b2bbdc58967e | 159 | #define S7_B2 0x0040 |
wim | 4:b2bbdc58967e | 160 | #define S7_C2 0x0040 |
wim | 4:b2bbdc58967e | 161 | #define S7_D2 0x0040 |
wim | 4:b2bbdc58967e | 162 | #define S7_E2 0x0040 |
wim | 4:b2bbdc58967e | 163 | #define S7_F2 0x0040 |
wim | 4:b2bbdc58967e | 164 | #define S7_G2 0x0040 |
wim | 4:b2bbdc58967e | 165 | #define S7_DP2 0x0040 |
wim | 4:b2bbdc58967e | 166 | #define S7_ICON_GR2 (0x0000) |
wim | 4:b2bbdc58967e | 167 | |
wim | 4:b2bbdc58967e | 168 | //Segments and Icons Grid 3 |
wim | 4:b2bbdc58967e | 169 | #define S7_A3 0x0020 |
wim | 4:b2bbdc58967e | 170 | #define S7_B3 0x0020 |
wim | 4:b2bbdc58967e | 171 | #define S7_C3 0x0020 |
wim | 4:b2bbdc58967e | 172 | #define S7_D3 0x0020 |
wim | 4:b2bbdc58967e | 173 | #define S7_E3 0x0020 |
wim | 4:b2bbdc58967e | 174 | #define S7_F3 0x0020 |
wim | 4:b2bbdc58967e | 175 | #define S7_G3 0x0020 |
wim | 4:b2bbdc58967e | 176 | #define S7_DP3 0x0020 |
wim | 4:b2bbdc58967e | 177 | #define S7_ICON_GR3 (0x0000) |
wim | 4:b2bbdc58967e | 178 | |
wim | 4:b2bbdc58967e | 179 | //Segments and Icons Grid 4 |
wim | 4:b2bbdc58967e | 180 | #define S7_A4 0x0010 |
wim | 4:b2bbdc58967e | 181 | #define S7_B4 0x0010 |
wim | 4:b2bbdc58967e | 182 | #define S7_C4 0x0010 |
wim | 4:b2bbdc58967e | 183 | #define S7_D4 0x0010 |
wim | 4:b2bbdc58967e | 184 | #define S7_E4 0x0010 |
wim | 4:b2bbdc58967e | 185 | #define S7_F4 0x0010 |
wim | 4:b2bbdc58967e | 186 | #define S7_G4 0x0010 |
wim | 4:b2bbdc58967e | 187 | #define S7_DP4 0x0010 |
wim | 4:b2bbdc58967e | 188 | #define S7_ICON_GR4 (0x0000) |
wim | 4:b2bbdc58967e | 189 | |
wim | 4:b2bbdc58967e | 190 | //Segments and Icons Grid 5 |
wim | 4:b2bbdc58967e | 191 | #define S7_A5 0x0008 |
wim | 4:b2bbdc58967e | 192 | #define S7_B5 0x0008 |
wim | 4:b2bbdc58967e | 193 | #define S7_C5 0x0008 |
wim | 4:b2bbdc58967e | 194 | #define S7_D5 0x0008 |
wim | 4:b2bbdc58967e | 195 | #define S7_E5 0x0008 |
wim | 4:b2bbdc58967e | 196 | #define S7_F5 0x0008 |
wim | 4:b2bbdc58967e | 197 | #define S7_G5 0x0008 |
wim | 4:b2bbdc58967e | 198 | #define S7_DP5 0x0008 |
wim | 4:b2bbdc58967e | 199 | #define S7_ICON_GR5 (0x0000) |
wim | 4:b2bbdc58967e | 200 | |
wim | 4:b2bbdc58967e | 201 | //Segments and Icons Grid 6 |
wim | 4:b2bbdc58967e | 202 | #define S7_A6 0x0004 |
wim | 4:b2bbdc58967e | 203 | #define S7_B6 0x0004 |
wim | 4:b2bbdc58967e | 204 | #define S7_C6 0x0004 |
wim | 4:b2bbdc58967e | 205 | #define S7_D6 0x0004 |
wim | 4:b2bbdc58967e | 206 | #define S7_E6 0x0004 |
wim | 4:b2bbdc58967e | 207 | #define S7_F6 0x0004 |
wim | 4:b2bbdc58967e | 208 | #define S7_G6 0x0004 |
wim | 4:b2bbdc58967e | 209 | #define S7_DP6 0x0004 |
wim | 4:b2bbdc58967e | 210 | #define S7_ICON_GR6 (0x0000) |
wim | 4:b2bbdc58967e | 211 | |
wim | 4:b2bbdc58967e | 212 | //Segments and Icons Grid 7 |
wim | 4:b2bbdc58967e | 213 | #define S7_A7 0x0002 |
wim | 4:b2bbdc58967e | 214 | #define S7_B7 0x0002 |
wim | 4:b2bbdc58967e | 215 | #define S7_C7 0x0002 |
wim | 4:b2bbdc58967e | 216 | #define S7_D7 0x0002 |
wim | 4:b2bbdc58967e | 217 | #define S7_E7 0x0002 |
wim | 4:b2bbdc58967e | 218 | #define S7_F7 0x0002 |
wim | 4:b2bbdc58967e | 219 | #define S7_G7 0x0002 |
wim | 4:b2bbdc58967e | 220 | #define S7_DP7 0x0002 |
wim | 4:b2bbdc58967e | 221 | #define S7_ICON_GR7 (0x0000) |
wim | 4:b2bbdc58967e | 222 | |
wim | 4:b2bbdc58967e | 223 | //Segments and Icons Grid 8 |
wim | 4:b2bbdc58967e | 224 | #define S7_A8 0x0001 |
wim | 4:b2bbdc58967e | 225 | #define S7_B8 0x0001 |
wim | 4:b2bbdc58967e | 226 | #define S7_C8 0x0001 |
wim | 4:b2bbdc58967e | 227 | #define S7_D8 0x0001 |
wim | 4:b2bbdc58967e | 228 | #define S7_E8 0x0001 |
wim | 4:b2bbdc58967e | 229 | #define S7_F8 0x0001 |
wim | 4:b2bbdc58967e | 230 | #define S7_G8 0x0001 |
wim | 4:b2bbdc58967e | 231 | #define S7_DP8 0x0001 |
wim | 4:b2bbdc58967e | 232 | #define S7_ICON_GR8 (0x0000) |
wim | 4:b2bbdc58967e | 233 | |
wim | 4:b2bbdc58967e | 234 | //Mask for blending out and restoring Icons |
wim | 4:b2bbdc58967e | 235 | extern const char MASK_ICON_GRID[][2]; |
wim | 4:b2bbdc58967e | 236 | #endif |
wim | 4:b2bbdc58967e | 237 | |
wim | 4:b2bbdc58967e | 238 | #if (LKM1638_TEST == 1) |
wim | 4:b2bbdc58967e | 239 | // Segment bit positions for 7 Segment display using the LKM1638 mapping for TM1638 |
wim | 4:b2bbdc58967e | 240 | // Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_7S const table below |
wim | 4:b2bbdc58967e | 241 | // will be adapted automatically according to the bit-to-segment mapping. Obviously this will only work when the segment |
wim | 4:b2bbdc58967e | 242 | // mapping is identical for every digit position. This will be the case unless the hardware designer really hates software developers. |
wim | 4:b2bbdc58967e | 243 | // |
wim | 4:b2bbdc58967e | 244 | // The ASCII character defines and the FONT_7S const table below will be adapted automatically according to the bit-to-segment mapping. |
wim | 4:b2bbdc58967e | 245 | // |
wim | 4:b2bbdc58967e | 246 | // A |
wim | 4:b2bbdc58967e | 247 | // ----- |
wim | 4:b2bbdc58967e | 248 | // | | |
wim | 4:b2bbdc58967e | 249 | // F | | B |
wim | 4:b2bbdc58967e | 250 | // | G | |
wim | 4:b2bbdc58967e | 251 | // ----- |
wim | 4:b2bbdc58967e | 252 | // | | |
wim | 4:b2bbdc58967e | 253 | // E | | C |
wim | 4:b2bbdc58967e | 254 | // | | |
wim | 4:b2bbdc58967e | 255 | // ----- * DP |
wim | 4:b2bbdc58967e | 256 | // D |
wim | 4:b2bbdc58967e | 257 | // |
wim | 4:b2bbdc58967e | 258 | //Generic segment placeholders |
wim | 4:b2bbdc58967e | 259 | #define S7_A 0x0001 |
wim | 4:b2bbdc58967e | 260 | #define S7_B 0x0002 |
wim | 4:b2bbdc58967e | 261 | #define S7_C 0x0004 |
wim | 4:b2bbdc58967e | 262 | #define S7_D 0x0008 |
wim | 4:b2bbdc58967e | 263 | #define S7_E 0x0010 |
wim | 4:b2bbdc58967e | 264 | #define S7_F 0x0020 |
wim | 4:b2bbdc58967e | 265 | #define S7_G 0x0040 |
wim | 4:b2bbdc58967e | 266 | #define S7_DP 0x0080 |
wim | 4:b2bbdc58967e | 267 | |
wim | 4:b2bbdc58967e | 268 | //Mask for blending out and setting 7 segments digits |
wim | 4:b2bbdc58967e | 269 | //#define MASK_7S_ALL = (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G} |
wim | 4:b2bbdc58967e | 270 | |
wim | 4:b2bbdc58967e | 271 | //Icons Grid 1 |
wim | 4:b2bbdc58967e | 272 | #define S7_DP1 0x0080 |
wim | 4:b2bbdc58967e | 273 | #define S7_GR1 0x0100 |
wim | 4:b2bbdc58967e | 274 | #define S7_RD1 0x0200 |
wim | 4:b2bbdc58967e | 275 | #define S7_YL1 0x0300 |
wim | 4:b2bbdc58967e | 276 | #define S7_ICON_GR1 (S7_RD1 | S7_GR1 | S7_YL1) |
wim | 4:b2bbdc58967e | 277 | //#define S7_ICON_GR1 (S7_RD1 | S7_GR1 | S7_YL1 | S7_DP1) |
wim | 4:b2bbdc58967e | 278 | |
wim | 4:b2bbdc58967e | 279 | //Icons Grid 2 |
wim | 4:b2bbdc58967e | 280 | #define S7_DP2 0x0080 |
wim | 4:b2bbdc58967e | 281 | #define S7_GR2 0x0100 |
wim | 4:b2bbdc58967e | 282 | #define S7_RD2 0x0200 |
wim | 4:b2bbdc58967e | 283 | #define S7_YL2 0x0300 |
wim | 4:b2bbdc58967e | 284 | #define S7_ICON_GR2 (S7_RD2 | S7_GR2 | S7_YL2) |
wim | 4:b2bbdc58967e | 285 | //#define S7_ICON_GR2 (S7_RD2 | S7_GR2 | S7_YL2 | S7_DP2) |
wim | 4:b2bbdc58967e | 286 | |
wim | 4:b2bbdc58967e | 287 | //Icons Grid 3 |
wim | 4:b2bbdc58967e | 288 | #define S7_DP3 0x0080 |
wim | 4:b2bbdc58967e | 289 | #define S7_GR3 0x0100 |
wim | 4:b2bbdc58967e | 290 | #define S7_RD3 0x0200 |
wim | 4:b2bbdc58967e | 291 | #define S7_YL3 0x0300 |
wim | 4:b2bbdc58967e | 292 | #define S7_ICON_GR3 (S7_RD3 | S7_GR3 | S7_YL3) |
wim | 4:b2bbdc58967e | 293 | //#define S7_ICON_GR3 (S7_RD3 | S7_GR3 | S7_YL3 | S7_DP3) |
wim | 4:b2bbdc58967e | 294 | |
wim | 4:b2bbdc58967e | 295 | //Icons Grid 4 |
wim | 4:b2bbdc58967e | 296 | #define S7_DP4 0x0080 |
wim | 4:b2bbdc58967e | 297 | #define S7_GR4 0x0100 |
wim | 4:b2bbdc58967e | 298 | #define S7_RD4 0x0200 |
wim | 4:b2bbdc58967e | 299 | #define S7_YL4 0x0300 |
wim | 4:b2bbdc58967e | 300 | #define S7_ICON_GR4 (S7_RD4 | S7_GR4 | S7_YL4) |
wim | 4:b2bbdc58967e | 301 | //#define S7_ICON_GR4 (S7_RD4 | S7_GR4 | S7_YL4 | S7_DP4) |
wim | 4:b2bbdc58967e | 302 | |
wim | 4:b2bbdc58967e | 303 | //Icons Grid 5 |
wim | 4:b2bbdc58967e | 304 | #define S7_DP5 0x0080 |
wim | 4:b2bbdc58967e | 305 | #define S7_GR5 0x0100 |
wim | 4:b2bbdc58967e | 306 | #define S7_RD5 0x0200 |
wim | 4:b2bbdc58967e | 307 | #define S7_YL5 0x0300 |
wim | 4:b2bbdc58967e | 308 | #define S7_ICON_GR5 (S7_RD5 | S7_GR5 | S7_YL5) |
wim | 4:b2bbdc58967e | 309 | //#define S7_ICON_GR5 (S7_RD5 | S7_GR5 | S7_YL5 | S7_DP5) |
wim | 4:b2bbdc58967e | 310 | |
wim | 4:b2bbdc58967e | 311 | //Icons Grid 6 |
wim | 4:b2bbdc58967e | 312 | #define S7_DP6 0x0080 |
wim | 4:b2bbdc58967e | 313 | #define S7_GR6 0x0100 |
wim | 4:b2bbdc58967e | 314 | #define S7_RD6 0x0200 |
wim | 4:b2bbdc58967e | 315 | #define S7_YL6 0x0300 |
wim | 4:b2bbdc58967e | 316 | #define S7_ICON_GR6 (S7_RD6 | S7_GR6 | S7_YL6) |
wim | 4:b2bbdc58967e | 317 | //#define S7_ICON_GR6 (S7_RD6 | S7_GR6 | S7_YL6 | S7_DP6) |
wim | 4:b2bbdc58967e | 318 | |
wim | 4:b2bbdc58967e | 319 | //Icons Grid 7 |
wim | 4:b2bbdc58967e | 320 | #define S7_DP7 0x0080 |
wim | 4:b2bbdc58967e | 321 | #define S7_GR7 0x0100 |
wim | 4:b2bbdc58967e | 322 | #define S7_RD7 0x0200 |
wim | 4:b2bbdc58967e | 323 | #define S7_YL7 0x0300 |
wim | 4:b2bbdc58967e | 324 | #define S7_ICON_GR7 (S7_RD7 | S7_GR7 | S7_YL7) |
wim | 4:b2bbdc58967e | 325 | //#define S7_ICON_GR7 (S7_RD7 | S7_GR7 | S7_YL7 | S7_DP7) |
wim | 4:b2bbdc58967e | 326 | |
wim | 4:b2bbdc58967e | 327 | //Icons Grid 8 |
wim | 4:b2bbdc58967e | 328 | #define S7_DP8 0x0080 |
wim | 4:b2bbdc58967e | 329 | #define S7_GR8 0x0100 |
wim | 4:b2bbdc58967e | 330 | #define S7_RD8 0x0200 |
wim | 4:b2bbdc58967e | 331 | #define S7_YL8 0x0300 |
wim | 4:b2bbdc58967e | 332 | #define S7_ICON_GR8 (S7_RD8 | S7_GR8 | S7_YL8) |
wim | 4:b2bbdc58967e | 333 | //#define S7_ICON_GR8 (S7_RD8 | S7_GR8 | S7_YL8 | S7_DP8) |
wim | 4:b2bbdc58967e | 334 | |
wim | 4:b2bbdc58967e | 335 | //Mask for blending out and restoring Icons |
wim | 4:b2bbdc58967e | 336 | extern const char MASK_ICON_GRID[][2]; |
wim | 4:b2bbdc58967e | 337 | #endif |
wim | 0:201dfacbe0e5 | 338 | |
wim | 0:201dfacbe0e5 | 339 | // ASCII Font definitions for segments in each character |
wim | 0:201dfacbe0e5 | 340 | // |
wim | 0:201dfacbe0e5 | 341 | //32 0x20 Symbols |
wim | 1:1f2453ed85d7 | 342 | #define C7_SPC (0x0000) |
wim | 2:532ce15ea9ec | 343 | #define C7_EXC (S7_B | S7_C) //! |
wim | 2:532ce15ea9ec | 344 | #define C7_QTE (S7_B | S7_F) //" |
wim | 2:532ce15ea9ec | 345 | #define C7_HSH (S7_C | S7_D | S7_E | S7_G) //# |
wim | 2:532ce15ea9ec | 346 | #define C7_DLR (S7_A | S7_C | S7_D | S7_F | S7_G) //$ |
wim | 2:532ce15ea9ec | 347 | #define C7_PCT (S7_C | S7_F) //% |
wim | 2:532ce15ea9ec | 348 | #define C7_AMP (S7_A | S7_C | S7_D | S7_E | S7_F | S7_G) //& |
wim | 2:532ce15ea9ec | 349 | #define C7_ACC (S7_B) //' |
wim | 2:532ce15ea9ec | 350 | #define C7_LBR (S7_A | S7_D | S7_E | S7_F) //( |
wim | 2:532ce15ea9ec | 351 | #define C7_RBR (S7_A | S7_B | S7_C | S7_D) //) |
wim | 2:532ce15ea9ec | 352 | #define C7_MLT (S7_B | S7_C | S7_E | S7_F | S7_G) //* |
wim | 2:532ce15ea9ec | 353 | #define C7_PLS (S7_B | S7_C | S7_G) //+ |
wim | 1:1f2453ed85d7 | 354 | #define C7_CMA (S7_DP) |
wim | 2:532ce15ea9ec | 355 | #define C7_MIN (S7_G) |
wim | 1:1f2453ed85d7 | 356 | #define C7_DPT (S7_DP) |
wim | 2:532ce15ea9ec | 357 | #define C7_RS (S7_B | S7_E | S7_G) // / |
wim | 0:201dfacbe0e5 | 358 | |
wim | 0:201dfacbe0e5 | 359 | //48 0x30 Digits |
wim | 0:201dfacbe0e5 | 360 | #define C7_0 (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F) |
wim | 0:201dfacbe0e5 | 361 | #define C7_1 (S7_B | S7_C) |
wim | 0:201dfacbe0e5 | 362 | #define C7_2 (S7_A | S7_B | S7_D | S7_E | S7_G) |
wim | 0:201dfacbe0e5 | 363 | #define C7_3 (S7_A | S7_B | S7_C | S7_D | S7_G) |
wim | 0:201dfacbe0e5 | 364 | #define C7_4 (S7_B | S7_C | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 365 | #define C7_5 (S7_A | S7_C | S7_D | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 366 | #define C7_6 (S7_A | S7_C | S7_D | S7_E | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 367 | #define C7_7 (S7_A | S7_B | S7_C) |
wim | 0:201dfacbe0e5 | 368 | #define C7_8 (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 369 | #define C7_9 (S7_A | S7_B | S7_C | S7_D | S7_F | S7_G) |
wim | 2:532ce15ea9ec | 370 | |
wim | 2:532ce15ea9ec | 371 | //58 0x3A |
wim | 2:532ce15ea9ec | 372 | #define C7_COL (S7_D | S7_G) // : |
wim | 2:532ce15ea9ec | 373 | #define C7_SCL (S7_D | S7_G) // ; |
wim | 2:532ce15ea9ec | 374 | #define C7_LT (S7_D | S7_E | S7_G) // < |
wim | 2:532ce15ea9ec | 375 | #define C7_EQ (S7_D | S7_G) // = |
wim | 2:532ce15ea9ec | 376 | #define C7_GT (S7_C | S7_D | S7_G) // > |
wim | 2:532ce15ea9ec | 377 | #define C7_QM (S7_A | S7_B | S7_E | S7_G) // ? |
wim | 2:532ce15ea9ec | 378 | #define C7_AT (S7_A | S7_B | S7_C | S7_D | S7_E | S7_G) // @ |
wim | 2:532ce15ea9ec | 379 | |
wim | 2:532ce15ea9ec | 380 | //65 0x41 Upper case alphabet |
wim | 0:201dfacbe0e5 | 381 | #define C7_A (S7_A | S7_B | S7_C | S7_E | S7_F | S7_G ) |
wim | 0:201dfacbe0e5 | 382 | #define C7_B (S7_C | S7_D | S7_E | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 383 | #define C7_C (S7_A | S7_D | S7_E | S7_F) |
wim | 0:201dfacbe0e5 | 384 | #define C7_D (S7_B | S7_C | S7_D | S7_E | S7_G) |
wim | 0:201dfacbe0e5 | 385 | #define C7_E (S7_A | S7_D | S7_E | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 386 | #define C7_F (S7_A | S7_E | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 387 | |
wim | 2:532ce15ea9ec | 388 | #define C7_G (S7_A | S7_C | S7_D | S7_E | S7_F) |
wim | 0:201dfacbe0e5 | 389 | #define C7_H (S7_B | S7_C | S7_E | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 390 | #define C7_I (S7_B | S7_C) |
wim | 2:532ce15ea9ec | 391 | #define C7_J (S7_B | S7_C | S7_D | S7_E) |
wim | 2:532ce15ea9ec | 392 | #define C7_K (S7_B | S7_C | S7_E | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 393 | #define C7_L (S7_D | S7_E | S7_F) |
wim | 2:532ce15ea9ec | 394 | #define C7_M (S7_A | S7_C | S7_E) |
wim | 2:532ce15ea9ec | 395 | #define C7_N (S7_A | S7_B | S7_C | S7_E | S7_F) |
wim | 0:201dfacbe0e5 | 396 | #define C7_O (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F) |
wim | 0:201dfacbe0e5 | 397 | #define C7_P (S7_A | S7_B | S7_E | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 398 | #define C7_Q (S7_A | S7_B | S7_C | S7_F | S7_G) |
wim | 2:532ce15ea9ec | 399 | #define C7_R (S7_E | S7_G ) |
wim | 0:201dfacbe0e5 | 400 | #define C7_S (S7_A | S7_C | S7_D | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 401 | #define C7_T (S7_D | S7_E | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 402 | #define C7_U (S7_B | S7_C | S7_D | S7_E | S7_F) |
wim | 2:532ce15ea9ec | 403 | #define C7_V (S7_B | S7_C | S7_D | S7_E | S7_F) |
wim | 2:532ce15ea9ec | 404 | #define C7_W (S7_B | S7_D | S7_F) |
wim | 2:532ce15ea9ec | 405 | #define C7_X (S7_B | S7_C | S7_E | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 406 | #define C7_Y (S7_B | S7_C | S7_D | S7_F | S7_G) |
wim | 0:201dfacbe0e5 | 407 | #define C7_Z (S7_A | S7_B | S7_D | S7_E | S7_G) |
wim | 0:201dfacbe0e5 | 408 | |
wim | 2:532ce15ea9ec | 409 | //91 0x5B |
wim | 2:532ce15ea9ec | 410 | #define C7_SBL (S7_A | S7_D | S7_E | S7_F) // [ |
wim | 2:532ce15ea9ec | 411 | #define C7_LS (S7_C | S7_F | S7_G) // left slash |
wim | 2:532ce15ea9ec | 412 | #define C7_SBR (S7_A | S7_B | S7_C | S7_D) // ] |
wim | 2:532ce15ea9ec | 413 | #define C7_PWR (S7_A | S7_B | S7_F) // ^ |
wim | 2:532ce15ea9ec | 414 | #define C7_UDS (S7_D) // _ |
wim | 2:532ce15ea9ec | 415 | #define C7_DSH (S7_F) // ` |
wim | 2:532ce15ea9ec | 416 | |
wim | 0:201dfacbe0e5 | 417 | //97 0x61 Lower case alphabet |
wim | 0:201dfacbe0e5 | 418 | #define C7_a C7_A |
wim | 0:201dfacbe0e5 | 419 | #define C7_b C7_B |
wim | 0:201dfacbe0e5 | 420 | #define C7_c C7_C |
wim | 0:201dfacbe0e5 | 421 | #define C7_d C7_D |
wim | 0:201dfacbe0e5 | 422 | #define C7_e C7_E |
wim | 0:201dfacbe0e5 | 423 | #define C7_f C7_H |
wim | 0:201dfacbe0e5 | 424 | |
wim | 0:201dfacbe0e5 | 425 | #define C7_g C7_G |
wim | 0:201dfacbe0e5 | 426 | #define C7_h C7_H |
wim | 0:201dfacbe0e5 | 427 | #define C7_i C7_I |
wim | 0:201dfacbe0e5 | 428 | #define C7_j C7_J |
wim | 2:532ce15ea9ec | 429 | #define C7_k C7_K |
wim | 0:201dfacbe0e5 | 430 | #define C7_l C7_L |
wim | 0:201dfacbe0e5 | 431 | #define C7_m C7_M |
wim | 2:532ce15ea9ec | 432 | //#define C7_n C7_N |
wim | 2:532ce15ea9ec | 433 | #define C7_n (S7_C | S7_E | S7_G) |
wim | 2:532ce15ea9ec | 434 | //#define C7_o C7_O |
wim | 2:532ce15ea9ec | 435 | #define C7_o (S7_C | S7_D | S7_E | S7_G) |
wim | 0:201dfacbe0e5 | 436 | #define C7_p C7_P |
wim | 0:201dfacbe0e5 | 437 | #define C7_q C7_Q |
wim | 2:532ce15ea9ec | 438 | //#define C7_r C7_R |
wim | 2:532ce15ea9ec | 439 | #define C7_r (S7_E | S7_G) |
wim | 0:201dfacbe0e5 | 440 | #define C7_s C7_S |
wim | 0:201dfacbe0e5 | 441 | #define C7_t C7_T |
wim | 0:201dfacbe0e5 | 442 | #define C7_u C7_U |
wim | 2:532ce15ea9ec | 443 | #define C7_v C7_V |
wim | 2:532ce15ea9ec | 444 | #define C7_w C7_W |
wim | 2:532ce15ea9ec | 445 | #define C7_x C7_X |
wim | 0:201dfacbe0e5 | 446 | #define C7_y C7_Y |
wim | 0:201dfacbe0e5 | 447 | #define C7_z C7_Z |
wim | 0:201dfacbe0e5 | 448 | |
wim | 2:532ce15ea9ec | 449 | //123 0x7B |
wim | 2:532ce15ea9ec | 450 | #define C7_CBL (S7_A | S7_D | S7_E | S7_F) // { |
wim | 2:532ce15ea9ec | 451 | #define C7_OR (S7_B | S7_C) // | |
wim | 2:532ce15ea9ec | 452 | #define C7_CBR (S7_A | S7_B | S7_C | S7_D) // } |
wim | 2:532ce15ea9ec | 453 | #define C7_TLD (S7_B | S7_E | S7_G ) // ~ |
wim | 2:532ce15ea9ec | 454 | #define C7_DEL (0x0000) |
wim | 2:532ce15ea9ec | 455 | |
wim | 0:201dfacbe0e5 | 456 | |
wim | 0:201dfacbe0e5 | 457 | //User Defined Characters (some examples) |
wim | 2:532ce15ea9ec | 458 | #define C7_DGR (S7_A | S7_B | S7_F | S7_G) //Degrees |
wim | 2:532ce15ea9ec | 459 | |
wim | 0:201dfacbe0e5 | 460 | // Font data selection for transmission to TM1638 memory |
wim | 0:201dfacbe0e5 | 461 | #define LO(x) ( x & 0xFF) |
wim | 0:201dfacbe0e5 | 462 | #define HI(x) ((x >> 8) & 0xFF) |
wim | 0:201dfacbe0e5 | 463 | |
wim | 0:201dfacbe0e5 | 464 | |
wim | 0:201dfacbe0e5 | 465 | // ASCII Font definition table |
wim | 0:201dfacbe0e5 | 466 | // |
wim | 2:532ce15ea9ec | 467 | #define FONT_7S_START 0x20 |
wim | 2:532ce15ea9ec | 468 | #define FONT_7S_END 0x7F |
wim | 0:201dfacbe0e5 | 469 | //#define FONT_7S_NR_CHARS (FONT_7S_END - FONT_7S_START + 1) |
wim | 2:532ce15ea9ec | 470 | extern const short FONT_7S[]; |
wim | 0:201dfacbe0e5 | 471 | |
wim | 0:201dfacbe0e5 | 472 | #endif |