fuck this

Dependencies:   BMP280

Committer:
mwthewsey
Date:
Wed Jan 10 03:57:59 2018 +0000
Revision:
25:a2aedb498b27
Parent:
23:a6bb5298346c
Final Submission

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mwthewsey 23:a6bb5298346c 1 #ifndef __DriverLCD__
mwthewsey 23:a6bb5298346c 2 #define __DriverLCD__
mwthewsey 23:a6bb5298346c 3
mwthewsey 23:a6bb5298346c 4 #include "mbed.h"
mwthewsey 23:a6bb5298346c 5
mwthewsey 23:a6bb5298346c 6 /*
mwthewsey 23:a6bb5298346c 7 * This module handles the low level control of a 16x2 LCD.
mwthewsey 23:a6bb5298346c 8 * It contains a class structure, and allows for text to be written to the LCD.
mwthewsey 23:a6bb5298346c 9 * Text can be written by using printf, achived by including virtual Stream.
mwthewsey 23:a6bb5298346c 10 */
mwthewsey 23:a6bb5298346c 11
mwthewsey 23:a6bb5298346c 12 //Datasheet sparkfun.com/datasheets/LCD/HD44780.pdf
mwthewsey 23:a6bb5298346c 13
mwthewsey 23:a6bb5298346c 14 #define CMD 0
mwthewsey 23:a6bb5298346c 15 #define STR 1
mwthewsey 23:a6bb5298346c 16 #define INIT 2
mwthewsey 23:a6bb5298346c 17
mwthewsey 23:a6bb5298346c 18 class DriverLCD : public Stream
mwthewsey 23:a6bb5298346c 19 {
mwthewsey 23:a6bb5298346c 20 public:
mwthewsey 23:a6bb5298346c 21
mwthewsey 23:a6bb5298346c 22 DriverLCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7);
mwthewsey 23:a6bb5298346c 23 //Constructor
mwthewsey 23:a6bb5298346c 24
mwthewsey 23:a6bb5298346c 25 void locate(int column, int row);
mwthewsey 23:a6bb5298346c 26 //Moves cursor to specific position
mwthewsey 23:a6bb5298346c 27
mwthewsey 23:a6bb5298346c 28 void cls();
mwthewsey 23:a6bb5298346c 29 //Clear LCD
mwthewsey 23:a6bb5298346c 30
mwthewsey 23:a6bb5298346c 31 protected:
mwthewsey 23:a6bb5298346c 32
mwthewsey 23:a6bb5298346c 33 // Stream implementation functions
mwthewsey 23:a6bb5298346c 34 virtual int _putc(int data);
mwthewsey 23:a6bb5298346c 35 virtual int _getc();
mwthewsey 23:a6bb5298346c 36
mwthewsey 23:a6bb5298346c 37 void character(int column, int row, int data);
mwthewsey 23:a6bb5298346c 38 //Writes a char to the display at set coordinates
mwthewsey 23:a6bb5298346c 39
mwthewsey 23:a6bb5298346c 40 void LCD_DATA(int data,int command);
mwthewsey 23:a6bb5298346c 41 //Configure LCD state
mwthewsey 23:a6bb5298346c 42
mwthewsey 23:a6bb5298346c 43
mwthewsey 23:a6bb5298346c 44 DigitalOut _rs, _e; //Write and command pins
mwthewsey 23:a6bb5298346c 45 BusOut _d; //Data out
mwthewsey 23:a6bb5298346c 46
mwthewsey 23:a6bb5298346c 47 int _column; //Internal position store
mwthewsey 23:a6bb5298346c 48 int _row;
mwthewsey 23:a6bb5298346c 49 };
mwthewsey 23:a6bb5298346c 50
mwthewsey 23:a6bb5298346c 51 #endif