Provides an API software interface to TIMER2 to control upto four stepper motors.

Dependents:   Steppermotor

Revision:
4:7b7940df7865
Parent:
0:7393c52297ee
--- a/src/SimpleSteppers.cpp	Mon May 02 10:17:33 2011 +0000
+++ b/src/SimpleSteppers.cpp	Fri May 20 09:13:31 2011 +0000
@@ -57,6 +57,8 @@
     
     _maintainPositionData = true; 
     
+    _steps_per_second = 0;
+    
     setPulseSense(1);
     setDirectionSense(1);
     
@@ -194,12 +196,14 @@
     if (steps_per_second == 0) {
         LPC_TIM2->EMR |=  (NothingOnMatch << _EMCshift);
         LPC_TIM2->MCR &= ~(7UL << _match_shift);
-        if (_pulseSense) LPC_TIM2->EMR &= ~_EMmask; else LPC_TIM2->EMR |= _EMmask; 
+        if (_pulseSense) LPC_TIM2->EMR |= _EMmask; else LPC_TIM2->EMR &= ~_EMmask; 
         _stepperState = Stopped;
         _pulseState = PulseIdle;
         _commandSpeed = 0;
+        _steps_per_second = 0;
     }
     else {
+        _steps_per_second = steps_per_second;
         int n = steps_per_second;
         if (n < 0) n *= -1;
         if (_direction) {