Speeduino
Loading...
Searching...
No Matches
speeduino
units.h
Go to the documentation of this file.
1
#pragma once
2
8
#include <stdint.h>
9
#include "
maths.h
"
10
13
constexpr
int16_t
CALIBRATION_TEMPERATURE_OFFSET
= 40;
14
15
/* TO DO: store *all* temps in storage units: *only* convert to display units during I/O.
16
This will avoid a lot of conversions (speed, simplicity) */
17
24
static
constexpr
inline
uint8_t
temperatureAddOffset
(
int16_t
temperature
)
25
{
26
return
temperature
+
CALIBRATION_TEMPERATURE_OFFSET
;
27
}
28
37
static
constexpr
inline
int16_t
temperatureRemoveOffset
(
uint8_t
temperature
)
38
{
39
return
(
int16_t
)
temperature
-
CALIBRATION_TEMPERATURE_OFFSET
;
40
}
rshift
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition
bit_shifts.h:349
maths.h
temperatureAddOffset
static constexpr uint8_t temperatureAddOffset(int16_t temperature)
Convert an internal temperature value (-40 to 215°C) to a storage value (0-255).
Definition
units.h:24
CALIBRATION_TEMPERATURE_OFFSET
constexpr int16_t CALIBRATION_TEMPERATURE_OFFSET
Definition
units.h:13
temperatureRemoveOffset
static constexpr int16_t temperatureRemoveOffset(uint8_t temperature)
Convert a storage value (0-255) to an internal temperature value (-40 to 215°C).
Definition
units.h:37
Generated by
1.9.8