Gary Richardson
/
testLCD
Test of LCD code
Diff: main.cpp
- Revision:
- 0:a4d44dfd2f03
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 30 12:24:56 2014 +0000 @@ -0,0 +1,62 @@ +#include "mbed.h" +#include "lcd_i2c.h" + +Serial pc(USBTX, USBRX); // tx, rx +extern char update[NUPDATE]; + +int main() { +char ch, row, col; +int address, frequency, rc; + + row = col = 0; + pc.printf("Enter address "); + pc.scanf("%x", &address); + pc.printf("\n\rEnter frequency "); + pc.scanf("%d", &frequency); + pc.printf("\n\raddress: 0x%x frequency=%d\n\r", address, frequency); + while(1) + { + pc.scanf("%c ", &ch); + if (ch == 27) + break; + pc.printf("%c", ch); + switch (ch) + { + case 'c': + rc = initLcd(address, frequency); + pc.printf("rc: %d ", rc); + row = 0; + col = 0; + break; + case 'd': + rc = lcdWriteMsg("Now is the time"); + pc.printf("rc: %d ", rc); + break; + case 'e': + rc = lcdPositionCursor(row, col); + pc.printf("rc: %d ", rc); + row ^= 1; + col = (col + 1) % 20; + break; + case 'f': + rc = lcdClearDisplay(); + pc.printf("rc: %d ", rc); + break; + case 'g': + { + int k, j; + j = 0; + pc.printf("\n\r"); + for (k = 0; k < 6; k++) + { + pc.printf("%02x %02x %02x\n\r", update[j], update[j+1], update[j+2]); + j += 3; + } + } + break; + default: + break; + } + } + pc.printf("done\n\r"); +}