Ben Gordon
/
ELEC351_GroupA-branch1
Troubleshooting
Diff: LCD.hpp
- Revision:
- 7:0213c3702c99
- Parent:
- 6:f3d1ab8a9e99
- Parent:
- 4:bb7a78619678
- Child:
- 8:e34e23edfc84
--- a/LCD.hpp Sun Nov 04 20:32:59 2018 +0000 +++ b/LCD.hpp Sun Nov 04 21:09:02 2018 +0000 @@ -1,45 +1,50 @@ #ifndef _LCD_HPP #define _LCD_HPP - -#include "mbed.h" -#include "DataTypes.hpp" + + #include "mbed.h" + #include "DataTypes.hpp" + + #define CLEAR 0x01 + #define RETURN 0x02 + + #define ENTRYMODE 0x04 + #define I 0x02 + #define shift 0x01 + + #define DISPLAY 0x08 + #define on 0x04 + #define cursor 0x02 + #define blink 0x01 + + #define DDRAM 0x20 + #define bit8 0x10 + #define lines2 0x08 + #define dots11 0x04 -#define CLEAR 0x01 -#define RETURN 0x02 -#define ENTRYMODE 0x04 -#define I 0x02 -#define shift 0x01 -#define DISPLAY 0x08 -#define on 0x04 -#define cursor 0x02 -#define blink 0x01 -#define DDRAM 0x20 -#define bit8 0x10 -#define lines2 0x08 -#define dots11 0x04 -#define control 0 -#define text 1 -#define write 0 -#define read 1 -#define LINE1 0x80 -#define LINE2 0xc0 + #define control 0 + #define text 1 + + #define write 0 + #define read 1 + + #define LINE1 0x80 + #define LINE2 0xc0 -class LCD{ - public: - LCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7) : _LCD_RS(rs), _LCD_E(e), LCD_DDRAM(d7,d6,d5,d4) {} - void INIT(); - void clear(); - void display(BYTE* str, INT_32 line, INT_32 position); - void putt(BYTE c); - private: - DigitalOut _LCD_RS; - DigitalOut _LCD_E; - BusOut LCD_DDRAM; - private: - void cmdLCD(U_BYTE cmd); - void LCD_strobe(void); - void set_LCD_data(U_BYTE d); - UINT_32 findSpace(BYTE* str); - + class LCD{ + public: + LCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7) : _LCD_RS(rs), _LCD_E(e), LCD_DDRAM(d4,d5,d6,d7) {} + void INIT(); + void clear(); + void display(BYTE* str, INT_32 line, INT_32 position); + void putt(BYTE c); + private: + DigitalOut _LCD_RS; + DigitalOut _LCD_E; + BusOut LCD_DDRAM; + private: + void cmdLCD(U_BYTE cmd); + void LCD_strobe(void); + void set_LCD_data(U_BYTE d); + UINT_32 findSpace(BYTE* str); }; #endif \ No newline at end of file