Wim Huiskamp
/
mbed_LC75711
Test program for Sanyo LC75711 VFD controller
main.cpp@2:46ec5f4fb9d8, 2017-09-17 (annotated)
- Committer:
- wim
- Date:
- Sun Sep 17 13:33:05 2017 +0000
- Revision:
- 2:46ec5f4fb9d8
- Parent:
- 1:7b154968b0ca
Minor Cleanup, added comments, added Display On/Off
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 | 2:46ec5f4fb9d8 | 52 | pc.printf("C/D: Display On/Off\n\r"); |
wim | 2:46ec5f4fb9d8 | 53 | pc.printf("X: Bye\n\r"); |
wim | 0:57ddd953d3a2 | 54 | } |
wim | 0:57ddd953d3a2 | 55 | |
wim | 0:57ddd953d3a2 | 56 | |
wim | 0:57ddd953d3a2 | 57 | int main() { |
wim | 0:57ddd953d3a2 | 58 | pc.printf("Hello World: LC75711 test\n\r"); |
wim | 0:57ddd953d3a2 | 59 | |
wim | 0:57ddd953d3a2 | 60 | LC75711.locate(0); |
wim | 0:57ddd953d3a2 | 61 | LC75711.printf("Hello mbed"); |
wim | 0:57ddd953d3a2 | 62 | |
wim | 0:57ddd953d3a2 | 63 | LC75711.setBrightness(LC75711_BRT_4); |
wim | 0:57ddd953d3a2 | 64 | wait(1); |
wim | 0:57ddd953d3a2 | 65 | LC75711.setBrightness(LC75711_BRT_1); |
wim | 0:57ddd953d3a2 | 66 | wait(1); |
wim | 0:57ddd953d3a2 | 67 | LC75711.setBrightness(LC75711_BRT_4); |
wim | 0:57ddd953d3a2 | 68 | wait(1); |
wim | 0:57ddd953d3a2 | 69 | |
wim | 0:57ddd953d3a2 | 70 | char cmd, cmd2 = '0'; |
wim | 0:57ddd953d3a2 | 71 | while (1) { |
wim | 0:57ddd953d3a2 | 72 | |
wim | 0:57ddd953d3a2 | 73 | show_menu(); |
wim | 0:57ddd953d3a2 | 74 | cmd2 = pc.getc(); |
wim | 0:57ddd953d3a2 | 75 | |
wim | 0:57ddd953d3a2 | 76 | switch (cmd2) { |
wim | 0:57ddd953d3a2 | 77 | case '1' : { |
wim | 0:57ddd953d3a2 | 78 | pc.printf("all\r\n"); |
wim | 0:57ddd953d3a2 | 79 | LC75711.cls(); |
wim | 0:57ddd953d3a2 | 80 | LC75711.printf("Hello mbed"); |
wim | 0:57ddd953d3a2 | 81 | break; |
wim | 0:57ddd953d3a2 | 82 | } |
wim | 0:57ddd953d3a2 | 83 | |
wim | 0:57ddd953d3a2 | 84 | |
wim | 0:57ddd953d3a2 | 85 | case '2' : { |
wim | 0:57ddd953d3a2 | 86 | pc.printf("UDC\r\n"); |
wim | 0:57ddd953d3a2 | 87 | LC75711.cls(); |
wim | 0:57ddd953d3a2 | 88 | |
wim | 0:57ddd953d3a2 | 89 | // Note that UDC_idx=0 is reserved for Grid11 to display Icons |
wim | 0:57ddd953d3a2 | 90 | LC75711.setUDC(1, (char *) udc_checker); |
wim | 0:57ddd953d3a2 | 91 | LC75711.setUDC(2, (char *) udc_Bat_Hi); |
wim | 0:57ddd953d3a2 | 92 | LC75711.setUDC(3, (char *) udc_Bat_Ha); |
wim | 0:57ddd953d3a2 | 93 | LC75711.setUDC(4, (char *) udc_Bat_Lo); |
wim | 0:57ddd953d3a2 | 94 | LC75711.locate(0); |
wim | 0:57ddd953d3a2 | 95 | LC75711.putc((char) 1); |
wim | 0:57ddd953d3a2 | 96 | LC75711.putc((char) 2); |
wim | 0:57ddd953d3a2 | 97 | LC75711.putc((char) 3); |
wim | 0:57ddd953d3a2 | 98 | LC75711.putc((char) 4); |
wim | 0:57ddd953d3a2 | 99 | |
wim | 0:57ddd953d3a2 | 100 | break; |
wim | 0:57ddd953d3a2 | 101 | } |
wim | 0:57ddd953d3a2 | 102 | |
wim | 0:57ddd953d3a2 | 103 | case '3' : { |
wim | 0:57ddd953d3a2 | 104 | #if(1) |
wim | 0:57ddd953d3a2 | 105 | //test to show all chars |
wim | 0:57ddd953d3a2 | 106 | pc.printf("Show all alpha chars\r\n"); |
wim | 0:57ddd953d3a2 | 107 | wait(1); |
wim | 0:57ddd953d3a2 | 108 | LC75711.cls(); |
wim | 0:57ddd953d3a2 | 109 | |
wim | 0:57ddd953d3a2 | 110 | for (int i=0; i<26; i++) { |
wim | 0:57ddd953d3a2 | 111 | LC75711.printf("%c", char(i + 'A')); |
wim | 0:57ddd953d3a2 | 112 | // LC75711.printf("%c", char(i + 'a')); |
wim | 0:57ddd953d3a2 | 113 | wait(0.25); |
wim | 0:57ddd953d3a2 | 114 | } |
wim | 0:57ddd953d3a2 | 115 | pc.printf("Show all alpha chars done\r\n"); |
wim | 0:57ddd953d3a2 | 116 | #endif |
wim | 0:57ddd953d3a2 | 117 | break; |
wim | 0:57ddd953d3a2 | 118 | } |
wim | 0:57ddd953d3a2 | 119 | |
wim | 0:57ddd953d3a2 | 120 | case '4': { |
wim | 0:57ddd953d3a2 | 121 | #if(0) |
wim | 0:57ddd953d3a2 | 122 | //test to show all digits (base is 10) |
wim | 0:57ddd953d3a2 | 123 | pc.printf("Show all digits\r\n"); |
wim | 0:57ddd953d3a2 | 124 | wait(1); |
wim | 0:57ddd953d3a2 | 125 | LC75711.cls(); |
wim | 0:57ddd953d3a2 | 126 | |
wim | 0:57ddd953d3a2 | 127 | for (int i=0; i<LC75711_NR_DIGITS; i++) { |
wim | 0:57ddd953d3a2 | 128 | |
wim | 0:57ddd953d3a2 | 129 | for (int cnt=0; cnt<10; cnt++) { |
wim | 0:57ddd953d3a2 | 130 | LC75711.locate(i); |
wim | 0:57ddd953d3a2 | 131 | LC75711.printf("%0d", cnt); |
wim | 0:57ddd953d3a2 | 132 | |
wim | 0:57ddd953d3a2 | 133 | // wait(0.5); |
wim | 0:57ddd953d3a2 | 134 | cmd = pc.getc(); // wait for key |
wim | 0:57ddd953d3a2 | 135 | } |
wim | 0:57ddd953d3a2 | 136 | } |
wim | 0:57ddd953d3a2 | 137 | pc.printf("\r\nShow all digits done\r\n"); |
wim | 0:57ddd953d3a2 | 138 | #endif |
wim | 0:57ddd953d3a2 | 139 | |
wim | 0:57ddd953d3a2 | 140 | #if(1) |
wim | 0:57ddd953d3a2 | 141 | //test to show all digits (base is 0x10) |
wim | 0:57ddd953d3a2 | 142 | pc.printf("Show all hex digits\r\n"); |
wim | 0:57ddd953d3a2 | 143 | wait(1); |
wim | 0:57ddd953d3a2 | 144 | LC75711.cls(); |
wim | 0:57ddd953d3a2 | 145 | |
wim | 0:57ddd953d3a2 | 146 | LC75711.printf("%010X", 0x0123ABCDEF); |
wim | 0:57ddd953d3a2 | 147 | cmd = pc.getc(); // wait for key |
wim | 0:57ddd953d3a2 | 148 | LC75711.printf("%010X", 0x0); |
wim | 0:57ddd953d3a2 | 149 | |
wim | 0:57ddd953d3a2 | 150 | for (int i=0; i<ASTON_NR_DIGITS; i++) { |
wim | 0:57ddd953d3a2 | 151 | |
wim | 0:57ddd953d3a2 | 152 | for (int cnt=0; cnt<0x10; cnt++) { |
wim | 0:57ddd953d3a2 | 153 | LC75711.locate(i); |
wim | 0:57ddd953d3a2 | 154 | LC75711.printf("%0X", cnt); |
wim | 0:57ddd953d3a2 | 155 | |
wim | 0:57ddd953d3a2 | 156 | // wait(0.5); |
wim | 0:57ddd953d3a2 | 157 | cmd = pc.getc(); // wait for key |
wim | 0:57ddd953d3a2 | 158 | } |
wim | 0:57ddd953d3a2 | 159 | } |
wim | 0:57ddd953d3a2 | 160 | pc.printf("\r\nShow all hex digits done\r\n"); |
wim | 0:57ddd953d3a2 | 161 | #endif |
wim | 0:57ddd953d3a2 | 162 | break; |
wim | 0:57ddd953d3a2 | 163 | } |
wim | 0:57ddd953d3a2 | 164 | |
wim | 0:57ddd953d3a2 | 165 | case '5': { |
wim | 0:57ddd953d3a2 | 166 | #if(1) |
wim | 0:57ddd953d3a2 | 167 | //test to show all icons |
wim | 0:57ddd953d3a2 | 168 | pc.printf("Show all icons\r\n"); |
wim | 0:57ddd953d3a2 | 169 | LC75711.cls(true); // Also clear all Icons |
wim | 0:57ddd953d3a2 | 170 | |
wim | 0:57ddd953d3a2 | 171 | #if(0) |
wim | 0:57ddd953d3a2 | 172 | // activate each icon sequentially to find mapping |
wim | 0:57ddd953d3a2 | 173 | char udc[7] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00}; |
wim | 0:57ddd953d3a2 | 174 | for (int row=0; row<7; row++) { |
wim | 0:57ddd953d3a2 | 175 | for (int bit=0; bit<5; bit++) { |
wim | 0:57ddd953d3a2 | 176 | udc[row] = (1 << bit); |
wim | 0:57ddd953d3a2 | 177 | LC75711.setUDC(0, (char *) udc); |
wim | 0:57ddd953d3a2 | 178 | pc.printf("Icon row= %d, bit= %d\r\n", row, bit); |
wim | 0:57ddd953d3a2 | 179 | cmd = pc.getc(); // wait for key |
wim | 0:57ddd953d3a2 | 180 | } |
wim | 0:57ddd953d3a2 | 181 | udc[row] = 0x00; |
wim | 0:57ddd953d3a2 | 182 | } |
wim | 0:57ddd953d3a2 | 183 | #endif |
wim | 0:57ddd953d3a2 | 184 | |
wim | 0:57ddd953d3a2 | 185 | float delay=0.1; |
wim | 0:57ddd953d3a2 | 186 | |
wim | 0:57ddd953d3a2 | 187 | // Icons on |
wim | 0:57ddd953d3a2 | 188 | LC75711.setIcon(LC75711_ASTON::R0); wait(delay); |
wim | 0:57ddd953d3a2 | 189 | LC75711.setIcon(LC75711_ASTON::R1); wait(delay); |
wim | 0:57ddd953d3a2 | 190 | LC75711.setIcon(LC75711_ASTON::R2); wait(delay); |
wim | 0:57ddd953d3a2 | 191 | LC75711.setIcon(LC75711_ASTON::R3); wait(delay); |
wim | 0:57ddd953d3a2 | 192 | LC75711.setIcon(LC75711_ASTON::CRD1); wait(delay); |
wim | 0:57ddd953d3a2 | 193 | LC75711.setIcon(LC75711_ASTON::CRD2); wait(delay); |
wim | 0:57ddd953d3a2 | 194 | LC75711.setIcon(LC75711_ASTON::CARD); wait(delay); |
wim | 0:57ddd953d3a2 | 195 | LC75711.setIcon(LC75711_ASTON::KEY); wait(delay); |
wim | 0:57ddd953d3a2 | 196 | LC75711.setIcon(LC75711_ASTON::VDCRP); wait(delay); |
wim | 0:57ddd953d3a2 | 197 | LC75711.setIcon(LC75711_ASTON::D); wait(delay); |
wim | 0:57ddd953d3a2 | 198 | LC75711.setIcon(LC75711_ASTON::D2); wait(delay); |
wim | 0:57ddd953d3a2 | 199 | LC75711.setIcon(LC75711_ASTON::MAC); wait(delay); |
wim | 0:57ddd953d3a2 | 200 | LC75711.setIcon(LC75711_ASTON::R16_9); wait(delay); |
wim | 0:57ddd953d3a2 | 201 | LC75711.setIcon(LC75711_ASTON::DISH); wait(delay); |
wim | 0:57ddd953d3a2 | 202 | LC75711.setIcon(LC75711_ASTON::DSH1); wait(delay); |
wim | 0:57ddd953d3a2 | 203 | LC75711.setIcon(LC75711_ASTON::DSH2); wait(delay); |
wim | 0:57ddd953d3a2 | 204 | LC75711.setIcon(LC75711_ASTON::TMR); wait(delay); |
wim | 0:57ddd953d3a2 | 205 | LC75711.setIcon(LC75711_ASTON::CBND); wait(delay); |
wim | 0:57ddd953d3a2 | 206 | LC75711.setIcon(LC75711_ASTON::KBND); wait(delay); |
wim | 0:57ddd953d3a2 | 207 | LC75711.setIcon(LC75711_ASTON::AFC); wait(delay); |
wim | 0:57ddd953d3a2 | 208 | |
wim | 0:57ddd953d3a2 | 209 | wait(delay); |
wim | 0:57ddd953d3a2 | 210 | |
wim | 0:57ddd953d3a2 | 211 | // Icons off |
wim | 0:57ddd953d3a2 | 212 | LC75711.clrIcon(LC75711_ASTON::AFC); wait(delay); |
wim | 0:57ddd953d3a2 | 213 | LC75711.clrIcon(LC75711_ASTON::KBND); wait(delay); |
wim | 0:57ddd953d3a2 | 214 | LC75711.clrIcon(LC75711_ASTON::CBND); wait(delay); |
wim | 0:57ddd953d3a2 | 215 | LC75711.clrIcon(LC75711_ASTON::TMR); wait(delay); |
wim | 0:57ddd953d3a2 | 216 | LC75711.clrIcon(LC75711_ASTON::DSH2); wait(delay); |
wim | 0:57ddd953d3a2 | 217 | LC75711.clrIcon(LC75711_ASTON::DSH1); wait(delay); |
wim | 0:57ddd953d3a2 | 218 | LC75711.clrIcon(LC75711_ASTON::DISH); wait(delay); |
wim | 0:57ddd953d3a2 | 219 | LC75711.clrIcon(LC75711_ASTON::R16_9); wait(delay); |
wim | 0:57ddd953d3a2 | 220 | LC75711.clrIcon(LC75711_ASTON::MAC); wait(delay); |
wim | 0:57ddd953d3a2 | 221 | LC75711.clrIcon(LC75711_ASTON::D2); wait(delay); |
wim | 0:57ddd953d3a2 | 222 | LC75711.clrIcon(LC75711_ASTON::D); wait(delay); |
wim | 0:57ddd953d3a2 | 223 | LC75711.clrIcon(LC75711_ASTON::VDCRP); wait(delay); |
wim | 0:57ddd953d3a2 | 224 | LC75711.clrIcon(LC75711_ASTON::KEY); wait(delay); |
wim | 0:57ddd953d3a2 | 225 | LC75711.clrIcon(LC75711_ASTON::CRD2); wait(delay); |
wim | 0:57ddd953d3a2 | 226 | LC75711.clrIcon(LC75711_ASTON::CRD1); wait(delay); |
wim | 0:57ddd953d3a2 | 227 | LC75711.clrIcon(LC75711_ASTON::CARD); wait(delay); |
wim | 0:57ddd953d3a2 | 228 | LC75711.clrIcon(LC75711_ASTON::R3); wait(delay); |
wim | 0:57ddd953d3a2 | 229 | LC75711.clrIcon(LC75711_ASTON::R2); wait(delay); |
wim | 0:57ddd953d3a2 | 230 | LC75711.clrIcon(LC75711_ASTON::R1); wait(delay); |
wim | 0:57ddd953d3a2 | 231 | LC75711.clrIcon(LC75711_ASTON::R0); wait(delay); |
wim | 0:57ddd953d3a2 | 232 | |
wim | 0:57ddd953d3a2 | 233 | pc.printf("Show all icons done\r\n"); |
wim | 0:57ddd953d3a2 | 234 | #endif |
wim | 0:57ddd953d3a2 | 235 | break; |
wim | 0:57ddd953d3a2 | 236 | } |
wim | 0:57ddd953d3a2 | 237 | |
wim | 0:57ddd953d3a2 | 238 | case '6': { |
wim | 0:57ddd953d3a2 | 239 | pc.printf("Show counter\r\n"); |
wim | 0:57ddd953d3a2 | 240 | LC75711.cls(); // clear all, preserve Icons |
wim | 0:57ddd953d3a2 | 241 | |
wim | 0:57ddd953d3a2 | 242 | #if(1) |
wim | 0:57ddd953d3a2 | 243 | LC75711.locate(0); |
wim | 0:57ddd953d3a2 | 244 | LC75711.printf("Cnt="); |
wim | 0:57ddd953d3a2 | 245 | for (int cnt=0; cnt<=0xFF; cnt++) { |
wim | 0:57ddd953d3a2 | 246 | LC75711.locate(8); |
wim | 0:57ddd953d3a2 | 247 | LC75711.printf("%02X", cnt); |
wim | 0:57ddd953d3a2 | 248 | wait(0.2); |
wim | 0:57ddd953d3a2 | 249 | } |
wim | 0:57ddd953d3a2 | 250 | #endif |
wim | 0:57ddd953d3a2 | 251 | break; |
wim | 0:57ddd953d3a2 | 252 | } |
wim | 0:57ddd953d3a2 | 253 | |
wim | 0:57ddd953d3a2 | 254 | case '7': { |
wim | 0:57ddd953d3a2 | 255 | pc.printf("Show floats\r\n"); |
wim | 0:57ddd953d3a2 | 256 | |
wim | 0:57ddd953d3a2 | 257 | LC75711.cls(); // clear all, preserve Icons |
wim | 0:57ddd953d3a2 | 258 | LC75711.printf("%1.7f", -0.1234567); // test decimal point display |
wim | 0:57ddd953d3a2 | 259 | wait(0.5); |
wim | 0:57ddd953d3a2 | 260 | LC75711.cls(); // clear all, preserve Icons |
wim | 0:57ddd953d3a2 | 261 | LC75711.printf("%3.6f", 123.456789); // test decimal point display |
wim | 0:57ddd953d3a2 | 262 | break; |
wim | 0:57ddd953d3a2 | 263 | } |
wim | 0:57ddd953d3a2 | 264 | |
wim | 0:57ddd953d3a2 | 265 | case '8': { |
wim | 0:57ddd953d3a2 | 266 | |
wim | 0:57ddd953d3a2 | 267 | #if(1) |
wim | 0:57ddd953d3a2 | 268 | //test to show KITT |
wim | 0:57ddd953d3a2 | 269 | pc.printf("Show KITT scanner\r\n"); |
wim | 0:57ddd953d3a2 | 270 | |
wim | 0:57ddd953d3a2 | 271 | // 0123456789 |
wim | 0:57ddd953d3a2 | 272 | const char KITT[][11] = {{"8 "}, |
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 | {" 38"}, |
wim | 0:57ddd953d3a2 | 282 | {" 3"}, |
wim | 0:57ddd953d3a2 | 283 | {" "}, |
wim | 0:57ddd953d3a2 | 284 | {" 8"}, |
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 | {"8E "}, |
wim | 0:57ddd953d3a2 | 294 | {"E "}, |
wim | 0:57ddd953d3a2 | 295 | {" "} |
wim | 0:57ddd953d3a2 | 296 | }; |
wim | 0:57ddd953d3a2 | 297 | |
wim | 0:57ddd953d3a2 | 298 | LC75711.cls(); // clear all, preserve Icons |
wim | 0:57ddd953d3a2 | 299 | |
wim | 0:57ddd953d3a2 | 300 | while (!pc.readable()) { // wait for key |
wim | 0:57ddd953d3a2 | 301 | for (int i=0; i < (sizeof(KITT) / 11) ; i++) { |
wim | 0:57ddd953d3a2 | 302 | LC75711.locate(0); |
wim | 0:57ddd953d3a2 | 303 | LC75711.printf("%s", KITT[i]); |
wim | 0:57ddd953d3a2 | 304 | wait(0.1); |
wim | 0:57ddd953d3a2 | 305 | } |
wim | 0:57ddd953d3a2 | 306 | } |
wim | 0:57ddd953d3a2 | 307 | cmd = pc.getc(); // read key |
wim | 0:57ddd953d3a2 | 308 | pc.printf("Show KITT done\r\n"); |
wim | 0:57ddd953d3a2 | 309 | #endif |
wim | 0:57ddd953d3a2 | 310 | break; |
wim | 0:57ddd953d3a2 | 311 | } |
wim | 0:57ddd953d3a2 | 312 | |
wim | 0:57ddd953d3a2 | 313 | |
wim | 0:57ddd953d3a2 | 314 | case '9': { |
wim | 0:57ddd953d3a2 | 315 | LC75711.cls(true); // clear all, including Icons |
wim | 0:57ddd953d3a2 | 316 | break; |
wim | 0:57ddd953d3a2 | 317 | } |
wim | 0:57ddd953d3a2 | 318 | |
wim | 0:57ddd953d3a2 | 319 | case 'A': { |
wim | 0:57ddd953d3a2 | 320 | //Blink some grids |
wim | 1:7b154968b0ca | 321 | LC75711.setBlink( (LC75711_GR1 | LC75711_GR2 | LC75711_GR3 | LC75711_GR4) ); |
wim | 0:57ddd953d3a2 | 322 | break; |
wim | 0:57ddd953d3a2 | 323 | } |
wim | 0:57ddd953d3a2 | 324 | |
wim | 0:57ddd953d3a2 | 325 | case 'B': { |
wim | 1:7b154968b0ca | 326 | //Disable Blinking grids |
wim | 1:7b154968b0ca | 327 | LC75711.clrBlink(LC75711_GR3); // Clear GR3 Blink |
wim | 0:57ddd953d3a2 | 328 | wait(2); |
wim | 1:7b154968b0ca | 329 | LC75711.clrBlink(); //Clear All |
wim | 0:57ddd953d3a2 | 330 | |
wim | 0:57ddd953d3a2 | 331 | break; |
wim | 0:57ddd953d3a2 | 332 | } |
wim | 0:57ddd953d3a2 | 333 | |
wim | 0:57ddd953d3a2 | 334 | case 'C': { |
wim | 2:46ec5f4fb9d8 | 335 | //Display On |
wim | 2:46ec5f4fb9d8 | 336 | LC75711.setDisplay(true); |
wim | 2:46ec5f4fb9d8 | 337 | break; |
wim | 2:46ec5f4fb9d8 | 338 | } |
wim | 2:46ec5f4fb9d8 | 339 | |
wim | 2:46ec5f4fb9d8 | 340 | case 'D': { |
wim | 2:46ec5f4fb9d8 | 341 | //Display Off |
wim | 2:46ec5f4fb9d8 | 342 | LC75711.setDisplay(false); |
wim | 2:46ec5f4fb9d8 | 343 | |
wim | 2:46ec5f4fb9d8 | 344 | break; |
wim | 2:46ec5f4fb9d8 | 345 | } |
wim | 2:46ec5f4fb9d8 | 346 | |
wim | 2:46ec5f4fb9d8 | 347 | case 'X': { |
wim | 0:57ddd953d3a2 | 348 | LC75711.cls(); // clear all, preserve Icons |
wim | 0:57ddd953d3a2 | 349 | LC75711.printf("Bye"); |
wim | 0:57ddd953d3a2 | 350 | |
wim | 0:57ddd953d3a2 | 351 | break; |
wim | 0:57ddd953d3a2 | 352 | } |
wim | 0:57ddd953d3a2 | 353 | |
wim | 0:57ddd953d3a2 | 354 | default : { |
wim | 0:57ddd953d3a2 | 355 | break; |
wim | 0:57ddd953d3a2 | 356 | } |
wim | 0:57ddd953d3a2 | 357 | |
wim | 0:57ddd953d3a2 | 358 | } //switch cmd |
wim | 0:57ddd953d3a2 | 359 | |
wim | 0:57ddd953d3a2 | 360 | myled = !myled; |
wim | 0:57ddd953d3a2 | 361 | wait(0.3); |
wim | 0:57ddd953d3a2 | 362 | } |
wim | 0:57ddd953d3a2 | 363 | } |
wim | 0:57ddd953d3a2 | 364 | #endif |
wim | 0:57ddd953d3a2 | 365 | |
wim | 0:57ddd953d3a2 | 366 | |
wim | 0:57ddd953d3a2 | 367 | #if (LC75711_TEST == 1) |
wim | 0:57ddd953d3a2 | 368 | |
wim | 0:57ddd953d3a2 | 369 | // LC75711 Bare Metal Test |
wim | 0:57ddd953d3a2 | 370 | #include "mbed.h" |
wim | 0:57ddd953d3a2 | 371 | #include "LC75711.h" |
wim | 0:57ddd953d3a2 | 372 | |
wim | 0:57ddd953d3a2 | 373 | DigitalOut myled(LED1); |
wim | 0:57ddd953d3a2 | 374 | Serial pc(USBTX, USBRX); |
wim | 0:57ddd953d3a2 | 375 | |
wim | 0:57ddd953d3a2 | 376 | // LC75711 declaration, Default setting 16 Grids @ 35 Segments |
wim | 0:57ddd953d3a2 | 377 | LC75711 LC75711(p5, p7, p8); // DI, CLK, CS |
wim | 0:57ddd953d3a2 | 378 | |
wim | 0:57ddd953d3a2 | 379 | int main() { |
wim | 0:57ddd953d3a2 | 380 | pc.printf("Hello World: LC75711 test\n\r"); |
wim | 0:57ddd953d3a2 | 381 | |
wim | 0:57ddd953d3a2 | 382 | LC75711.writeData((char)'H', 9); |
wim | 0:57ddd953d3a2 | 383 | LC75711.writeData((char)'e', 8); |
wim | 0:57ddd953d3a2 | 384 | LC75711.writeData((char)'l', 7); |
wim | 0:57ddd953d3a2 | 385 | LC75711.writeData((char)'l', 6); |
wim | 0:57ddd953d3a2 | 386 | LC75711.writeData((char)'o', 5); |
wim | 0:57ddd953d3a2 | 387 | |
wim | 0:57ddd953d3a2 | 388 | LC75711.setBlink(true, (LC75711_GR10 | LC75711_GR9 | LC75711_GR8 | LC75711_GR7 | LC75711_GR6) ); |
wim | 0:57ddd953d3a2 | 389 | |
wim | 0:57ddd953d3a2 | 390 | while(1) { |
wim | 0:57ddd953d3a2 | 391 | myled = !myled; |
wim | 0:57ddd953d3a2 | 392 | wait(1); |
wim | 0:57ddd953d3a2 | 393 | } |
wim | 0:57ddd953d3a2 | 394 | } |
wim | 0:57ddd953d3a2 | 395 | #endif |