Quadrature Encoder support. More...
#include <encoder.h>
Classes | |
| struct | Conf |
| Encoder constructor. More... | |
Public Member Functions | |
| void | measure () |
| measure the sensor | |
| int16_t | getValue () |
| return the counter value of the timer connected to the encoder | |
| double | getPosition () |
| return current value of encoder with overflow correction | |
| void | zero () |
| reset encoder position | |
Quadrature Encoder support.
| struct TIMER::Encoder::Conf |
Encoder constructor.
make sure the pins for the encoder are on channels 1 and 2 of the used timer.
| tim | Microcontroller Timer Peripheral (e.g. TIM2) |
| a | Alternate Function initialized pin A |
| b | Alternate Function initialized pin B |
| factor | all encompassing conversion factor from encoder value to needed unit Examples:
|
|
inline |
measure the sensor
do this periodically to update encoder state
|
inline |
return the counter value of the timer connected to the encoder
|
inline |
return current value of encoder with overflow correction