Wave generator

The wave generator is a simple library that generates the value of a wave signal. The wave signal parameters are defined as wave_gen_param. The wave_gen_generate_value() generates the value of the wave signal at a given time.

Configuration

Set CONFIG_WAVE_GEN_LIB to enable the wave genarator library.

API documentation

Header file: include/wave_gen.h
Source files: lib/wave_gen/
group wave_gen

Library for generating wave signals.

Enums

enum wave_gen_type

Available generated wave types.

Values:

enumerator WAVE_GEN_TYPE_SINE
enumerator WAVE_GEN_TYPE_TRIANGLE
enumerator WAVE_GEN_TYPE_SQUARE
enumerator WAVE_GEN_TYPE_NONE
enumerator WAVE_GEN_TYPE_COUNT

Functions

int wave_gen_generate_value(uint32_t time, const struct wave_gen_param *params, double *out_val)

Generate wave value.

Parameters
  • time[in] Time for generated value.

  • params[in] Parameters describing generated wave signal.

  • out_val[out] Pointer to the variable that is used to store generated value.

Return values

0 – If the operation was successful. Otherwise, a (negative) error code is returned.

struct wave_gen_param
#include <wave_gen.h>

Generated wave parameters.

Public Members

enum wave_gen_type type

Type of the wave signal.

uint32_t period_ms

Period of the wave signal [ms].

double offset

Offset of the wave signal.

double amplitude

Amplitude of the wave signal.

double noise

Amplitue of the added noise signal.