ti bisogna il phaserunner

Dependencies:   mbed PID mbed-rtos

Revision:
9:56aed8c6779f
Parent:
8:1655d27152e6
--- a/Peripherien/Regler.h	Fri May 17 14:35:54 2019 +0000
+++ b/Peripherien/Regler.h	Wed May 29 17:05:34 2019 +0000
@@ -5,10 +5,16 @@
 #ifndef PA_REGLER_H
 #define PA_REGLER_H
 
+#include "mbed.h"
 #include "Phaserunner.h"
 #include "Encoder.h"
 #include "PID.h"
 
+
+#define ERGO 0
+#define MOFA 1
+#define PEDELEC 2
+
 class Regler{
 private:
     //Alle Phaserunner
@@ -17,8 +23,12 @@
     Phaserunner& linkspedal;
     Phaserunner& rechtspedal;
     
+    // Analog Outputs für Generatoren am Pedalen
+    AnalogOut gegenmomentLinks;
+    AnalogOut gegenmomentRechts;
+    
     // PID Regler
-    PID          pid;
+    PID&          pid;
     
     //Encoder
     Encoder&     encoder;
@@ -41,11 +51,18 @@
     // Regler Parameters Pedale
     float Kp_,Ki_,Ts_,setPoint_;
     
-    // Ergometer Stufe (von 1 bis 10)
+    // Betriebsmodus (0->Ergo, 1->Mofa, 2->Pedelec) 
+    uint8_t Modus_;
+    
+    // Ergometer Stufe "(von 1 bis 10)"
     float ErgoStufe_;
     
     // Pedelec Values
-    float PedStufe_, PedFactor_; 
+    float PedStufe_, PedFactor_;
+    
+    // AnalogOut Pins für gegenmomentsteuerung
+    static const PinName GEG_LINKS_PIN = PA_4; 
+    static const PinName GEG_RECHTS_PIN = PA_5; 
     
     const static float PI = 3.14159265;
 
@@ -92,6 +109,12 @@
     void setTorquePedals(uint8_t torque);
 
     /**
+     * Setzt das Nullpunkt der Pedalen.
+     * 
+     */
+    void setZero();
+    
+    /**
      * Setzt die Rekuperation der Motoren
      * @param recuperation
      */
@@ -142,6 +165,12 @@
      * @param PedFactor
      */
     void setPedFactor(float PedFactor);
+    
+    /**
+     * Setzt die Modus
+     * @param Modus
+     */
+    void setModus(float Modus);
 };
 
 #endif //PA_REGLER_H