ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dsps_wind_flat_top_f32.c File Reference
#include "dsps_wind_flat_top.h"
#include <math.h>
Include dependency graph for dsps_wind_flat_top_f32.c:

Go to the source code of this file.

Macros

#define _USE_MATH_DEFINES

Functions

void dsps_wind_flat_top_f32 (float *window, int len)
 Flat-Top window.

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Definition at line 15 of file dsps_wind_flat_top_f32.c.

Function Documentation

◆ dsps_wind_flat_top_f32()

void dsps_wind_flat_top_f32 ( float * window,
int len )

Flat-Top window.

The function generates Flat-Top window.

Parameters
windowbuffer to store window array.
lenlength of the window array

Definition at line 19 of file dsps_wind_flat_top_f32.c.

20{
21 const float a0 = 0.21557895;
22 const float a1 = 0.41663158;
23 const float a2 = 0.277263158;
24 const float a3 = 0.083578947;
25 const float a4 = 0.006947368;
26
27 float len_mult = 1 / (float)(len - 1);
28 for (int i = 0; i < len; i++) {
29 window[i] = a0
30 - a1 * cosf(i * 2 * M_PI * len_mult)
31 + a2 * cosf(i * 4 * M_PI * len_mult)
32 - a3 * cosf(i * 6 * M_PI * len_mult)
33 + a4 * cosf(i * 8 * M_PI * len_mult);
34 }
35}
#define M_PI
Definition esp_err.h:26

References M_PI.

Referenced by app_main().

Here is the caller graph for this function: