Driver to call functions at a fixed rate.
More...
Driver to call functions at a fixed rate.
This driver setups three timers of the STM32, in order to call at a precise rate the control functions: the current regulation loop, the position regulation loop and the communication loop (data streaming part only).
In the initialization code, first call cbt_Init(). Then call each cbt_Set*LoopTimer() function, giving the pointer to the function to call as an argument.
◆ cbt_GetCommLoopPeriod()
| uint32_t cbt_GetCommLoopPeriod |
( |
void |
| ) |
|
Get the period of the communication loop.
- Returns
- the period of the communication loop [us].
◆ cbt_GetCurrentLoopPeriod()
| uint32_t cbt_GetCurrentLoopPeriod |
( |
void |
| ) |
|
Get the period of the current loop.
- Returns
- the period of the current loop [us].
◆ cbt_GetHapticControllerPeriod()
| uint32_t cbt_GetHapticControllerPeriod |
( |
void |
| ) |
|
Get the period of the position loop.
- Returns
- the period of the position loop [us].
◆ cbt_Init()
Initialize the timers to call an interrupt routine periodically.
◆ cbt_SetCommLoopPeriod()
| void cbt_SetCommLoopPeriod |
( |
uint32_t |
period | ) |
|
Set the period of the communication loop.
- Parameters
-
| period | the new period of the communication loop [us]. |
◆ cbt_SetCommLoopTimer()
Set the function to call periodically by the timer 7.
- Parameters
-
| f | the function to call periodically. |
| period | the period between each call of f [us]. |
◆ cbt_SetCurrentLoopTimer()
Set the function to call periodically by the timer 1.
- Parameters
-
| f | the function to call periodically. |
| period | the period between each call of f [us]. |
◆ cbt_SetHapticControllerPeriod()
| void cbt_SetHapticControllerPeriod |
( |
uint32_t |
period | ) |
|
Set the period of the position loop.
- Parameters
-
| period | the new period of the position loop [us]. |
◆ cbt_SetHapticControllerTimer()
Set the function to call periodically by the timer 6.
- Parameters
-
| f | the function to call periodically. |
| period | the period between each call of f [us]. |