HRI board firmware v2.1 Microcontroller firmware of the board used during the HRI labs.

utils.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2017 EPFL-LSRO (Laboratoire de Systemes Robotiques).
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __UTILS_H
18 #define __UTILS_H
19
20 #include "../main.h"
21
32 #define CPU_TRAPS_ENABLED 1
33
34 #define SECOND_TO_MICROSECOND 1000000.0f
35 #define MICROSECOND_TO_SECOND (1.0f/SECOND_TO_MICROSECOND)
36
37 void utils_TrapCpu(void);
38
39 void utils_DelayUs(uint32_t duration);
40 void utils_DelayMs(uint32_t duration);
41
42 void utils_DelayUs(uint32_t duration);
43 void utils_DelayMs(uint32_t duration);
44 void utils_SaturateF(float32_t *val, float32_t min, float32_t max);
45 void utils_SaturateU(uint32_t *val, uint32_t min, uint32_t max);
46 float32_t utils_Mean(float32_t *array, int size);
47
52 #endif
utils_Mean
float32_t utils_Mean(float32_t *array, int size)
Compute the mean of the array values.
Definition: utils.c:113
utils_SaturateU
void utils_SaturateU(uint32_t *val, uint32_t min, uint32_t max)
Saturate an integer number between two bounds.
Definition: utils.c:99
utils_DelayMs
void utils_DelayMs(uint32_t duration)
"Busy wait" delay function
Definition: utils.c:59
utils_TrapCpu
void utils_TrapCpu(void)
Endless loop function to stop the execution of the program here.
Definition: utils.c:23
utils_DelayUs
void utils_DelayUs(uint32_t duration)
"Busy wait" delay function
Definition: utils.c:35
utils_SaturateF
void utils_SaturateF(float32_t *val, float32_t min, float32_t max)
Saturate a float number between two bounds.
Definition: utils.c:84