Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: SparkFunSerialGraphicLCD.cpp
- Revision:
- 4:0c943e6ba349
- Parent:
- 3:889836485429
diff -r 889836485429 -r 0c943e6ba349 SparkFunSerialGraphicLCD.cpp
--- a/SparkFunSerialGraphicLCD.cpp Mon Feb 20 03:14:16 2012 +0000
+++ b/SparkFunSerialGraphicLCD.cpp Wed Feb 22 08:12:46 2012 +0000
@@ -4,9 +4,12 @@
SparkFunSerialGraphicLCD::SparkFunSerialGraphicLCD(PinName tx, PinName rx = NC) : MySerial(tx, rx) {
- MySerial.baud(115200);
- wait_ms(1500);
+ MySerial.baud(9600);
clear();
+ setBacklight(100);
+ setFont(0);
+ setAutoCRLF(false);
+ setReverse(false);
}
void SparkFunSerialGraphicLCD::clear() {
@@ -35,9 +38,10 @@
MySerial.putc(set);
}
-void SparkFunSerialGraphicLCD::toggleCRLF() {
+void SparkFunSerialGraphicLCD::setAutoCRLF(bool enable) {
MySerial.putc(0x7C);
MySerial.putc(0x04);
+ MySerial.putc(enable);
}
void SparkFunSerialGraphicLCD::eraseBlock(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1) {
@@ -54,14 +58,39 @@
MySerial.putc(0x06);
}
-void SparkFunSerialGraphicLCD::setBaud() {
+void SparkFunSerialGraphicLCD::setBaud(unsigned char baud) {
+ if(baud < 1) baud = 1;
+ else if(baud > 6) baud = 6;
+
MySerial.putc(0x7C);
MySerial.putc(0x07);
+ MySerial.putc(baud);
+ switch(baud) {
+ case 1:
+ MySerial.baud(4800);
+ break;
+ case 2:
+ MySerial.baud(9600);
+ break;
+ case 3:
+ MySerial.baud(19200);
+ break;
+ case 4:
+ MySerial.baud(38400);
+ break;
+ case 5:
+ MySerial.baud(57600);
+ break;
+ case 6:
+ MySerial.baud(115200);
+ break;
+ }
}
-void SparkFunSerialGraphicLCD::toggleFont() {
+void SparkFunSerialGraphicLCD::setFont(unsigned char font) {
MySerial.putc(0x7C);
MySerial.putc(0x08);
+ MySerial.putc(font);
}
void SparkFunSerialGraphicLCD::setFontMode(unsigned char mode) {
@@ -126,15 +155,17 @@
}
-void SparkFunSerialGraphicLCD::toggleReverse() {
+void SparkFunSerialGraphicLCD::setReverse(bool enable) {
MySerial.putc(0x7C);
MySerial.putc(0x14);
+ MySerial.putc(enable);
}
-void SparkFunSerialGraphicLCD::toggleSplash() {
+/*void SparkFunSerialGraphicLCD::setSplash(bool enable) {
MySerial.putc(0x7C);
MySerial.putc(0x15);
-}
+ MySerial.putc(enable);
+}*/
void SparkFunSerialGraphicLCD::bitblt(unsigned char x, unsigned char y, unsigned char mode, unsigned char w, unsigned char h, unsigned char* data) {
error("method not implemented");