This program consists of the software developed for the ELEC5870M Individual Project. It runs on the mbed LPC1768. It uses the mbed RTOS to perform the following tasks: - Implements intuitive GUI with buttons, LCD TFT Display and LEDs. - Serial Communication with the RPi - I2C communication with INA219 voltage current sensors - Power control at the USB ports

Dependencies:   Adafruit_GFX Adafruit_ST7735 INA219 MODSERIAL MbedJSONValue mbed-rtos mbed

Committer:
OHstin
Date:
Sun Apr 30 17:19:22 2017 +0000
Revision:
6:196a63a3378d
Parent:
3:7666de697752
Final Code for mbed operation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OHstin 3:7666de697752 1 #ifndef SENSORMODEL_H
OHstin 3:7666de697752 2 #define SENSORMODEL_H
OHstin 3:7666de697752 3
OHstin 3:7666de697752 4 /**
OHstin 3:7666de697752 5 // this class basically stores models of sensor to be used in other threads
OHstin 3:7666de697752 6 **/
OHstin 3:7666de697752 7
OHstin 3:7666de697752 8 // battery model
OHstin 3:7666de697752 9 class BatteryModel
OHstin 3:7666de697752 10 {
OHstin 3:7666de697752 11 public:
OHstin 3:7666de697752 12 BatteryModel();
OHstin 3:7666de697752 13 BatteryModel(float b1C,float b1V,float b2C,float b2V);
OHstin 3:7666de697752 14 float batteryOneCurrent;
OHstin 3:7666de697752 15 float batteryOneVoltage;
OHstin 3:7666de697752 16 float batteryTwoCurrent;
OHstin 3:7666de697752 17 float batteryTwoVoltage;
OHstin 3:7666de697752 18 };
OHstin 3:7666de697752 19
OHstin 3:7666de697752 20 BatteryModel::BatteryModel()
OHstin 3:7666de697752 21 {
OHstin 3:7666de697752 22
OHstin 3:7666de697752 23 }
OHstin 3:7666de697752 24
OHstin 3:7666de697752 25 BatteryModel::BatteryModel(float b1C, float b1V, float b2C, float b2V )
OHstin 3:7666de697752 26 {
OHstin 3:7666de697752 27 batteryOneCurrent = b1C;
OHstin 3:7666de697752 28 batteryOneVoltage = b1V;
OHstin 3:7666de697752 29 batteryTwoCurrent = b2C;
OHstin 3:7666de697752 30 batteryTwoVoltage = b2V;
OHstin 3:7666de697752 31 }
OHstin 3:7666de697752 32
OHstin 3:7666de697752 33
OHstin 3:7666de697752 34 // solar model
OHstin 3:7666de697752 35 class SolarModel
OHstin 3:7666de697752 36 {
OHstin 3:7666de697752 37 public:
OHstin 3:7666de697752 38 SolarModel();
OHstin 3:7666de697752 39 SolarModel(float sV, float sC);
OHstin 3:7666de697752 40 float solarVoltage;
OHstin 3:7666de697752 41 float solarCurrent;
OHstin 3:7666de697752 42 };
OHstin 3:7666de697752 43
OHstin 3:7666de697752 44 SolarModel::SolarModel()
OHstin 3:7666de697752 45 {
OHstin 3:7666de697752 46
OHstin 3:7666de697752 47 }
OHstin 3:7666de697752 48
OHstin 3:7666de697752 49 SolarModel::SolarModel(float sV, float sC)
OHstin 3:7666de697752 50 {
OHstin 3:7666de697752 51 solarVoltage = sV;
OHstin 3:7666de697752 52 solarCurrent = sC;
OHstin 3:7666de697752 53 }
OHstin 3:7666de697752 54
OHstin 3:7666de697752 55 // consumption model
OHstin 3:7666de697752 56 class ConsumptionModel
OHstin 3:7666de697752 57 {
OHstin 3:7666de697752 58 public:
OHstin 3:7666de697752 59 ConsumptionModel();
OHstin 6:196a63a3378d 60 ConsumptionModel(float oV, float oC);
OHstin 3:7666de697752 61 float consumptionVoltage;
OHstin 3:7666de697752 62 float consumptionCurrent;
OHstin 3:7666de697752 63 };
OHstin 3:7666de697752 64
OHstin 6:196a63a3378d 65 ConsumptionModel::ConsumptionModel(float oV, float oC)
OHstin 3:7666de697752 66 {
OHstin 6:196a63a3378d 67 consumptionVoltage = oV;
OHstin 6:196a63a3378d 68 consumptionCurrent = oC;
OHstin 3:7666de697752 69 }
OHstin 3:7666de697752 70 #endif