Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sensor_value Struct Reference

Representation of a sensor readout value. More...

#include <sensor.h>

Data Fields

int32_t val1
 Integer part of the value.
 
int32_t val2
 Fractional part of the value (in one-millionth parts).
 

Detailed Description

Representation of a sensor readout value.

The value is represented as having an integer and a fractional part, and can be obtained using the formula val1 + val2 * 10^(-6). Negative values also adhere to the above formula, but may need special attention. Here are some examples of the value representation:

 0.5: val1 =  0, val2 =  500000
-0.5: val1 =  0, val2 = -500000
-1.0: val1 = -1, val2 =  0
-1.5: val1 = -1, val2 = -500000

Field Documentation

◆ val1

int32_t sensor_value::val1

Integer part of the value.

◆ val2

int32_t sensor_value::val2

Fractional part of the value (in one-millionth parts).


The documentation for this struct was generated from the following file: