Thermostat class implements basic functionality of a thermostat

Revision:
0:cd3a00aa2dbc
Child:
1:909cb1aef872
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/thermostat.h	Thu Feb 13 08:07:46 2014 +0000
@@ -0,0 +1,59 @@
+//Thermostat class
+//Napoleon Leoni
+//Thermostat with Joystick control input
+//Class Thermostat: 
+//Has a control loop enable/disable(I will refer to this as Heater on/off), an over-ride enable/disable.
+//an object TemperatureRecording (keeps current temperature, max and min since last reset 
+//and circular buffer with recorded data)
+//Functions to check user input on joystick
+//sets interrupt on accelerometer (To be implemented)
+
+#include "mbed.h"
+#include "LM75B.h"
+#include "temperatureRecorder.h"
+#include "joystickAppBoard.h"
+
+#ifndef THERMOSTAT
+#define THERMOSTAT
+#define DEFAULTHYSTERESYS  5 //degrees F, dead band of controller to prevent excessive turn on/off
+#define DEFAULTGRANULARITY 2 //degrees F, increment in temperaure setting per joystick click
+#define DEFAULTTEMPSETTING 60 //degrees F, default setting for thermostat
+#define DEFAULTMAXTEMPSETTING 96     //degrees F, max temperature setting to avoid user over shooting setting with joystick
+#define DEFAULTMINTEMPSETTING 44     //degrees F, min temperature setting to avoid user under shooting setting with joystick
+#define DEFAULTTIME 
+
+class thermostat{
+    //public members
+    public:
+    //private members
+    private:
+        temperatureRecorder *trecord;       //pointer to TemperatureRecordeObject
+        joystickAppBoard *inputJoystick;    //pointer to input joystick object
+        DigitalOut *actuatorOutput;         //pointer to Digital Output for actuator, this would run the relay for the heater
+                                            //temporarily we could use an LED as output so that the heating action is signaled
+                                            //by the turning on and off of an LED
+        struct tm timeKeeper;               //structure to hold date/time type
+        time_t timeInSeconds;               //variable to keep absolute time
+        float hysteresisGap, temperatureGranularity, defaultTemperature, maxTemperature, minTemperature;
+        bool heaterEnabled;     //This flag corresponds to whether the thermostat control is on
+        bool heatingActionOn;   //this flag corresponds to whether the thermostat has turned the heating action (relay) on
+    //public methods
+    public:
+        thermostat();//default constructor
+        thermostat(temperatureRecorder *,joystickAppBoard *,DigitalOut *);//regular constructor
+        void enableHeater(void);
+        void disableHeater(void);
+        void checkJoystickInput(void);
+        void runThermostatControlCycle(void);
+        float getTemperature(void);//Read current temperature
+        float getMaxTemperature(void);//read Maximum Temperature
+        float getMinTemperature(void);//read Maximum Temperature
+        float getTemperatureSetting(void); //read temperature setting
+        bool getThermostatStatus(void); //returns true if heaterEnabled, that is thermostat control is on
+        void setDay(int,int,int);
+        void setTime(int,int,int);
+        void getDateandTime(char*,int); //return Date and time as a formatted string in the provided char buffer
+    //private methods
+    private:
+}; //end of thermostat class prototype 
+#endif