PROJ515-MASTER-No-PWM

Dependencies:   mbed mbed-rtos ShiftReg2 TextLCD

Committer:
thomasmorris
Date:
Tue May 07 21:55:57 2019 +0000
Revision:
4:020f93d35f6e
Added mutex and safey coding needs more. Added board and serial functions that need testing. As well as a more thorough post function.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thomasmorris 4:020f93d35f6e 1 #include "Feedback.hpp"
thomasmorris 4:020f93d35f6e 2 //Constructor
thomasmorris 4:020f93d35f6e 3 FEEDBACK::FEEDBACK(PinName N1, PinName N2, PinName N3, PinName N4, PinName N5, PinName N6, PinName N7, PinName N8, PinName N9, PinName N10) :
thomasmorris 4:020f93d35f6e 4 _Battery_Measurement(N1),_Temperature_Sensor_1(N2),_Temperature_Sensor_2(N3),_Temperature_Sensor_3(N4),
thomasmorris 4:020f93d35f6e 5 _Feedback_Sensor_1(N5),_Feedback_Sensor_2(N6),_Feedback_Sensor_3(N7),_Feedback_Sensor_4(N8),_Feedback_Sensor_5(N9),_Feedback_Sensor_6(N10)
thomasmorris 4:020f93d35f6e 6 {
thomasmorris 4:020f93d35f6e 7 _Battery_Measurement_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 8 _Battery_Measurement_Value = 0;
thomasmorris 4:020f93d35f6e 9 _Battery_Measurement_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 10 _Temp_1_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 11 _Temp_1_Value = 0;
thomasmorris 4:020f93d35f6e 12 _Temp_1_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 13 _Temp_2_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 14 _Temp_2_Value = 0;
thomasmorris 4:020f93d35f6e 15 _Temp_2_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 16 _Temp_3_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 17 _Temp_3_Value = 0;
thomasmorris 4:020f93d35f6e 18 _Temp_3_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 19 _Feedback_1_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 20 _Feedback_1_Value = 0;
thomasmorris 4:020f93d35f6e 21 _Feedback_1_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 22 _Feedback_2_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 23 _Feedback_2_Value = 0;
thomasmorris 4:020f93d35f6e 24 _Feedback_2_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 25 _Feedback_3_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 26 _Feedback_3_Value = 0;
thomasmorris 4:020f93d35f6e 27 _Feedback_3_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 28 _Feedback_4_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 29 _Feedback_4_Value = 0;
thomasmorris 4:020f93d35f6e 30 _Feedback_4_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 31 _Feedback_5_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 32 _Feedback_5_Value = 0;
thomasmorris 4:020f93d35f6e 33 _Feedback_5_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 34 _Feedback_6_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 35 _Feedback_6_Value = 0;
thomasmorris 4:020f93d35f6e 36 _Feedback_6_Value_Mutex.unlock();
thomasmorris 4:020f93d35f6e 37 }
thomasmorris 4:020f93d35f6e 38 FEEDBACK::~FEEDBACK(){}//Destructor
thomasmorris 4:020f93d35f6e 39 void FEEDBACK::Init(){}//Initialisation Routine
thomasmorris 4:020f93d35f6e 40 int FEEDBACK::Post()//Power on self test
thomasmorris 4:020f93d35f6e 41 {
thomasmorris 4:020f93d35f6e 42 return 1;//Success
thomasmorris 4:020f93d35f6e 43 }
thomasmorris 4:020f93d35f6e 44
thomasmorris 4:020f93d35f6e 45 float FEEDBACK::Get_Battery_Measurement_Value(){_Battery_Measurement_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 46 _Battery_Measurement_Value = _Battery_Measurement.read();_Battery_Measurement_Value_Mutex.unlock();return _Battery_Measurement_Value;}
thomasmorris 4:020f93d35f6e 47 float FEEDBACK::Get_Temp_1_Value(){_Temp_1_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 48 _Temp_1_Value = _Temperature_Sensor_1.read();_Temp_1_Value_Mutex.unlock(); return _Temp_1_Value;}
thomasmorris 4:020f93d35f6e 49 float FEEDBACK::Get_Temp_2_Value(){_Temp_2_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 50 _Temp_2_Value = _Temperature_Sensor_2.read();_Temp_2_Value_Mutex.unlock(); return _Temp_2_Value;}
thomasmorris 4:020f93d35f6e 51 float FEEDBACK::Get_Temp_3_Value(){_Temp_3_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 52 _Temp_3_Value = _Temperature_Sensor_3.read();_Temp_3_Value_Mutex.unlock(); return _Temp_3_Value;}
thomasmorris 4:020f93d35f6e 53 float FEEDBACK::Get_Feedback_1_Value(){_Feedback_1_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 54 _Feedback_1_Value = _Feedback_Sensor_1.read(); _Feedback_1_Value_Mutex.unlock();return _Feedback_1_Value;}
thomasmorris 4:020f93d35f6e 55 float FEEDBACK::Get_Feedback_2_Value(){_Feedback_2_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 56 _Feedback_2_Value = _Feedback_Sensor_2.read(); _Feedback_2_Value_Mutex.unlock();return _Feedback_2_Value;}
thomasmorris 4:020f93d35f6e 57 float FEEDBACK::Get_Feedback_3_Value(){_Feedback_3_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 58 _Feedback_3_Value = _Feedback_Sensor_3.read(); _Feedback_3_Value_Mutex.unlock();return _Feedback_3_Value;}
thomasmorris 4:020f93d35f6e 59 float FEEDBACK::Get_Feedback_4_Value(){_Feedback_4_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 60 _Feedback_4_Value = _Feedback_Sensor_4.read(); _Feedback_4_Value_Mutex.unlock();return _Feedback_4_Value;}
thomasmorris 4:020f93d35f6e 61 float FEEDBACK::Get_Feedback_5_Value(){_Feedback_5_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 62 _Feedback_5_Value = _Feedback_Sensor_5.read(); _Feedback_5_Value_Mutex.unlock();return _Feedback_5_Value;}
thomasmorris 4:020f93d35f6e 63 float FEEDBACK::Get_Feedback_6_Value(){_Feedback_6_Value_Mutex.lock();
thomasmorris 4:020f93d35f6e 64 _Feedback_6_Value = _Feedback_Sensor_6.read(); _Feedback_6_Value_Mutex.unlock();return _Feedback_6_Value;}