Updated for the next revision of the motor board

MotorShield.h

Committer:
adimmit
Date:
23 months ago
Revision:
8:e8985e8e9146
Parent:
7:e3a2ade56b79

File content as of revision 8:e8985e8e9146:

/* Library to interface with 2.74 Motor Shield
** Uses low level HAL libraries to enable high speed PWM 
** Use as follows:
** - Create shield object and specify PWM period for the motors
** - Set the duty cycle and direction for each motor 
*/

class MotorShield {
    
    public:
    
    MotorShield(int periodTicks);
    void motorAWrite(float duty_cycle, int direction);
    void motorBWrite(float duty_cycle, int direction);
    void motorCWrite(float duty_cycle, int direction);
    void motorDWrite(float duty_cycle, int direction);
    uint32_t readCurrentA();
    uint32_t readCurrentB();
    uint32_t readCurrentC();
    uint32_t readCurrentD();
    void changePeriod(int periodTicks); 
    
    private:
    
    int periodTickVal;
    void init();
    
};