A simple motor driver for the MC33926 chip, commonly found on the Polulu md11a breakout https://www.pololu.com/product/1213.

MC33926.h

Committer:
sk398
Date:
2017-04-30
Revision:
0:3163bb06484b

File content as of revision 0:3163bb06484b:

/********************************************************************************************

   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