sparkfun Compatible Serial LCD
SerialLcd.cpp@0:f30bad3f815d, 2013-07-11 (annotated)
- Committer:
- komaida424
- Date:
- Thu Jul 11 19:17:02 2013 +0000
- Revision:
- 0:f30bad3f815d
name change from SelialLCD to SerialLcd
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
komaida424 | 0:f30bad3f815d | 1 | #include "mbed.h" |
komaida424 | 0:f30bad3f815d | 2 | #include "SerialLcd.h" |
komaida424 | 0:f30bad3f815d | 3 | |
komaida424 | 0:f30bad3f815d | 4 | SerialLcd::SerialLcd(PinName TX): _lcd(TX,NC) |
komaida424 | 0:f30bad3f815d | 5 | { |
komaida424 | 0:f30bad3f815d | 6 | // LCD_contrast = 60; |
komaida424 | 0:f30bad3f815d | 7 | } |
komaida424 | 0:f30bad3f815d | 8 | |
komaida424 | 0:f30bad3f815d | 9 | int SerialLcd::_putc(int value) { |
komaida424 | 0:f30bad3f815d | 10 | _lcd.putc(value); |
komaida424 | 0:f30bad3f815d | 11 | return value; |
komaida424 | 0:f30bad3f815d | 12 | } |
komaida424 | 0:f30bad3f815d | 13 | |
komaida424 | 0:f30bad3f815d | 14 | int SerialLcd::_getc() { |
komaida424 | 0:f30bad3f815d | 15 | return -1; |
komaida424 | 0:f30bad3f815d | 16 | } |
komaida424 | 0:f30bad3f815d | 17 | |
komaida424 | 0:f30bad3f815d | 18 | void SerialLcd::cls() |
komaida424 | 0:f30bad3f815d | 19 | { |
komaida424 | 0:f30bad3f815d | 20 | _lcd.putc(0xFE); |
komaida424 | 0:f30bad3f815d | 21 | _lcd.putc(0x01); |
komaida424 | 0:f30bad3f815d | 22 | wait(0.01); |
komaida424 | 0:f30bad3f815d | 23 | } |
komaida424 | 0:f30bad3f815d | 24 | |
komaida424 | 0:f30bad3f815d | 25 | void SerialLcd::locate(int clm,int row) |
komaida424 | 0:f30bad3f815d | 26 | { |
komaida424 | 0:f30bad3f815d | 27 | _lcd.putc(0xFE); |
komaida424 | 0:f30bad3f815d | 28 | _lcd.putc( 0x80 + (row * 0x40) + clm ); |
komaida424 | 0:f30bad3f815d | 29 | wait(0.01); |
komaida424 | 0:f30bad3f815d | 30 | } |
komaida424 | 0:f30bad3f815d | 31 | ; |