Library for the serial LCD-09396 of Sparkfun
Revision 0:497632f57657, committed 2011-08-10
- Comitter:
- beelin
- Date:
- Wed Aug 10 13:32:08 2011 +0000
- Commit message:
Changed in this revision
SerLCDv25.h | Show annotated file Show diff for this revision Revisions of this file |
SertLCDv25.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 497632f57657 SerLCDv25.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SerLCDv25.h Wed Aug 10 13:32:08 2011 +0000 @@ -0,0 +1,25 @@ +#ifndef SerLCDv25_H +#define SerLCDv25_H + +#include "mbed.h" + +class SerLCDv25 { + +public: + SerLCDv25(PinName rx, PinName tx); + void clear(); + void cursorUnderline(); + void cursorBlinkingBox(); + void cursorClear(); + void displayON(); + void displayOFF(); + void printf(char *string); //printf(char *string) + void printValue(float *Value); + void putc(char lettre); + void Brightness(int Value); +private: + Serial* device; +}; + + +#endif \ No newline at end of file
diff -r 000000000000 -r 497632f57657 SertLCDv25.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SertLCDv25.cpp Wed Aug 10 13:32:08 2011 +0000 @@ -0,0 +1,58 @@ +#include "mbed.h" +#include "SerLCDv25.h" + + + +SerLCDv25::SerLCDv25(PinName rx, PinName tx) { + device = new Serial(rx, tx); +} + + +void SerLCDv25::clear() { + device->printf("%c%c",0xFE,0x01); +} +void SerLCDv25::cursorUnderline() { + device->printf("%c%c",0xFE,0x0E); +} +void SerLCDv25::cursorBlinkingBox() { + device->printf("%c%c",0xFE,0x0D); +} +void SerLCDv25::cursorClear() { + device->printf("%c%c",0xFE,0x0C); +} +void SerLCDv25::displayON() { + device->printf("%c%c",0xFE,0x0C); +} +void SerLCDv25::displayOFF() { + device->printf("%c%c",0xFE,0x08); +} +void SerLCDv25::printf(char *string) { + device->printf("%s",string); +} +void SerLCDv25::printValue(float *Value) { + device->printf("%4.2f",*Value); +} +void SerLCDv25::putc(char lettre) { + device->printf("%c",lettre); +} +void SerLCDv25::Brightness(int Value) { + if (Value<0) { + Value=0; + } + if (Value>100) { + Value=100; + } + Value=Value*29/100+128; + device->printf("%c%c",0x7C,Value); +} + + + + + + + + + + +