LV8548 Motor Driver Stepper Motor Dc MOtor

Dependents:   LV8548_ON_MD_Modlle_kit_DCMtr_And_STEPMtr

Revision:
1:e60c7c42e6fc
Parent:
0:04db82da014d
Child:
2:627825272d30
--- a/LV8548.cpp	Fri Nov 16 16:45:46 2018 +0000
+++ b/LV8548.cpp	Sat Nov 17 05:05:13 2018 +0000
@@ -250,8 +250,10 @@
     {
         SetDcMotorStop(MOTOR_A);
         _PwmPeriod[MOTOR_A] = 1/Freq;
+#if USE_PWM_PORT
         _in1.period( _PwmPeriod[MOTOR_A] );
         _in2.period( _PwmPeriod[MOTOR_A] );        
+#endif
         SetDcMotor(MOTOR_A);
  #if _DEBUG_
           printf("freq0 : %f ",_PwmPeriod[MOTOR_A]);
@@ -261,8 +263,10 @@
     {
         SetDcMotorStop(MOTOR_B);
         _PwmPeriod[MOTOR_B] = 1/Freq;
-        _in2.period( _PwmPeriod[MOTOR_B] );
-        _in3.period( _PwmPeriod[MOTOR_B] );        
+#if USE_PWM_PORT
+       _in3.period( _PwmPeriod[MOTOR_B] );
+       _in4.period( _PwmPeriod[MOTOR_B] );        
+#endif
 #if _DEBUG_
           printf("freq1 : %f ",_PwmPeriod[MOTOR_B]);
 #endif
@@ -559,7 +563,7 @@
 #if _DEBUG_
             printf("Ot:%x %x %x\n",OutputImage,_StepPhase,_TargetStepMode);    
 #endif
-    
+#if USE_PWM_PORT
             if( OutputImage &  COIL_A )      _in1.write(1.0f);
             else                             _in1.write(0.0f);
             if( OutputImage &  COIL_B )      _in2.write(1.0f);
@@ -568,8 +572,12 @@
             else                             _in3.write(0.0f);
             if( OutputImage &  COIL_D )      _in4.write(1.0f);
             else                             _in4.write(0.0f);
-    
-    
+#else
+            _in1 =  (( OutputImage &  COIL_A ) != 0);
+            _in2 =  (( OutputImage &  COIL_B ) != 0);
+            _in3 =  (( OutputImage &  COIL_C ) != 0);
+            _in4 =  (( OutputImage &  COIL_D ) != 0);
+ #endif    
             if(_NowStepDirection)   _StepPhase --;
             else                    _StepPhase ++;
             _StepPhase = _StepPhase & (STEPPHASEMAX -1);