Go to the documentation of this file.
57 #define PHYDAT_DIM (3U)
62 #define PHYDAT_SCALE_STR_MAXLEN (sizeof("*E-128\0"))
158 #define PHYDAT_MIN (INT16_MIN)
163 #define PHYDAT_MAX (INT16_MAX)
@ UNIT_G
gravitational force
@ UNIT_TEMP_F
degree Fahrenheit
size_t phydat_to_json(const phydat_t *data, size_t dim, char *buf)
Convert the given phydat_t structure into a JSON string.
@ UNIT_UNDEF
unit undefined
const char * phydat_unit_to_str_verbose(uint8_t unit)
Return a string representation for every unit, including non-physical units like 'none' or 'time'.
const char * phydat_unit_to_str(uint8_t unit)
Convert the given unit to a string.
@ UNIT_GR
grams - not using the SI unit (kg) here to make scale handling simpler
@ UNIT_TEMP_C
degree Celsius
Common macros and compiler attributes/pragmas configuration.
#define PHYDAT_DIM
The fixed number of dimensions we work with.
@ UNIT_PERMILL
out of 1000
int8_t scale
the scale factor, 10^*scale*
@ UNIT_PPB
part per billion
uint8_t unit
the (physical) unit of the data
Generic data structure for expressing physical values.
char phydat_prefix_from_scale(int8_t scale)
Convert the given scale factor to an SI prefix.
void phydat_dump(phydat_t *data, uint8_t dim)
Dump the given data container to STDIO.
@ UNIT_DPS
degree per second
@ UNIT_CPM3
count per cubic meter
@ UNIT_DATE
the 3 dimensions contain days, months and years
@ UNIT_BOOL
boolean value [0|1]
@ UNIT_DBM
decibel-milliwatts
@ UNIT_NONE
data has no physical unit
void phydat_fit(phydat_t *dat, const int32_t *values, unsigned int dim)
Scale integer value(s) to fit into a phydat_t.
@ UNIT_TIME
the three dimensions contain sec, min, and hours
@ UNIT_PPM
part per million
@ UNIT_GPM3
grams per cubic meter