Menu para a IHM

Dependencies:   TextLCD mbed

Fork of TextLCD_HelloWorld2 by Wim Huiskamp

Committer:
wim
Date:
Tue Jun 17 17:41:59 2014 +0000
Revision:
1:ef419b21167d
Parent:
0:a75049de1a82
Child:
2:c2978a6fa79a
Tested with PCF2116

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wim 0:a75049de1a82 1 // Hello World! for the TextLCD
wim 0:a75049de1a82 2
wim 0:a75049de1a82 3 #include "mbed.h"
wim 0:a75049de1a82 4 #include "TextLCD.h"
wim 0:a75049de1a82 5
wim 0:a75049de1a82 6 // Host PC Communication channels
wim 0:a75049de1a82 7 Serial pc(USBTX, USBRX); // tx, rx
wim 0:a75049de1a82 8
wim 0:a75049de1a82 9 void show_menu() {
wim 0:a75049de1a82 10 pc.printf("0: Exit\n\r");
wim 0:a75049de1a82 11 pc.printf("1: Show Menu\n\r");
wim 0:a75049de1a82 12 pc.printf("2: Goto 0,0\n\r");
wim 0:a75049de1a82 13 pc.printf("3: Goto columns(),rows()\n\r");
wim 0:a75049de1a82 14 pc.printf("4: cls()\n\r");
wim 0:a75049de1a82 15 pc.printf("5: UDCs \n\r");
wim 0:a75049de1a82 16 pc.printf("6: Fill\n\r");
wim 0:a75049de1a82 17 pc.printf("7: Cursor On\n\r");
wim 0:a75049de1a82 18 pc.printf("8: Cursor Off\n\r");
wim 0:a75049de1a82 19 pc.printf("9: Text\n\r");
wim 0:a75049de1a82 20 pc.printf("A: Display On\n\r");
wim 0:a75049de1a82 21 pc.printf("B: Display Off\n\r");
wim 0:a75049de1a82 22 pc.printf("C: Backlight On\n\r");
wim 0:a75049de1a82 23 pc.printf("D: Backlight Off\n\r");
wim 1:ef419b21167d 24 pc.printf("P: init \n\r");
wim 0:a75049de1a82 25 pc.printf("\n\r");
wim 0:a75049de1a82 26 }
wim 0:a75049de1a82 27
wim 0:a75049de1a82 28
wim 0:a75049de1a82 29 // I2C Communication
wim 0:a75049de1a82 30 I2C i2c_lcd(p28,p27); // SDA, SCL
wim 0:a75049de1a82 31 //I2C i2c_lcd(p9,p10); // SDA, SCL
wim 0:a75049de1a82 32
wim 0:a75049de1a82 33 // SPI Communication
wim 0:a75049de1a82 34 SPI spi_lcd(p5, NC, p7); // MOSI, MISO, SCLK
wim 0:a75049de1a82 35 //DigitalOut cs(p8);
wim 0:a75049de1a82 36 //DigitalOut cs2(p9);
wim 0:a75049de1a82 37
wim 0:a75049de1a82 38 //TextLCD lcd2(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x4); // rs, e, d4-d7 =ok
wim 0:a75049de1a82 39 //TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x2); // rs, e, d4-d7 =ok
wim 0:a75049de1a82 40 //TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x4); // rs, e, d4-d7 =ok
wim 0:a75049de1a82 41 //TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD24x4); // rs, e, d4-d7 =ok
wim 0:a75049de1a82 42 //TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD24x2); // rs, e, d4-d7 =ok
wim 0:a75049de1a82 43 //TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD40x2); // rs, e, d4-d7 =ok
wim 0:a75049de1a82 44
wim 1:ef419b21167d 45 //TextLCD_I2C lcd(&i2c_lcd, 0x40, TextLCD::LCD20x4); // I2C bus, PCF8574 Slaveaddress, LCD Type =ok
wim 0:a75049de1a82 46 //TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD20x4); // I2C bus, PCF8574 Slaveaddress, LCD Type =ok
wim 0:a75049de1a82 47
wim 1:ef419b21167d 48 //Test Adafruit module, change #define
wim 1:ef419b21167d 49 TextLCD_I2C lcd(&i2c_lcd, MCP23008_SA0, TextLCD::LCD20x4); // I2C bus, MCP23008 Slaveaddress, LCD Type =OK
wim 0:a75049de1a82 50
wim 0:a75049de1a82 51 //TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD16x2, TextLCD::WS0010); // I2C bus, PCF8574 Slaveaddress, LCD Type, LCD Ctrl
wim 0:a75049de1a82 52
wim 0:a75049de1a82 53 //TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD24x4); // SPI bus, CS pin, LCD Type =ok
wim 0:a75049de1a82 54 //TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x2); // SPI bus, CS pin, LCD Type =ok
wim 0:a75049de1a82 55 //TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4); // SPI bus, CS pin, LCD Type =ok
wim 0:a75049de1a82 56
wim 0:a75049de1a82 57 //TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4, TextLCD::HD44780); // SPI bus, CS pin, LCD Type, LCD Ctrl =ok
wim 0:a75049de1a82 58 //TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4, TextLCD::WS0010); // SPI bus, CS pin, LCD Type, LCD Ctrl
wim 0:a75049de1a82 59
wim 0:a75049de1a82 60 //TextLCD_SPI lcd2(&spi_lcd, p9, TextLCD::LCD8x2B); // SPI bus, CS pin, LCD Type =ok
wim 0:a75049de1a82 61 //TextLCD_SPI lcd2(&spi_lcd, p9, TextLCD::LCD16x1); // SPI bus, CS pin, LCD Type =ok
wim 0:a75049de1a82 62 //TextLCD_SPI lcd2(&spi_lcd, p9, TextLCD::LCD16x2); // SPI bus, CS pin, LCD Type (VFD) =ok
wim 0:a75049de1a82 63
wim 1:ef419b21167d 64 //TextLCD_SPI_N lcd(&spi_lcd, p8, p9, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032 =ok
wim 1:ef419b21167d 65 //TextLCD_I2C_N lcd(&i2c_lcd, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // I2C bus, slaveaddress, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032
wim 0:a75049de1a82 66
wim 1:ef419b21167d 67
wim 1:ef419b21167d 68 //TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA0, TextLCD::LCD12x3B, NC, TextLCD::PCF21XX_3V3); // I2C bus, slaveaddress, LCDType=LCD12x3B, BL=NC, LCDTCtrl=PCF21XX
wim 1:ef419b21167d 69 //TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA0, TextLCD::LCD12x4B, NC, TextLCD::PCF21XX_3V3); // I2C bus, slaveaddress, LCDType=LCD12x4B, BL=NC, LCDTCtrl=PCF21XX
wim 1:ef419b21167d 70 //TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA0, TextLCD::LCD24x1, NC, TextLCD::PCF21XX_3V3); // I2C bus, slaveaddress, LCDType=LCD24x1, BL=NC, LCDTCtrl=PCF21XX
wim 1:ef419b21167d 71 //TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA0, TextLCD::LCD24x2, NC, TextLCD::PCF21XX_3V3); // I2C bus, slaveaddress, LCDType=LCD24x2, BL=NC, LCDTCtrl=PCF21XX
wim 0:a75049de1a82 72
wim 0:a75049de1a82 73 int main() {
wim 0:a75049de1a82 74 // int i=0;
wim 0:a75049de1a82 75 int count=0;
wim 0:a75049de1a82 76 bool running=true;
wim 0:a75049de1a82 77 char command;
wim 0:a75049de1a82 78
wim 0:a75049de1a82 79 pc.printf("LCD Test. Colums=%d, Rows=%d\n\r", lcd.columns(), lcd.rows());
wim 0:a75049de1a82 80
wim 0:a75049de1a82 81 //while (1) {
wim 0:a75049de1a82 82 for (int row=0; row<lcd.rows(); row++) {
wim 0:a75049de1a82 83 int col=0;
wim 0:a75049de1a82 84
wim 0:a75049de1a82 85 pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));
wim 0:a75049de1a82 86 // lcd.putc('-');
wim 0:a75049de1a82 87 lcd.putc('0' + row);
wim 0:a75049de1a82 88
wim 0:a75049de1a82 89 for (col=1; col<lcd.columns()-1; col++) {
wim 0:a75049de1a82 90 lcd.putc('*');
wim 0:a75049de1a82 91 }
wim 0:a75049de1a82 92
wim 0:a75049de1a82 93 pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));
wim 0:a75049de1a82 94 lcd.putc('+');
wim 0:a75049de1a82 95
wim 0:a75049de1a82 96 }
wim 0:a75049de1a82 97
wim 0:a75049de1a82 98 // wait_ms(500);
wim 0:a75049de1a82 99 // lcd.cls(); // Test timing
wim 0:a75049de1a82 100 //}
wim 0:a75049de1a82 101
wim 0:a75049de1a82 102
wim 0:a75049de1a82 103 lcd.setCursor(TextLCD::CurOff_BlkOn);
wim 0:a75049de1a82 104
wim 1:ef419b21167d 105 #if(0)
wim 1:ef419b21167d 106 lcd.setUDC(0, (char *) udc_AA);
wim 1:ef419b21167d 107 lcd.putc(0);
wim 0:a75049de1a82 108
wim 1:ef419b21167d 109 lcd.setUDC(1, (char *) udc_0E);
wim 1:ef419b21167d 110 lcd.putc(1);
wim 0:a75049de1a82 111
wim 1:ef419b21167d 112 lcd.setUDC(0, (char *) udc_0);
wim 1:ef419b21167d 113 lcd.putc(0);
wim 1:ef419b21167d 114 lcd.setUDC(1, (char *) udc_1);
wim 1:ef419b21167d 115 lcd.putc(1);
wim 1:ef419b21167d 116 lcd.setUDC(2, (char *) udc_2);
wim 1:ef419b21167d 117 lcd.putc(2);
wim 1:ef419b21167d 118 #endif
wim 0:a75049de1a82 119
wim 1:ef419b21167d 120 #if(1)
wim 0:a75049de1a82 121 lcd.setUDC(0, (char *) udc_Bat_Hi);
wim 0:a75049de1a82 122 lcd.setUDC(1, (char *) udc_Bat_Ha);
wim 0:a75049de1a82 123 lcd.setUDC(2, (char *) udc_Bat_Lo);
wim 0:a75049de1a82 124 lcd.setUDC(3, (char *) udc_AC);
wim 0:a75049de1a82 125 lcd.setUDC(4, (char *) udc_4);
wim 0:a75049de1a82 126 lcd.setUDC(5, (char *) udc_5);
wim 0:a75049de1a82 127 lcd.setUDC(6, (char *) udc_6);
wim 0:a75049de1a82 128 lcd.setUDC(7, (char *) udc_7);
wim 1:ef419b21167d 129 #endif
wim 1:ef419b21167d 130
wim 1:ef419b21167d 131 #if(0)
wim 1:ef419b21167d 132 lcd.setUDC(0, (char *) udc_ch_1);
wim 1:ef419b21167d 133 lcd.setUDC(1, (char *) udc_ch_2);
wim 1:ef419b21167d 134 lcd.setUDC(2, (char *) udc_ch_3);
wim 1:ef419b21167d 135 lcd.setUDC(3, (char *) udc_ch_4);
wim 1:ef419b21167d 136 lcd.setUDC(4, (char *) udc_ch_yr);
wim 1:ef419b21167d 137 lcd.setUDC(5, (char *) udc_ch_mo);
wim 1:ef419b21167d 138 lcd.setUDC(6, (char *) udc_ch_dy);
wim 1:ef419b21167d 139 lcd.setUDC(7, (char *) udc_ch_mi);
wim 1:ef419b21167d 140 #endif
wim 0:a75049de1a82 141
wim 0:a75049de1a82 142 lcd.putc(0);
wim 0:a75049de1a82 143 lcd.putc(1);
wim 0:a75049de1a82 144 lcd.putc(2);
wim 0:a75049de1a82 145 lcd.putc(3);
wim 0:a75049de1a82 146 lcd.putc(4);
wim 0:a75049de1a82 147 lcd.putc(5);
wim 0:a75049de1a82 148 lcd.putc(6);
wim 0:a75049de1a82 149 lcd.putc(7);
wim 0:a75049de1a82 150
wim 0:a75049de1a82 151 #if(0)
wim 0:a75049de1a82 152 lcd2.setUDC(0, (char *) udc_Bat_Hi);
wim 0:a75049de1a82 153 lcd2.setUDC(1, (char *) udc_Bat_Ha);
wim 0:a75049de1a82 154 lcd2.setUDC(2, (char *) udc_Bat_Lo);
wim 0:a75049de1a82 155 lcd2.setUDC(3, (char *) udc_AC);
wim 0:a75049de1a82 156 lcd2.putc(0);
wim 0:a75049de1a82 157 lcd2.putc(1);
wim 0:a75049de1a82 158 lcd2.putc(2);
wim 0:a75049de1a82 159 lcd2.putc(3);
wim 0:a75049de1a82 160 #endif
wim 0:a75049de1a82 161
wim 0:a75049de1a82 162 #if(0)
wim 0:a75049de1a82 163 while (1) {
wim 0:a75049de1a82 164 lcd.locate(4, 2);
wim 0:a75049de1a82 165 lcd.printf("Count=%3d", i);
wim 0:a75049de1a82 166 i++;
wim 0:a75049de1a82 167 if (i==100) i=0;
wim 0:a75049de1a82 168
wim 0:a75049de1a82 169 wait(1);
wim 0:a75049de1a82 170 }
wim 0:a75049de1a82 171 #endif
wim 0:a75049de1a82 172
wim 0:a75049de1a82 173 pc.printf("Hello World!\n\r");
wim 0:a75049de1a82 174 show_menu();
wim 0:a75049de1a82 175
wim 0:a75049de1a82 176 while(running) {
wim 0:a75049de1a82 177
wim 0:a75049de1a82 178 count++;
wim 0:a75049de1a82 179
wim 0:a75049de1a82 180 if(pc.readable()) {
wim 0:a75049de1a82 181 command = pc.getc();
wim 0:a75049de1a82 182 pc.printf("command= %c \n\r", command);
wim 0:a75049de1a82 183
wim 0:a75049de1a82 184 switch (command) {
wim 0:a75049de1a82 185 case '0' :
wim 0:a75049de1a82 186 pc.printf("Done\n\r");
wim 0:a75049de1a82 187 running = false;
wim 0:a75049de1a82 188 break;
wim 0:a75049de1a82 189
wim 0:a75049de1a82 190 case '1' :
wim 0:a75049de1a82 191 show_menu();
wim 0:a75049de1a82 192 break;
wim 0:a75049de1a82 193
wim 0:a75049de1a82 194 case '2' :
wim 0:a75049de1a82 195 pc.printf("Goto 0,0\n\r");
wim 0:a75049de1a82 196 lcd.locate(0, 0);
wim 0:a75049de1a82 197 // lcd2.locate(0, 0);
wim 0:a75049de1a82 198 break;
wim 0:a75049de1a82 199
wim 0:a75049de1a82 200 case '3' :
wim 0:a75049de1a82 201 pc.printf("Goto Col,Row\n\r");
wim 0:a75049de1a82 202 lcd.locate( (lcd.columns() - 1), (lcd.rows() - 1));
wim 0:a75049de1a82 203 // lcd2.locate( (lcd.columns() - 1), (lcd.rows() - 1));
wim 0:a75049de1a82 204 break;
wim 0:a75049de1a82 205
wim 0:a75049de1a82 206 case '4' :
wim 0:a75049de1a82 207 pc.printf("cls()\n\r");
wim 0:a75049de1a82 208 lcd.cls();
wim 0:a75049de1a82 209 // lcd2.cls();
wim 0:a75049de1a82 210 break;
wim 0:a75049de1a82 211
wim 0:a75049de1a82 212 case '5' :
wim 0:a75049de1a82 213 pc.printf("UDCs\n\r");
wim 0:a75049de1a82 214 lcd.locate(2, 0);
wim 0:a75049de1a82 215 lcd.putc(0);
wim 0:a75049de1a82 216 lcd.putc(1);
wim 0:a75049de1a82 217 lcd.putc(2);
wim 0:a75049de1a82 218 lcd.putc(3);
wim 0:a75049de1a82 219 lcd.putc(4);
wim 0:a75049de1a82 220 lcd.putc(5);
wim 0:a75049de1a82 221 lcd.putc(6);
wim 0:a75049de1a82 222 lcd.putc(7);
wim 0:a75049de1a82 223
wim 0:a75049de1a82 224 lcd.locate(4, lcd.rows()-1);
wim 0:a75049de1a82 225 lcd.putc(0);
wim 0:a75049de1a82 226 lcd.putc(1);
wim 0:a75049de1a82 227 lcd.putc(2);
wim 0:a75049de1a82 228 lcd.putc(3);
wim 0:a75049de1a82 229
wim 0:a75049de1a82 230
wim 0:a75049de1a82 231 // lcd2.locate(4, lcd.rows()-1);
wim 0:a75049de1a82 232 // lcd2.putc(0);
wim 0:a75049de1a82 233 // lcd2.putc(1);
wim 0:a75049de1a82 234 // lcd2.putc(2);
wim 0:a75049de1a82 235 // lcd2.putc(3);
wim 0:a75049de1a82 236
wim 0:a75049de1a82 237 break;
wim 0:a75049de1a82 238 case '6' :
wim 0:a75049de1a82 239 pc.printf("Fill\n\r");
wim 0:a75049de1a82 240 lcd.locate(0, 0);
wim 0:a75049de1a82 241 for (int row=0; row<lcd.rows(); row++) {
wim 0:a75049de1a82 242 int col=0;
wim 0:a75049de1a82 243
wim 0:a75049de1a82 244 // pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));
wim 0:a75049de1a82 245 // lcd.putc('-');
wim 0:a75049de1a82 246 lcd.putc('0' + row);
wim 0:a75049de1a82 247
wim 0:a75049de1a82 248 for (col=1; col<lcd.columns()-1; col++) {
wim 0:a75049de1a82 249 lcd.putc('*');
wim 0:a75049de1a82 250 }
wim 0:a75049de1a82 251
wim 0:a75049de1a82 252 // pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));
wim 0:a75049de1a82 253 lcd.putc('+');
wim 0:a75049de1a82 254 }
wim 0:a75049de1a82 255
wim 0:a75049de1a82 256 break;
wim 0:a75049de1a82 257
wim 0:a75049de1a82 258 case '7' :
wim 0:a75049de1a82 259 pc.printf("Cursor 0n\n\r");
wim 0:a75049de1a82 260 lcd.setCursor(TextLCD::CurOff_BlkOn);
wim 0:a75049de1a82 261 // lcd2.setCursor(TextLCD::CurOff_BlkOn);
wim 0:a75049de1a82 262 break;
wim 0:a75049de1a82 263
wim 0:a75049de1a82 264 case '8' :
wim 0:a75049de1a82 265 pc.printf("Cursor 0ff\n\r");
wim 0:a75049de1a82 266 lcd.setCursor(TextLCD::CurOff_BlkOff);
wim 0:a75049de1a82 267 // lcd2.setCursor(TextLCD::CurOff_BlkOff);
wim 0:a75049de1a82 268 break;
wim 0:a75049de1a82 269
wim 0:a75049de1a82 270 case '9' :
wim 0:a75049de1a82 271 pc.printf("Text\n\r");
wim 1:ef419b21167d 272 lcd.locate(0, 0);
wim 1:ef419b21167d 273 lcd.printf(" Hello mbed\n");
wim 1:ef419b21167d 274 lcd.printf(" Native I2C\n");
wim 0:a75049de1a82 275 // lcd2.printf("Hello mbed\n");
wim 1:ef419b21167d 276
wim 1:ef419b21167d 277 #if(0)
wim 1:ef419b21167d 278 // Needed for PCF2116C and PCF2116K
wim 1:ef419b21167d 279 lcd.putc('H' ^ 0x80);
wim 1:ef419b21167d 280 lcd.putc('e' ^ 0x80);
wim 1:ef419b21167d 281 lcd.putc('l' ^ 0x80);
wim 1:ef419b21167d 282 lcd.putc('l' ^ 0x80);
wim 1:ef419b21167d 283 lcd.putc('o' ^ 0x80);
wim 1:ef419b21167d 284 lcd.putc(' ' ^ 0x80);
wim 1:ef419b21167d 285 lcd.putc('m' ^ 0x80);
wim 1:ef419b21167d 286 lcd.putc('b' ^ 0x80);
wim 1:ef419b21167d 287 lcd.putc('e' ^ 0x80);
wim 1:ef419b21167d 288 lcd.putc('d' ^ 0x80);
wim 1:ef419b21167d 289 lcd.putc('\n');
wim 1:ef419b21167d 290 lcd.putc('I' ^ 0x80);
wim 1:ef419b21167d 291 lcd.putc('2' ^ 0x80);
wim 1:ef419b21167d 292 lcd.putc('C' ^ 0x80);
wim 1:ef419b21167d 293 lcd.putc(' ' ^ 0x80);
wim 1:ef419b21167d 294 lcd.putc('P' ^ 0x80);
wim 1:ef419b21167d 295 lcd.putc('C' ^ 0x80);
wim 1:ef419b21167d 296 lcd.putc('F' ^ 0x80);
wim 1:ef419b21167d 297 lcd.putc('2' ^ 0x80);
wim 1:ef419b21167d 298 lcd.putc('1' ^ 0x80);
wim 1:ef419b21167d 299 lcd.putc('1' ^ 0x80);
wim 1:ef419b21167d 300 lcd.putc('6' ^ 0x80);
wim 1:ef419b21167d 301 #endif
wim 1:ef419b21167d 302
wim 0:a75049de1a82 303 break;
wim 0:a75049de1a82 304
wim 0:a75049de1a82 305 case 'A' :
wim 0:a75049de1a82 306 pc.printf("Display On\n\r");
wim 0:a75049de1a82 307 lcd.setMode(TextLCD::DispOn);
wim 0:a75049de1a82 308 // lcd2.setMode(TextLCD::DispOn);
wim 0:a75049de1a82 309 break;
wim 0:a75049de1a82 310
wim 0:a75049de1a82 311 case 'B' :
wim 0:a75049de1a82 312 pc.printf("Display Off\n\r");
wim 0:a75049de1a82 313 lcd.setMode(TextLCD::DispOff);
wim 0:a75049de1a82 314 // lcd2.setMode(TextLCD::DispOff);
wim 0:a75049de1a82 315 break;
wim 0:a75049de1a82 316
wim 0:a75049de1a82 317 case 'C' :
wim 0:a75049de1a82 318 pc.printf("Backlight On\n\r");
wim 0:a75049de1a82 319 lcd.setBacklight(TextLCD::LightOn);
wim 0:a75049de1a82 320 // lcd2.setBacklight(TextLCD::LightOn);
wim 0:a75049de1a82 321 break;
wim 0:a75049de1a82 322
wim 0:a75049de1a82 323 case 'D' :
wim 0:a75049de1a82 324 pc.printf("Backlight Off\n\r");
wim 0:a75049de1a82 325 lcd.setBacklight(TextLCD::LightOff);
wim 0:a75049de1a82 326 // lcd2.setBacklight(TextLCD::LightOff);
wim 0:a75049de1a82 327 break;
wim 0:a75049de1a82 328
wim 0:a75049de1a82 329
wim 0:a75049de1a82 330 // case 'E' :
wim 0:a75049de1a82 331 // pc.printf("Test nibble\n\r");
wim 0:a75049de1a82 332 // for (int i=0; i<16; i++) {
wim 0:a75049de1a82 333 // lcd._writeNibble(i);
wim 0:a75049de1a82 334 // wait(1);
wim 0:a75049de1a82 335 // }
wim 0:a75049de1a82 336 // break;
wim 0:a75049de1a82 337
wim 1:ef419b21167d 338 case 'P' :
wim 1:ef419b21167d 339 //test
wim 1:ef419b21167d 340 lcd._initCtrl();
wim 1:ef419b21167d 341 break;
wim 1:ef419b21167d 342
wim 0:a75049de1a82 343 default :
wim 0:a75049de1a82 344 lcd.putc(command);
wim 1:ef419b21167d 345 // lcd.putc(command ^ 0x80); // Needed for PCF2116C and PCF2116K
wim 0:a75049de1a82 346 // lcd2.putc(command);
wim 0:a75049de1a82 347 break;
wim 0:a75049de1a82 348
wim 0:a75049de1a82 349 } //switch
wim 0:a75049de1a82 350 }//if
wim 0:a75049de1a82 351 }//while
wim 0:a75049de1a82 352
wim 0:a75049de1a82 353 pc.printf("Bye World!\n\r");
wim 0:a75049de1a82 354 }