Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: SDSK.h
- Revision:
- 2:ea603e66a32e
- Parent:
- 1:491a39c644b1
diff -r 491a39c644b1 -r ea603e66a32e SDSK.h
--- a/SDSK.h Thu Apr 05 19:12:24 2018 +0000
+++ b/SDSK.h Mon Dec 02 11:38:14 2019 +0000
@@ -1,14 +1,25 @@
#ifndef SDSK_h
#define SDSK_h
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+#define DEG2RAD M_PI / 180.0
+#define RAD2DEG 180.0 / M_PI
+
#include <mbed.h>
+#include <vector>
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);
+ double move(double target_angle);
+
+ vector<uint64_t> planner(double target_angle);
+ void move_planner(vector<uint64_t> step_time, double target_angle);
+ void set_dir(double target_angle);
void reverse();
void zero();
@@ -16,6 +27,7 @@
void set_max_vel(double _max_vel);
void take_step();
+ double position_angle;
private:
DigitalOut step;
@@ -26,10 +38,12 @@
double max_vel;
uint32_t min_us_step_pulse;
- double position_angle;
uint32_t steps_per_rev;
double steps_per_angle;
+ double angle_per_steps;
+
+ bool pos_dir;
Serial pc;