pachas

Dependencies:   mbed QEI FastPWM

Revision:
1:aa5df1878126
Parent:
0:9d0b9785d3d6
Child:
3:45299e7882b9
--- a/main.cpp	Sat Apr 11 22:53:05 2020 +0000
+++ b/main.cpp	Thu Apr 16 13:02:36 2020 +0000
@@ -13,7 +13,7 @@
 // ******************************
 
 //Ticker interrupt
-Ticker ticker_int_10ms; // Ticker interrupt
+//Ticker ticker_int_10us; // Ticker interrupt
 
 Serial pc(USBTX, USBRX);
 
@@ -31,37 +31,13 @@
 
 
 int main(void) {
-    
-    stepper_en = 0;
-    stepper_dir = 0;
-    stepper_pulse.period(STEPPER_PULSE_PERIOD);
-    stepper_pulse.write(STEPPER_PULSE_DUTY_CYCLE);
-    
-    Buttons_Initialize();
-    // Allocate an interrupt service routine for Timer interrupt
-    ticker_int_10ms.attach(&Ticker_ISR, 0.01);
+
     TFT_Interface_Initialize();
-/*
-    tft->set_font((unsigned char*) Arial28x28);
-    tft->set_font_zoom(2,3);
-    if(gas_input == AIR_INPUT){
-        tft->locate(350,VALUES_ROW2_Y_POS );
-        tft->printf("Aire");
-    }else{
-        tft->locate(390,VALUES_ROW2_Y_POS );
-        tft->printf("O");     
-    }
- */   
-
+    Stepper_Driver_Init();
+    Stepper_Calculate_Period_Ramp();
+    
     while(1){     
-       //TFT_Encoder_Interaction();
-       if(stepper_motor_state == STEPPER_MOTOR_GO_HOME){ 
-            Stepper_Motor_Go_Home();
-        }
-        
-        if(stepper_motor_state == STEPPER_MOTOR_GO_AHEAD){ 
-            Stepper_Motor_Go_Ahead();
-        }      
+         Stepper_Driver_State_Machine();
     }
   
     return 0;
@@ -70,7 +46,10 @@
 
 
 // Ticker Interrupt Service Routine
-void Ticker_ISR(void){
+//void Ticker_ISR(void){
+   
+   //Stepper_Driver_Pulse_Signal_Update();
+   
    /* 
     static uint8_t conta_10ms = 0;
     
@@ -83,4 +62,4 @@
         Encoder_Read();
     }
     */
-}  
+//}