|
ESP-IDF Firmware
Firmware architecture and call graph
|
#include "dsps_cplx_gen.h"#include "dsp_common.h"#include "esp_log.h"#include <math.h>#include <malloc.h>Go to the source code of this file.
Macros | |
| #define | Q15_MAX INT16_MAX |
Functions | |
| esp_err_t | dsps_cplx_gen_init (cplx_sig_t *cplx_gen, out_d_type d_type, void *lut, int32_t lut_len, float freq, float initial_phase) |
| Initialize strucure for complex generator. | |
| esp_err_t | dsps_cplx_gen_freq_set (cplx_sig_t *cplx_gen, float freq) |
| function sets the output frequency of the complex generator | |
| float | dsps_cplx_gen_freq_get (cplx_sig_t *cplx_gen) |
| function gets the output frequency of the complex generator | |
| esp_err_t | dsps_cplx_gen_phase_set (cplx_sig_t *cplx_gen, float phase) |
| function sets the phase of the complex generator | |
| float | dsps_cplx_gen_phase_get (cplx_sig_t *cplx_gen) |
| function gets the phase of the complex generator | |
| esp_err_t | dsps_cplx_gen_set (cplx_sig_t *cplx_gen, float freq, float phase) |
| function sets the output frequency and the phase of the complex generator | |
| void | cplx_gen_free (cplx_sig_t *cplx_gen) |
| function frees dynamically allocated memory, which was allocated in the init function | |
Variables | |
| static const char * | TAG = "dsps_cplx_gen" |
| #define Q15_MAX INT16_MAX |
Definition at line 14 of file dsps_cplx_gen_init.c.
Referenced by dsps_cplx_gen_init().
| void cplx_gen_free | ( | cplx_sig_t * | cplx_gen | ) |
function frees dynamically allocated memory, which was allocated in the init function
free function must be called after the dsps_cplx_gen_init(...) is called, once the complex generator is not needed anymore
| cplx_gen | pointer to the complex signal generator structure |
Definition at line 142 of file dsps_cplx_gen_init.c.
References cplx_sig_s::free_status, and cplx_sig_s::lut.
| float dsps_cplx_gen_freq_get | ( | cplx_sig_t * | cplx_gen | ) |
function gets the output frequency of the complex generator
get function can be used after the cplx_gen structure was initialized by the dsps_cplx_gen_init(...) function
| cplx_gen | pointer to the complex signal generator structure |
Definition at line 92 of file dsps_cplx_gen_init.c.
References dsp_is_power_of_two(), cplx_sig_s::freq, cplx_sig_s::lut_len, and TAG.
| esp_err_t dsps_cplx_gen_freq_set | ( | cplx_sig_t * | cplx_gen, |
| float | freq ) |
function sets the output frequency of the complex generator
set function can be used after the cplx_gen structure was initialized by the dsps_cplx_gen_init(...) function
| cplx_gen | pointer to the complex signal generator structure |
| freq | new frequency to be set in a range of [-1..1] where 1 is a Nyquist frequency |
Definition at line 81 of file dsps_cplx_gen_init.c.
References ESP_ERR_DSP_INVALID_PARAM, ESP_OK, cplx_sig_s::freq, and TAG.
| esp_err_t dsps_cplx_gen_init | ( | cplx_sig_t * | cplx_gen, |
| out_d_type | d_type, | ||
| void * | lut, | ||
| int32_t | lut_len, | ||
| float | freq, | ||
| float | initial_phase ) |
Initialize strucure for complex generator.
Function initializes a structure for either 16-bit fixed point, or 32-bit floating point complex generator using LUT table. cplx_gen_free(...) must be called, once the generator is not needed anymore to free dynamically allocated memory
A user can specify his own LUT table and pass a pointer to the table (void *lut) during the initialization. If the LUT table pointer passed to the init function is a NULL, the LUT table is initialized internally.
| cplx_gen | pointer to the floating point generator structure |
| d_type | output data type - out_d_type enum |
| lut | pointer to a user-defined LUT, the data type is void so both (S16_FIXED, F32_FLOAT) types could be used |
| lut_len | length of the LUT |
| freq | Frequency of the output signal in a range of [-1...1], where 1 is a Nyquist frequency |
| initial_phase | initial phase of the complex signal in range of [-1..1] where 1 is related to 2Pi and -1 is related to -2Pi |
Definition at line 18 of file dsps_cplx_gen_init.c.
References cplx_sig_s::d_type, dsp_is_power_of_two(), ESP_ERR_DSP_INVALID_LENGTH, ESP_ERR_DSP_INVALID_PARAM, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, F32_FLOAT, cplx_sig_s::free_status, cplx_sig_s::freq, cplx_sig_s::lut, cplx_sig_s::lut_len, M_PI, cplx_sig_s::phase, Q15_MAX, S16_FIXED, and TAG.
| float dsps_cplx_gen_phase_get | ( | cplx_sig_t * | cplx_gen | ) |
function gets the phase of the complex generator
get function can be used after the cplx_gen structure was initialized by the dsps_cplx_gen_init(...) function
| cplx_gen | pointer to the complex signal generator structure |
Definition at line 114 of file dsps_cplx_gen_init.c.
References dsp_is_power_of_two(), cplx_sig_s::lut_len, cplx_sig_s::phase, and TAG.
| esp_err_t dsps_cplx_gen_phase_set | ( | cplx_sig_t * | cplx_gen, |
| float | phase ) |
function sets the phase of the complex generator
set function can be used after the cplx_gen structure was initialized by the dsps_cplx_gen_init(...) function
| cplx_gen | pointer to the complex signal generator structure |
| phase | new phase to be set in the range of [-1..1] where 1 is related to 2Pi and -1 is related to -2Pi |
Definition at line 103 of file dsps_cplx_gen_init.c.
References ESP_ERR_DSP_INVALID_PARAM, ESP_OK, cplx_sig_s::phase, and TAG.
| esp_err_t dsps_cplx_gen_set | ( | cplx_sig_t * | cplx_gen, |
| float | freq, | ||
| float | phase ) |
function sets the output frequency and the phase of the complex generator
set function can be used after the cplx_gen structure was initialized by the dsps_cplx_gen_init(...) function
| cplx_gen | pointer to the complex signal generator structure |
| freq | new frequency to be set in the range of [-1..1] where 1 is a Nyquist frequency |
| phase | new phase to be set in the range of [-1..1] where 1 is related to 2Pi and -1 is related to -2Pi |
Definition at line 125 of file dsps_cplx_gen_init.c.
References ESP_ERR_DSP_INVALID_PARAM, ESP_OK, cplx_sig_s::freq, cplx_sig_s::phase, and TAG.
|
static |
Definition at line 16 of file dsps_cplx_gen_init.c.