for LPC1114FN28 (Cortex-M0)
Fork of UIT_FFT_Real by
Diff: fftReal.hpp
- Revision:
- 0:982a9acf3a07
- Child:
- 1:ba9ce95ec9a4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fftReal.hpp Fri Dec 19 12:10:34 2014 +0000 @@ -0,0 +1,46 @@ +//------------------------------------------------------------------- +// FFT class for real data ---- Header +// This class can execute FFT and IFFT +// Copyright (c) 2014 MIKAMI, Naoki, 2014/12/19 +//------------------------------------------------------------------- + +#ifndef FFT_REAL_HPP +#define FFT_REAL_HPP + +#include "mbed.h" +#include <complex> // requisite for complex + +namespace Mikami +{ + typedef complex<float> Complex; // define "Complex" + + class FftReal + { + private: + const int N_FFT_; + const float N_INV_; + + Complex* wTable_; // twiddle factor + uint16_t* bTable_; // for bit reversal + Complex* u_; // working area + + // Processing except for last stage + void ExcludeLastTtage(); + // Use for reordering of rit reversal in IFFT + int Index(int n) { return (N_FFT_-bTable_[n]); } + + FftReal(const FftReal& ); + FftReal& operator=(const FftReal& ); + + public: + // Constructor + explicit FftReal(int16_t n); + // Destructor + ~FftReal(); + // Execute FFT + void Execute(const float x[], Complex y[]); + // Execute IFFT + void ExecuteIfft(const Complex y[], float x[]); + }; +} +#endif // FFT_REAL_HPP