|
modm API documentation
|
This driver generates a AB (incremental) encoder signal to emulate a hardware encoder with a microcontroller. More...
#include <modm/driver/encoder/bitbang_encoder_output.hpp>
Public Member Functions | |
| BitBangEncoderOutput (PositionType initialValue) | |
| Initializes the Encoder. More... | |
| void | update () |
| Update method. Generates the encoder signal. More... | |
| void | setPosition (PositionType position) |
| Set the position for the encoder. More... | |
This driver generates a AB (incremental) encoder signal to emulate a hardware encoder with a microcontroller.
| SignalA | First modm::platform::Gpio pin to output the encoder signal. |
| SignalB | Second modm::platform::Gpio pin to output the encoder signal. |
| PositionType | Data type (integer) of the position value, default int32_t. |
| PeriodicTimer | Defaults to modm::PeriodicTimer, must be replaced for encoder frequencies above 1kHz by a class that offers time steps less than 1ms, e.g. modm::PrecisePeriodicTimer. |
| period | Timebase for the output signal. This limits the maximal frequency of the encoder signal. Defaults to 1000us (1ms). |
| modm::BitBangEncoderOutput< SignalA, SignalB, PositionType, PeriodicTimer, period >::BitBangEncoderOutput | ( | PositionType | initialValue | ) |
Initializes the Encoder.
Sets pins (SignalA and SignalB) as output pins.
| initialValue | for the encoder. Useful with unsigned PositionType data types. Defaults to 0. |
|
inline |
Set the position for the encoder.
| position | The position setpoint for the encoder. |
| void modm::BitBangEncoderOutput< SignalA, SignalB, PositionType, PeriodicTimer, period >::update | ( | ) |
Update method. Generates the encoder signal.
Call this function in your main loop.