Add basic motion API
parent
8e994c3b17
commit
3ef113cf6c
|
|
@ -192,6 +192,7 @@ target_sources(
|
||||||
src/modules/protocol.cpp
|
src/modules/protocol.cpp
|
||||||
src/modules/buttons.cpp
|
src/modules/buttons.cpp
|
||||||
src/modules/leds.cpp
|
src/modules/leds.cpp
|
||||||
|
src/modules/motion.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(
|
set_property(
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
#include "motion.h"
|
||||||
|
|
||||||
|
namespace modules {
|
||||||
|
namespace motion {
|
||||||
|
|
||||||
|
Motion motion;
|
||||||
|
|
||||||
|
void Motion::PlanMove(Axis axis, float targetPosition, uint16_t feedrate) {}
|
||||||
|
|
||||||
|
void Motion::Home(Axis axis) {}
|
||||||
|
|
||||||
|
void Motion::SetMode(Mode mode) {}
|
||||||
|
|
||||||
|
void Motion::Step() {}
|
||||||
|
|
||||||
|
void ISR() {}
|
||||||
|
|
||||||
|
} // namespace motion
|
||||||
|
} // namespace modules
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
/// @@TODO
|
/// @@TODO
|
||||||
/// Logic of motor handling
|
/// Logic of motor handling
|
||||||
|
|
@ -19,3 +20,43 @@
|
||||||
/// rotate(speed)
|
/// rotate(speed)
|
||||||
/// rotate(speed, angle/steps)
|
/// rotate(speed, angle/steps)
|
||||||
/// home?
|
/// home?
|
||||||
|
|
||||||
|
namespace modules {
|
||||||
|
namespace motion {
|
||||||
|
|
||||||
|
enum Axis {
|
||||||
|
Idler,
|
||||||
|
Selector,
|
||||||
|
Pulley
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Mode {
|
||||||
|
Stealth,
|
||||||
|
Normal
|
||||||
|
};
|
||||||
|
|
||||||
|
class Motion {
|
||||||
|
public:
|
||||||
|
/// Enqueue move of a specific motor/axis into planner buffer
|
||||||
|
void PlanMove(Axis axis, float targetPosition, uint16_t feedrate);
|
||||||
|
|
||||||
|
/// Enqueue performing of homing of an axis
|
||||||
|
void Home(Axis axis);
|
||||||
|
|
||||||
|
/// Set mode of TMC/motors operation
|
||||||
|
/// Common for all axes/motors
|
||||||
|
void SetMode(Mode mode);
|
||||||
|
|
||||||
|
/// State machine doing all the planning and stepping preparation based on received commands
|
||||||
|
void Step();
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
/// ISR stepping routine
|
||||||
|
extern void ISR();
|
||||||
|
|
||||||
|
extern Motion motion;
|
||||||
|
|
||||||
|
} // namespace motion
|
||||||
|
} // namespace modules
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue