This repository has been archived by the owner on Aug 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 199
/
dda_kinematics.h
72 lines (59 loc) · 2.68 KB
/
dda_kinematics.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef _DDA_KINEMATICS_H
#define _DDA_KINEMATICS_H
#include "config_wrapper.h"
#include <stdint.h>
#include "dda.h"
void carthesian_to_carthesian(const TARGET *startpoint, const TARGET *target,
axes_uint32_t delta_um, axes_int32_t steps);
void carthesian_to_corexy(const TARGET *startpoint, const TARGET *target,
axes_uint32_t delta_um, axes_int32_t steps);
//void carthesian_to_scara(TARGET *startpoint, TARGET *target,
// axes_uint32_t delta_um, axes_int32_t steps);
static void code_axes_to_stepper_axes(const TARGET *, const TARGET *, axes_uint32_t,
axes_int32_t)
__attribute__ ((always_inline));
inline void code_axes_to_stepper_axes(const TARGET *startpoint, const TARGET *target,
axes_uint32_t delta_um,
axes_int32_t steps) {
#if defined KINEMATICS_STRAIGHT
carthesian_to_carthesian(startpoint, target, delta_um, steps);
#elif defined KINEMATICS_COREXY
carthesian_to_corexy(startpoint, target, delta_um, steps);
// #elif defined KINEMATICS_SCARA
// return carthesian_to_scara(startpoint, target, delta_um, steps);
#else
#error KINEMATICS not defined or unknown, edit your config.h.
#endif
}
void axes_um_to_steps_cartesian(const axes_int32_t um, axes_int32_t steps);
void axes_um_to_steps_corexy(const axes_int32_t um, axes_int32_t steps);
// void axes_um_to_steps_scara(const axes_int32_t um, axes_int32_t steps);
static void axes_um_to_steps(const axes_int32_t, axes_int32_t)
__attribute__ ((always_inline));
inline void axes_um_to_steps(const axes_int32_t um, axes_int32_t steps) {
#if defined KINEMATICS_STRAIGHT
axes_um_to_steps_cartesian(um, steps);
#elif defined KINEMATICS_COREXY
axes_um_to_steps_corexy(um, steps);
// #elif defined KINEMATICS_SCARA
// axes_um_to_steps_scara(um, steps);
#else
#error KINEMATICS not defined or unknown, edit your config.h.
#endif
}
void delta_to_axes_cartesian(axes_int32_t delta_um);
void delta_to_axes_corexy(axes_int32_t delta_um);
// void delta_to_axes_scara(const axes_int32_t delta_um, axes_int32_t um);
static void delta_to_axes(axes_int32_t) __attribute__ ((always_inline));
inline void delta_to_axes(axes_int32_t delta) {
#if defined KINEMATICS_STRAIGHT
delta_to_axes_cartesian(delta);
#elif defined KINEMATICS_COREXY
delta_to_axes_corexy(delta);
// #elif defined KINEMATICS_SCARA
// delta_to_axes_scara(delta_um, um);
#else
#error KINEMATICS not defined or unknown, edit your config.h.
#endif
}
#endif /* _DDA_KINEMATICS_H */