Utility functions and constants.
More...
Utility functions and constants.
This module provides functions and constants that may be used at many places in the code.
◆ CPU_TRAPS_ENABLED
| #define CPU_TRAPS_ENABLED 1 |
◆ MICROSECOND_TO_SECOND
| #define MICROSECOND_TO_SECOND (1.0f/SECOND_TO_MICROSECOND) |
◆ SECOND_TO_MICROSECOND
| #define SECOND_TO_MICROSECOND 1000000.0f |
◆ utils_DelayMs()
| void utils_DelayMs |
( |
uint32_t |
duration | ) |
|
"Busy wait" delay function
- Parameters
-
| duration | Delay time in [ms] (approximative value based on a 168MHz core clock). |
- Note
- This delay is approximative, and may last longer if there are many interrupts.
◆ utils_DelayUs()
| void utils_DelayUs |
( |
uint32_t |
duration | ) |
|
"Busy wait" delay function
- Parameters
-
| duration | Delay time in [us] (approximative value based on a 168MHz core clock) |
◆ utils_Mean()
| float32_t utils_Mean |
( |
float32_t * |
array, |
|
|
int |
size |
|
) |
| |
Compute the mean of the array values.
- Parameters
-
| array | array of float number to get the mean from. |
| size | size of the array. |
- Return values
-
| the | mean of the array values. |
◆ utils_SaturateF()
| void utils_SaturateF |
( |
float32_t * |
val, |
|
|
float32_t |
min, |
|
|
float32_t |
max |
|
) |
| |
Saturate a float number between two bounds.
- Parameters
-
| val | value to constrain between two limits. |
| min | minimum |
| max | maximum |
- Return values
-
◆ utils_SaturateU()
| void utils_SaturateU |
( |
uint32_t * |
val, |
|
|
uint32_t |
min, |
|
|
uint32_t |
max |
|
) |
| |
Saturate an integer number between two bounds.
- Parameters
-
| val | value to constrain between the two limits. |
| min | lower limit. |
| max | upper limit. |
- Return values
-
◆ utils_TrapCpu()
| void utils_TrapCpu |
( |
void |
| ) |
|
Endless loop function to stop the execution of the program here.
- Note
- This function does nothing if CPU_TRAPS_ENABLED is set to zero.