Prusa3d Marlin fork
sm4.h
1 //sm4.h - simple 4-axis stepper control
2 #ifndef _SM4_H
3 #define _SM4_H
4 
5 #include <inttypes.h>
6 #include "config.h"
7 
8 
9 #if defined(__cplusplus)
10 extern "C" {
11 #endif //defined(__cplusplus)
12 
13 
14 // callback prototype for stop condition (return 0 - continue, return 1 - stop)
15 typedef uint8_t (*sm4_stop_cb_t)();
16 
17 // callback prototype for updating position counters
18 typedef void (*sm4_update_pos_cb_t)(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t de);
19 
20 // callback prototype for calculating delay
21 typedef uint16_t (*sm4_calc_delay_cb_t)(uint16_t nd, uint16_t dd);
22 
23 
24 // callback pointer - stop
25 extern sm4_stop_cb_t sm4_stop_cb;
26 
27 // callback pointer - update_pos
28 extern sm4_update_pos_cb_t sm4_update_pos_cb;
29 
30 // callback pointer - calc_delay
31 extern sm4_calc_delay_cb_t sm4_calc_delay_cb;
32 
33 
34 // returns direction for single axis (0 - positive, 1 - negative)
35 extern uint8_t sm4_get_dir(uint8_t axis);
36 
37 // set direction for single axis (0 - positive, 1 - negative)
38 extern void sm4_set_dir(uint8_t axis, uint8_t dir);
39 
40 // returns direction of all axes as bitmask (0 - positive, 1 - negative)
41 extern uint8_t sm4_get_dir_bits(void);
42 
43 // set direction for all axes as bitmask (0 - positive, 1 - negative)
44 extern void sm4_set_dir_bits(uint8_t dir_bits);
45 
46 // step axes by bitmask
47 extern void sm4_do_step(uint8_t axes_mask);
48 
49 // xyze linear-interpolated relative move, returns remaining diagonal steps (>0 means stoped)
50 extern uint16_t sm4_line_xyze_ui(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t de);
51 extern uint16_t sm4_line_xyz_ui(uint16_t dx, uint16_t dy, uint16_t dz);
52 
53 
54 #if defined(__cplusplus)
55 }
56 #endif //defined(__cplusplus)
57 #endif //_SM4_H