premiere ebauche

Dependencies:   mbed PinDetect

Revision:
4:a8c9f6a13633
Parent:
3:4da392d2bae8
Child:
5:aef1fc6c0df1
--- a/speedlimiter.hpp	Thu Oct 18 17:31:03 2018 +0000
+++ b/speedlimiter.hpp	Tue Oct 23 14:19:54 2018 +0000
@@ -9,6 +9,8 @@
 
 class SpeedLimiter
 {
+public:
+
     static const float TRANSFER_FUNCTION_PERIOD = 0.1; // seconds
     static const float DISABLE_ECO_ALGO_TRIGGER = 999; // TODO: probably defined somewhere else.
 
@@ -19,41 +21,33 @@
     static const float PEDAL_HI_MAX_VALUE = 2.96; // Volts
     static const float PEDAL_LO_MIN_VALUE = PEDAL_HI_MIN_VALUE / 2;
     static const float PEDAL_LO_MAX_VALUE = PEDAL_HI_MAX_VALUE / 2;
-    
+
     static const float TORQUE_MAX = 20.0; // Newtons
-    
+
     static const float SPEED_MAX = 40.0;
 
-public:
     SpeedLimiter(const PinName& pedalInHi, const PinName& pedalInLo, const PinName& pedalOutHi, const PinName& pedalOutLo);
     ~SpeedLimiter();
-    void start();
+    
+    void ipControllerTransferFunction();
 
     inline float getReferenceSpeed() {
-        _mutex->lock();
         float retval = _referenceSpeed;
-        _mutex->unlock();
         return retval;
     }
     inline float getMeasuredSpeed() {
-        _mutex->lock();
         float retval = _measuredSpeed;
-        _mutex->unlock();
         return retval;
     }
     inline void setReferenceSpeed(const float speed) {
-        _mutex->lock();
         _referenceSpeed = speed;
-        _mutex->unlock();
     }
     inline void setMeasuredSpeed(const float speed) {
-        _mutex->lock();
         _measuredSpeed = speed;
-        _mutex->unlock();
     }
-    
-    
-    
+
+
+
 private:
     float readAdcPedalHi();
     float readAdcPedalLo();
@@ -61,12 +55,10 @@
     void writeAdcPedalLo(const float voltage);
     float ecoDisabledAlgorithm();
     float ecoEnabledAlgorithm();
-    void tickerCallback();
-    void ipControllerTransferFunction();
-    
+
     float boundValue(float value, const float lowerBound, const float upperBound);
     float voltageToDecimal(const float decimal, const float reference);
-    
+
     inline void setOutputPedalVoltageHi(const float voltage) {
         _outputPedalVoltageHi = voltage;
     }
@@ -91,9 +83,6 @@
     volatile float _outputPedalVoltageHi;
     volatile float _outputPedalVoltageLo;
 
-    Ticker* _ticker;
-    Mutex* _mutex;
-    
     static Serial* pc; // for communication / debugging
 };