SRA Board Components
ESP-IDF component for SRA Board
Functions
utils.c File Reference
#include "utils.h"
Include dependency graph for utils.c:

Functions

float bound (float val, float min, float max)
 Bound a value in a range [min, max]. More...
 
float map (float val, float input_lower_limit, float input_higher_limit, float output_lower_limit, float output_higher_limit)
 Maps a value in range [input_lower_limit, input_higher_limit] to [output_lower_limit, output_higher_limit]. More...
 

Function Documentation

◆ bound()

float bound ( float  val,
float  min,
float  max 
)

Bound a value in a range [min, max].

Parameters
valvalue to be bound
minmin value which the variable can take
maxmax value which the variable can take

◆ map()

float map ( float  val,
float  input_lower_limit,
float  input_higher_limit,
float  output_lower_limit,
float  output_higher_limit 
)

Maps a value in range [input_lower_limit, input_higher_limit] to [output_lower_limit, output_higher_limit].

Parameters
valvalue to be mapped
input_lower_limitmin value of val
input_higher_limitmax value of val
output_lower_limitinput_lower_limit is mapped to output_lower_limit
output_higher_limitinput_higher_limit is mapped to output_higher_limit