interrupt géré compil ok sans isr

Fork of T2_STM32 by Atechsys

Revision:
5:d6484db1ec5c
Child:
6:6291f032e996
diff -r b01a3ce6ef01 -r d6484db1ec5c lift.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lift.h	Mon Feb 05 08:10:13 2018 +0000
@@ -0,0 +1,63 @@
+//Ne pas oublier la détection de surintensité
+
+#define PeakCurrent     510   //   Valeur à vérifier
+
+class Lift {
+
+  public:
+  Lift(int, int, int);
+  ~Lift(void);
+
+  void Starting();
+  void Stopping();
+  void GoUp();
+  void GoDown();
+  
+  private:
+  bool InMotion;
+  char sTargetPos, 
+       PreviousPos, 
+       CurrentPos;
+  int  StepPin, 
+       spinDown,
+       sMiddleSensor, 
+       CurrentSensor,
+       tempStepPin,
+       tempDirPin;    
+};
+
+
+Lift::Lift( LIFTSTEPPIN, LIFT_DIRPIN, LIFT_CURRENTSENSOR){ 
+  DigitalOut Step(LIFTSTEPPIN);
+  DigitalOut Dir(LIFTDIRPIN);
+}
+
+
+void Lift::Starting(){
+  int i;
+  for(i=0; i<128; i++){
+    SendPWM_Carre(i, StepPin);
+    delay(10);
+  }
+}
+
+void Lift::Stopping(){
+  int i;
+  for(i=128; i>0; i--){
+    SendPWM_Carre(i, StepPin);
+    delay(10);
+  }
+}
+
+void Lift::GoUp(){
+  DirPin = 0;
+  Starting();
+  Started();
+}
+
+void Lift::GoDown(){
+  DirPin = 1;
+  Starting();
+}
+
+#endif
\ No newline at end of file