CW Decoder (Morse code decoder) 1st release version. Only run on Nucleo-F446RE mbed board.
Dependencies: Array_Matrix F446_AD_DA ST7565_SPI_LCD TextLCD UIT_FFT_Real
Fork of F446_MySoundMachine by
Base on F446_MySoundMachine program created by 不韋 呂-san.
Thanks to 不韋 呂-san making fundamental part such as FFT and ADC high speed interrupt driven program.
I just combined LCD and show CW code.
MySpectrogram/AnalysisBase.hpp@6:5e21ac9f0550, 2017-02-05 (annotated)
- Committer:
- kenjiArai
- Date:
- Sun Feb 05 08:02:54 2017 +0000
- Revision:
- 6:5e21ac9f0550
CW Decoder (Morse code decoder) 1st release version. Only run on Nucleo-F446RE mbed board.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 6:5e21ac9f0550 | 1 | //------------------------------------------------------- |
kenjiArai | 6:5e21ac9f0550 | 2 | // Base abstract class for spectrum analysis (Header) |
kenjiArai | 6:5e21ac9f0550 | 3 | // |
kenjiArai | 6:5e21ac9f0550 | 4 | // 2016/07/23, Copyright (c) 2016 MIKAMI, Naoki |
kenjiArai | 6:5e21ac9f0550 | 5 | //------------------------------------------------------- |
kenjiArai | 6:5e21ac9f0550 | 6 | |
kenjiArai | 6:5e21ac9f0550 | 7 | #ifndef BASE_ANALYZER_HPP |
kenjiArai | 6:5e21ac9f0550 | 8 | #define BASE_ANALYZER_HPP |
kenjiArai | 6:5e21ac9f0550 | 9 | |
kenjiArai | 6:5e21ac9f0550 | 10 | #include "Array.hpp" |
kenjiArai | 6:5e21ac9f0550 | 11 | #include "fftReal.hpp" |
kenjiArai | 6:5e21ac9f0550 | 12 | #include "Hamming.hpp" |
kenjiArai | 6:5e21ac9f0550 | 13 | |
kenjiArai | 6:5e21ac9f0550 | 14 | namespace Mikami |
kenjiArai | 6:5e21ac9f0550 | 15 | { |
kenjiArai | 6:5e21ac9f0550 | 16 | class AnalyzerBase |
kenjiArai | 6:5e21ac9f0550 | 17 | { |
kenjiArai | 6:5e21ac9f0550 | 18 | public: |
kenjiArai | 6:5e21ac9f0550 | 19 | // nData: Number of data to be analyzed |
kenjiArai | 6:5e21ac9f0550 | 20 | // nFft: Number of FFT points |
kenjiArai | 6:5e21ac9f0550 | 21 | // nUse: FFT, cepstrum: window width + zero padding |
kenjiArai | 6:5e21ac9f0550 | 22 | // Linear prediction: window width |
kenjiArai | 6:5e21ac9f0550 | 23 | AnalyzerBase(int nData, int nFft, int nUse); |
kenjiArai | 6:5e21ac9f0550 | 24 | virtual ~AnalyzerBase() {} |
kenjiArai | 6:5e21ac9f0550 | 25 | void Execute(const float xn[], float db[]); |
kenjiArai | 6:5e21ac9f0550 | 26 | |
kenjiArai | 6:5e21ac9f0550 | 27 | protected: |
kenjiArai | 6:5e21ac9f0550 | 28 | const int N_DATA_; |
kenjiArai | 6:5e21ac9f0550 | 29 | const int N_FFT_; |
kenjiArai | 6:5e21ac9f0550 | 30 | |
kenjiArai | 6:5e21ac9f0550 | 31 | FftReal fft_; |
kenjiArai | 6:5e21ac9f0550 | 32 | |
kenjiArai | 6:5e21ac9f0550 | 33 | float Norm(Complex x) |
kenjiArai | 6:5e21ac9f0550 | 34 | { return x.real()*x.real() + x.imag()*x.imag(); } |
kenjiArai | 6:5e21ac9f0550 | 35 | |
kenjiArai | 6:5e21ac9f0550 | 36 | private: |
kenjiArai | 6:5e21ac9f0550 | 37 | HammingWindow wHm_; |
kenjiArai | 6:5e21ac9f0550 | 38 | |
kenjiArai | 6:5e21ac9f0550 | 39 | Array<float> xData_; // data to be analyzed |
kenjiArai | 6:5e21ac9f0550 | 40 | Array<float> wData_; // windowd data |
kenjiArai | 6:5e21ac9f0550 | 41 | |
kenjiArai | 6:5e21ac9f0550 | 42 | virtual void Analyze(const float wData[], float db[]) = 0; |
kenjiArai | 6:5e21ac9f0550 | 43 | |
kenjiArai | 6:5e21ac9f0550 | 44 | // disallow copy constructor and assignment operator |
kenjiArai | 6:5e21ac9f0550 | 45 | AnalyzerBase(const AnalyzerBase& ); |
kenjiArai | 6:5e21ac9f0550 | 46 | AnalyzerBase& operator=(const AnalyzerBase& ); |
kenjiArai | 6:5e21ac9f0550 | 47 | }; |
kenjiArai | 6:5e21ac9f0550 | 48 | } |
kenjiArai | 6:5e21ac9f0550 | 49 | #endif // BASE_ANALYZER_HPP |
kenjiArai | 6:5e21ac9f0550 | 50 |