Speeduino
Loading...
Searching...
No Matches
Functions | Variables
units.h File Reference

Unit conversion functions and constants. More...

#include <stdint.h>
#include "maths.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static constexpr uint8_t temperatureAddOffset (int16_t temperature)
 Convert an internal temperature value (-40 to 215°C) to a storage value (0-255).
 
static constexpr int16_t temperatureRemoveOffset (uint8_t temperature)
 Convert a storage value (0-255) to an internal temperature value (-40 to 215°C).
 

Variables

constexpr int16_t CALIBRATION_TEMPERATURE_OFFSET = 40
 

Detailed Description

Unit conversion functions and constants.

Function Documentation

◆ temperatureAddOffset()

static constexpr uint8_t temperatureAddOffset ( int16_t  temperature)
inlinestaticconstexpr

Convert an internal temperature value (-40 to 215°C) to a storage value (0-255).

Parameters
temperaturein °C, from -40 to 215.
Returns
uint8_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ temperatureRemoveOffset()

static constexpr int16_t temperatureRemoveOffset ( uint8_t  temperature)
inlinestaticconstexpr

Convert a storage value (0-255) to an internal temperature value (-40 to 215°C).

Reverse operation of temperatureAddOffset.

Parameters
temperature
Returns
int8_t
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ CALIBRATION_TEMPERATURE_OFFSET

constexpr int16_t CALIBRATION_TEMPERATURE_OFFSET = 40
constexpr

< All temperature measurements are stored offset by 40 degrees. This is so we can use an unsigned byte (0-255) to represent temperature ranges from -40 to 215