Wim Huiskamp
/
mbed_LC75711
Test program for Sanyo LC75711 VFD controller
main.cpp@1:7b154968b0ca, 2017-09-15 (annotated)
- Committer:
- wim
- Date:
- Fri Sep 15 17:38:57 2017 +0000
- Revision:
- 1:7b154968b0ca
- Parent:
- 0:57ddd953d3a2
- Child:
- 2:46ec5f4fb9d8
Modified setBlink(), added clrBlink()
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wim | 0:57ddd953d3a2 | 1 | /* mbed LC75711 Test program, for Sanyo LC75711 VFD controller |
wim | 0:57ddd953d3a2 | 2 | * Copyright (c) 2017, v01: WH, Initial version |
wim | 1:7b154968b0ca | 3 | * 2017, v02: WH, Modified setBlink |
wim | 0:57ddd953d3a2 | 4 | * |
wim | 0:57ddd953d3a2 | 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
wim | 0:57ddd953d3a2 | 6 | * of this software and associated documentation files (the "Software"), to deal |
wim | 0:57ddd953d3a2 | 7 | * in the Software without restriction, including without limitation the rights |
wim | 0:57ddd953d3a2 | 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
wim | 0:57ddd953d3a2 | 9 | * copies of the Software, and to permit persons to whom the Software is |
wim | 0:57ddd953d3a2 | 10 | * furnished to do so, subject to the following conditions: |
wim | 0:57ddd953d3a2 | 11 | * |
wim | 0:57ddd953d3a2 | 12 | * The above copyright notice and this permission notice shall be included in |
wim | 0:57ddd953d3a2 | 13 | * all copies or substantial portions of the Software. |
wim | 0:57ddd953d3a2 | 14 | * |
wim | 0:57ddd953d3a2 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
wim | 0:57ddd953d3a2 | 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
wim | 0:57ddd953d3a2 | 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
wim | 0:57ddd953d3a2 | 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
wim | 0:57ddd953d3a2 | 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
wim | 0:57ddd953d3a2 | 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
wim | 0:57ddd953d3a2 | 21 | * THE SOFTWARE. |
wim | 0:57ddd953d3a2 | 22 | */ |
wim | 0:57ddd953d3a2 | 23 | #include "mbed.h" |
wim | 0:57ddd953d3a2 | 24 | #include "LC75711.h" |
wim | 0:57ddd953d3a2 | 25 | |
wim | 0:57ddd953d3a2 | 26 | // Select one of the testboards for Sanyo LC75711 VFD controller |
wim | 0:57ddd953d3a2 | 27 | #include "LC75711_Config.h" |
wim | 0:57ddd953d3a2 | 28 | |
wim | 0:57ddd953d3a2 | 29 | #if (ASTON_TEST == 1) |
wim | 0:57ddd953d3a2 | 30 | |
wim | 0:57ddd953d3a2 | 31 | // LC75711 Test |
wim | 0:57ddd953d3a2 | 32 | #include "mbed.h" |
wim | 0:57ddd953d3a2 | 33 | #include "LC75711.h" |
wim | 0:57ddd953d3a2 | 34 | |
wim | 0:57ddd953d3a2 | 35 | DigitalOut myled(LED1); |
wim | 0:57ddd953d3a2 | 36 | Serial pc(USBTX, USBRX); |
wim | 0:57ddd953d3a2 | 37 | |
wim | 0:57ddd953d3a2 | 38 | LC75711_ASTON LC75711(p5, p7, p8); |
wim | 0:57ddd953d3a2 | 39 | |
wim | 0:57ddd953d3a2 | 40 | void show_menu() { |
wim | 0:57ddd953d3a2 | 41 | // pc.printf("0: Exit\n\r"); |
wim | 0:57ddd953d3a2 | 42 | pc.printf("1: All\n\r"); |
wim | 0:57ddd953d3a2 | 43 | pc.printf("2: Show UDC chars\n\r"); |
wim | 0:57ddd953d3a2 | 44 | pc.printf("3: Show all chars\n\r"); |
wim | 0:57ddd953d3a2 | 45 | pc.printf("4: Show all digits\n\r"); |
wim | 0:57ddd953d3a2 | 46 | pc.printf("5: Show all icons\n\r"); |
wim | 0:57ddd953d3a2 | 47 | pc.printf("6: Counter\n\r"); |
wim | 0:57ddd953d3a2 | 48 | pc.printf("7: Floats\n\r"); |
wim | 0:57ddd953d3a2 | 49 | pc.printf("8: Kitt\n\r"); |
wim | 0:57ddd953d3a2 | 50 | pc.printf("9: Cls\n\r"); |
wim | 0:57ddd953d3a2 | 51 | pc.printf("A/B: Blink On/Off\n\r"); |
wim | 0:57ddd953d3a2 | 52 | pc.printf("C: Bye\n\r"); |
wim | 0:57ddd953d3a2 | 53 | } |
wim | 0:57ddd953d3a2 | 54 | |
wim | 0:57ddd953d3a2 | 55 | |
wim | 0:57ddd953d3a2 | 56 | int main() { |
wim | 0:57ddd953d3a2 | 57 | pc.printf("Hello World: LC75711 test\n\r"); |
wim | 0:57ddd953d3a2 | 58 | |
wim | 0:57ddd953d3a2 | 59 | LC75711.locate(0); |
wim | 0:57ddd953d3a2 | 60 | LC75711.printf("Hello mbed"); |
wim | 0:57ddd953d3a2 | 61 | |
wim | 0:57ddd953d3a2 | 62 | LC75711.setBrightness(LC75711_BRT_4); |
wim | 0:57ddd953d3a2 | 63 | wait(1); |
wim | 0:57ddd953d3a2 | 64 | LC75711.setBrightness(LC75711_BRT_1); |
wim | 0:57ddd953d3a2 | 65 | wait(1); |
wim | 0:57ddd953d3a2 | 66 | LC75711.setBrightness(LC75711_BRT_4); |
wim | 0:57ddd953d3a2 | 67 | wait(1); |
wim | 0:57ddd953d3a2 | 68 | |
wim | 0:57ddd953d3a2 | 69 | char cmd, cmd2 = '0'; |
wim | 0:57ddd953d3a2 | 70 | while (1) { |
wim | 0:57ddd953d3a2 | 71 | |
wim | 0:57ddd953d3a2 | 72 | show_menu(); |
wim | 0:57ddd953d3a2 | 73 | cmd2 = pc.getc(); |
wim | 0:57ddd953d3a2 | 74 | |
wim | 0:57ddd953d3a2 | 75 | switch (cmd2) { |
wim | 0:57ddd953d3a2 | 76 | case '1' : { |
wim | 0:57ddd953d3a2 | 77 | pc.printf("all\r\n"); |
wim | 0:57ddd953d3a2 | 78 | LC75711.cls(); |
wim | 0:57ddd953d3a2 | 79 | LC75711.printf("Hello mbed"); |
wim | 0:57ddd953d3a2 | 80 | break; |
wim | 0:57ddd953d3a2 | 81 | } |
wim | 0:57ddd953d3a2 | 82 | |
wim | 0:57ddd953d3a2 | 83 | |
wim | 0:57ddd953d3a2 | 84 | case '2' : { |
wim | 0:57ddd953d3a2 | 85 | pc.printf("UDC\r\n"); |
wim | 0:57ddd953d3a2 | 86 | LC75711.cls(); |
wim | 0:57ddd953d3a2 | 87 | |
wim | 0:57ddd953d3a2 | 88 | // Note that UDC_idx=0 is reserved for Grid11 to display Icons |
wim | 0:57ddd953d3a2 | 89 | LC75711.setUDC(1, (char *) udc_checker); |
wim | 0:57ddd953d3a2 | 90 | LC75711.setUDC(2, (char *) udc_Bat_Hi); |
wim | 0:57ddd953d3a2 | 91 | LC75711.setUDC(3, (char *) udc_Bat_Ha); |
wim | 0:57ddd953d3a2 | 92 | LC75711.setUDC(4, (char *) udc_Bat_Lo); |
wim | 0:57ddd953d3a2 | 93 | LC75711.locate(0); |
wim | 0:57ddd953d3a2 | 94 | LC75711.putc((char) 1); |
wim | 0:57ddd953d3a2 | 95 | LC75711.putc((char) 2); |
wim | 0:57ddd953d3a2 | 96 | LC75711.putc((char) 3); |
wim | 0:57ddd953d3a2 | 97 | LC75711.putc((char) 4); |
wim | 0:57ddd953d3a2 | 98 | |
wim | 0:57ddd953d3a2 | 99 | break; |
wim | 0:57ddd953d3a2 | 100 | } |
wim | 0:57ddd953d3a2 | 101 | |
wim | 0:57ddd953d3a2 | 102 | case '3' : { |
wim | 0:57ddd953d3a2 | 103 | #if(1) |
wim | 0:57ddd953d3a2 | 104 | //test to show all chars |
wim | 0:57ddd953d3a2 | 105 | pc.printf("Show all alpha chars\r\n"); |
wim | 0:57ddd953d3a2 | 106 | wait(1); |
wim | 0:57ddd953d3a2 | 107 | LC75711.cls(); |
wim | 0:57ddd953d3a2 | 108 | |
wim | 0:57ddd953d3a2 | 109 | for (int i=0; i<26; i++) { |
wim | 0:57ddd953d3a2 | 110 | LC75711.printf("%c", char(i + 'A')); |
wim | 0:57ddd953d3a2 | 111 | // LC75711.printf("%c", char(i + 'a')); |
wim | 0:57ddd953d3a2 | 112 | wait(0.25); |
wim | 0:57ddd953d3a2 | 113 | } |
wim | 0:57ddd953d3a2 | 114 | pc.printf("Show all alpha chars done\r\n"); |
wim | 0:57ddd953d3a2 | 115 | #endif |
wim | 0:57ddd953d3a2 | 116 | break; |
wim | 0:57ddd953d3a2 | 117 | } |
wim | 0:57ddd953d3a2 | 118 | |
wim | 0:57ddd953d3a2 | 119 | case '4': { |
wim | 0:57ddd953d3a2 | 120 | #if(0) |
wim | 0:57ddd953d3a2 | 121 | //test to show all digits (base is 10) |
wim | 0:57ddd953d3a2 | 122 | pc.printf("Show all digits\r\n"); |
wim | 0:57ddd953d3a2 | 123 | wait(1); |
wim | 0:57ddd953d3a2 | 124 | LC75711.cls(); |
wim | 0:57ddd953d3a2 | 125 | |
wim | 0:57ddd953d3a2 | 126 | for (int i=0; i<LC75711_NR_DIGITS; i++) { |
wim | 0:57ddd953d3a2 | 127 | |
wim | 0:57ddd953d3a2 | 128 | for (int cnt=0; cnt<10; cnt++) { |
wim | 0:57ddd953d3a2 | 129 | LC75711.locate(i); |
wim | 0:57ddd953d3a2 | 130 | LC75711.printf("%0d", cnt); |
wim | 0:57ddd953d3a2 | 131 | |
wim | 0:57ddd953d3a2 | 132 | // wait(0.5); |
wim | 0:57ddd953d3a2 | 133 | cmd = pc.getc(); // wait for key |
wim | 0:57ddd953d3a2 | 134 | } |
wim | 0:57ddd953d3a2 | 135 | } |
wim | 0:57ddd953d3a2 | 136 | pc.printf("\r\nShow all digits done\r\n"); |
wim | 0:57ddd953d3a2 | 137 | #endif |
wim | 0:57ddd953d3a2 | 138 | |
wim | 0:57ddd953d3a2 | 139 | #if(1) |
wim | 0:57ddd953d3a2 | 140 | //test to show all digits (base is 0x10) |
wim | 0:57ddd953d3a2 | 141 | pc.printf("Show all hex digits\r\n"); |
wim | 0:57ddd953d3a2 | 142 | wait(1); |
wim | 0:57ddd953d3a2 | 143 | LC75711.cls(); |
wim | 0:57ddd953d3a2 | 144 | |
wim | 0:57ddd953d3a2 | 145 | LC75711.printf("%010X", 0x0123ABCDEF); |
wim | 0:57ddd953d3a2 | 146 | cmd = pc.getc(); // wait for key |
wim | 0:57ddd953d3a2 | 147 | LC75711.printf("%010X", 0x0); |
wim | 0:57ddd953d3a2 | 148 | |
wim | 0:57ddd953d3a2 | 149 | for (int i=0; i<ASTON_NR_DIGITS; i++) { |
wim | 0:57ddd953d3a2 | 150 | |
wim | 0:57ddd953d3a2 | 151 | for (int cnt=0; cnt<0x10; cnt++) { |
wim | 0:57ddd953d3a2 | 152 | LC75711.locate(i); |
wim | 0:57ddd953d3a2 | 153 | LC75711.printf("%0X", cnt); |
wim | 0:57ddd953d3a2 | 154 | |
wim | 0:57ddd953d3a2 | 155 | // wait(0.5); |
wim | 0:57ddd953d3a2 | 156 | cmd = pc.getc(); // wait for key |
wim | 0:57ddd953d3a2 | 157 | } |
wim | 0:57ddd953d3a2 | 158 | } |
wim | 0:57ddd953d3a2 | 159 | pc.printf("\r\nShow all hex digits done\r\n"); |
wim | 0:57ddd953d3a2 | 160 | #endif |
wim | 0:57ddd953d3a2 | 161 | break; |
wim | 0:57ddd953d3a2 | 162 | } |
wim | 0:57ddd953d3a2 | 163 | |
wim | 0:57ddd953d3a2 | 164 | case '5': { |
wim | 0:57ddd953d3a2 | 165 | #if(1) |
wim | 0:57ddd953d3a2 | 166 | //test to show all icons |
wim | 0:57ddd953d3a2 | 167 | pc.printf("Show all icons\r\n"); |
wim | 0:57ddd953d3a2 | 168 | LC75711.cls(true); // Also clear all Icons |
wim | 0:57ddd953d3a2 | 169 | |
wim | 0:57ddd953d3a2 | 170 | #if(0) |
wim | 0:57ddd953d3a2 | 171 | // activate each icon sequentially to find mapping |
wim | 0:57ddd953d3a2 | 172 | char udc[7] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00}; |
wim | 0:57ddd953d3a2 | 173 | for (int row=0; row<7; row++) { |
wim | 0:57ddd953d3a2 | 174 | for (int bit=0; bit<5; bit++) { |
wim | 0:57ddd953d3a2 | 175 | udc[row] = (1 << bit); |
wim | 0:57ddd953d3a2 | 176 | LC75711.setUDC(0, (char *) udc); |
wim | 0:57ddd953d3a2 | 177 | pc.printf("Icon row= %d, bit= %d\r\n", row, bit); |
wim | 0:57ddd953d3a2 | 178 | cmd = pc.getc(); // wait for key |
wim | 0:57ddd953d3a2 | 179 | } |
wim | 0:57ddd953d3a2 | 180 | udc[row] = 0x00; |
wim | 0:57ddd953d3a2 | 181 | } |
wim | 0:57ddd953d3a2 | 182 | #endif |
wim | 0:57ddd953d3a2 | 183 | |
wim | 0:57ddd953d3a2 | 184 | float delay=0.1; |
wim | 0:57ddd953d3a2 | 185 | |
wim | 0:57ddd953d3a2 | 186 | // Icons on |
wim | 0:57ddd953d3a2 | 187 | LC75711.setIcon(LC75711_ASTON::R0); wait(delay); |
wim | 0:57ddd953d3a2 | 188 | LC75711.setIcon(LC75711_ASTON::R1); wait(delay); |
wim | 0:57ddd953d3a2 | 189 | LC75711.setIcon(LC75711_ASTON::R2); wait(delay); |
wim | 0:57ddd953d3a2 | 190 | LC75711.setIcon(LC75711_ASTON::R3); wait(delay); |
wim | 0:57ddd953d3a2 | 191 | LC75711.setIcon(LC75711_ASTON::CRD1); wait(delay); |
wim | 0:57ddd953d3a2 | 192 | LC75711.setIcon(LC75711_ASTON::CRD2); wait(delay); |
wim | 0:57ddd953d3a2 | 193 | LC75711.setIcon(LC75711_ASTON::CARD); wait(delay); |
wim | 0:57ddd953d3a2 | 194 | LC75711.setIcon(LC75711_ASTON::KEY); wait(delay); |
wim | 0:57ddd953d3a2 | 195 | LC75711.setIcon(LC75711_ASTON::VDCRP); wait(delay); |
wim | 0:57ddd953d3a2 | 196 | LC75711.setIcon(LC75711_ASTON::D); wait(delay); |
wim | 0:57ddd953d3a2 | 197 | LC75711.setIcon(LC75711_ASTON::D2); wait(delay); |
wim | 0:57ddd953d3a2 | 198 | LC75711.setIcon(LC75711_ASTON::MAC); wait(delay); |
wim | 0:57ddd953d3a2 | 199 | LC75711.setIcon(LC75711_ASTON::R16_9); wait(delay); |
wim | 0:57ddd953d3a2 | 200 | LC75711.setIcon(LC75711_ASTON::DISH); wait(delay); |
wim | 0:57ddd953d3a2 | 201 | LC75711.setIcon(LC75711_ASTON::DSH1); wait(delay); |
wim | 0:57ddd953d3a2 | 202 | LC75711.setIcon(LC75711_ASTON::DSH2); wait(delay); |
wim | 0:57ddd953d3a2 | 203 | LC75711.setIcon(LC75711_ASTON::TMR); wait(delay); |
wim | 0:57ddd953d3a2 | 204 | LC75711.setIcon(LC75711_ASTON::CBND); wait(delay); |
wim | 0:57ddd953d3a2 | 205 | LC75711.setIcon(LC75711_ASTON::KBND); wait(delay); |
wim | 0:57ddd953d3a2 | 206 | LC75711.setIcon(LC75711_ASTON::AFC); wait(delay); |
wim | 0:57ddd953d3a2 | 207 | |
wim | 0:57ddd953d3a2 | 208 | wait(delay); |
wim | 0:57ddd953d3a2 | 209 | |
wim | 0:57ddd953d3a2 | 210 | // Icons off |
wim | 0:57ddd953d3a2 | 211 | LC75711.clrIcon(LC75711_ASTON::AFC); wait(delay); |
wim | 0:57ddd953d3a2 | 212 | LC75711.clrIcon(LC75711_ASTON::KBND); wait(delay); |
wim | 0:57ddd953d3a2 | 213 | LC75711.clrIcon(LC75711_ASTON::CBND); wait(delay); |
wim | 0:57ddd953d3a2 | 214 | LC75711.clrIcon(LC75711_ASTON::TMR); wait(delay); |
wim | 0:57ddd953d3a2 | 215 | LC75711.clrIcon(LC75711_ASTON::DSH2); wait(delay); |
wim | 0:57ddd953d3a2 | 216 | LC75711.clrIcon(LC75711_ASTON::DSH1); wait(delay); |
wim | 0:57ddd953d3a2 | 217 | LC75711.clrIcon(LC75711_ASTON::DISH); wait(delay); |
wim | 0:57ddd953d3a2 | 218 | LC75711.clrIcon(LC75711_ASTON::R16_9); wait(delay); |
wim | 0:57ddd953d3a2 | 219 | LC75711.clrIcon(LC75711_ASTON::MAC); wait(delay); |
wim | 0:57ddd953d3a2 | 220 | LC75711.clrIcon(LC75711_ASTON::D2); wait(delay); |
wim | 0:57ddd953d3a2 | 221 | LC75711.clrIcon(LC75711_ASTON::D); wait(delay); |
wim | 0:57ddd953d3a2 | 222 | LC75711.clrIcon(LC75711_ASTON::VDCRP); wait(delay); |
wim | 0:57ddd953d3a2 | 223 | LC75711.clrIcon(LC75711_ASTON::KEY); wait(delay); |
wim | 0:57ddd953d3a2 | 224 | LC75711.clrIcon(LC75711_ASTON::CRD2); wait(delay); |
wim | 0:57ddd953d3a2 | 225 | LC75711.clrIcon(LC75711_ASTON::CRD1); wait(delay); |
wim | 0:57ddd953d3a2 | 226 | LC75711.clrIcon(LC75711_ASTON::CARD); wait(delay); |
wim | 0:57ddd953d3a2 | 227 | LC75711.clrIcon(LC75711_ASTON::R3); wait(delay); |
wim | 0:57ddd953d3a2 | 228 | LC75711.clrIcon(LC75711_ASTON::R2); wait(delay); |
wim | 0:57ddd953d3a2 | 229 | LC75711.clrIcon(LC75711_ASTON::R1); wait(delay); |
wim | 0:57ddd953d3a2 | 230 | LC75711.clrIcon(LC75711_ASTON::R0); wait(delay); |
wim | 0:57ddd953d3a2 | 231 | |
wim | 0:57ddd953d3a2 | 232 | pc.printf("Show all icons done\r\n"); |
wim | 0:57ddd953d3a2 | 233 | #endif |
wim | 0:57ddd953d3a2 | 234 | break; |
wim | 0:57ddd953d3a2 | 235 | } |
wim | 0:57ddd953d3a2 | 236 | |
wim | 0:57ddd953d3a2 | 237 | case '6': { |
wim | 0:57ddd953d3a2 | 238 | pc.printf("Show counter\r\n"); |
wim | 0:57ddd953d3a2 | 239 | LC75711.cls(); // clear all, preserve Icons |
wim | 0:57ddd953d3a2 | 240 | |
wim | 0:57ddd953d3a2 | 241 | #if(1) |
wim | 0:57ddd953d3a2 | 242 | LC75711.locate(0); |
wim | 0:57ddd953d3a2 | 243 | LC75711.printf("Cnt="); |
wim | 0:57ddd953d3a2 | 244 | for (int cnt=0; cnt<=0xFF; cnt++) { |
wim | 0:57ddd953d3a2 | 245 | LC75711.locate(8); |
wim | 0:57ddd953d3a2 | 246 | LC75711.printf("%02X", cnt); |
wim | 0:57ddd953d3a2 | 247 | wait(0.2); |
wim | 0:57ddd953d3a2 | 248 | } |
wim | 0:57ddd953d3a2 | 249 | #endif |
wim | 0:57ddd953d3a2 | 250 | break; |
wim | 0:57ddd953d3a2 | 251 | } |
wim | 0:57ddd953d3a2 | 252 | |
wim | 0:57ddd953d3a2 | 253 | case '7': { |
wim | 0:57ddd953d3a2 | 254 | pc.printf("Show floats\r\n"); |
wim | 0:57ddd953d3a2 | 255 | |
wim | 0:57ddd953d3a2 | 256 | LC75711.cls(); // clear all, preserve Icons |
wim | 0:57ddd953d3a2 | 257 | LC75711.printf("%1.7f", -0.1234567); // test decimal point display |
wim | 0:57ddd953d3a2 | 258 | wait(0.5); |
wim | 0:57ddd953d3a2 | 259 | LC75711.cls(); // clear all, preserve Icons |
wim | 0:57ddd953d3a2 | 260 | LC75711.printf("%3.6f", 123.456789); // test decimal point display |
wim | 0:57ddd953d3a2 | 261 | break; |
wim | 0:57ddd953d3a2 | 262 | } |
wim | 0:57ddd953d3a2 | 263 | |
wim | 0:57ddd953d3a2 | 264 | case '8': { |
wim | 0:57ddd953d3a2 | 265 | |
wim | 0:57ddd953d3a2 | 266 | #if(1) |
wim | 0:57ddd953d3a2 | 267 | //test to show KITT |
wim | 0:57ddd953d3a2 | 268 | pc.printf("Show KITT scanner\r\n"); |
wim | 0:57ddd953d3a2 | 269 | |
wim | 0:57ddd953d3a2 | 270 | // 0123456789 |
wim | 0:57ddd953d3a2 | 271 | const char KITT[][11] = {{"8 "}, |
wim | 0:57ddd953d3a2 | 272 | {"38 "}, |
wim | 0:57ddd953d3a2 | 273 | {" 38 "}, |
wim | 0:57ddd953d3a2 | 274 | {" 38 "}, |
wim | 0:57ddd953d3a2 | 275 | {" 38 "}, |
wim | 0:57ddd953d3a2 | 276 | {" 38 "}, |
wim | 0:57ddd953d3a2 | 277 | {" 38 "}, |
wim | 0:57ddd953d3a2 | 278 | {" 38 "}, |
wim | 0:57ddd953d3a2 | 279 | {" 38 "}, |
wim | 0:57ddd953d3a2 | 280 | {" 38"}, |
wim | 0:57ddd953d3a2 | 281 | {" 3"}, |
wim | 0:57ddd953d3a2 | 282 | {" "}, |
wim | 0:57ddd953d3a2 | 283 | {" 8"}, |
wim | 0:57ddd953d3a2 | 284 | {" 8E"}, |
wim | 0:57ddd953d3a2 | 285 | {" 8E "}, |
wim | 0:57ddd953d3a2 | 286 | {" 8E "}, |
wim | 0:57ddd953d3a2 | 287 | {" 8E "}, |
wim | 0:57ddd953d3a2 | 288 | {" 8E "}, |
wim | 0:57ddd953d3a2 | 289 | {" 8E "}, |
wim | 0:57ddd953d3a2 | 290 | {" 8E "}, |
wim | 0:57ddd953d3a2 | 291 | {" 8E "}, |
wim | 0:57ddd953d3a2 | 292 | {"8E "}, |
wim | 0:57ddd953d3a2 | 293 | {"E "}, |
wim | 0:57ddd953d3a2 | 294 | {" "} |
wim | 0:57ddd953d3a2 | 295 | }; |
wim | 0:57ddd953d3a2 | 296 | |
wim | 0:57ddd953d3a2 | 297 | LC75711.cls(); // clear all, preserve Icons |
wim | 0:57ddd953d3a2 | 298 | |
wim | 0:57ddd953d3a2 | 299 | while (!pc.readable()) { // wait for key |
wim | 0:57ddd953d3a2 | 300 | for (int i=0; i < (sizeof(KITT) / 11) ; i++) { |
wim | 0:57ddd953d3a2 | 301 | LC75711.locate(0); |
wim | 0:57ddd953d3a2 | 302 | LC75711.printf("%s", KITT[i]); |
wim | 0:57ddd953d3a2 | 303 | wait(0.1); |
wim | 0:57ddd953d3a2 | 304 | } |
wim | 0:57ddd953d3a2 | 305 | } |
wim | 0:57ddd953d3a2 | 306 | cmd = pc.getc(); // read key |
wim | 0:57ddd953d3a2 | 307 | pc.printf("Show KITT done\r\n"); |
wim | 0:57ddd953d3a2 | 308 | #endif |
wim | 0:57ddd953d3a2 | 309 | break; |
wim | 0:57ddd953d3a2 | 310 | } |
wim | 0:57ddd953d3a2 | 311 | |
wim | 0:57ddd953d3a2 | 312 | |
wim | 0:57ddd953d3a2 | 313 | case '9': { |
wim | 0:57ddd953d3a2 | 314 | LC75711.cls(true); // clear all, including Icons |
wim | 0:57ddd953d3a2 | 315 | break; |
wim | 0:57ddd953d3a2 | 316 | } |
wim | 0:57ddd953d3a2 | 317 | |
wim | 0:57ddd953d3a2 | 318 | case 'A': { |
wim | 0:57ddd953d3a2 | 319 | //Blink some grids |
wim | 1:7b154968b0ca | 320 | LC75711.setBlink( (LC75711_GR1 | LC75711_GR2 | LC75711_GR3 | LC75711_GR4) ); |
wim | 0:57ddd953d3a2 | 321 | break; |
wim | 0:57ddd953d3a2 | 322 | } |
wim | 0:57ddd953d3a2 | 323 | |
wim | 0:57ddd953d3a2 | 324 | case 'B': { |
wim | 1:7b154968b0ca | 325 | //Disable Blinking grids |
wim | 1:7b154968b0ca | 326 | LC75711.clrBlink(LC75711_GR3); // Clear GR3 Blink |
wim | 0:57ddd953d3a2 | 327 | wait(2); |
wim | 1:7b154968b0ca | 328 | LC75711.clrBlink(); //Clear All |
wim | 0:57ddd953d3a2 | 329 | |
wim | 0:57ddd953d3a2 | 330 | break; |
wim | 0:57ddd953d3a2 | 331 | } |
wim | 0:57ddd953d3a2 | 332 | |
wim | 0:57ddd953d3a2 | 333 | case 'C': { |
wim | 0:57ddd953d3a2 | 334 | LC75711.cls(); // clear all, preserve Icons |
wim | 0:57ddd953d3a2 | 335 | LC75711.printf("Bye"); |
wim | 0:57ddd953d3a2 | 336 | |
wim | 0:57ddd953d3a2 | 337 | break; |
wim | 0:57ddd953d3a2 | 338 | } |
wim | 0:57ddd953d3a2 | 339 | |
wim | 0:57ddd953d3a2 | 340 | default : { |
wim | 0:57ddd953d3a2 | 341 | break; |
wim | 0:57ddd953d3a2 | 342 | } |
wim | 0:57ddd953d3a2 | 343 | |
wim | 0:57ddd953d3a2 | 344 | } //switch cmd |
wim | 0:57ddd953d3a2 | 345 | |
wim | 0:57ddd953d3a2 | 346 | myled = !myled; |
wim | 0:57ddd953d3a2 | 347 | wait(0.3); |
wim | 0:57ddd953d3a2 | 348 | } |
wim | 0:57ddd953d3a2 | 349 | } |
wim | 0:57ddd953d3a2 | 350 | #endif |
wim | 0:57ddd953d3a2 | 351 | |
wim | 0:57ddd953d3a2 | 352 | |
wim | 0:57ddd953d3a2 | 353 | #if (LC75711_TEST == 1) |
wim | 0:57ddd953d3a2 | 354 | |
wim | 0:57ddd953d3a2 | 355 | // LC75711 Bare Metal Test |
wim | 0:57ddd953d3a2 | 356 | #include "mbed.h" |
wim | 0:57ddd953d3a2 | 357 | #include "LC75711.h" |
wim | 0:57ddd953d3a2 | 358 | |
wim | 0:57ddd953d3a2 | 359 | DigitalOut myled(LED1); |
wim | 0:57ddd953d3a2 | 360 | Serial pc(USBTX, USBRX); |
wim | 0:57ddd953d3a2 | 361 | |
wim | 0:57ddd953d3a2 | 362 | // LC75711 declaration, Default setting 16 Grids @ 35 Segments |
wim | 0:57ddd953d3a2 | 363 | LC75711 LC75711(p5, p7, p8); // DI, CLK, CS |
wim | 0:57ddd953d3a2 | 364 | |
wim | 0:57ddd953d3a2 | 365 | int main() { |
wim | 0:57ddd953d3a2 | 366 | pc.printf("Hello World: LC75711 test\n\r"); |
wim | 0:57ddd953d3a2 | 367 | |
wim | 0:57ddd953d3a2 | 368 | LC75711.writeData((char)'H', 9); |
wim | 0:57ddd953d3a2 | 369 | LC75711.writeData((char)'e', 8); |
wim | 0:57ddd953d3a2 | 370 | LC75711.writeData((char)'l', 7); |
wim | 0:57ddd953d3a2 | 371 | LC75711.writeData((char)'l', 6); |
wim | 0:57ddd953d3a2 | 372 | LC75711.writeData((char)'o', 5); |
wim | 0:57ddd953d3a2 | 373 | |
wim | 0:57ddd953d3a2 | 374 | LC75711.setBlink(true, (LC75711_GR10 | LC75711_GR9 | LC75711_GR8 | LC75711_GR7 | LC75711_GR6) ); |
wim | 0:57ddd953d3a2 | 375 | |
wim | 0:57ddd953d3a2 | 376 | while(1) { |
wim | 0:57ddd953d3a2 | 377 | myled = !myled; |
wim | 0:57ddd953d3a2 | 378 | wait(1); |
wim | 0:57ddd953d3a2 | 379 | } |
wim | 0:57ddd953d3a2 | 380 | } |
wim | 0:57ddd953d3a2 | 381 | #endif |