diff options
Diffstat (limited to 'obdlogger/PCD8544.cpp')
-rw-r--r-- | obdlogger/PCD8544.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/obdlogger/PCD8544.cpp b/obdlogger/PCD8544.cpp index 9c85662..a54bfc8 100644 --- a/obdlogger/PCD8544.cpp +++ b/obdlogger/PCD8544.cpp @@ -25,12 +25,7 @@ #include "PCD8544.h" -#if ARDUINO < 100 -#include <WProgram.h> -#else #include <Arduino.h> -#endif - #include <avr/pgmspace.h> @@ -77,7 +72,7 @@ void PCD8544::begin(unsigned char width, unsigned char height, unsigned char mod digitalWrite(this->pin_reset, HIGH); digitalWrite(this->pin_sce, HIGH); digitalWrite(this->pin_reset, LOW); - delay(100); + delay(100); digitalWrite(this->pin_reset, HIGH); // Set the LCD parameters... @@ -171,11 +166,11 @@ void PCD8544::home() void PCD8544::setCursor(unsigned char column, unsigned char line) { - this->column = (column % this->width); + this->column = (column * 6 % this->width); this->line = (line % (this->height/9 + 1)); this->send(PCD8544_CMD, 0x80 | this->column); - this->send(PCD8544_CMD, 0x40 | this->line); + this->send(PCD8544_CMD, 0x40 | this->line); } @@ -185,7 +180,7 @@ void PCD8544::createChar(unsigned char chr, const unsigned char *glyph) if (chr >= ' ') { return; } - + this->custom[chr] = glyph; } @@ -278,7 +273,7 @@ void PCD8544::drawColumn(unsigned char lines, unsigned char value) // Find the line where "value" resides... unsigned char mark = (lines*8 - 1 - value)/8; - + // Clear the lines above the mark... for (unsigned char line = 0; line < mark; line++) { this->setCursor(scolumn, sline + line); @@ -299,16 +294,16 @@ void PCD8544::drawColumn(unsigned char lines, unsigned char value) this->setCursor(scolumn, sline + line); this->send(PCD8544_DATA, 0xff); } - + // Leave the cursor in a consistent position... - this->setCursor(scolumn + 1, sline); + this->setCursor(scolumn + 1, sline); } void PCD8544::send(unsigned char type, unsigned char data) { digitalWrite(this->pin_dc, type); - + digitalWrite(this->pin_sce, LOW); shiftOut(this->pin_sdin, this->pin_sclk, MSBFIRST, data); digitalWrite(this->pin_sce, HIGH); |