summaryrefslogtreecommitdiff
path: root/libraries/MultiLCD/LCD4Bit_mod.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/MultiLCD/LCD4Bit_mod.h')
-rw-r--r--libraries/MultiLCD/LCD4Bit_mod.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/libraries/MultiLCD/LCD4Bit_mod.h b/libraries/MultiLCD/LCD4Bit_mod.h
new file mode 100644
index 0000000..7cd5115
--- /dev/null
+++ b/libraries/MultiLCD/LCD4Bit_mod.h
@@ -0,0 +1,47 @@
+#ifndef LCD4Bit_mod_h
+#define LCD4Bit_mod_h
+
+#include <inttypes.h>
+
+class LCD4Bit_mod {
+public:
+ LCD4Bit_mod(byte num_lines = 2):USING_RW(false),RS(8),RW(11),Enable(9)
+ {
+ DB[0] = 4;
+ DB[1] = 5;
+ DB[2] = 6;
+ DB[3] = 7;
+ this->num_lines = num_lines;
+ }
+ void commandWrite(byte value);
+ void begin();
+ void write(byte value);
+ void print(const char* string);
+ void clear();
+ //non-core---------------
+ void setCursor(byte x, byte line);
+ void leftScroll(byte chars, unsigned int delay_time);
+ //end of non-core--------
+
+ //4bit only, therefore ideally private but may be needed by user
+ void commandWriteNibble(byte nibble);
+private:
+ void pulseEnablePin();
+ void pushNibble(byte nibble);
+ void pushByte(byte value);
+ // --------- PINS -------------------------------------
+ //is the RW pin of the LCD under our control? If we're only ever going to write to the LCD, we can use one less microcontroller pin, and just tie the LCD pin to the necessary signal, high or low.
+ //this stops us sending signals to the RW pin if it isn't being used.
+ bool USING_RW;
+ //RS, RW and Enable can be set to whatever you like
+ byte RS;
+ byte RW;
+ byte Enable;
+ //DB should be an unseparated group of pins - because of lazy coding in pushNibble()
+ byte DB[4]; //wire these to DB4~7 on LCD.
+ //how many lines has the LCD? (don't change here - specify on calling constructor)
+ int num_lines;
+
+};
+
+#endif