Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sensor_data_types.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Google LLC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_DATA_TYPES_H
8#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_DATA_TYPES_H
9
10#include <zephyr/dsp/types.h>
12
13#include <inttypes.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
32
68
69#define PRIsensor_three_axis_data PRIu64 "ns, (%" PRIq(6) ", %" PRIq(6) ", %" PRIq(6) ")"
70
71#define PRIsensor_three_axis_data_arg(data_, readings_offset_) \
72 (data_).header.base_timestamp_ns + (data_).readings[(readings_offset_)].timestamp_delta, \
73 PRIq_arg((data_).readings[(readings_offset_)].x, 6, (data_).shift), \
74 PRIq_arg((data_).readings[(readings_offset_)].y, 6, (data_).shift), \
75 PRIq_arg((data_).readings[(readings_offset_)].z, 6, (data_).shift)
76
86
87#define PRIsensor_occurrence_data PRIu64 "ns"
88
89#define PRIsensor_occurrence_data_arg(data_, readings_offset_) \
90 (data_).header.base_timestamp_ns + (data_).readings[(readings_offset_)].timestamp_delta
91
117
118#define PRIsensor_q31_data PRIu64 "ns (%" PRIq(6) ")"
119
120#define PRIsensor_q31_data_arg(data_, readings_offset_) \
121 (data_).header.base_timestamp_ns + (data_).readings[(readings_offset_)].timestamp_delta, \
122 PRIq_arg((data_).readings[(readings_offset_)].value, 6, (data_).shift)
123
141
142#define PRIsensor_byte_data(field_name_) PRIu64 "ns (" STRINGIFY(field_name_) " = %" PRIu8 ")"
143
144#define PRIsensor_byte_data_arg(data_, readings_offset_, field_name_) \
145 (data_).header.base_timestamp_ns + (data_).readings[(readings_offset_)].timestamp_delta, \
146 (data_).readings[(readings_offset_)].field_name_
147
159
160#define PRIsensor_uint64_data PRIu64 "ns (%" PRIu64 ")"
161
162#define PRIsensor_uint64_data_arg(data_, readings_offset_) \
163 (data_).header.base_timestamp_ns + (data_).readings[(readings_offset_)].timestamp_delta, \
164 (data_).readings[(readings_offset_)].value
165
166#ifdef __cplusplus
167}
168#endif
169
170#endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_DATA_TYPES_H */
int32_t q31_t
32-bit fractional data type in 1.31 format.
Definition types.h:35
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT8_TYPE__ int8_t
Definition stdint.h:72
Definition sensor_data_types.h:130
uint8_t value
Definition sensor_data_types.h:133
uint8_t padding
Definition sensor_data_types.h:136
uint32_t timestamp_delta
Definition sensor_data_types.h:131
uint8_t is_near
Definition sensor_data_types.h:135
Data from a sensor that produces a byte of data.
Definition sensor_data_types.h:128
struct sensor_data_header header
Definition sensor_data_types.h:129
struct sensor_byte_data::sensor_byte_sample_data readings[1]
Definition sensor_data_types.h:19
uint64_t base_timestamp_ns
The closest timestamp for when the first frame was generated as attained by :c:func:k_uptime_ticks.
Definition sensor_data_types.h:24
uint16_t reading_count
The number of elements in the 'readings' array.
Definition sensor_data_types.h:30
uint32_t timestamp_delta
Definition sensor_data_types.h:83
Data from a sensor where we only care about an event occurring.
Definition sensor_data_types.h:80
struct sensor_data_header header
Definition sensor_data_types.h:81
struct sensor_occurrence_data::sensor_occurrence_sample_data readings[1]
Definition sensor_data_types.h:95
q31_t density_ppm
Unit: parts per million.
Definition sensor_data_types.h:105
q31_t density_ppb
Unit: parts per billion.
Definition sensor_data_types.h:106
q31_t density
Unit: ug/m^3.
Definition sensor_data_types.h:104
q31_t percent
Unit: percent.
Definition sensor_data_types.h:102
q31_t power
Unit: watts.
Definition sensor_data_types.h:110
q31_t current
Unit: amps.
Definition sensor_data_types.h:109
q31_t light
Unit: lux.
Definition sensor_data_types.h:99
q31_t temperature
Unit: degrees Celsius.
Definition sensor_data_types.h:101
q31_t angle
Unit: degrees.
Definition sensor_data_types.h:111
q31_t electric_charge
Unit: mAh.
Definition sensor_data_types.h:112
q31_t humidity
Unit: RH.
Definition sensor_data_types.h:113
q31_t distance
Unit: meters.
Definition sensor_data_types.h:103
q31_t pressure
Unit: kilopascal.
Definition sensor_data_types.h:100
q31_t resistance
Unit: ohms.
Definition sensor_data_types.h:107
q31_t voltage
Unit: volts.
Definition sensor_data_types.h:108
q31_t value
Definition sensor_data_types.h:98
uint32_t timestamp_delta
Definition sensor_data_types.h:96
Definition sensor_data_types.h:92
struct sensor_q31_data::sensor_q31_sample_data readings[1]
int8_t shift
Definition sensor_data_types.h:94
struct sensor_data_header header
Definition sensor_data_types.h:93
q31_t z
Definition sensor_data_types.h:63
q31_t x
Definition sensor_data_types.h:61
uint32_t timestamp_delta
Definition sensor_data_types.h:56
q31_t v[3]
Definition sensor_data_types.h:59
q31_t values[3]
Definition sensor_data_types.h:58
q31_t y
Definition sensor_data_types.h:62
Data for a sensor channel which reports on three axes.
Definition sensor_data_types.h:52
struct sensor_data_header header
Definition sensor_data_types.h:53
struct sensor_three_axis_data::sensor_three_axis_sample_data readings[1]
int8_t shift
Definition sensor_data_types.h:54
Definition sensor_data_types.h:154
uint64_t value
Definition sensor_data_types.h:156
uint32_t timestamp_delta
Definition sensor_data_types.h:155
Data from a sensor that produces a count like value.
Definition sensor_data_types.h:152
struct sensor_data_header header
Definition sensor_data_types.h:153
struct sensor_uint64_data::sensor_uint64_sample_data readings[1]