H-Bridge driver

Fork of TB6612FNG by Robert Abad

Revision:
3:7d60ce61990e
Parent:
2:4231e0b6e68d
--- a/TB6612FNG.h	Tue Dec 08 07:32:17 2015 +0000
+++ b/TB6612FNG.h	Wed Dec 09 16:50:09 2015 +0000
@@ -58,7 +58,7 @@
 
 #include "mbed.h"
 
-#define TB6612FNG_PWM_PERIOD_DEFAULT      (0.00002)   // 50KHz
+#define TB6612FNG_PWM_PERIOD_DEFAULT      (20000)   // 50KHz
 #define TB6612FNG_PWM_PULSEWIDTH_DEFAULT  (0.50)      // 50% duty cycle
  
 class TB6612FNG
@@ -67,12 +67,9 @@
     TB6612FNG( PinName pinPwmA, PinName pinAin1, PinName pinAin2,
                PinName pinPwmB, PinName pinBin1, PinName pinBin2,
                PinName pinNStby );
-    void setPwmA(float fPeriod, float fPulsewidth);
-    void setPwmAperiod(float fPeriod);
-    void setPwmApulsewidth(float fPulsewidth);
-    void setPwmB(float fPeriod, float fPulsewidth);
-    void setPwmBperiod(float fPeriod);
-    void setPwmBpulsewidth(float fPulsewidth);
+    
+    void setPwmA(int p_us, float dc);
+    void setPwmB(int p_us, float dc);
     void standby(void);
     void motorA_stop(void);
     void motorA_ccw(void);
@@ -80,6 +77,10 @@
     void motorB_stop(void);
     void motorB_ccw(void);
     void motorB_cw(void);
+    void toggleA_Off(void);
+    void toggleA_On(void);
+    void toggleB_Off(void);
+    void toggleB_On(void);
     
 private:
     DigitalOut pwmA;
@@ -89,6 +90,16 @@
     DigitalOut Bin1;
     DigitalOut Bin2;
     DigitalOut nStby;
+    
+    int on_delayA;
+    int off_delayA;
+    int on_delayB;
+    int off_delayB;
+    
+    Timeout timerA;
+    Timeout timerB;
+    
+    
 };
 
 #endif /* __TB6612FNG_H__ */
\ No newline at end of file