ELEC350 - Team Q / Mbed OS Sampling_Data_into_buffer

Dependencies:   BME280 BMP280

Fork of Task690-mbed-os-FZ429ZI by University of Plymouth - Stages 1, 2 and 3

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LCD.h Source File

LCD.h

00001 #include "mbed.h"
00002 #include <string>
00003 
00004 class NewLCD : public Stream {
00005     
00006     public:
00007     
00008         /*  Create a new LCD interface
00009         
00010         RS      :   Intruction/data register control pin. 0 = Instruction register. 1 = Data register.
00011         E       :   Start data read/write.
00012         D0-3    :   Data lines.
00013         
00014         */
00015         NewLCD(PinName RS, PinName E, PinName D0, PinName D1, PinName D2, PinName D3);
00016         
00017         /*  Write a character to the display
00018         
00019         c   :   The character to display
00020         
00021         */
00022         //int putc(int txt);
00023         
00024         /*  Write a string to the display
00025         
00026         stringToDisplay  :  A string to display on the LCD, followed by potential variables that are
00027                             used in the string.
00028                             
00029         */        
00030         //int printf(const char* stringToDisplay, ...);
00031         
00032         /*  Move starting point of where the display will start printing
00033         
00034         column  :   The horizontal position from the left, starting at 0
00035         row     :   The row selection from the top, starting at 0
00036         
00037         */
00038         void cursorLocation(int column, int row);
00039         
00040         /*  Clear the screen    */
00041         void clearScreen();
00042         
00043         /*  Function to shift the cursor left or right. 0 for left, 1 for right */
00044         void shiftCursor(string direction);
00045         
00046         /*  Variables used to set the time and date */
00047         char hours;
00048         char minutes;
00049         char day;
00050         char month;
00051         int year;
00052         
00053         /*  Function to set the time and date using the switches    */
00054         void setDateAndTime(int sw1s, int sw2s);
00055         void updateClock();
00056         void startClock();
00057         
00058     protected:
00059     
00060         //Function to print characters. This gets called from printf.
00061         virtual int _putc(int txt);
00062         virtual int _getc();
00063         virtual int _repc(int txt);
00064     
00065         //Sets DDRAM Address (this corresponds to the cursor location)
00066         int DDRAMAddress(int column, int row);
00067         
00068         //Function to write a single character to the display in a given location
00069         void charDisp(int column, int row, char c);
00070         
00071         //Function to send information down the data lines to instruction/data register
00072         void writeByte(char byteToSend);
00073         
00074         //Function to set RS pin low and call writeByte to send command
00075         void writeCommand(char commandToSend);
00076         
00077         //Function to set RS pin high and call writeByte to send data
00078         void writeData(char dataToSend);
00079         
00080         
00081         DigitalOut _RS, _E;
00082         BusOut _D;
00083         
00084         int _column;
00085         int _row;
00086         
00087         bool firstSet;
00088         
00089 };
00090         
00091