Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
demo APIs

demo API More...

Data Structures

struct  algorithm_demo_common_args
union  algorithm_demo_common_data

Macros

#define ALGORITHM_DEMO_EVENT_DEFINE(name, loggers_, tdfs, event_chance_percent)
 Statically define an instance of the demo event algorithm.
#define ALGORITHM_DEMO_STATE_DEFINE(name, loggers_, tdfs)
 Statically define an instance of the demo state algorithm.
#define ALGORITHM_DEMO_METRIC_DEFINE(name, loggers_, tdfs, metric_compute_len)
 Statically define an instance of the demo compute algorithm.

Enumerations

enum  { ALGORITHM_DEMO_EVENT_LOG = BIT(0) , ALGORITHM_DEMO_STATE_LOG = BIT(0) , ALGORITHM_DEMO_METRIC_LOG = BIT(0) }

Functions

void algorithm_demo_event_fn (const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
 Algorithm implementation, see algorithm_run_fn.
void algorithm_demo_state_fn (const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
 Algorithm implementation, see algorithm_run_fn.
void algorithm_demo_metric_fn (const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
 Algorithm implementation, see algorithm_run_fn.

Detailed Description

demo API

Macro Definition Documentation

◆ ALGORITHM_DEMO_EVENT_DEFINE

#define ALGORITHM_DEMO_EVENT_DEFINE ( name,
loggers_,
tdfs,
event_chance_percent )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/algorithm_runner/algorithms/demo.h>

Value:
static const struct algorithm_runner_common_config name##_config = { \
.algorithm_id = 0xFFFFFFF0, \
.zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
.arguments_size = sizeof(struct algorithm_demo_common_args), \
.state_size = sizeof(union algorithm_demo_common_data), \
}; \
static struct algorithm_demo_common_args name##_default_args = { \
.logging = \
{ \
.loggers = loggers_, \
.tdf_mask = tdfs, \
}, \
.event_gen_chance = event_chance_percent, \
}; \
static union algorithm_demo_common_data name##_data; \
static struct algorithm_runner_algorithm name = { \
.config = &name##_config, \
.arguments = &name##_default_args, \
.runtime_state = &name##_data, \
}
void algorithm_demo_event_fn(const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
Algorithm implementation, see algorithm_run_fn.
@ INFUSE_ZBUS_CHAN_IMU
Data type: imu_sample_array.
Definition channels.h:53
Definition demo.h:36
Definition runner.h:31
Definition demo.h:48

Statically define an instance of the demo event algorithm.

This algorithm randomly generates events, with a percentage chance equal to the argument on each IMU sample buffer that arrives.

Parameters
nameVariable name base
loggers_TDF loggers to log outputs to
tdfsTDFs to log
event_chance_percentChance to emit an event on each buffer

◆ ALGORITHM_DEMO_METRIC_DEFINE

#define ALGORITHM_DEMO_METRIC_DEFINE ( name,
loggers_,
tdfs,
metric_compute_len )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/algorithm_runner/algorithms/demo.h>

Value:
static const struct algorithm_runner_common_config name##_config = { \
.algorithm_id = 0xFFFFFFF2, \
.zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
.arguments_size = sizeof(struct algorithm_demo_common_args), \
.state_size = sizeof(union algorithm_demo_common_data), \
}; \
static struct algorithm_demo_common_args name##_default_args = { \
.logging = \
{ \
.loggers = loggers_, \
.tdf_mask = tdfs, \
}, \
.compute_metric_len = metric_compute_len, \
}; \
static union algorithm_demo_common_data name##_data; \
static struct algorithm_runner_algorithm name = { \
.config = &name##_config, \
.arguments = &name##_default_args, \
.runtime_state = &name##_data, \
}
void algorithm_demo_metric_fn(const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
Algorithm implementation, see algorithm_run_fn.

Statically define an instance of the demo compute algorithm.

This algorithm generates a compute metric, with one metric computed every N samples

Parameters
nameVariable name base
loggers_TDF loggers to log outputs to
tdfsTDFs to log
metric_compute_lenNumber of samples to compute metric over

◆ ALGORITHM_DEMO_STATE_DEFINE

#define ALGORITHM_DEMO_STATE_DEFINE ( name,
loggers_,
tdfs )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/algorithm_runner/algorithms/demo.h>

Value:
static const struct algorithm_runner_common_config name##_config = { \
.algorithm_id = 0xFFFFFFF1, \
.zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
.arguments_size = sizeof(struct algorithm_demo_common_args), \
.state_size = sizeof(union algorithm_demo_common_data), \
}; \
static struct algorithm_demo_common_args name##_default_args = { \
.logging = \
{ \
.loggers = loggers_, \
.tdf_mask = tdfs, \
}, \
}; \
static union algorithm_demo_common_data name##_data; \
static struct algorithm_runner_algorithm name = { \
.config = &name##_config, \
.arguments = &name##_default_args, \
.runtime_state = &name##_data, \
}
void algorithm_demo_state_fn(const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
Algorithm implementation, see algorithm_run_fn.

Statically define an instance of the demo state algorithm.

This algorithm randomly transitions between states on IMU buffers

Parameters
nameVariable name base
loggers_TDF loggers to log outputs to
tdfsTDFs to log

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/algorithm_runner/algorithms/demo.h>

Enumerator
ALGORITHM_DEMO_EVENT_LOG 
ALGORITHM_DEMO_STATE_LOG 
ALGORITHM_DEMO_METRIC_LOG 

Function Documentation

◆ algorithm_demo_event_fn()

void algorithm_demo_event_fn ( const struct zbus_channel * chan,
const struct algorithm_runner_common_config * common,
const void * args,
void * data )

◆ algorithm_demo_metric_fn()

void algorithm_demo_metric_fn ( const struct zbus_channel * chan,
const struct algorithm_runner_common_config * common,
const void * args,
void * data )

◆ algorithm_demo_state_fn()

void algorithm_demo_state_fn ( const struct zbus_channel * chan,
const struct algorithm_runner_common_config * common,
const void * args,
void * data )