|
HRI board firmware
v2.1
Microcontroller firmware of the board used during the HRI labs.
|
Driver for an incremental encoder. More...
Functions | |
| void | enc_Init (void) |
| Initialize the incremental encoder driver. More... | |
| float32_t | enc_GetPosition (void) |
| Gets the current motor shaft angle, measured by the encoder counter. More... | |
| void | enc_SetPosition (float32_t newPosition) |
| Set the position offset. More... | |
Driver for an incremental encoder.
This driver uses a timer of the STM32, configured as a quadrature decoder.
Call enc_Init() first in the initialization code. Then, call enc_GetPosition() to get the decoded value. The output value is the paddle position in degrees, taking the reduction ratio into account.
| float32_t enc_GetPosition | ( | void | ) |
Gets the current motor shaft angle, measured by the encoder counter.
| The | current angle of the motor shaft [deg]. |
| void enc_Init | ( | void | ) |
Initialize the incremental encoder driver.
This function initialize the timer 5 as a quadrature decoder, and set the current paddle position to zero.
| void enc_SetPosition | ( | float32_t | newPosition | ) |
Set the position offset.
The new position offset is computed such that the given position will now be returned by enc_GetPosition() if the paddle remains at this physical position.
| newPosition | the new paddle position. |
1.8.13