Real-time spectrum analyzer for ST Nucleo F401RE using Seeed Studio 2.8'' TFT Touch Shield V2.0.

Dependencies:   SeeedStudioTFTv2 UITDSP_ADDA UIT_FFT_Real mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FFT_Analysis.hpp Source File

FFT_Analysis.hpp

00001 //-------------------------------------------------------
00002 // Class for spectrum analysis using FFT (Header)
00003 // Copyright (c) 2014 MIKAMI, Naoki,  2014/12/30
00004 //-------------------------------------------------------
00005 
00006 #ifndef FFT_ANALYZER_HPP
00007 #define FFT_ANALYZER_HPP
00008 
00009 #include "fftReal.hpp"
00010 #include "Hamming.hpp"
00011 #include "PeakHolder.hpp"
00012 
00013 namespace Mikami
00014 {
00015     class FftAnalyzer
00016     {
00017     public:
00018         FftAnalyzer(int nData, int nFft);
00019         ~FftAnalyzer();
00020         void Execute(float xn[], float db[]);
00021 
00022     private:
00023         const int N_DATA_;
00024         const int N_FFT_;
00025 
00026         HammingWindow hm_;
00027         FftReal fft_;
00028         PeakHolder* pkHolder_;
00029 
00030         float* xData;   // Data to be analyzed
00031         float* xFft;    // Input for FFT
00032         Complex* yFft;  // Output of FFT
00033         float* normY;   // Powerspectrum
00034 
00035         float Sqr(float x) { return x*x; }
00036     };
00037 }
00038 
00039 #endif  // FFT_ANALYZER_HPP