A simple motor driver for the MC33926 chip, commonly found on the Polulu md11a breakout https://www.pololu.com/product/1213.
Diff: MC33926.h
- Revision:
- 0:3163bb06484b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MC33926.h Sun Apr 30 16:14:35 2017 +0000 @@ -0,0 +1,64 @@ +/******************************************************************************************** + + Filename: MC33926.h + + Original Author: Steven Kay + + Development Group: Steve!! + + Original Creation Date: April 2017 + + Description: <Desc> + + Revision History: Version 1.0 - Initial Release + + *********************************************************************************************/ + +#ifndef MC33926_H +#define MC33926_H + + +#include "mbed.h" + + +#define DRIVER_PWM_PERIOD 2 + + +#define RESET 2 +#define FORWARD 1 +#define REVERSE 0 + + +class MC33926 +{ + + public: + + MC33926(PinName pinIN1, PinName pinIN2, PinName pinFB, PinName pinSF); + + + void SetPWMPulsewidth(int direction, float PWM_Pulsewidth); + + float ReadCurrentFeedback(); + + // Implemented on v2.0 +// void StatusFlagWatch(bool latchPol); +// bool GetStatus(); +// void ResetStatus(); + + protected: + + PwmOut *_pinIN1; + PwmOut *_pinIN2; + AnalogIn *_pinFB; + InterruptIn *_pinSF; + + volatile bool statusFlag; + + + void StatusFlagISR(); + + +}; + +#endif