Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/data_logger/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static const struct task_schedule schedules[] = {
.validity = TASK_VALID_ALWAYS,
.periodicity_type = TASK_PERIODICITY_LOCKOUT,
.periodicity.lockout.lockout_s = 5 * SEC_PER_MIN,
.task_args.infuse.tdf_logger =
.task_args.tdf_logger =
{
.loggers = TDF_DATA_LOGGER_UDP,
.tdfs = TASK_TDF_LOGGER_LOG_ANNOUNCE | TASK_TDF_LOGGER_LOG_BATTERY |
Expand All @@ -69,7 +69,7 @@ static const struct task_schedule schedules[] = {
.validity = TASK_VALID_ALWAYS,
.periodicity_type = TASK_PERIODICITY_LOCKOUT,
.periodicity.lockout.lockout_s = 2,
.task_args.infuse.tdf_logger =
.task_args.tdf_logger =
{
.loggers = TDF_DATA_LOGGER_BT_ADV | TDF_DATA_LOGGER_SERIAL,
.random_delay_ms = 1000,
Expand All @@ -89,7 +89,7 @@ static const struct task_schedule schedules[] = {
.tdf_mask = TASK_IMU_LOG_ACC | TASK_IMU_LOG_GYR,
},
},
.task_args.infuse.imu =
.task_args.imu =
{
.accelerometer =
{
Expand Down Expand Up @@ -117,7 +117,7 @@ static const struct task_schedule schedules[] = {
.tdf_mask = TASK_GNSS_LOG_PVT,
},
},
.task_args.infuse.gnss =
.task_args.gnss =
{
.flags = TASK_GNSS_FLAGS_RUN_FOREVER |
TASK_GNSS_FLAGS_PERFORMANCE_MODE,
Expand Down
10 changes: 5 additions & 5 deletions apps/gateway_lte/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static const struct task_schedule schedules[] = {
.validity = TASK_VALID_ALWAYS,
.periodicity_type = TASK_PERIODICITY_LOCKOUT,
.periodicity.lockout.lockout_s = 5 * SEC_PER_MIN,
.task_args.infuse.tdf_logger =
.task_args.tdf_logger =
{
.loggers = TDF_DATA_LOGGER_UDP,
.tdfs = TASK_TDF_LOGGER_LOG_ANNOUNCE | TASK_TDF_LOGGER_LOG_BATTERY |
Expand All @@ -62,7 +62,7 @@ static const struct task_schedule schedules[] = {
{
.task_id = TASK_ID_TDF_LOGGER_ALT1,
.validity = TASK_VALID_PERMANENTLY_RUNS,
.task_args.infuse.tdf_logger =
.task_args.tdf_logger =
{
.loggers = TDF_DATA_LOGGER_BT_ADV,
.logging_period_ms = 1000,
Expand Down Expand Up @@ -103,14 +103,14 @@ static const struct task_schedule schedules[] = {
.tdf_mask = TASK_GNSS_LOG_LLHA | TASK_GNSS_LOG_FIX_INFO,
},
},
.task_args.infuse.gnss =
.task_args.gnss =
{
.flags = TASK_GNSS_FLAGS_RUN_TO_LOCATION_FIX |
TASK_GNSS_FLAGS_PERFORMANCE_MODE,
/* FIX_OK: 1m accuracy, 10.0 PDOP */
.accuracy_m = 1,
.position_dop = 100,
.run_to_fix =
.mode.run_to_fix =
{
/* 1 minute to get some location knowledge */
.any_fix_timeout = SEC_PER_MIN,
Expand All @@ -133,7 +133,7 @@ static const struct task_schedule schedules[] = {
.validity = TASK_VALID_ALWAYS,
.timeout_s = 2 * SEC_PER_MIN,
.states_start = TASK_STATES_DEFINE(APP_STATES_GNSS_TRIGGER),
.task_args.infuse.gnss =
.task_args.gnss =
{
.flags = TASK_GNSS_FLAGS_RUN_TO_LOCATION_FIX |
TASK_GNSS_FLAGS_PERFORMANCE_MODE,
Expand Down
2 changes: 1 addition & 1 deletion apps/gateway_usb/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static const struct task_schedule schedules[] = {
.validity = TASK_VALID_ALWAYS,
.periodicity_type = TASK_PERIODICITY_LOCKOUT,
.periodicity.lockout.lockout_s = SEC_PER_MIN,
.task_args.infuse.tdf_logger =
.task_args.tdf_logger =
{
.loggers = TDF_DATA_LOGGER_SERIAL,
.random_delay_ms = 1000,
Expand Down
4 changes: 2 additions & 2 deletions apps/gateway_wifi/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static const struct task_schedule schedules[] = {
.validity = TASK_VALID_ALWAYS,
.periodicity_type = TASK_PERIODICITY_LOCKOUT,
.periodicity.lockout.lockout_s = 5,
.task_args.infuse.tdf_logger =
.task_args.tdf_logger =
{
.loggers = TDF_DATA_LOGGER_UDP,
.tdfs = TASK_TDF_LOGGER_LOG_ANNOUNCE | TASK_TDF_LOGGER_LOG_NET_CONN,
Expand All @@ -53,7 +53,7 @@ static const struct task_schedule schedules[] = {
{
.task_id = TASK_ID_TDF_LOGGER_ALT1,
.validity = TASK_VALID_PERMANENTLY_RUNS,
.task_args.infuse.tdf_logger =
.task_args.tdf_logger =
{
.loggers = TDF_DATA_LOGGER_BT_ADV,
.logging_period_ms = 4500,
Expand Down
8 changes: 4 additions & 4 deletions apps/lte_tracker/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static const struct task_schedule schedules[] = {
.validity = TASK_VALID_ALWAYS,
.periodicity_type = TASK_PERIODICITY_LOCKOUT,
.periodicity.lockout.lockout_s = 5 * SEC_PER_MIN,
.task_args.infuse.network_scan =
.task_args.network_scan =
{
#ifdef CONFIG_WIFI
.flags = TASK_NETWORK_SCAN_FLAGS_LTE_CELLS |
Expand Down Expand Up @@ -72,7 +72,7 @@ static const struct task_schedule schedules[] = {
.periodicity_type = TASK_PERIODICITY_AFTER,
.periodicity.after.schedule_idx = 0,
.periodicity.after.duration_s = 0,
.task_args.infuse.tdf_logger =
.task_args.tdf_logger =
{
.loggers = TDF_DATA_LOGGER_SERIAL | TDF_DATA_LOGGER_UDP,
.tdfs = TASK_TDF_LOGGER_LOG_ANNOUNCE | TASK_TDF_LOGGER_LOG_BATTERY |
Expand All @@ -85,7 +85,7 @@ static const struct task_schedule schedules[] = {
.validity = TASK_VALID_ALWAYS,
.periodicity_type = TASK_PERIODICITY_LOCKOUT,
.periodicity.lockout.lockout_s = 2,
.task_args.infuse.tdf_logger =
.task_args.tdf_logger =
{
.loggers = TDF_DATA_LOGGER_SERIAL,
.random_delay_ms = 1000,
Expand All @@ -111,7 +111,7 @@ static const struct task_schedule schedules[] = {
{
.task_id = TASK_ID_TDF_LOGGER_ALT1,
.validity = TASK_VALID_PERMANENTLY_RUNS,
.task_args.infuse.tdf_logger =
.task_args.tdf_logger =
{
.loggers = TDF_DATA_LOGGER_BT_ADV,
.logging_period_ms = 900,
Expand Down
28 changes: 24 additions & 4 deletions doc/embedded/app_features/task_runner.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ need to be tweaked after deployment.
{
.task_id = TASK_ID_IMU,
.validity = TASK_VALID_ALWAYS,
.task_args.infuse.imu =
.task_args.imu =
{
.accelerometer =
{
Expand All @@ -89,9 +89,29 @@ need to be tweaked after deployment.
},
};

Arguments for custom task implementations can be inserted into
:c:struct:`task_schedule` with the
:kconfig:option:`CONFIG_TASK_RUNNER_CUSTOM_TASK_DEFINITIONS` option.
Task argument structures, task IDs, and task logging masks are generated from
``scripts/west_commands/cloud_definitions/tasks.json`` by ``west cloudgen``.
Generated headers are written under
``generated/include/infuse/task_runner/tasks``. The task-specific argument
headers define the ``struct task_<task>_args`` types and constants such as
``TASK_<TASK>_LOG_*``. The common
``generated/include/infuse/task_runner/tasks/infuse_task_args.h`` header
combines them into :c:union:`task_arguments`, which is embedded directly
as :c:member:`task_schedule.task_args`.

Downstream applications can add task definitions by providing an extension
``tasks.json`` to ``west cloudgen``:

.. code-block:: console

west cloudgen -d path/to/extensions -o path/to/application

Extension task definitions are merged with the built-in definitions.

When a downstream task should be included by the generated
``infuse_tasks.h`` aggregate header, the application should provide a matching
task API header such as ``include/infuse/task_runner/tasks/<task>.h``. That
header typically declares the task implementation entry points or helper macros.

Updating Task Schedules
***********************
Expand Down
43 changes: 43 additions & 0 deletions generated/include/infuse/task_runner/tasks/audio_dmic_args.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* @file
* @brief Autogenerated AUDIO_DMIC task arguments
* @copyright 2024 Embeint Holdings Pty Ltd
* @author scripts/west_commands/cloudgen.py
*
* INFUSE-IOT-AUTOGENERATED
*
* SPDX-License-Identifier: FSL-1.1-ALv2
*/

#ifndef INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_AUDIO_DMIC_ARGS_H_
#define INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_AUDIO_DMIC_ARGS_H_

#include <stdint.h>

#include <zephyr/toolchain.h>
#include <zephyr/sys/util.h>

#ifdef __cplusplus
extern "C" {
#endif

enum {
/** Log audio metadata */
TASK_AUDIO_DMIC_LOG_METADATA = BIT(0),
/** Log raw audio samples */
TASK_AUDIO_DMIC_LOG_SAMPLES = BIT(1),
};

/** Digital microphone task arguments (@ref task_audio_dmic_args) */
struct task_audio_dmic_args {
/** Requested sample rate in Hz */
uint32_t sample_rate_hz;
/** Sample gain in dB */
int8_t gain_db;
} __packed;

#ifdef __cplusplus
}
#endif

#endif /* INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_AUDIO_DMIC_ARGS_H_ */
43 changes: 43 additions & 0 deletions generated/include/infuse/task_runner/tasks/battery_args.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* @file
* @brief Autogenerated BATTERY task arguments
* @copyright 2024 Embeint Holdings Pty Ltd
* @author scripts/west_commands/cloudgen.py
*
* INFUSE-IOT-AUTOGENERATED
*
* SPDX-License-Identifier: FSL-1.1-ALv2
*/

#ifndef INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_BATTERY_ARGS_H_
#define INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_BATTERY_ARGS_H_

#include <stdint.h>

#include <zephyr/toolchain.h>
#include <zephyr/sys/util.h>

#ifdef __cplusplus
extern "C" {
#endif

enum {
/** Log battery voltage, charge current and charge percentage */
TASK_BATTERY_LOG_COMPLETE = BIT(0),
/** Log battery voltage */
TASK_BATTERY_LOG_VOLTAGE = BIT(1),
/** Log battery charge percentage */
TASK_BATTERY_LOG_SOC = BIT(2),
};

/** Battery task arguments (@ref task_battery_args) */
struct task_battery_args {
/** Period between measurements, 0 for single shot mode */
uint16_t repeat_interval_ms;
} __packed;

#ifdef __cplusplus
}
#endif

#endif /* INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_BATTERY_ARGS_H_ */
53 changes: 53 additions & 0 deletions generated/include/infuse/task_runner/tasks/bt_scanner_args.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* @file
* @brief Autogenerated BT_SCANNER task arguments
* @copyright 2024 Embeint Holdings Pty Ltd
* @author scripts/west_commands/cloudgen.py
*
* INFUSE-IOT-AUTOGENERATED
*
* SPDX-License-Identifier: FSL-1.1-ALv2
*/

#ifndef INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_BT_SCANNER_ARGS_H_
#define INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_BT_SCANNER_ARGS_H_

#include <stdint.h>

#include <zephyr/toolchain.h>
#include <zephyr/sys/util.h>

#ifdef __cplusplus
extern "C" {
#endif

enum {
/** Log Infuse-IoT Bluetooth packets */
TASK_BT_SCANNER_LOG_INFUSE_BT = BIT(0),
};

/** Bluetooth scanner task operation flags */
enum task_bt_scanner_flags {
/** Log packets that failed to decrypt */
TASK_BT_SCANNER_FLAGS_LOG_ENCRYPTED = BIT(0),
/** Only log each device once */
TASK_BT_SCANNER_FLAGS_FILTER_DUPLICATES = BIT(1),
/** Log observed devices at task termination */
TASK_BT_SCANNER_FLAGS_DEFER_LOGGING = BIT(2),
};

/** Bluetooth scanner task arguments (@ref task_bt_scanner_args) */
struct task_bt_scanner_args {
/** Scan duration in milliseconds */
uint32_t duration_ms;
/** Maximum number of packets to log */
uint8_t max_logs;
/** Operation flags */
uint8_t flags;
} __packed;

#ifdef __cplusplus
}
#endif

#endif /* INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_BT_SCANNER_ARGS_H_ */
41 changes: 41 additions & 0 deletions generated/include/infuse/task_runner/tasks/environmental_args.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @file
* @brief Autogenerated ENVIRONMENTAL task arguments
* @copyright 2024 Embeint Holdings Pty Ltd
* @author scripts/west_commands/cloudgen.py
*
* INFUSE-IOT-AUTOGENERATED
*
* SPDX-License-Identifier: FSL-1.1-ALv2
*/

#ifndef INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_ENVIRONMENTAL_ARGS_H_
#define INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_ENVIRONMENTAL_ARGS_H_

#include <stdint.h>

#include <zephyr/toolchain.h>
#include <zephyr/sys/util.h>

#ifdef __cplusplus
extern "C" {
#endif

enum {
/** Log temperature, pressure and humidity */
TASK_ENVIRONMENTAL_LOG_TPH = BIT(0),
/** Log temperature */
TASK_ENVIRONMENTAL_LOG_T = BIT(1),
/** Log pressure */
TASK_ENVIRONMENTAL_LOG_P = BIT(2),
};

/** Environmental task arguments (@ref task_environmental_args) */
struct task_environmental_args {
} __packed;

#ifdef __cplusplus
}
#endif

#endif /* INFUSE_SDK_INCLUDE_GENERATED_TASK_RUNNER_TASKS_ENVIRONMENTAL_ARGS_H_ */
Loading
Loading