cleaning up debug gpios
authorArthur Wolf <wolf.arthur@gmail.com>
Wed, 20 Feb 2013 23:12:01 +0000 (00:12 +0100)
committerArthur Wolf <wolf.arthur@gmail.com>
Wed, 20 Feb 2013 23:12:01 +0000 (00:12 +0100)
src/libs/StepTicker.cpp
src/libs/StepperMotor.cpp

index 5df12aa..cd457a4 100644 (file)
@@ -131,16 +131,10 @@ extern "C" void TIMER1_IRQHandler (void){
 // The actual interrupt handler where we do all the work
 extern "C" void TIMER0_IRQHandler (void){
 
-    LPC_GPIO1->FIODIR |= 1<<22;
-    LPC_GPIO1->FIOSET = 1<<22;
-
-//     uint32_t initial_tc = LPC_TIM0->TC;
-
     LPC_TIM0->IR |= 1 << 0;
 
     // If no axes enabled, just ignore for now
     if( global_step_ticker->active_motor_bm == 0 ){
-        LPC_GPIO1->FIOCLR = 1<<22;
         return;
     }
 
@@ -175,9 +169,6 @@ extern "C" void TIMER0_IRQHandler (void){
     // This can be OK, if we take notice of it, which we do now
     if( LPC_TIM0->TC > global_step_ticker->period ){ // TODO: remove the size condition
 
-        LPC_GPIO1->FIODIR |= 1<<23;
-        LPC_GPIO1->FIOSET = 1<<23;
-
         uint32_t start_tc = LPC_TIM0->TC;
 
         // How many ticks we want to skip ( this does not include the current tick, but we add the time we spent doing this computation last time )
@@ -214,8 +205,6 @@ extern "C" void TIMER0_IRQHandler (void){
 
         //if( global_step_ticker->last_duration > 2000 || LPC_TIM0->MR0 > 2000 || LPC_TIM0->TC > 2000 || initial_tc > 2000 ){ __debugbreak(); }
 
-        LPC_GPIO1->FIOCLR = 1<<23;
-
     }else{
         LPC_TIM0->MR0 = global_step_ticker->period;
     }
@@ -224,7 +213,6 @@ extern "C" void TIMER0_IRQHandler (void){
         LPC_TIM0->MR0 += global_step_ticker->period;
     }
 
-    LPC_GPIO1->FIOCLR = 1<<22;
 }
 
 
index d0fdc58..a20b1d5 100644 (file)
@@ -42,18 +42,12 @@ StepperMotor::StepperMotor(Pin* step, Pin* dir, Pin* en) : step_pin(step), dir_p
 // Called a great many times per second, to step if we have to now
 void StepperMotor::tick(){
 
-    LPC_GPIO1->FIODIR |= 1<<31;
-    LPC_GPIO1->FIOSET = 1<<31;
-
     // increase the ( fixed point ) counter by one tick 11t
     this->fx_counter += (uint64_t)((uint64_t)1<<32);
 
     // if we are to step now 10t
     if( this->fx_counter >= this->fx_ticks_per_step ){
 
-        LPC_GPIO1->FIODIR |= 1<<30;
-        LPC_GPIO1->FIOSET = 1<<30;
-
         // output to pins 37t
         this->step_pin->set( 1                   );
         this->step_ticker->reset_step_pins = true;
@@ -75,12 +69,8 @@ void StepperMotor::tick(){
             this->step_ticker->moves_finished = true;
         }
 
-        LPC_GPIO1->FIOCLR = 1<<30;
-
     }
 
-    LPC_GPIO1->FIOCLR = 1<<31;
-
 }
 
 // If the move is finished, the StepTicker will call this ( because we asked it to in tick() )
@@ -146,15 +136,6 @@ void StepperMotor::move( bool direction, unsigned int steps ){
 
 // Set the speed at which this steper moves
 void StepperMotor::set_speed( double speed ){
-//     if( speed <= 1.0 ){
-//         this->steps_per_second = 0;
-//         this->fx_ticks_per_step = 1ULL<<63;
-//         return;
-//     }
-
-    //if( speed < this->steps_per_second ){
-        LPC_GPIO1->FIOSET = 1<<19;
-    //}
 
     if (speed < 1.0)
         speed = 1.0;