HRI board firmware  v2.1
Microcontroller firmware of the board used during the HRI labs.
Functions
Driver / Callback timers

Driver to call functions at a fixed rate. More...

Functions

void cbt_Init (void)
 Initialize the timers to call an interrupt routine periodically. More...
 
void cbt_SetCurrentLoopTimer (cbt_PeriodicTaskFunc f, uint32_t period)
 Set the function to call periodically by the timer 1. More...
 
void cbt_SetHapticControllerTimer (cbt_PeriodicTaskFunc f, uint32_t period)
 Set the function to call periodically by the timer 6. More...
 
void cbt_SetCommLoopTimer (cbt_PeriodicTaskFunc f, uint32_t period)
 Set the function to call periodically by the timer 7. More...
 
void cbt_SetHapticControllerPeriod (uint32_t period)
 Set the period of the position loop. More...
 
void cbt_SetCommLoopPeriod (uint32_t period)
 Set the period of the communication loop. More...
 
uint32_t cbt_GetCurrentLoopPeriod (void)
 Get the period of the current loop. More...
 
uint32_t cbt_GetHapticControllerPeriod (void)
 Get the period of the position loop. More...
 
uint32_t cbt_GetCommLoopPeriod (void)
 Get the period of the communication loop. More...
 

Detailed Description

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.

Function Documentation

◆ 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()

void cbt_Init ( void  )

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
periodthe new period of the communication loop [us].

◆ cbt_SetCommLoopTimer()

void cbt_SetCommLoopTimer ( cbt_PeriodicTaskFunc  f,
uint32_t  period 
)

Set the function to call periodically by the timer 7.

Parameters
fthe function to call periodically.
periodthe period between each call of f [us].

◆ cbt_SetCurrentLoopTimer()

void cbt_SetCurrentLoopTimer ( cbt_PeriodicTaskFunc  f,
uint32_t  period 
)

Set the function to call periodically by the timer 1.

Parameters
fthe function to call periodically.
periodthe period between each call of f [us].

◆ cbt_SetHapticControllerPeriod()

void cbt_SetHapticControllerPeriod ( uint32_t  period)

Set the period of the position loop.

Parameters
periodthe new period of the position loop [us].

◆ cbt_SetHapticControllerTimer()

void cbt_SetHapticControllerTimer ( cbt_PeriodicTaskFunc  f,
uint32_t  period 
)

Set the function to call periodically by the timer 6.

Parameters
fthe function to call periodically.
periodthe period between each call of f [us].