Ben Gordon
/
ELEC351_GroupA-branch1
Troubleshooting
Diff: LCD.hpp
- Revision:
- 0:f8fe58d43763
- Child:
- 4:bb7a78619678
- Child:
- 6:f3d1ab8a9e99
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD.hpp Sat Nov 03 21:55:11 2018 +0000 @@ -0,0 +1,53 @@ +#ifndef _LCD_HPP +#define _LCD_HPP + #include "mbed.h" + + #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 + + 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(char* str, int line, int position); + void putt(char c); + + private: + DigitalOut _LCD_RS; + DigitalOut _LCD_E; + BusOut LCD_DDRAM; + private: + void cmdLCD(unsigned char cmd); + void LCD_strobe(void); + void set_LCD_data(unsigned char d); + unsigned int findSpace(char* str); + + }; +#endif \ No newline at end of file