|
Smart Knob Controller
|
Class to interface with a 14-bit SPI-based rotary encoder. More...
#include <encoder.h>
Public Member Functions | |
| Encoder (SPI_HandleTypeDef *hspi, TIM_HandleTypeDef *htim, GPIO &CSn) | |
| Constructs an Encoder object. | |
| void | update () |
| Updates angle, position, and velocity. | |
| int32_t | getCommutationAngle () |
| Returns angle adjusted for motor commutation. | |
| float | getAngle () |
| Returns current angle in radians [0, 2π). | |
| float | getPosition () |
| Returns accumulated position in radians. | |
| float | getVelocity () |
| Returns estimated angular velocity in rad/s. | |
| void | zero () |
| Sets current angle as new zero reference. | |
| void | resetPosition () |
| Resets the multi-turn position to zero. | |
| uint16_t | readRawAngle () |
| Performs an SPI read to get raw encoder angle. | |
Public Attributes | |
| uint16_t | rawAngle |
Class to interface with a 14-bit SPI-based rotary encoder.
| Encoder::Encoder | ( | SPI_HandleTypeDef * | hspi, |
| TIM_HandleTypeDef * | htim, | ||
| GPIO & | CSn ) |
| float Encoder::getAngle | ( | ) |
Returns current angle in radians [0, 2π).
| int32_t Encoder::getCommutationAngle | ( | ) |
Returns angle adjusted for motor commutation.
| float Encoder::getPosition | ( | ) |
Returns accumulated position in radians.
| float Encoder::getVelocity | ( | ) |
Returns estimated angular velocity in rad/s.
| uint16_t Encoder::readRawAngle | ( | ) |
Performs an SPI read to get raw encoder angle.