frequency change?
Fork of BridgeDriver by
Diff: BridgeDriver.h
- Revision:
- 1:c8e328389a98
- Parent:
- 0:b1e3fa917367
- Child:
- 4:87768972db3f
diff -r b1e3fa917367 -r c8e328389a98 BridgeDriver.h --- a/BridgeDriver.h Thu Jul 03 17:09:29 2014 +0000 +++ b/BridgeDriver.h Thu Jul 03 20:56:20 2014 +0000 @@ -2,6 +2,7 @@ #include "mbed.h" #include "MCP23017.h" +#include "TextLCD.h" //if using diagnostic #define BRIDGEDRIVER_H @@ -21,15 +22,17 @@ class BridgeDriver{ - enum Bridges{ BRIDGE_A, + + + public: + enum Bridges{ BRIDGE_A, BRIDGE_B, BRIDGE_C, BRIDGE_D - }; - - public: - - BridgeDriver( I2C *i2c, const uint8_t enPwmA = 0, const uint8_t enPwmB = 0, const uint8_t enPwmC = 0, const uint8_t enPwmD = 0, const uint8_t enAddr = EN_ADDR, const uint8_t ledAddr = LED_ADDR); + }; + + + BridgeDriver( I2C *i2c, uint8_t enPwmA = 0, uint8_t enPwmB = 0, uint8_t enPwmC = 0, uint8_t enPwmD = 0, uint8_t enAddr = EN_ADDR, uint8_t ledAddr = LED_ADDR); ~BridgeDriver(); @@ -51,6 +54,8 @@ float drive(Bridges bridge, int8_t dir, float speed); //dir: 1=fwd, -1=rev, 0=brake (irregardless of setting of _braking //speed from 0 to 1, speed of 0 will coast or brake depending on setting of _braking + + void diagnostic(TextLCD_I2C *lcd); @@ -62,10 +67,11 @@ I2C *_i2c; uint8_t _enAddr; uint8_t _ledAddr; - uint8_t _pwm[4]; - int8_t _dir[4]; //dir of 1 means lower # ch is driving, dir of -1 means higher number ch is driving + uint8_t _pwm[4]; //enabled full bridges + uint8_t _pwmCh; //currently actie PWM pins + int8_t _dir[4]; //dir of 1 means lower # ch is driving, dir of -1 means higher number ch is driving uint8_t _braking[4]; - uint8_t _oldLedState; //for setLed functions. Kept external to overload function + uint8_t _oldLedState; //for setLed functions. Kept external to overload function void enableCh(uint8_t ch, uint8_t en); void setLed(uint8_t ch, uint8_t en);