/* Function for generating sine wave samples for FFT calculations. 
This function fill up output array with generated sine wave data with proper sampling frequency. Must be executed before fft_process function. */
static void fft_generate_samples(float32_t *p_input, uint16_t size, float32_t sampling_freq, float32_t sine_freq, bool add_noise)
/* Function for generating sine wave samples for FFT calculations. 
This function fill up output array with generated sine wave data with proper sampling frequency. Must be executed before fft_process function. */
static void fft_generate_samples(float32_t *p_input, uint16_t size, float32_t sampling_freq, float32_t sine_freq, bool add_noise)
{
    uint32_t i;
    uint32_t sample_idx = 0;
    if (2 > size)
    {
        return;
    }
    for (i = 0; i < (size - 1UL); i += 2) {
        sample_idx = i / 2;
        p_input[(uint16_t)i] = sin(sine_freq * (2.f * PI) * sample_idx / sampling_freq);
        if (add_noise)
        {
            p_input[(uint16_t)i] *= ((rand()) % ((int)(NOISE_AMPLITUDE * SIGNALS_RESOLUTION)))
                                    / SIGNALS_RESOLUTION;
        }
        p_input[(uint16_t)i + 1] = 0;
    }
}