SRA Board Components
ESP-IDF component for SRA Board
Macros | Functions
utils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BITS_IN_A_BYTE   (8 * sizeof(uint8_t))
 Number of bits in a byte. More...
 
#define BITS_IN_4_BYTES   (8 * sizeof(uint32_t))
 Number of bits in 4 bytes / int32_t / uint32_t. More...
 

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...
 

Macro Definition Documentation

◆ BITS_IN_4_BYTES

#define BITS_IN_4_BYTES   (8 * sizeof(uint32_t))

Number of bits in 4 bytes / int32_t / uint32_t.

◆ BITS_IN_A_BYTE

#define BITS_IN_A_BYTE   (8 * sizeof(uint8_t))

Number of bits in a byte.

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