Contains necessary classes and functions for ELEC351

/media/uploads/Luka_Danilovic/elec_315_prototype_assembly.jpg

Revision:
3:e84fa53173e6
Child:
5:becb1545229d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/displayMaster/displayMaster.hpp	Thu Dec 28 12:14:53 2017 +0000
@@ -0,0 +1,38 @@
+#ifndef displayMaster
+#define displayMaster
+
+#define defaultD1 D7
+#define defaultD2 D6
+#define defaultD3 D4
+#define defaultD4 D2
+#define defaultRS D9
+#define defaultRW D0
+#define defaultEN D8
+
+/* Instructions on using the 16x2 LCD panel are found here:
+[https://www.8051projects.net/lcd-interfacing/lcd-4-bit.php] */
+
+/* N.B. This class contains blocking function */
+
+class C_displayMaster // Custom 16x2 LCD display driver (4 bit mode only)
+{
+    private:
+    enum REGISTER {INSTRUCTION, DATA};
+    enum MODE     {WRITE, READ};
+    enum ENABLE   {DISABLE, ENABLE};
+    
+    BusInOut      _commsBus;
+    DigitalOut    _registerSel;
+    DigitalOut    _modeSel;
+    DigitalOut    _enable;
+    void writeChar(char, bool);
+//    void writeData(char);
+    void busyCheck(); 
+    
+    public:
+    C_displayMaster(PinName D1 = defaultD1, PinName D2 = defaultD2, PinName D3 = defaultD3, PinName D4 = defaultD4, PinName RS = defaultRS, PinName RW = defaultRW, PinName EN = defaultEN);
+  //  void write(string text);
+//    void clear();
+};
+
+#endif
\ No newline at end of file