Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
channels.h
Go to the documentation of this file.
1
9
10#ifndef INFUSE_SDK_INCLUDE_INFUSE_ZBUS_CHANNELS_H_
11#define INFUSE_SDK_INCLUDE_INFUSE_ZBUS_CHANNELS_H_
12
13#include <zephyr/zbus/zbus.h>
14
15#include <infuse/zbus/types.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
27
33#define INFUSE_ZBUS_CHAN_DEFINE(channel) \
34 ZBUS_CHAN_DEFINE_WITH_ID(INFUSE_ZBUS_NAME(channel), channel, INFUSE_ZBUS_TYPE(channel), \
35 NULL, NULL, ZBUS_OBSERVERS_EMPTY, ZBUS_MSG_INIT(0));
36
38#define _INFUSE_ZBUS_CHAN_EXTERN(channel) _ZBUS_CHAN_EXTERN(INFUSE_ZBUS_NAME(channel))
40
44#define INFUSE_ZBUS_CHAN_DECLARE(...) FOR_EACH(_INFUSE_ZBUS_CHAN_EXTERN, (;), __VA_ARGS__)
45
51#define INFUSE_ZBUS_CHAN_GET(channel) (&INFUSE_ZBUS_NAME(channel))
52
61static inline uint64_t infuse_zbus_channel_data_age(const struct zbus_channel *chan)
62{
63#ifdef CONFIG_ZBUS_CHANNEL_PUBLISH_STATS
64 if (zbus_chan_pub_stats_count(chan) == 0) {
65 return UINT64_MAX;
66 }
67 return k_ticks_to_ms_floor64(k_uptime_ticks() - zbus_chan_pub_stats_last_time(chan));
68#else
69 return UINT64_MAX;
70#endif /* CONFIG_ZBUS_CHANNEL_PUBLISH_STATS */
71}
72
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif /* INFUSE_SDK_INCLUDE_INFUSE_ZBUS_CHANNELS_H_ */
static uint64_t infuse_zbus_channel_data_age(const struct zbus_channel *chan)
Retrieve the age of the data in the zbus channel.
Definition channels.h:61
Infuse-IoT zbus channel types.