Implements a state machine quadrature encoder based on Matthias Hertel's rotary library
More...
|
double | getCount () |
| Returns current incremental position.
|
|
void | setCount (double count) |
| set count of current encoder position More...
|
|
void | clearCount () |
| set count of current encoder position to 0
|
|
void | pauseCount () |
| Ignore any pulses until resumeCount() is called.
|
|
void | resumeCount () |
| Resume counting, after having it stopped by pauseCount()
|
|
double | getTicksPerRevolution () |
| ...
|
|
void | update () override |
| Polls encoder.
|
|
void | init (double ticks, uint8_t PinA, uint8_t pinB) |
| Attach rotary encoder to pins, initialize and clear position to 0. More...
|
|
void | setFilter (double value) |
| Set filter to smoothen faulty or jittery absolute readings. More...
|
|
double | getFilteredCount () |
| Returns current position count with filter setting applied. More...
|
|
void | throwError (const char *invokedBy, const char *errorMessage) |
| Writes error message and error invoking class to Serial. More...
|
|
void | log (const char *logEntry) |
| Puts timestamped string into the system log (atm: writes it out to Serial). More...
|
|
|
bool | processMessage (uint8_t *m) override |
| (abstract) Interprets message handed down from QPID_Unit locally. Must be overridden in derived classes
|
|
| QPID_Object () |
| Constructor. Begins Serial with 115200 baud for logging and error reporting, if not done previously.
|
|
|
double | ticksPerRevolution |
|
double | filter = 0 |
|
double | lastCount = 0 |
|
Implements a state machine quadrature encoder based on Matthias Hertel's rotary library
QPID_Encoder)
- Note
- This is a demo implementation which relies on polling via QPID subsystem polling (cf. QPID_Object::update() ). I assume this could be unreliable for fast counting, as polling/update frequency depends on QPID_Unit main update speed. A better implememtation would do the polling via timed interrupt (not pin change interrupt, this is a state machine encoder!), however this would have to be implemented per architecture.
- Todo:
- check private, protected etc. for all derived classes
◆ setCount()
void QPID_Encoder_QuadratureStateMachine::setCount |
( |
double |
count | ) |
|
|
virtual |
set count of current encoder position
- Parameters
-
Reimplemented from QPID_Encoder.
◆ init()
void QPID_Encoder_QuadratureStateMachine::init |
( |
double |
ticks, |
|
|
uint8_t |
pinA, |
|
|
uint8_t |
pinB |
|
) |
| |
Attach rotary encoder to pins, initialize and clear position to 0.
- Parameters
-
ticks | ticks per revolution |
pinA,pinB | encoder pins |
The documentation for this class was generated from the following files: