Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sensor.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2016 Intel Corporation
9 *
10 * SPDX-License-Identifier: Apache-2.0
11 */
12#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_H_
13#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_H_
14
24#include <errno.h>
25#include <stdlib.h>
26
27#include <zephyr/device.h>
29#include <zephyr/dsp/types.h>
30#include <zephyr/rtio/rtio.h>
32#include <zephyr/types.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
57
111
120
129
132
135
140
143
146
155
158
195
198
203
209
214};
215
282
292
366
374typedef void (*sensor_trigger_handler_t)(const struct device *dev,
375 const struct sensor_trigger *trigger);
376
383typedef int (*sensor_attr_set_t)(const struct device *dev,
384 enum sensor_channel chan,
385 enum sensor_attribute attr,
386 const struct sensor_value *val);
387
394typedef int (*sensor_attr_get_t)(const struct device *dev,
395 enum sensor_channel chan,
396 enum sensor_attribute attr,
397 struct sensor_value *val);
398
405typedef int (*sensor_trigger_set_t)(const struct device *dev,
406 const struct sensor_trigger *trig,
414typedef int (*sensor_sample_fetch_t)(const struct device *dev,
415 enum sensor_channel chan);
422typedef int (*sensor_channel_get_t)(const struct device *dev,
423 enum sensor_channel chan,
424 struct sensor_value *val);
425
438
440/* Ensure sensor_chan_spec is sensibly sized to pass by value */
441BUILD_ASSERT(sizeof(struct sensor_chan_spec) <= sizeof(uintptr_t),
442 "sensor_chan_spec size should be equal or less than the size of a machine word");
453static inline bool sensor_chan_spec_eq(struct sensor_chan_spec chan_spec0,
454 struct sensor_chan_spec chan_spec1)
455{
456 return chan_spec0.chan_type == chan_spec1.chan_type &&
457 chan_spec0.chan_idx == chan_spec1.chan_idx;
458}
459
476 int (*get_frame_count)(const uint8_t *buffer, struct sensor_chan_spec channel,
477 uint16_t *frame_count);
478
491 int (*get_size_info)(struct sensor_chan_spec channel, size_t *base_size,
492 size_t *frame_size);
493
519 int (*decode)(const uint8_t *buffer, struct sensor_chan_spec channel, uint32_t *fit,
520 uint16_t max_count, void *data_out);
521
529 bool (*has_trigger)(const uint8_t *buffer, enum sensor_trigger_type trigger);
530};
531
562
566#define SENSOR_DECODE_CONTEXT_INIT(decoder_, buffer_, channel_type_, channel_index_) \
567 { \
568 .decoder = (decoder_), \
569 .buffer = (buffer_), \
570 .channel = {.chan_type = (channel_type_), .chan_idx = (channel_index_)}, \
571 .fit = 0, \
572 }
573
582static inline int sensor_decode(struct sensor_decode_context *ctx, void *out, uint16_t max_count)
583{
584 return ctx->decoder->decode(ctx->buffer, ctx->channel, &ctx->fit, max_count, out);
585}
586
588 size_t *frame_size);
589
596typedef int (*sensor_get_decoder_t)(const struct device *dev,
597 const struct sensor_decoder_api **api);
598
610
615
616#define SENSOR_STREAM_TRIGGER_PREP(_trigger, _opt) \
617 { \
618 .trigger = (_trigger), .opt = (_opt), \
619 }
620
621/*
622 * Internal data structure used to store information about the IODevice for async reading and
623 * streaming sensor data.
624 */
626 const struct device *sensor;
627 const bool is_streaming;
628 union {
631 };
632 size_t count;
633 const size_t max;
634};
635
651#define SENSOR_DT_READ_IODEV(name, dt_node, ...) \
652 static struct sensor_chan_spec _CONCAT(__channel_array_, name)[] = {__VA_ARGS__}; \
653 static struct sensor_read_config _CONCAT(__sensor_read_config_, name) = { \
654 .sensor = DEVICE_DT_GET(dt_node), \
655 .is_streaming = false, \
656 .channels = _CONCAT(__channel_array_, name), \
657 .count = ARRAY_SIZE(_CONCAT(__channel_array_, name)), \
658 .max = ARRAY_SIZE(_CONCAT(__channel_array_, name)), \
659 }; \
660 RTIO_IODEV_DEFINE(name, &__sensor_iodev_api, _CONCAT(&__sensor_read_config_, name))
661
681#define SENSOR_DT_STREAM_IODEV(name, dt_node, ...) \
682 static struct sensor_stream_trigger _CONCAT(__trigger_array_, name)[] = {__VA_ARGS__}; \
683 static struct sensor_read_config _CONCAT(__sensor_read_config_, name) = { \
684 .sensor = DEVICE_DT_GET(dt_node), \
685 .is_streaming = true, \
686 .triggers = _CONCAT(__trigger_array_, name), \
687 .count = ARRAY_SIZE(_CONCAT(__trigger_array_, name)), \
688 .max = ARRAY_SIZE(_CONCAT(__trigger_array_, name)), \
689 }; \
690 RTIO_IODEV_DEFINE(name, &__sensor_iodev_api, &_CONCAT(__sensor_read_config_, name))
691
692/* Used to submit an RTIO sqe to the sensor's iodev */
693typedef void (*sensor_submit_t)(const struct device *sensor, struct rtio_iodev_sqe *sqe);
694
695/* The default decoder API */
696extern const struct sensor_decoder_api __sensor_default_decoder;
697
698/* The default sensor iodev API */
699extern const struct rtio_iodev_api __sensor_iodev_api;
700
710
723__syscall int sensor_attr_set(const struct device *dev,
724 enum sensor_channel chan,
725 enum sensor_attribute attr,
726 const struct sensor_value *val);
727
728static inline int z_impl_sensor_attr_set(const struct device *dev,
729 enum sensor_channel chan,
730 enum sensor_attribute attr,
731 const struct sensor_value *val)
732{
733 const struct sensor_driver_api *api =
734 (const struct sensor_driver_api *)dev->api;
735
736 if (api->attr_set == NULL) {
737 return -ENOSYS;
738 }
739
740 return api->attr_set(dev, chan, attr, val);
741}
742
755__syscall int sensor_attr_get(const struct device *dev,
756 enum sensor_channel chan,
757 enum sensor_attribute attr,
758 struct sensor_value *val);
759
760static inline int z_impl_sensor_attr_get(const struct device *dev,
761 enum sensor_channel chan,
762 enum sensor_attribute attr,
763 struct sensor_value *val)
764{
765 const struct sensor_driver_api *api =
766 (const struct sensor_driver_api *)dev->api;
767
768 if (api->attr_get == NULL) {
769 return -ENOSYS;
770 }
771
772 return api->attr_get(dev, chan, attr, val);
773}
774
797static inline int sensor_trigger_set(const struct device *dev,
798 const struct sensor_trigger *trig,
800{
801 const struct sensor_driver_api *api =
802 (const struct sensor_driver_api *)dev->api;
803
804 if (api->trigger_set == NULL) {
805 return -ENOSYS;
806 }
807
808 return api->trigger_set(dev, trig, handler);
809}
810
829__syscall int sensor_sample_fetch(const struct device *dev);
830
831static inline int z_impl_sensor_sample_fetch(const struct device *dev)
832{
833 const struct sensor_driver_api *api =
834 (const struct sensor_driver_api *)dev->api;
835
836 return api->sample_fetch(dev, SENSOR_CHAN_ALL);
837}
838
860__syscall int sensor_sample_fetch_chan(const struct device *dev,
861 enum sensor_channel type);
862
863static inline int z_impl_sensor_sample_fetch_chan(const struct device *dev,
864 enum sensor_channel type)
865{
866 const struct sensor_driver_api *api =
867 (const struct sensor_driver_api *)dev->api;
868
869 return api->sample_fetch(dev, type);
870}
871
893__syscall int sensor_channel_get(const struct device *dev,
894 enum sensor_channel chan,
895 struct sensor_value *val);
896
897static inline int z_impl_sensor_channel_get(const struct device *dev,
898 enum sensor_channel chan,
899 struct sensor_value *val)
900{
901 const struct sensor_driver_api *api =
902 (const struct sensor_driver_api *)dev->api;
903
904 return api->channel_get(dev, chan, val);
905}
906
907#if defined(CONFIG_SENSOR_ASYNC_API) || defined(__DOXYGEN__)
908
909/*
910 * Generic data structure used for encoding the sample timestamp and number of channels sampled.
911 */
912struct __attribute__((__packed__)) sensor_data_generic_header {
913 /* The timestamp at which the data was collected from the sensor */
915
916 /*
917 * The number of channels present in the frame. This will be the true number of elements in
918 * channel_info and in the q31 values that follow the header.
919 */
921
922 /* Shift value for all samples in the frame */
924
925 /* This padding is needed to make sure that the 'channels' field is aligned */
926 int8_t _padding[sizeof(struct sensor_chan_spec) - 1];
927
928 /* Channels present in the frame */
929 struct sensor_chan_spec channels[0];
930};
931
940#define SENSOR_CHANNEL_3_AXIS(chan) \
941 ((chan) == SENSOR_CHAN_ACCEL_XYZ || (chan) == SENSOR_CHAN_GYRO_XYZ || \
942 (chan) == SENSOR_CHAN_MAGN_XYZ || (chan) == SENSOR_CHAN_POS_DXYZ)
943
952#define SENSOR_CHANNEL_IS_ACCEL(chan) \
953 ((chan) == SENSOR_CHAN_ACCEL_XYZ || (chan) == SENSOR_CHAN_ACCEL_X || \
954 (chan) == SENSOR_CHAN_ACCEL_Y || (chan) == SENSOR_CHAN_ACCEL_Z)
955
964#define SENSOR_CHANNEL_IS_GYRO(chan) \
965 ((chan) == SENSOR_CHAN_GYRO_XYZ || (chan) == SENSOR_CHAN_GYRO_X || \
966 (chan) == SENSOR_CHAN_GYRO_Y || (chan) == SENSOR_CHAN_GYRO_Z)
967
976__syscall int sensor_get_decoder(const struct device *dev,
977 const struct sensor_decoder_api **decoder);
978
979static inline int z_impl_sensor_get_decoder(const struct device *dev,
980 const struct sensor_decoder_api **decoder)
981{
982 const struct sensor_driver_api *api = (const struct sensor_driver_api *)dev->api;
983
984 __ASSERT_NO_MSG(api != NULL);
985
986 if (api->get_decoder == NULL) {
987 *decoder = &__sensor_default_decoder;
988 return 0;
989 }
990
991 return api->get_decoder(dev, decoder);
992}
993
1012__syscall int sensor_reconfigure_read_iodev(struct rtio_iodev *iodev, const struct device *sensor,
1013 const struct sensor_chan_spec *channels,
1014 size_t num_channels);
1015
1016static inline int z_impl_sensor_reconfigure_read_iodev(struct rtio_iodev *iodev,
1017 const struct device *sensor,
1018 const struct sensor_chan_spec *channels,
1019 size_t num_channels)
1020{
1021 struct sensor_read_config *cfg = (struct sensor_read_config *)iodev->data;
1022
1023 if (cfg->max < num_channels || cfg->is_streaming) {
1024 return -ENOMEM;
1025 }
1026
1027 cfg->sensor = sensor;
1028 memcpy(cfg->channels, channels, num_channels * sizeof(struct sensor_chan_spec));
1029 cfg->count = num_channels;
1030 return 0;
1031}
1032
1033static inline int sensor_stream(struct rtio_iodev *iodev, struct rtio *ctx, void *userdata,
1034 struct rtio_sqe **handle)
1035{
1036 if (IS_ENABLED(CONFIG_USERSPACE)) {
1037 struct rtio_sqe sqe;
1038
1040 rtio_sqe_copy_in_get_handles(ctx, &sqe, handle, 1);
1041 } else {
1042 struct rtio_sqe *sqe = rtio_sqe_acquire(ctx);
1043
1044 if (sqe == NULL) {
1045 return -ENOMEM;
1046 }
1047 if (handle != NULL) {
1048 *handle = sqe;
1049 }
1051 }
1052 rtio_submit(ctx, 0);
1053 return 0;
1054}
1055
1070static inline int sensor_read(struct rtio_iodev *iodev, struct rtio *ctx, uint8_t *buf,
1071 size_t buf_len)
1072{
1073 if (IS_ENABLED(CONFIG_USERSPACE)) {
1074 struct rtio_sqe sqe;
1075
1077 rtio_sqe_copy_in(ctx, &sqe, 1);
1078 } else {
1079 struct rtio_sqe *sqe = rtio_sqe_acquire(ctx);
1080
1081 if (sqe == NULL) {
1082 return -ENOMEM;
1083 }
1085 }
1086 rtio_submit(ctx, 0);
1087
1088 struct rtio_cqe *cqe = rtio_cqe_consume_block(ctx);
1089 int res = cqe->result;
1090
1091 __ASSERT(cqe->userdata == buf,
1092 "consumed non-matching completion for sensor read into buffer %p\n", buf);
1093
1094 rtio_cqe_release(ctx, cqe);
1095
1096 return res;
1097}
1098
1112static inline int sensor_read_async_mempool(struct rtio_iodev *iodev, struct rtio *ctx,
1113 void *userdata)
1114{
1115 if (IS_ENABLED(CONFIG_USERSPACE)) {
1116 struct rtio_sqe sqe;
1117
1119 rtio_sqe_copy_in(ctx, &sqe, 1);
1120 } else {
1121 struct rtio_sqe *sqe = rtio_sqe_acquire(ctx);
1122
1123 if (sqe == NULL) {
1124 return -ENOMEM;
1125 }
1127 }
1128 rtio_submit(ctx, 0);
1129 return 0;
1130}
1131
1144 void *userdata);
1145
1158
1159#endif /* defined(CONFIG_SENSOR_ASYNC_API) || defined(__DOXYGEN__) */
1160
1164#define SENSOR_G 9806650LL
1165
1169#define SENSOR_PI 3141592LL
1170
1179static inline int32_t sensor_ms2_to_g(const struct sensor_value *ms2)
1180{
1181 int64_t micro_ms2 = ms2->val1 * 1000000LL + ms2->val2;
1182
1183 if (micro_ms2 > 0) {
1184 return (micro_ms2 + SENSOR_G / 2) / SENSOR_G;
1185 } else {
1186 return (micro_ms2 - SENSOR_G / 2) / SENSOR_G;
1187 }
1188}
1189
1196static inline void sensor_g_to_ms2(int32_t g, struct sensor_value *ms2)
1197{
1198 ms2->val1 = ((int64_t)g * SENSOR_G) / 1000000LL;
1199 ms2->val2 = ((int64_t)g * SENSOR_G) % 1000000LL;
1200}
1201
1210static inline int32_t sensor_ms2_to_ug(const struct sensor_value *ms2)
1211{
1212 int64_t micro_ms2 = (ms2->val1 * INT64_C(1000000)) + ms2->val2;
1213
1214 return (micro_ms2 * 1000000LL) / SENSOR_G;
1215}
1216
1223static inline void sensor_ug_to_ms2(int32_t ug, struct sensor_value *ms2)
1224{
1225 ms2->val1 = ((int64_t)ug * SENSOR_G / 1000000LL) / 1000000LL;
1226 ms2->val2 = ((int64_t)ug * SENSOR_G / 1000000LL) % 1000000LL;
1227}
1228
1236static inline int32_t sensor_rad_to_degrees(const struct sensor_value *rad)
1237{
1238 int64_t micro_rad_s = rad->val1 * 1000000LL + rad->val2;
1239
1240 if (micro_rad_s > 0) {
1241 return (micro_rad_s * 180LL + SENSOR_PI / 2) / SENSOR_PI;
1242 } else {
1243 return (micro_rad_s * 180LL - SENSOR_PI / 2) / SENSOR_PI;
1244 }
1245}
1246
1253static inline void sensor_degrees_to_rad(int32_t d, struct sensor_value *rad)
1254{
1255 rad->val1 = ((int64_t)d * SENSOR_PI / 180LL) / 1000000LL;
1256 rad->val2 = ((int64_t)d * SENSOR_PI / 180LL) % 1000000LL;
1257}
1258
1270static inline int32_t sensor_rad_to_10udegrees(const struct sensor_value *rad)
1271{
1272 int64_t micro_rad_s = rad->val1 * 1000000LL + rad->val2;
1273
1274 return (micro_rad_s * 180LL * 100000LL) / SENSOR_PI;
1275}
1276
1283static inline void sensor_10udegrees_to_rad(int32_t d, struct sensor_value *rad)
1284{
1285 rad->val1 = ((int64_t)d * SENSOR_PI / 180LL / 100000LL) / 1000000LL;
1286 rad->val2 = ((int64_t)d * SENSOR_PI / 180LL / 100000LL) % 1000000LL;
1287}
1288
1295static inline double sensor_value_to_double(const struct sensor_value *val)
1296{
1297 return (double)val->val1 + (double)val->val2 / 1000000;
1298}
1299
1306static inline float sensor_value_to_float(const struct sensor_value *val)
1307{
1308 return (float)val->val1 + (float)val->val2 / 1000000;
1309}
1310
1318static inline int sensor_value_from_double(struct sensor_value *val, double inp)
1319{
1320 if (inp < INT32_MIN || inp > INT32_MAX) {
1321 return -ERANGE;
1322 }
1323
1324 double val2 = (inp - (int32_t)inp) * 1000000.0;
1325
1326 if (val2 < INT32_MIN || val2 > INT32_MAX) {
1327 return -ERANGE;
1328 }
1329
1330 val->val1 = (int32_t)inp;
1331 val->val2 = (int32_t)val2;
1332
1333 return 0;
1334}
1335
1343static inline int sensor_value_from_float(struct sensor_value *val, float inp)
1344{
1345 float val2 = (inp - (int32_t)inp) * 1000000.0f;
1346
1347 if (val2 < INT32_MIN || val2 > (float)(INT32_MAX - 1)) {
1348 return -ERANGE;
1349 }
1350
1351 val->val1 = (int32_t)inp;
1352 val->val2 = (int32_t)val2;
1353
1354 return 0;
1355}
1356
1357#ifdef CONFIG_SENSOR_INFO
1358
1359struct sensor_info {
1360 const struct device *dev;
1361 const char *vendor;
1362 const char *model;
1363 const char *friendly_name;
1364};
1365
1366#define SENSOR_INFO_INITIALIZER(_dev, _vendor, _model, _friendly_name) \
1367 { \
1368 .dev = _dev, \
1369 .vendor = _vendor, \
1370 .model = _model, \
1371 .friendly_name = _friendly_name, \
1372 }
1373
1374#define SENSOR_INFO_DEFINE(name, ...) \
1375 static const STRUCT_SECTION_ITERABLE(sensor_info, name) = \
1376 SENSOR_INFO_INITIALIZER(__VA_ARGS__)
1377
1378#define SENSOR_INFO_DT_NAME(node_id) \
1379 _CONCAT(__sensor_info, DEVICE_DT_NAME_GET(node_id))
1380
1381#define SENSOR_INFO_DT_DEFINE(node_id) \
1382 SENSOR_INFO_DEFINE(SENSOR_INFO_DT_NAME(node_id), \
1383 DEVICE_DT_GET(node_id), \
1384 DT_NODE_VENDOR_OR(node_id, NULL), \
1385 DT_NODE_MODEL_OR(node_id, NULL), \
1386 DT_PROP_OR(node_id, friendly_name, NULL)) \
1387
1388#else
1389
1390#define SENSOR_INFO_DEFINE(name, ...)
1391#define SENSOR_INFO_DT_DEFINE(node_id)
1392
1393#endif /* CONFIG_SENSOR_INFO */
1394
1422#define SENSOR_DEVICE_DT_DEFINE(node_id, init_fn, pm_device, \
1423 data_ptr, cfg_ptr, level, prio, \
1424 api_ptr, ...) \
1425 DEVICE_DT_DEFINE(node_id, init_fn, pm_device, \
1426 data_ptr, cfg_ptr, level, prio, \
1427 api_ptr, __VA_ARGS__); \
1428 \
1429 SENSOR_INFO_DT_DEFINE(node_id);
1430
1440#define SENSOR_DEVICE_DT_INST_DEFINE(inst, ...) \
1441 SENSOR_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
1442
1449static inline int64_t sensor_value_to_milli(const struct sensor_value *val)
1450{
1451 return ((int64_t)val->val1 * 1000) + val->val2 / 1000;
1452}
1453
1460static inline int64_t sensor_value_to_micro(const struct sensor_value *val)
1461{
1462 return ((int64_t)val->val1 * 1000000) + val->val2;
1463}
1464
1472static inline int sensor_value_from_milli(struct sensor_value *val, int64_t milli)
1473{
1474 if (milli < ((int64_t)INT32_MIN - 1) * 1000LL ||
1475 milli > ((int64_t)INT32_MAX + 1) * 1000LL) {
1476 return -ERANGE;
1477 }
1478
1479 val->val1 = (int32_t)(milli / 1000);
1480 val->val2 = (int32_t)(milli % 1000) * 1000;
1481
1482 return 0;
1483}
1484
1492static inline int sensor_value_from_micro(struct sensor_value *val, int64_t micro)
1493{
1494 if (micro < ((int64_t)INT32_MIN - 1) * 1000000LL ||
1495 micro > ((int64_t)INT32_MAX + 1) * 1000000LL) {
1496 return -ERANGE;
1497 }
1498
1499 val->val1 = (int32_t)(micro / 1000000LL);
1500 val->val2 = (int32_t)(micro % 1000000LL);
1501
1502 return 0;
1503}
1504
1514#define SENSOR_DECODER_NAME() UTIL_CAT(DT_DRV_COMPAT, __decoder_api)
1515
1523#define SENSOR_DECODER_DT_GET(node_id) \
1524 &UTIL_CAT(DT_STRING_TOKEN_BY_IDX(node_id, compatible, 0), __decoder_api)
1525
1541#define SENSOR_DECODER_API_DT_DEFINE() \
1542 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT), (), (static)) \
1543 const STRUCT_SECTION_ITERABLE(sensor_decoder_api, SENSOR_DECODER_NAME())
1544
1545#define Z_MAYBE_SENSOR_DECODER_DECLARE_INTERNAL_IDX(node_id, prop, idx) \
1546 extern const struct sensor_decoder_api UTIL_CAT( \
1547 DT_STRING_TOKEN_BY_IDX(node_id, prop, idx), __decoder_api);
1548
1549#define Z_MAYBE_SENSOR_DECODER_DECLARE_INTERNAL(node_id) \
1550 COND_CODE_1(DT_NODE_HAS_PROP(node_id, compatible), \
1551 (DT_FOREACH_PROP_ELEM(node_id, compatible, \
1552 Z_MAYBE_SENSOR_DECODER_DECLARE_INTERNAL_IDX)), \
1553 ())
1554
1555DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_SENSOR_DECODER_DECLARE_INTERNAL)
1556
1557#ifdef __cplusplus
1558}
1559#endif
1560
1561#include <zephyr/syscalls/sensor.h>
1562
1563#endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_H_ */
irp nz macro MOVR cc d
Definition asm-macro-32-bit-gnu.h:11
System error numbers.
#define DT_FOREACH_STATUS_OKAY_NODE(fn)
Invokes fn for every status okay node in the tree.
Definition devicetree.h:2960
#define RTIO_PRIO_NORM
Normal priority.
Definition rtio.h:70
static void rtio_sqe_prep_read_with_pool(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, void *userdata)
Prepare a read op submission with context's mempool.
Definition rtio.h:595
static int rtio_sqe_copy_in(struct rtio *r, const struct rtio_sqe *sqes, size_t sqe_count)
Copy an array of SQEs into the queue.
Definition rtio.h:1448
int rtio_sqe_copy_in_get_handles(struct rtio *r, const struct rtio_sqe *sqes, struct rtio_sqe **handle, size_t sqe_count)
Copy an array of SQEs into the queue and get resulting handles back.
static void rtio_sqe_prep_read(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, uint8_t *buf, uint32_t len, void *userdata)
Prepare a read op submission.
Definition rtio.h:574
static struct rtio_sqe * rtio_sqe_acquire(struct rtio *r)
Acquire a single submission queue event if available.
Definition rtio.h:1002
static void rtio_sqe_prep_read_multishot(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, void *userdata)
Definition rtio.h:603
static void rtio_cqe_release(struct rtio *r, struct rtio_cqe *cqe)
Release consumed completion queue event.
Definition rtio.h:1121
static struct rtio_cqe * rtio_cqe_consume_block(struct rtio *r)
Wait for and consume a single completion queue event.
Definition rtio.h:1097
int rtio_submit(struct rtio *r, uint32_t wait_count)
Submit I/O requests to the underlying executor.
#define SENSOR_G
The value of gravitational constant in micro m/s^2.
Definition sensor.h:1164
int(* sensor_attr_get_t)(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, struct sensor_value *val)
Callback API upon getting a sensor's attributes.
Definition sensor.h:394
static int sensor_decode(struct sensor_decode_context *ctx, void *out, uint16_t max_count)
Decode N frames using a sensor_decode_context.
Definition sensor.h:582
static int32_t sensor_rad_to_degrees(const struct sensor_value *rad)
Helper function for converting radians to degrees.
Definition sensor.h:1236
sensor_trigger_type
Sensor trigger types.
Definition sensor.h:219
sensor_attribute
Sensor attribute types.
Definition sensor.h:296
int sensor_get_decoder(const struct device *dev, const struct sensor_decoder_api **decoder)
Get the sensor's decoder API.
static int sensor_read(struct rtio_iodev *iodev, struct rtio *ctx, uint8_t *buf, size_t buf_len)
Blocking one shot read of samples from a sensor into a buffer.
Definition sensor.h:1070
int(* sensor_get_decoder_t)(const struct device *dev, const struct sensor_decoder_api **api)
Get the decoder associate with the given device.
Definition sensor.h:596
static void sensor_ug_to_ms2(int32_t ug, struct sensor_value *ms2)
Helper function to convert acceleration from micro Gs to m/s^2.
Definition sensor.h:1223
static double sensor_value_to_double(const struct sensor_value *val)
Helper function for converting struct sensor_value to double.
Definition sensor.h:1295
static float sensor_value_to_float(const struct sensor_value *val)
Helper function for converting struct sensor_value to float.
Definition sensor.h:1306
int sensor_natively_supported_channel_size_info(struct sensor_chan_spec channel, size_t *base_size, size_t *frame_size)
int(* sensor_attr_set_t)(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, const struct sensor_value *val)
Callback API upon setting a sensor's attributes.
Definition sensor.h:383
static void sensor_degrees_to_rad(int32_t d, struct sensor_value *rad)
Helper function for converting degrees to radians.
Definition sensor.h:1253
static int32_t sensor_ms2_to_ug(const struct sensor_value *ms2)
Helper function to convert acceleration from m/s^2 to micro Gs.
Definition sensor.h:1210
int(* sensor_channel_get_t)(const struct device *dev, enum sensor_channel chan, struct sensor_value *val)
Callback API for getting a reading from a sensor.
Definition sensor.h:422
static int sensor_value_from_float(struct sensor_value *val, float inp)
Helper function for converting float to struct sensor_value.
Definition sensor.h:1343
static void sensor_g_to_ms2(int32_t g, struct sensor_value *ms2)
Helper function to convert acceleration from Gs to m/s^2.
Definition sensor.h:1196
static int64_t sensor_value_to_milli(const struct sensor_value *val)
Helper function for converting struct sensor_value to integer milli units.
Definition sensor.h:1449
#define SENSOR_PI
The value of constant PI in micros.
Definition sensor.h:1169
static int sensor_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler)
Activate a sensor's trigger and set the trigger handler.
Definition sensor.h:797
sensor_stream_data_opt
Options for what to do with the associated data when a trigger is consumed.
Definition sensor.h:602
static int sensor_value_from_milli(struct sensor_value *val, int64_t milli)
Helper function for converting integer milli units to struct sensor_value.
Definition sensor.h:1472
void(* sensor_trigger_handler_t)(const struct device *dev, const struct sensor_trigger *trigger)
Callback API upon firing of a trigger.
Definition sensor.h:374
static int64_t sensor_value_to_micro(const struct sensor_value *val)
Helper function for converting struct sensor_value to integer micro units.
Definition sensor.h:1460
int sensor_channel_get(const struct device *dev, enum sensor_channel chan, struct sensor_value *val)
Get a reading from a sensor device.
int sensor_sample_fetch(const struct device *dev)
Fetch a sample from the sensor and store it in an internal driver buffer.
void(* sensor_processing_callback_t)(int result, uint8_t *buf, uint32_t buf_len, void *userdata)
Callback function used with the helper processing function.
Definition sensor.h:1143
sensor_channel
Sensor channels.
Definition sensor.h:61
static void sensor_10udegrees_to_rad(int32_t d, struct sensor_value *rad)
Helper function for converting 10 micro degrees to radians.
Definition sensor.h:1283
static int32_t sensor_ms2_to_g(const struct sensor_value *ms2)
Helper function to convert acceleration from m/s^2 to Gs.
Definition sensor.h:1179
int sensor_reconfigure_read_iodev(struct rtio_iodev *iodev, const struct device *sensor, const struct sensor_chan_spec *channels, size_t num_channels)
Reconfigure a reading iodev.
static int sensor_read_async_mempool(struct rtio_iodev *iodev, struct rtio *ctx, void *userdata)
One shot non-blocking read with pool allocated buffer.
Definition sensor.h:1112
void sensor_processing_with_callback(struct rtio *ctx, sensor_processing_callback_t cb)
Helper function for common processing of sensor data.
static int sensor_value_from_micro(struct sensor_value *val, int64_t micro)
Helper function for converting integer micro units to struct sensor_value.
Definition sensor.h:1492
int sensor_sample_fetch_chan(const struct device *dev, enum sensor_channel type)
Fetch a sample from the sensor and store it in an internal driver buffer.
static int sensor_stream(struct rtio_iodev *iodev, struct rtio *ctx, void *userdata, struct rtio_sqe **handle)
Definition sensor.h:1033
int(* sensor_sample_fetch_t)(const struct device *dev, enum sensor_channel chan)
Callback API for fetching data from a sensor.
Definition sensor.h:414
void(* sensor_submit_t)(const struct device *sensor, struct rtio_iodev_sqe *sqe)
Definition sensor.h:693
int(* sensor_trigger_set_t)(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler)
Callback API for setting a sensor's trigger and handler.
Definition sensor.h:405
static int32_t sensor_rad_to_10udegrees(const struct sensor_value *rad)
Helper function for converting radians to 10 micro degrees.
Definition sensor.h:1270
static bool sensor_chan_spec_eq(struct sensor_chan_spec chan_spec0, struct sensor_chan_spec chan_spec1)
Check if channel specs are equivalent.
Definition sensor.h:453
int sensor_attr_get(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, struct sensor_value *val)
Get an attribute for a sensor.
static int sensor_value_from_double(struct sensor_value *val, double inp)
Helper function for converting double to struct sensor_value.
Definition sensor.h:1318
int sensor_attr_set(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, const struct sensor_value *val)
Set an attribute for a sensor.
@ SENSOR_TRIG_DELTA
Trigger fires when the selected channel varies significantly.
Definition sensor.h:235
@ SENSOR_TRIG_NEAR_FAR
Trigger fires when a near/far event is detected.
Definition sensor.h:237
@ SENSOR_TRIG_FREEFALL
Trigger fires when a free fall is detected.
Definition sensor.h:253
@ SENSOR_TRIG_PRIV_START
This and higher values are sensor specific.
Definition sensor.h:275
@ SENSOR_TRIG_FIFO_FULL
Trigger fires when the FIFO becomes full.
Definition sensor.h:265
@ SENSOR_TRIG_MOTION
Trigger fires when motion is detected.
Definition sensor.h:256
@ SENSOR_TRIG_STATIONARY
Trigger fires when no motion has been detected for a while.
Definition sensor.h:259
@ SENSOR_TRIG_COMMON_COUNT
Number of all common sensor triggers.
Definition sensor.h:269
@ SENSOR_TRIG_THRESHOLD
Trigger fires when channel reading transitions configured thresholds.
Definition sensor.h:244
@ SENSOR_TRIG_MAX
Maximum value describing a sensor trigger type.
Definition sensor.h:280
@ SENSOR_TRIG_DOUBLE_TAP
Trigger fires when a double tap is detected.
Definition sensor.h:250
@ SENSOR_TRIG_TIMER
Timer-based trigger, useful when the sensor does not have an interrupt line.
Definition sensor.h:224
@ SENSOR_TRIG_FIFO_WATERMARK
Trigger fires when the FIFO watermark has been reached.
Definition sensor.h:262
@ SENSOR_TRIG_TAP
Trigger fires when a single tap is detected.
Definition sensor.h:247
@ SENSOR_TRIG_DATA_READY
Trigger fires whenever new data is ready.
Definition sensor.h:226
@ SENSOR_ATTR_HYSTERESIS
Definition sensor.h:314
@ SENSOR_ATTR_FEATURE_MASK
Enable/disable sensor features.
Definition sensor.h:334
@ SENSOR_ATTR_CALIB_TARGET
Calibration target.
Definition sensor.h:328
@ SENSOR_ATTR_OFFSET
The sensor value returned will be altered by the amount indicated by offset: final_value = sensor_val...
Definition sensor.h:323
@ SENSOR_ATTR_BATCH_DURATION
Hardware batch duration in ticks.
Definition sensor.h:345
@ SENSOR_ATTR_OVERSAMPLING
Oversampling factor.
Definition sensor.h:316
@ SENSOR_ATTR_FF_DUR
Free-fall duration represented in milliseconds.
Definition sensor.h:342
@ SENSOR_ATTR_UPPER_THRESH
Upper threshold for trigger.
Definition sensor.h:305
@ SENSOR_ATTR_CONFIGURATION
Configure the operating modes of a sensor.
Definition sensor.h:330
@ SENSOR_ATTR_RESOLUTION
Definition sensor.h:349
@ SENSOR_ATTR_CALIBRATION
Set a calibration value needed by a sensor.
Definition sensor.h:332
@ SENSOR_ATTR_COMMON_COUNT
Number of all common sensor attributes.
Definition sensor.h:353
@ SENSOR_ATTR_ALERT
Alert threshold or alert enable/disable.
Definition sensor.h:336
@ SENSOR_ATTR_SLOPE_TH
Threshold for any-motion (slope) trigger.
Definition sensor.h:307
@ SENSOR_ATTR_GAIN
Definition sensor.h:347
@ SENSOR_ATTR_SAMPLING_FREQUENCY
Sensor sampling frequency, i.e.
Definition sensor.h:301
@ SENSOR_ATTR_FULL_SCALE
Sensor range, in SI units.
Definition sensor.h:318
@ SENSOR_ATTR_LOWER_THRESH
Lower threshold for trigger.
Definition sensor.h:303
@ SENSOR_ATTR_SLOPE_DUR
Duration for which the slope values needs to be outside the threshold for the trigger to fire.
Definition sensor.h:312
@ SENSOR_ATTR_MAX
Maximum value describing a sensor attribute type.
Definition sensor.h:364
@ SENSOR_ATTR_PRIV_START
This and higher values are sensor specific.
Definition sensor.h:359
@ SENSOR_STREAM_DATA_INCLUDE
Include whatever data is associated with the trigger.
Definition sensor.h:604
@ SENSOR_STREAM_DATA_NOP
Do nothing with the associated trigger data, it may be consumed later.
Definition sensor.h:606
@ SENSOR_STREAM_DATA_DROP
Flush/clear whatever data is associated with the trigger.
Definition sensor.h:608
@ SENSOR_CHAN_GAUGE_STATE_OF_HEALTH
State of health measurement in %.
Definition sensor.h:182
@ SENSOR_CHAN_PM_1_0
1.0 micro-meters Particulate Matter, in ug/m^3
Definition sensor.h:113
@ SENSOR_CHAN_DIE_TEMP
Device die temperature in degrees Celsius.
Definition sensor.h:87
@ SENSOR_CHAN_PRESS
Pressure in kilopascal.
Definition sensor.h:91
@ SENSOR_CHAN_GAUGE_TIME_TO_FULL
Time to full in minutes.
Definition sensor.h:186
@ SENSOR_CHAN_ACCEL_XYZ
Acceleration on the X, Y and Z axes.
Definition sensor.h:69
@ SENSOR_CHAN_MAGN_X
Magnetic field on the X axis, in Gauss.
Definition sensor.h:79
@ SENSOR_CHAN_O2
O2 level, in parts per million (ppm)
Definition sensor.h:124
@ SENSOR_CHAN_CURRENT
Current, in amps.
Definition sensor.h:137
@ SENSOR_CHAN_GYRO_XYZ
Angular velocity around the X, Y and Z axes.
Definition sensor.h:77
@ SENSOR_CHAN_VSHUNT
Current Shunt Voltage in milli-volts.
Definition sensor.h:134
@ SENSOR_CHAN_GREEN
Illuminance in green spectrum, in lux.
Definition sensor.h:106
@ SENSOR_CHAN_MAGN_Z
Magnetic field on the Z axis, in Gauss.
Definition sensor.h:83
@ SENSOR_CHAN_MAGN_Y
Magnetic field on the Y axis, in Gauss.
Definition sensor.h:81
@ SENSOR_CHAN_GAUGE_DESIRED_VOLTAGE
Desired voltage of cell in V (nominal voltage)
Definition sensor.h:192
@ SENSOR_CHAN_POWER
Power in watts.
Definition sensor.h:139
@ SENSOR_CHAN_PM_2_5
2.5 micro-meters Particulate Matter, in ug/m^3
Definition sensor.h:115
@ SENSOR_CHAN_RESISTANCE
Resistance , in Ohm.
Definition sensor.h:142
@ SENSOR_CHAN_GAUGE_AVG_CURRENT
Average current, in amps.
Definition sensor.h:162
@ SENSOR_CHAN_GYRO_Y
Angular velocity around the Y axis, in radians/s.
Definition sensor.h:73
@ SENSOR_CHAN_GAUGE_DESIRED_CHARGING_CURRENT
Desired charging current in mA.
Definition sensor.h:194
@ SENSOR_CHAN_GAUGE_FULL_CHARGE_CAPACITY
Full Charge Capacity in mAh.
Definition sensor.h:172
@ SENSOR_CHAN_ROTATION
Angular rotation, in degrees.
Definition sensor.h:145
@ SENSOR_CHAN_AMBIENT_TEMP
Ambient temperature in degrees Celsius.
Definition sensor.h:89
@ SENSOR_CHAN_MAGN_XYZ
Magnetic field on the X, Y and Z axes.
Definition sensor.h:85
@ SENSOR_CHAN_GAUGE_STDBY_CURRENT
Standby current, in amps.
Definition sensor.h:164
@ SENSOR_CHAN_GAUGE_MAX_LOAD_CURRENT
Max load current, in amps.
Definition sensor.h:166
@ SENSOR_CHAN_ACCEL_Y
Acceleration on the Y axis, in m/s^2.
Definition sensor.h:65
@ SENSOR_CHAN_RPM
Revolutions per minute, in RPM.
Definition sensor.h:157
@ SENSOR_CHAN_GAUGE_FULL_AVAIL_CAPACITY
Full Available Capacity in mAh.
Definition sensor.h:178
@ SENSOR_CHAN_VOLTAGE
Voltage, in volts.
Definition sensor.h:131
@ SENSOR_CHAN_BLUE
Illuminance in blue spectrum, in lux.
Definition sensor.h:108
@ SENSOR_CHAN_LIGHT
Illuminance in visible spectrum, in lux.
Definition sensor.h:100
@ SENSOR_CHAN_GAUGE_DESIGN_VOLTAGE
Design voltage of cell in V (max voltage)
Definition sensor.h:190
@ SENSOR_CHAN_ACCEL_Z
Acceleration on the Z axis, in m/s^2.
Definition sensor.h:67
@ SENSOR_CHAN_CO2
CO2 level, in parts per million (ppm)
Definition sensor.h:122
@ SENSOR_CHAN_GAUGE_STATE_OF_CHARGE
State of charge measurement in %.
Definition sensor.h:170
@ SENSOR_CHAN_POS_DXYZ
Position change on the X, Y and Z axis, in points.
Definition sensor.h:154
@ SENSOR_CHAN_GAUGE_CYCLE_COUNT
Cycle count (total number of charge/discharge cycles)
Definition sensor.h:188
@ SENSOR_CHAN_GAUGE_TEMP
Gauge temperature
Definition sensor.h:168
@ SENSOR_CHAN_POS_DY
Position change on the Y axis, in points.
Definition sensor.h:150
@ SENSOR_CHAN_GYRO_Z
Angular velocity around the Z axis, in radians/s.
Definition sensor.h:75
@ SENSOR_CHAN_POS_DX
Position change on the X axis, in points.
Definition sensor.h:148
@ SENSOR_CHAN_GAUGE_AVG_POWER
Average power in mW.
Definition sensor.h:180
@ SENSOR_CHAN_GAUGE_TIME_TO_EMPTY
Time to empty in minutes.
Definition sensor.h:184
@ SENSOR_CHAN_PM_10
10 micro-meters Particulate Matter, in ug/m^3
Definition sensor.h:117
@ SENSOR_CHAN_GAUGE_REMAINING_CHARGE_CAPACITY
Remaining Charge Capacity in mAh.
Definition sensor.h:174
@ SENSOR_CHAN_ALL
All channels.
Definition sensor.h:197
@ SENSOR_CHAN_GAUGE_VOLTAGE
Voltage, in volts.
Definition sensor.h:160
@ SENSOR_CHAN_PROX
Proximity.
Definition sensor.h:96
@ SENSOR_CHAN_COMMON_COUNT
Number of all common sensor channels.
Definition sensor.h:202
@ SENSOR_CHAN_PRIV_START
This and higher values are sensor specific.
Definition sensor.h:208
@ SENSOR_CHAN_GYRO_X
Angular velocity around the X axis, in radians/s.
Definition sensor.h:71
@ SENSOR_CHAN_GAS_RES
Gas sensor resistance in ohms.
Definition sensor.h:128
@ SENSOR_CHAN_HUMIDITY
Humidity, in percent.
Definition sensor.h:98
@ SENSOR_CHAN_DISTANCE
Distance.
Definition sensor.h:119
@ SENSOR_CHAN_IR
Illuminance in infra-red spectrum, in lux.
Definition sensor.h:102
@ SENSOR_CHAN_MAX
Maximum value describing a sensor channel type.
Definition sensor.h:213
@ SENSOR_CHAN_POS_DZ
Position change on the Z axis, in points.
Definition sensor.h:152
@ SENSOR_CHAN_RED
Illuminance in red spectrum, in lux.
Definition sensor.h:104
@ SENSOR_CHAN_ALTITUDE
Altitude, in meters.
Definition sensor.h:110
@ SENSOR_CHAN_GAUGE_NOM_AVAIL_CAPACITY
Nominal Available Capacity in mAh.
Definition sensor.h:176
@ SENSOR_CHAN_ACCEL_X
Acceleration on the X axis, in m/s^2.
Definition sensor.h:63
@ SENSOR_CHAN_VOC
VOC level, in parts per billion (ppb)
Definition sensor.h:126
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:140
#define ENOSYS
Function not implemented.
Definition errno.h:82
#define ENOMEM
Not enough core.
Definition errno.h:50
#define ERANGE
Result too large.
Definition errno.h:72
Size of off_t must be equal or less than size of size_t
Definition retained_mem.h:28
Real-Time IO device API for moving bytes with low effort.
#define bool
Definition stdbool.h:13
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INT32_TYPE__ int32_t
Definition stdint.h:74
#define INT32_MAX
Definition stdint.h:18
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
#define INT32_MIN
Definition stdint.h:24
#define INT16_MAX
Definition stdint.h:17
__INT64_TYPE__ int64_t
Definition stdint.h:75
__INT8_TYPE__ int8_t
Definition stdint.h:72
void * memcpy(void *ZRESTRICT d, const void *ZRESTRICT s, size_t n)
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:417
A completion queue event.
Definition rtio.h:363
void * userdata
Associated userdata with operation.
Definition rtio.h:367
int32_t result
Result from operation.
Definition rtio.h:366
API that an RTIO IO device should implement.
Definition rtio.h:502
Compute the mempool block index for a given pointer.
Definition rtio.h:492
struct rtio_sqe sqe
Definition rtio.h:493
An IO device with a function table for submitting requests.
Definition rtio.h:517
void * data
Definition rtio.h:522
A submission queue event.
Definition rtio.h:286
void * userdata
User provided data which is returned upon operation completion.
Definition rtio.h:304
uint32_t buf_len
Length of buffer.
Definition rtio.h:310
const struct rtio_iodev * iodev
Device to operation on.
Definition rtio.h:295
const uint8_t * buf
Buffer to write from.
Definition rtio.h:311
An RTIO context containing what can be viewed as a pair of queues.
Definition rtio.h:396
Sensor Channel Specification.
Definition sensor.h:434
uint16_t chan_idx
A sensor channel index.
Definition sensor.h:436
uint16_t chan_type
A sensor channel type.
Definition sensor.h:435
Definition sensor.h:912
uint64_t timestamp_ns
Definition sensor.h:914
int8_t shift
Definition sensor.h:923
uint32_t num_channels
Definition sensor.h:920
Used for iterating over the data frames via the sensor_decoder_api.
Definition sensor.h:556
const struct sensor_decoder_api * decoder
Definition sensor.h:557
struct sensor_chan_spec channel
Definition sensor.h:559
const uint8_t * buffer
Definition sensor.h:558
uint32_t fit
Definition sensor.h:560
Decodes a single raw data buffer.
Definition sensor.h:466
int(* get_size_info)(struct sensor_chan_spec channel, size_t *base_size, size_t *frame_size)
Get the size required to decode a given channel.
Definition sensor.h:491
int(* get_frame_count)(const uint8_t *buffer, struct sensor_chan_spec channel, uint16_t *frame_count)
Get the number of frames in the current buffer.
Definition sensor.h:476
int(* decode)(const uint8_t *buffer, struct sensor_chan_spec channel, uint32_t *fit, uint16_t max_count, void *data_out)
Decode up to max_count samples from the buffer.
Definition sensor.h:519
bool(* has_trigger)(const uint8_t *buffer, enum sensor_trigger_type trigger)
Check if the given trigger type is present.
Definition sensor.h:529
Definition sensor.h:701
sensor_get_decoder_t get_decoder
Definition sensor.h:707
sensor_attr_set_t attr_set
Definition sensor.h:702
sensor_attr_get_t attr_get
Definition sensor.h:703
sensor_trigger_set_t trigger_set
Definition sensor.h:704
sensor_sample_fetch_t sample_fetch
Definition sensor.h:705
sensor_channel_get_t channel_get
Definition sensor.h:706
sensor_submit_t submit
Definition sensor.h:708
Definition sensor.h:625
struct sensor_chan_spec *const channels
Definition sensor.h:629
size_t count
Definition sensor.h:632
struct sensor_stream_trigger *const triggers
Definition sensor.h:630
const bool is_streaming
Definition sensor.h:627
const struct device * sensor
Definition sensor.h:626
const size_t max
Definition sensor.h:633
Definition sensor.h:611
enum sensor_stream_data_opt opt
Definition sensor.h:613
enum sensor_trigger_type trigger
Definition sensor.h:612
Sensor trigger spec.
Definition sensor.h:286
enum sensor_trigger_type type
Trigger type.
Definition sensor.h:288
enum sensor_channel chan
Channel the trigger is set on.
Definition sensor.h:290
Representation of a sensor readout value.
Definition sensor.h:51
int32_t val2
Fractional part of the value (in one-millionth parts).
Definition sensor.h:55
int32_t val1
Integer part of the value.
Definition sensor.h:53
#define INT64_C(x)
Definition xcc.h:104