Vincenzo Lippiello / SDSK
Revision:
0:913deac5f975
Child:
1:491a39c644b1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDSK.h	Thu Feb 01 19:06:08 2018 +0000
@@ -0,0 +1,44 @@
+#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=200, 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();
+    
+    //void set_direction(bool cw);    
+     
+private:
+    DigitalOut step;
+    DigitalOut dir;
+    
+    Timer profile_time;
+    
+    Serial pc;
+    
+    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;
+    
+    void delay_for_velocity(double velocity_steps);
+};
+#endif