Saltware / Mbed 2 deprecated Water Play

Dependencies:   mbed DRV88255 TextLCD Ping mbed-rtos

Committer:
sbouber1
Date:
Wed Jun 15 11:37:44 2016 +0000
Revision:
48:d7053e51b30a
Parent:
47:a73b8640fb60
Child:
52:eaddbde192f1
alarm timers as member variables

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sbouber1 10:fd4670ec0806 1 #ifndef __ALARMCONTROLLER_H__
sbouber1 10:fd4670ec0806 2 #define __ALARMCONTROLLER_H__
sbouber1 10:fd4670ec0806 3
sbouber1 10:fd4670ec0806 4 #include "mbed.h"
sbouber1 10:fd4670ec0806 5 #include "SensorController.h"
joran 40:1668630544c7 6 #include "PIDController.h"
joran 47:a73b8640fb60 7 #include "testing.h"
sbouber1 10:fd4670ec0806 8
sbouber1 38:930469a33001 9 #define STARTUP_ITERATIONS 10
sbouber1 38:930469a33001 10
sbouber1 10:fd4670ec0806 11
sbouber1 10:fd4670ec0806 12 class AlarmController : public Controller {
sbouber1 10:fd4670ec0806 13
sbouber1 10:fd4670ec0806 14
sbouber1 10:fd4670ec0806 15 public:
joran 43:0abb54448b75 16 AlarmController(bool threaded, int interval_ms, SensorController *temp, SensorController *salt, SensorController *proximity)
sbouber1 10:fd4670ec0806 17 : Controller(threaded, interval_ms) {
sbouber1 10:fd4670ec0806 18 this->temp = temp;
sbouber1 10:fd4670ec0806 19 this->salt = salt;
joran 20:521f795ea9d7 20 this->proximity = proximity;
joran 43:0abb54448b75 21
joran 20:521f795ea9d7 22 this->error = false;
joran 20:521f795ea9d7 23 this->tempiscrit = false;
joran 20:521f795ea9d7 24 this->saltiscrit = false;
joran 27:4f73f754fdc9 25 this->overflowiscrit = false;
joran 40:1668630544c7 26
sbouber1 10:fd4670ec0806 27 }
sbouber1 10:fd4670ec0806 28
sbouber1 10:fd4670ec0806 29 virtual void update();
sbouber1 10:fd4670ec0806 30
sbouber1 10:fd4670ec0806 31 virtual std::string get_name();
sbouber1 10:fd4670ec0806 32
sbouber1 10:fd4670ec0806 33 bool is_error();
sbouber1 10:fd4670ec0806 34
sbouber1 11:1a0a8fd74bc0 35 char *get_error_message();
joran 20:521f795ea9d7 36
joran 20:521f795ea9d7 37 void buzzOnce();
joran 20:521f795ea9d7 38 void raiseAlarmTemp(bool);
joran 20:521f795ea9d7 39 void raiseAlarmSalt(bool);
joran 27:4f73f754fdc9 40 void raiseAlarmOverFlow(bool);
sbouber1 10:fd4670ec0806 41
sbouber1 10:fd4670ec0806 42
sbouber1 10:fd4670ec0806 43 private:
sbouber1 10:fd4670ec0806 44 SensorController *temp;
sbouber1 10:fd4670ec0806 45 SensorController *salt;
sbouber1 10:fd4670ec0806 46 SensorController *proximity;
joran 43:0abb54448b75 47
sbouber1 10:fd4670ec0806 48
sbouber1 10:fd4670ec0806 49 bool error;
sbouber1 11:1a0a8fd74bc0 50 char *error_msg;
sbouber1 10:fd4670ec0806 51
sbouber1 11:1a0a8fd74bc0 52 void activate_buzzer();
joran 20:521f795ea9d7 53 bool tempiscrit;
joran 20:521f795ea9d7 54 bool saltiscrit;
joran 27:4f73f754fdc9 55 bool overflowiscrit;
joran 27:4f73f754fdc9 56
sbouber1 48:d7053e51b30a 57 Timer temptimer;
sbouber1 48:d7053e51b30a 58 Timer salttimer;
sbouber1 48:d7053e51b30a 59 Timer overflowtimer;
joran 27:4f73f754fdc9 60
sbouber1 10:fd4670ec0806 61 };
sbouber1 10:fd4670ec0806 62
sbouber1 10:fd4670ec0806 63
sbouber1 10:fd4670ec0806 64 #endif