A Clearpath SDSK trapezoidal motion controller

SDSK.h

Committer:
williamweatherholtz
Date:
2018-04-05
Revision:
1:491a39c644b1
Parent:
0:913deac5f975

File content as of revision 1:491a39c644b1:

#ifndef SDSK_h
#define SDSK_h

#include <mbed.h>

class SDSK
{
public:
    SDSK(PinName _pin_step, PinName _pin_dir, uint32_t _steps_per_rev=51200, double _max_acc=360, double _max_vel=180, uint32_t _min_us_step_pulse=4,  bool _positive_is_ccw=true);
    
    void move(double target_angle);
    
    void reverse();
    void zero();
    void set_max_acc(double _max_acc);
    void set_max_vel(double _max_vel);
    
    void take_step(); 
     
private:
    DigitalOut step;
    DigitalOut dir;
    bool positive_is_ccw; // changes to -1 if untrue
    
    double max_acc;
    double max_vel;
    
    uint32_t min_us_step_pulse;
    double position_angle;
    
    uint32_t steps_per_rev;
    double steps_per_angle;
    
    Serial pc;
    
    Timer profile_time;
    
};
#endif