The cast to Level is incorrect, since the expression returns either 0 or
a positive value if the pin is set. The value is directly assigned to
the underlying uint8_t, meaning that Level::high won't match for levels
greater than 0.
Return a boolean and cast that to Level instead.
Instead of adding #ifdefs for missing headers, create a shim that can be
included everywhere.
"limits.h" includes a bare-bone implementation of numeric_limits (to be
extended as needed).
Instead of stepping halfway, step ~1/3 of the way through.
This ensures we can check if the steps performed is correct due to the
internal step subtraction.
Motion::Full() (without a specific axis) is counter-productive.
When planning new moves the axis needs to be known beforehand, so it
might be as well be given to Full() to check the proper queue.
Implement Motion::SetEnabled (for symmetry with TMC2130::SetEnabled).
Rename DisableAxis to Disable and use the new SetEnabled. This makes the
member names more consistent.
Make ReadPin return the last value set by WritePin for proper testing.
Add a slow-path to TogglePin that goes through a read-write cycle. This
is useful both for testing and for platforms that don't have an
efficient toggle like AVR.
The cast to Level is incorrect, since the expression returns either 0 or
a positive value if the pin is set. The value is directly assigned to
the underlying uint8_t, meaning that Level::high won't match for levels
greater than 0.
Return a boolean and cast that to Level instead.
We might want to schedule new moves while a single motor is moving.
Allow to do that by introducing per-axis query functions.
The main QueueEmpty() and Full() still function as before:
- Call QueueEmpty() to wait for all moves to finish.
- Use !Full() to know that a Plan() move will never be discarded.
Since scheduling a move on a block which is being executed will jolt the
motors, be extra-safe and perform an extra lower-level check before
committing even if the caller is responsible.
Return the status, which can be useful to build a simple busy loop.
- Remove the combined PlanMove(a,b,c,rate) call. If we allow the units
of the various motors to be changed at compile time, the unit of
rate can vary between axes.
- Build PlanMove on top of the absolute PlanMoveTo.
- Add required stubs for TMC2130.
- Allow each axis mode to be set independently, since we have this
feature for free anyway.
- Rework internals to use PulseGen data types and structs.