Library for TM1637 LEDcontroller
Dependents: mbed_TM1637 TM1637_test
See here for more information.
Font_7Seg.cpp@0:dc8789a6e21f, 2016-01-30 (annotated)
- Committer:
- wim
- Date:
- Sat Jan 30 20:35:25 2016 +0000
- Revision:
- 0:dc8789a6e21f
- Child:
- 1:f63d87466f55
TM1637 Library, for TM1637 LEDcontroller
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wim | 0:dc8789a6e21f | 1 | /* mbed LED Font Library, for TM1637 LED controller |
wim | 0:dc8789a6e21f | 2 | * Copyright (c) 2016, v01: WH, Initial version, Test in CATALEX |
wim | 0:dc8789a6e21f | 3 | * |
wim | 0:dc8789a6e21f | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
wim | 0:dc8789a6e21f | 5 | * of this software and associated documentation files (the "Software"), to deal |
wim | 0:dc8789a6e21f | 6 | * in the Software without restriction, including without limitation the rights |
wim | 0:dc8789a6e21f | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
wim | 0:dc8789a6e21f | 8 | * copies of the Software, and to permit persons to whom the Software is |
wim | 0:dc8789a6e21f | 9 | * furnished to do so, subject to the following conditions: |
wim | 0:dc8789a6e21f | 10 | * |
wim | 0:dc8789a6e21f | 11 | * The above copyright notice and this permission notice shall be included in |
wim | 0:dc8789a6e21f | 12 | * all copies or substantial portions of the Software. |
wim | 0:dc8789a6e21f | 13 | * |
wim | 0:dc8789a6e21f | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
wim | 0:dc8789a6e21f | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
wim | 0:dc8789a6e21f | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
wim | 0:dc8789a6e21f | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
wim | 0:dc8789a6e21f | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
wim | 0:dc8789a6e21f | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
wim | 0:dc8789a6e21f | 20 | * THE SOFTWARE. |
wim | 0:dc8789a6e21f | 21 | */ |
wim | 0:dc8789a6e21f | 22 | #include "Font_7Seg.h" |
wim | 0:dc8789a6e21f | 23 | |
wim | 0:dc8789a6e21f | 24 | // Select one of the testboards for TM1637 LED controller |
wim | 0:dc8789a6e21f | 25 | #if (CATALEX_TEST == 1) |
wim | 0:dc8789a6e21f | 26 | |
wim | 0:dc8789a6e21f | 27 | //Mask for blending out and restoring Icons |
wim | 0:dc8789a6e21f | 28 | const char MASK_ICON_GRID[] = { |
wim | 0:dc8789a6e21f | 29 | LO(S7_ICON_GR1), |
wim | 0:dc8789a6e21f | 30 | LO(S7_ICON_GR2), |
wim | 0:dc8789a6e21f | 31 | LO(S7_ICON_GR3), |
wim | 0:dc8789a6e21f | 32 | LO(S7_ICON_GR4) |
wim | 0:dc8789a6e21f | 33 | }; |
wim | 0:dc8789a6e21f | 34 | |
wim | 0:dc8789a6e21f | 35 | // ASCII Font definition table for transmission to TM1637 |
wim | 0:dc8789a6e21f | 36 | // |
wim | 0:dc8789a6e21f | 37 | //#define FONT_7S_START 0x20 |
wim | 0:dc8789a6e21f | 38 | //#define FONT_7S_END 0x7F |
wim | 0:dc8789a6e21f | 39 | //#define FONT_7S_NR_CHARS (FONT_7_END - FONT_7S_START + 1) |
wim | 0:dc8789a6e21f | 40 | |
wim | 0:dc8789a6e21f | 41 | #if (SHOW_ASCII == 1) |
wim | 0:dc8789a6e21f | 42 | //display all ASCII characters |
wim | 0:dc8789a6e21f | 43 | const short FONT_7S[] = { |
wim | 0:dc8789a6e21f | 44 | C7_SPC, //32 0x20, Space |
wim | 0:dc8789a6e21f | 45 | C7_EXC, |
wim | 0:dc8789a6e21f | 46 | C7_QTE, |
wim | 0:dc8789a6e21f | 47 | C7_HSH, |
wim | 0:dc8789a6e21f | 48 | C7_DLR, |
wim | 0:dc8789a6e21f | 49 | C7_PCT, |
wim | 0:dc8789a6e21f | 50 | C7_AMP, |
wim | 0:dc8789a6e21f | 51 | C7_ACC, |
wim | 0:dc8789a6e21f | 52 | C7_LBR, |
wim | 0:dc8789a6e21f | 53 | C7_RBR, |
wim | 0:dc8789a6e21f | 54 | C7_MLT, |
wim | 0:dc8789a6e21f | 55 | C7_PLS, |
wim | 0:dc8789a6e21f | 56 | C7_CMA, |
wim | 0:dc8789a6e21f | 57 | C7_MIN, |
wim | 0:dc8789a6e21f | 58 | C7_DPT, |
wim | 0:dc8789a6e21f | 59 | C7_RS, |
wim | 0:dc8789a6e21f | 60 | C7_0, //48 0x30 |
wim | 0:dc8789a6e21f | 61 | C7_1, |
wim | 0:dc8789a6e21f | 62 | C7_2, |
wim | 0:dc8789a6e21f | 63 | C7_3, |
wim | 0:dc8789a6e21f | 64 | C7_4, |
wim | 0:dc8789a6e21f | 65 | C7_5, |
wim | 0:dc8789a6e21f | 66 | C7_6, |
wim | 0:dc8789a6e21f | 67 | C7_7, |
wim | 0:dc8789a6e21f | 68 | C7_8, |
wim | 0:dc8789a6e21f | 69 | C7_9, |
wim | 0:dc8789a6e21f | 70 | C7_COL, //58 0x3A |
wim | 0:dc8789a6e21f | 71 | C7_SCL, |
wim | 0:dc8789a6e21f | 72 | C7_LT, |
wim | 0:dc8789a6e21f | 73 | C7_EQ, |
wim | 0:dc8789a6e21f | 74 | C7_GT, |
wim | 0:dc8789a6e21f | 75 | C7_QM, |
wim | 0:dc8789a6e21f | 76 | C7_AT, //64 0x40 |
wim | 0:dc8789a6e21f | 77 | C7_A, //65 0x41, A |
wim | 0:dc8789a6e21f | 78 | C7_B, |
wim | 0:dc8789a6e21f | 79 | C7_C, |
wim | 0:dc8789a6e21f | 80 | C7_D, |
wim | 0:dc8789a6e21f | 81 | C7_E, |
wim | 0:dc8789a6e21f | 82 | C7_F, |
wim | 0:dc8789a6e21f | 83 | C7_G, |
wim | 0:dc8789a6e21f | 84 | C7_H, |
wim | 0:dc8789a6e21f | 85 | C7_I, |
wim | 0:dc8789a6e21f | 86 | C7_J, |
wim | 0:dc8789a6e21f | 87 | C7_K, |
wim | 0:dc8789a6e21f | 88 | C7_L, |
wim | 0:dc8789a6e21f | 89 | C7_M, |
wim | 0:dc8789a6e21f | 90 | C7_N, |
wim | 0:dc8789a6e21f | 91 | C7_O, |
wim | 0:dc8789a6e21f | 92 | C7_P, |
wim | 0:dc8789a6e21f | 93 | C7_Q, |
wim | 0:dc8789a6e21f | 94 | C7_R, |
wim | 0:dc8789a6e21f | 95 | C7_S, |
wim | 0:dc8789a6e21f | 96 | C7_T, |
wim | 0:dc8789a6e21f | 97 | C7_U, |
wim | 0:dc8789a6e21f | 98 | C7_V, |
wim | 0:dc8789a6e21f | 99 | C7_W, |
wim | 0:dc8789a6e21f | 100 | C7_X, |
wim | 0:dc8789a6e21f | 101 | C7_Y, |
wim | 0:dc8789a6e21f | 102 | C7_Z, //90 0x5A, Z |
wim | 0:dc8789a6e21f | 103 | C7_SBL, //91 0x5B |
wim | 0:dc8789a6e21f | 104 | C7_LS, |
wim | 0:dc8789a6e21f | 105 | C7_SBR, |
wim | 0:dc8789a6e21f | 106 | C7_PWR, |
wim | 0:dc8789a6e21f | 107 | C7_UDS, |
wim | 0:dc8789a6e21f | 108 | C7_ACC, |
wim | 0:dc8789a6e21f | 109 | C7_A, //97 0x61, A replacing a |
wim | 0:dc8789a6e21f | 110 | C7_B, |
wim | 0:dc8789a6e21f | 111 | C7_C, |
wim | 0:dc8789a6e21f | 112 | C7_D, |
wim | 0:dc8789a6e21f | 113 | C7_E, |
wim | 0:dc8789a6e21f | 114 | C7_F, |
wim | 0:dc8789a6e21f | 115 | C7_G, |
wim | 0:dc8789a6e21f | 116 | C7_H, |
wim | 0:dc8789a6e21f | 117 | C7_I, |
wim | 0:dc8789a6e21f | 118 | C7_J, |
wim | 0:dc8789a6e21f | 119 | C7_K, |
wim | 0:dc8789a6e21f | 120 | C7_L, |
wim | 0:dc8789a6e21f | 121 | C7_M, |
wim | 0:dc8789a6e21f | 122 | C7_N, |
wim | 0:dc8789a6e21f | 123 | C7_O, |
wim | 0:dc8789a6e21f | 124 | C7_P, |
wim | 0:dc8789a6e21f | 125 | C7_Q, |
wim | 0:dc8789a6e21f | 126 | C7_R, |
wim | 0:dc8789a6e21f | 127 | C7_S, |
wim | 0:dc8789a6e21f | 128 | C7_T, |
wim | 0:dc8789a6e21f | 129 | C7_U, |
wim | 0:dc8789a6e21f | 130 | C7_V, |
wim | 0:dc8789a6e21f | 131 | C7_W, |
wim | 0:dc8789a6e21f | 132 | C7_X, |
wim | 0:dc8789a6e21f | 133 | C7_Y, |
wim | 0:dc8789a6e21f | 134 | C7_Z, // 122 0x7A, Z replacing z |
wim | 0:dc8789a6e21f | 135 | C7_CBL, // 123 0x7B |
wim | 0:dc8789a6e21f | 136 | C7_OR, |
wim | 0:dc8789a6e21f | 137 | C7_CBR, |
wim | 0:dc8789a6e21f | 138 | C7_TLD, |
wim | 0:dc8789a6e21f | 139 | C7_DEL // 127 |
wim | 0:dc8789a6e21f | 140 | }; |
wim | 0:dc8789a6e21f | 141 | |
wim | 0:dc8789a6e21f | 142 | #else |
wim | 0:dc8789a6e21f | 143 | //display only digits and hex characters |
wim | 0:dc8789a6e21f | 144 | const short FONT_7S[] = { |
wim | 0:dc8789a6e21f | 145 | C7_0, //48 0x30 |
wim | 0:dc8789a6e21f | 146 | C7_1, |
wim | 0:dc8789a6e21f | 147 | C7_2, |
wim | 0:dc8789a6e21f | 148 | C7_3, |
wim | 0:dc8789a6e21f | 149 | C7_4, |
wim | 0:dc8789a6e21f | 150 | C7_5, |
wim | 0:dc8789a6e21f | 151 | C7_6, |
wim | 0:dc8789a6e21f | 152 | C7_7, |
wim | 0:dc8789a6e21f | 153 | C7_8, |
wim | 0:dc8789a6e21f | 154 | C7_9, |
wim | 0:dc8789a6e21f | 155 | C7_A, //65 0x41, A |
wim | 0:dc8789a6e21f | 156 | C7_B, |
wim | 0:dc8789a6e21f | 157 | C7_C, |
wim | 0:dc8789a6e21f | 158 | C7_D, |
wim | 0:dc8789a6e21f | 159 | C7_E, |
wim | 0:dc8789a6e21f | 160 | C7_F |
wim | 0:dc8789a6e21f | 161 | };// 127 |
wim | 0:dc8789a6e21f | 162 | #endif |
wim | 0:dc8789a6e21f | 163 | |
wim | 0:dc8789a6e21f | 164 | #endif |