Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
FftTest.h
00001 /** 00002 * @file FftTest.h 00003 * @brief Header file for FftTest.cpp 00004 * @date 2015.02.24 00005 * @version 1.0.2 00006 */ 00007 #ifndef _INC_FftTest 00008 #define _INC_FftTest 00009 00010 // #define _LARGE_RAM /* Uncomment if using large RAM. */ 00011 /* Hann window array and bit reversal array can */ 00012 /* be generated dynamically instead of constant. */ 00013 00014 #include "mbed.h" 00015 00016 /* Constant */ 00017 #define PI (3.141592) 00018 #define SQRT_2F (1.41421356f) 00019 #define DATA_LENGTH (256) 00020 00021 /** FFT test 00022 */ 00023 class FftTest 00024 { 00025 00026 public: 00027 FftTest(); 00028 ~FftTest(); 00029 void apply_window(float in_data[], float out_data[]); 00030 void calc_fft(float in_data[], float out_re_data[], float out_im_data[]); 00031 void calc_power(float re_data[], float im_data[], float pow_data[], int32_t dat_len); 00032 void calc_amplitude(float pow_data[], float amp_data[], int32_t dat_len); 00033 void norm_amplitude(float amp_data[], int32_t dat_len); 00034 00035 private: 00036 /* Menber variables */ 00037 int32_t _dat_len; 00038 int32_t _digit_len; 00039 #ifdef _LARGE_RAM 00040 float* _window_array; 00041 int32_t* _br_idx_array; 00042 #else 00043 static const float _window_array[DATA_LENGTH]; /* Hann window array */ 00044 static const int _br_idx_array[DATA_LENGTH]; /* Bit reversal index array */ 00045 #endif /* LARGE_RAM */ 00046 00047 /* Member functions */ 00048 void init(); 00049 int32_t get_digit_len(int32_t val); 00050 void set_hann_window(); 00051 void set_bit_reversal(); 00052 }; 00053 #endif /* INC_FftTest */
Generated on Wed Jul 13 2022 17:36:59 by
1.7.2