nRF Connect SDK API 3.4.99
Loading...
Searching...
No Matches
audio_regulator.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
17#ifndef _AUDIO_REGULATOR_H_
18#define _AUDIO_REGULATOR_H_
19
27
31struct audio_regulator_imp_ctx;
32
36struct audio_regulator_cfg;
37
51 int (*initialize)(struct audio_regulator_imp_ctx *const ctx);
52
62 int (*uninitialize)(struct audio_regulator_imp_ctx *const ctx);
63
74 int (*reset)(struct audio_regulator_imp_ctx *const ctx);
75
86 int (*cfg_set)(struct audio_regulator_imp_ctx *const ctx,
87 struct audio_regulator_cfg const *const cfg);
88
99 int (*cfg_get)(struct audio_regulator_imp_ctx const *const ctx,
100 struct audio_regulator_cfg *cfg);
101
119 int (*update)(struct audio_regulator_imp_ctx *const ctx, void *const ref_val_r,
120 void *const meas_val_y, void *const control_val_u);
121
133 int (*control_get)(struct audio_regulator_imp_ctx *const ctx, void *const control_val_u);
134};
135
143 /* Opaque structure to the implemented regulator context
144 * The structure and the pointer must remain valid for
145 * the lifetime of the instance of the module.
146 */
147 struct audio_regulator_imp_ctx *imp_ctx;
148
149 /* Audio regulator state, that must remain valid for the
150 * lifetime of the instance of the module
151 */
153
154 /* Callbacks for the regulator implementation */
156};
157
169 struct audio_regulator_imp_ctx *const imp_ctx,
170 struct audio_regulator_ops const *const imp_cb);
171
183
193
203 struct audio_regulator_cfg const *const cfg);
204
214 struct audio_regulator_cfg *const cfg);
215
228 void *const ref_val_r, void *const meas_val_y,
229 void *const control_val_u);
230
240 void *const control_val_u);
241
246#endif /* _AUDIO_REGULATOR_H_ */
int audio_regulator_cfg_get(struct audio_regulator_ctx const *const ctx, struct audio_regulator_cfg *const cfg)
Get the configuration of an audio regulator module.
int audio_regulator_cfg_set(struct audio_regulator_ctx *const ctx, struct audio_regulator_cfg const *const cfg)
Configure an audio regulator after it has been initialized.
int audio_regulator_control_get(struct audio_regulator_ctx const *const ctx, void *const control_val_u)
Get the control_val_u of an audio regulator module.
audio_regulator_state
The state of the audio regulator.
Definition audio_regulator.h:23
@ AUDIO_REGULATOR_STATE_UNINITIALIZED
Definition audio_regulator.h:24
@ AUDIO_REGULATOR_STATE_INITIALIZED
Definition audio_regulator.h:25
int audio_regulator_uninit(struct audio_regulator_ctx *ctx)
Uninitialize an audio regulator module.
int audio_regulator_reset(struct audio_regulator_ctx *const ctx)
Reset an audio regulator module back to the last configuration.
int audio_regulator_init(struct audio_regulator_ctx *const ctx, struct audio_regulator_imp_ctx *const imp_ctx, struct audio_regulator_ops const *const imp_cb)
Initialize an instance of the audio regulator module with the specified initial configuration.
int audio_regulator_update_control(struct audio_regulator_ctx const *const ctx, void *const ref_val_r, void *const meas_val_y, void *const control_val_u)
Update and get the new control_val_u between the reference value and the measured value for an audio ...
struct audio_regulator_ops cb
Definition audio_regulator.h:155
enum audio_regulator_state state
Definition audio_regulator.h:152
struct audio_regulator_imp_ctx * imp_ctx
Definition audio_regulator.h:147
Audio regulator's private configuration.
Definition audio_regulator.h:142
int(* control_get)(struct audio_regulator_imp_ctx *const ctx, void *const control_val_u)
Retrieve the last control_val_u calculated by the regulator implementation.
Definition audio_regulator.h:133
int(* reset)(struct audio_regulator_imp_ctx *const ctx)
Reset a regulator module implementation back to the last valid configuration.
Definition audio_regulator.h:74
int(* cfg_get)(struct audio_regulator_imp_ctx const *const ctx, struct audio_regulator_cfg *cfg)
Get the configuration of an active regulator implementation.
Definition audio_regulator.h:99
int(* uninitialize)(struct audio_regulator_imp_ctx *const ctx)
Uninitialize a regulator implementation.
Definition audio_regulator.h:62
int(* update)(struct audio_regulator_imp_ctx *const ctx, void *const ref_val_r, void *const meas_val_y, void *const control_val_u)
Update the regulator implementation.
Definition audio_regulator.h:119
int(* cfg_set)(struct audio_regulator_imp_ctx *const ctx, struct audio_regulator_cfg const *const cfg)
Configure a regulator module after it has been initialized.
Definition audio_regulator.h:86
int(* initialize)(struct audio_regulator_imp_ctx *const ctx)
Initialize a regulator module implementation.
Definition audio_regulator.h:51
Audio regulator's API structure.
Definition audio_regulator.h:41