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
26
32#define INFUSE_ZBUS_CHAN_DEFINE(channel) \
33 ZBUS_CHAN_DEFINE_WITH_ID(INFUSE_ZBUS_NAME(channel), channel, INFUSE_ZBUS_TYPE(channel), \
34 NULL, NULL, ZBUS_OBSERVERS_EMPTY, ZBUS_MSG_INIT(0));
35
37#define _INFUSE_ZBUS_CHAN_EXTERN(channel) _ZBUS_CHAN_EXTERN(INFUSE_ZBUS_NAME(channel))
39
43#define INFUSE_ZBUS_CHAN_DECLARE(...) FOR_EACH(_INFUSE_ZBUS_CHAN_EXTERN, (;), __VA_ARGS__)
44
50#define INFUSE_ZBUS_CHAN_GET(channel) (&INFUSE_ZBUS_NAME(channel))
51
60static inline uint64_t infuse_zbus_channel_data_age(const struct zbus_channel *chan)
61{
62#ifdef CONFIG_ZBUS_CHANNEL_PUBLISH_STATS
63 if (zbus_chan_pub_stats_count(chan) == 0) {
64 return UINT64_MAX;
65 }
66 return k_ticks_to_ms_floor64(k_uptime_ticks() - zbus_chan_pub_stats_last_time(chan));
67#else
68 return UINT64_MAX;
69#endif /* CONFIG_ZBUS_CHANNEL_PUBLISH_STATS */
70}
71
75
76#ifdef __cplusplus
77}
78#endif
79
80#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:60
Infuse-IoT zbus channel types.