|
ESP-IDF Firmware
Firmware architecture and call graph
|
Go to the source code of this file.
Data Structures | |
| struct | cplx_sig_s |
| Data struct of the complex signal generator. More... | |
Macros | |
| #define | dsps_cplx_gen dsps_cplx_gen_ansi |
Typedefs | |
| typedef enum output_data_type | out_d_type |
| Ennum defining output data type of the complex generator. | |
| typedef struct cplx_sig_s | cplx_sig_t |
| Data struct of the complex signal generator. | |
Enumerations | |
| enum | output_data_type { S16_FIXED = 0 , F32_FLOAT = 1 } |
| Ennum defining output data type of the complex generator. More... | |
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 | |
| esp_err_t | dsps_cplx_gen_ansi (cplx_sig_t *cplx_gen, void *output, int32_t len) |
| The function generates a complex signal. | |
| esp_err_t | dsps_cplx_gen_ae32 (cplx_sig_t *cplx_gen, void *output, int32_t len) |
| #define dsps_cplx_gen dsps_cplx_gen_ansi |
Definition at line 184 of file dsps_cplx_gen.h.
| typedef struct cplx_sig_s cplx_sig_t |
Data struct of the complex signal generator.
This structure is used by a complex generator internally. A user should access this structure only in case of extensions for the DSP Library. All the fields of this structure are initialized by the dsps_cplx_gen_init(...) function.
| typedef enum output_data_type out_d_type |
Ennum defining output data type of the complex generator.
| enum output_data_type |
Ennum defining output data type of the complex generator.
| Enumerator | |
|---|---|
| S16_FIXED | Q15 fixed point - int16_t |
| F32_FLOAT | Single precision floating point - float |
Definition at line 23 of file dsps_cplx_gen.h.
| 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.
| esp_err_t dsps_cplx_gen_ae32 | ( | cplx_sig_t * | cplx_gen, |
| void * | output, | ||
| int32_t | len ) |
| esp_err_t dsps_cplx_gen_ansi | ( | cplx_sig_t * | cplx_gen, |
| void * | output, | ||
| int32_t | len ) |
The function generates a complex signal.
the generated complex signal is in the form of two harmonics signals in either 16-bit signed fixed point or 32-bit floating point
x[i]= A*sin(step*i + ph/180*Pi) x[i+1]= B*cos(step*i + ph/180*Pi) where step = 2*Pi*frequency
dsps_cplx_gen_ansi() - The implementation uses ANSI C and could be compiled and run on any platform dsps_cplx_gen_ae32() - Is targetted for Xtensa cores
| cplx_gen | pointer to the generator structure |
| output | output array (length of len*2), data type is void so both (S16_FIXED, F32_FLOAT) types could be used |
| len | length of the output signal |
Definition at line 9 of file dsps_cplx_gen.c.
References cplx_sig_s::d_type, ESP_OK, cplx_sig_s::freq, cplx_sig_s::lut, cplx_sig_s::lut_len, cplx_sig_s::phase, and S16_FIXED.
| 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.