modm API documentation
modm::BitBangEncoderOutput< SignalA, SignalB, PositionType, PeriodicTimer, period > Class Template Reference

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...
 

Detailed Description

template<class SignalA, class SignalB, typename PositionType = int32_t, class PeriodicTimer = modm::PeriodicTimer, uint32_t period = 1000>
class modm::BitBangEncoderOutput< SignalA, SignalB, PositionType, PeriodicTimer, period >

This driver generates a AB (incremental) encoder signal to emulate a hardware encoder with a microcontroller.

Author
Raphael Lehmann
Template Parameters
SignalAFirst modm::platform::Gpio pin to output the encoder signal.
SignalBSecond modm::platform::Gpio pin to output the encoder signal.
PositionTypeData type (integer) of the position value, default int32_t.
PeriodicTimerDefaults 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.
periodTimebase for the output signal. This limits the maximal frequency of the encoder signal. Defaults to 1000us (1ms).

Constructor & Destructor Documentation

template<class SignalA , class SignalB , typename PositionType = int32_t, class PeriodicTimer = modm::PeriodicTimer, uint32_t period = 1000>
modm::BitBangEncoderOutput< SignalA, SignalB, PositionType, PeriodicTimer, period >::BitBangEncoderOutput ( PositionType  initialValue)

Initializes the Encoder.

Sets pins (SignalA and SignalB) as output pins.

Parameters
initialValuefor the encoder. Useful with unsigned PositionType data types. Defaults to 0.

Member Function Documentation

template<class SignalA , class SignalB , typename PositionType = int32_t, class PeriodicTimer = modm::PeriodicTimer, uint32_t period = 1000>
void modm::BitBangEncoderOutput< SignalA, SignalB, PositionType, PeriodicTimer, period >::setPosition ( PositionType  position)
inline

Set the position for the encoder.

Parameters
positionThe position setpoint for the encoder.
template<class SignalA , class SignalB , typename PositionType = int32_t, class PeriodicTimer = modm::PeriodicTimer, uint32_t period = 1000>
void modm::BitBangEncoderOutput< SignalA, SignalB, PositionType, PeriodicTimer, period >::update ( )

Update method. Generates the encoder signal.

Call this function in your main loop.


The documentation for this class was generated from the following file: