fuck this

Dependencies:   BMP280

Committer:
Swaggie
Date:
Sat Jan 06 22:54:42 2018 +0000
Revision:
15:e61297f9bae9
Parent:
14:1fb1354ac27c
Child:
16:1b3488fb67f5
LCD Constructor seems to be working. thread, ticker and button 2 are part of the class.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Swaggie 2:5a38ae8459d5 1 #ifndef __LCD__
Swaggie 2:5a38ae8459d5 2 #define __LCD__
Swaggie 14:1fb1354ac27c 3 /*
Swaggie 14:1fb1354ac27c 4 *This class inherits the TextLCD class to add functionality to display enviromental readings,
Swaggie 15:e61297f9bae9 5 *with a scrolling display, or to display a specific message, which times out back
Swaggie 15:e61297f9bae9 6 *to scrolling, and to set the time using two push buttons.
Swaggie 14:1fb1354ac27c 7 */
Swaggie 14:1fb1354ac27c 8 #include "mbed.h"
Swaggie 14:1fb1354ac27c 9 #include "TextLCD.h"
Swaggie 15:e61297f9bae9 10 #include "rtos.h"
Swaggie 14:1fb1354ac27c 11 #include <string>
Swaggie 2:5a38ae8459d5 12 //These functions manage writing to the LCD
Swaggie 2:5a38ae8459d5 13
Swaggie 15:e61297f9bae9 14 class EnviromLCDDisplay : private TextLCD
Swaggie 14:1fb1354ac27c 15 {
Swaggie 14:1fb1354ac27c 16 private:
Swaggie 14:1fb1354ac27c 17 //private variables
Swaggie 14:1fb1354ac27c 18 enum ThreadState{MESSAGE,SCROLLREADINGS,ADJUSTTIME};
Swaggie 14:1fb1354ac27c 19 enum ScrollState{PRESTEMP,LDRTIME};
Swaggie 14:1fb1354ac27c 20
Swaggie 14:1fb1354ac27c 21 ThreadState _TState; //This determines what function the LCD is doing
Swaggie 14:1fb1354ac27c 22 ScrollState _SState; //This determines what screen on the LCD is shown
Swaggie 14:1fb1354ac27c 23
Swaggie 15:e61297f9bae9 24 //Values to display
Swaggie 15:e61297f9bae9 25 float _temperature;
Swaggie 15:e61297f9bae9 26 float _pressure;
Swaggie 15:e61297f9bae9 27 float _ldr;
Swaggie 15:e61297f9bae9 28 string _message;
Swaggie 15:e61297f9bae9 29
Swaggie 15:e61297f9bae9 30 //Objects to be used
Swaggie 15:e61297f9bae9 31 Ticker _DisplayScroll; //pointer to an external ticker that will be used for changing the display
Swaggie 15:e61297f9bae9 32 Thread _LCDThread; //Pointer to the therad that will be used for the LCD
Swaggie 15:e61297f9bae9 33 PinName _Button1Pin; //Button will change between InterruptIn and DigitalIn. Used to enter time edit mode
Swaggie 15:e61297f9bae9 34 DigitalIn _Button2; //Button2
Swaggie 15:e61297f9bae9 35 bool _AutoQuit; //After message is displayed, should LCD return to SCROLLREADINGS?
Swaggie 15:e61297f9bae9 36
Swaggie 14:1fb1354ac27c 37 //private functions
Swaggie 15:e61297f9bae9 38
Swaggie 14:1fb1354ac27c 39 public:
Swaggie 14:1fb1354ac27c 40 //public functions
Swaggie 15:e61297f9bae9 41 EnviromLCDDisplay(PinName rs,PinName e, PinName d4, PinName d5, PinName d6, PinName d7, PinName Button1Pin, PinName Button2/*, Thread& LCDThread, Ticker& DisplayScroll*/); //Constructor
Swaggie 15:e61297f9bae9 42 //~EnviromLCDDisplay(); //Destructor
Swaggie 14:1fb1354ac27c 43
Swaggie 15:e61297f9bae9 44 bool POST(void); //Power On Self Test. Returns true if pass
Swaggie 15:e61297f9bae9 45 void Start(void); //Starts thread
Swaggie 15:e61297f9bae9 46
Swaggie 15:e61297f9bae9 47 void DispMessage(string message, bool returnToReadings); //Display given message on screen
Swaggie 14:1fb1354ac27c 48 void LCDThread(void); //This needs to be attached to a thread
Swaggie 15:e61297f9bae9 49
Swaggie 14:1fb1354ac27c 50 };
Swaggie 14:1fb1354ac27c 51
Swaggie 14:1fb1354ac27c 52
Swaggie 2:5a38ae8459d5 53 #endif