for LPC1114FN28 (Cortex-M0)

Fork of UIT_FFT_Real by 不韋 呂

Committer:
ohneta
Date:
Thu Oct 15 15:37:24 2015 +0000
Revision:
1:ba9ce95ec9a4
Parent:
0:982a9acf3a07
for Cortex-M0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 0:982a9acf3a07 1 //-------------------------------------------------------------------
MikamiUitOpen 0:982a9acf3a07 2 // FFT class for real data ---- Header
MikamiUitOpen 0:982a9acf3a07 3 // This class can execute FFT and IFFT
MikamiUitOpen 0:982a9acf3a07 4 // Copyright (c) 2014 MIKAMI, Naoki, 2014/12/19
MikamiUitOpen 0:982a9acf3a07 5 //-------------------------------------------------------------------
ohneta 1:ba9ce95ec9a4 6 // for LPPC1114FN28(Cortex-M0) modified by Takehisa Oneta(ohneta) 4th Aug.2015
MikamiUitOpen 0:982a9acf3a07 7
MikamiUitOpen 0:982a9acf3a07 8 #ifndef FFT_REAL_HPP
MikamiUitOpen 0:982a9acf3a07 9 #define FFT_REAL_HPP
MikamiUitOpen 0:982a9acf3a07 10
MikamiUitOpen 0:982a9acf3a07 11 #include "mbed.h"
MikamiUitOpen 0:982a9acf3a07 12 #include <complex> // requisite for complex
MikamiUitOpen 0:982a9acf3a07 13
ohneta 1:ba9ce95ec9a4 14
ohneta 1:ba9ce95ec9a4 15 typedef complex<float> Complex; // define "Complex"
MikamiUitOpen 0:982a9acf3a07 16
ohneta 1:ba9ce95ec9a4 17 class FftReal
ohneta 1:ba9ce95ec9a4 18 {
ohneta 1:ba9ce95ec9a4 19 private:
MikamiUitOpen 0:982a9acf3a07 20 const int N_FFT_;
MikamiUitOpen 0:982a9acf3a07 21 const float N_INV_;
MikamiUitOpen 0:982a9acf3a07 22
MikamiUitOpen 0:982a9acf3a07 23 Complex* wTable_; // twiddle factor
MikamiUitOpen 0:982a9acf3a07 24 uint16_t* bTable_; // for bit reversal
MikamiUitOpen 0:982a9acf3a07 25 Complex* u_; // working area
MikamiUitOpen 0:982a9acf3a07 26
MikamiUitOpen 0:982a9acf3a07 27 // Processing except for last stage
MikamiUitOpen 0:982a9acf3a07 28 void ExcludeLastTtage();
MikamiUitOpen 0:982a9acf3a07 29 // Use for reordering of rit reversal in IFFT
MikamiUitOpen 0:982a9acf3a07 30 int Index(int n) { return (N_FFT_-bTable_[n]); }
MikamiUitOpen 0:982a9acf3a07 31
MikamiUitOpen 0:982a9acf3a07 32 FftReal(const FftReal& );
MikamiUitOpen 0:982a9acf3a07 33 FftReal& operator=(const FftReal& );
MikamiUitOpen 0:982a9acf3a07 34
ohneta 1:ba9ce95ec9a4 35 public:
MikamiUitOpen 0:982a9acf3a07 36 // Constructor
MikamiUitOpen 0:982a9acf3a07 37 explicit FftReal(int16_t n);
MikamiUitOpen 0:982a9acf3a07 38 // Destructor
MikamiUitOpen 0:982a9acf3a07 39 ~FftReal();
MikamiUitOpen 0:982a9acf3a07 40 // Execute FFT
MikamiUitOpen 0:982a9acf3a07 41 void Execute(const float x[], Complex y[]);
MikamiUitOpen 0:982a9acf3a07 42 // Execute IFFT
ohneta 1:ba9ce95ec9a4 43 //void ExecuteIfft(const Complex y[], float x[]);
ohneta 1:ba9ce95ec9a4 44 };
ohneta 1:ba9ce95ec9a4 45
MikamiUitOpen 0:982a9acf3a07 46 #endif // FFT_REAL_HPP