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.

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?

UserRevisionLine numberNew contents of line
kenjiArai 6:5e21ac9f0550 1 //-------------------------------------------------------------------
kenjiArai 6:5e21ac9f0550 2 // Hamming windowing with zero-padding
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 HAMMING_WINDOW_HPP
kenjiArai 6:5e21ac9f0550 8 #define HAMMING_WINDOW_HPP
kenjiArai 6:5e21ac9f0550 9
kenjiArai 6:5e21ac9f0550 10 #include "mbed.h"
kenjiArai 6:5e21ac9f0550 11 #include "Array.hpp"
kenjiArai 6:5e21ac9f0550 12
kenjiArai 6:5e21ac9f0550 13 namespace Mikami
kenjiArai 6:5e21ac9f0550 14 {
kenjiArai 6:5e21ac9f0550 15 class HammingWindow
kenjiArai 6:5e21ac9f0550 16 {
kenjiArai 6:5e21ac9f0550 17 public:
kenjiArai 6:5e21ac9f0550 18 // Constructor
kenjiArai 6:5e21ac9f0550 19 HammingWindow(uint16_t nData, uint16_t nFft)
kenjiArai 6:5e21ac9f0550 20 : N_(nData), NFFT_(nFft), w_(nData)
kenjiArai 6:5e21ac9f0550 21 {
kenjiArai 6:5e21ac9f0550 22 float pi2L = 6.283185f/(float)nData;
kenjiArai 6:5e21ac9f0550 23 for (int k=0; k<nData; k++)
kenjiArai 6:5e21ac9f0550 24 w_[k] = 0.54f - 0.46f*cosf(k*pi2L);
kenjiArai 6:5e21ac9f0550 25 }
kenjiArai 6:5e21ac9f0550 26
kenjiArai 6:5e21ac9f0550 27 // Destructor
kenjiArai 6:5e21ac9f0550 28 virtual ~HammingWindow() {}
kenjiArai 6:5e21ac9f0550 29
kenjiArai 6:5e21ac9f0550 30 // Windowing
kenjiArai 6:5e21ac9f0550 31 void Execute(const float x[], float y[])
kenjiArai 6:5e21ac9f0550 32 {
kenjiArai 6:5e21ac9f0550 33 for (int n=0; n<N_; n++) y[n] = x[n]*w_[n];
kenjiArai 6:5e21ac9f0550 34 for (int n=N_; n<NFFT_; n++) y[n] = 0;
kenjiArai 6:5e21ac9f0550 35 }
kenjiArai 6:5e21ac9f0550 36
kenjiArai 6:5e21ac9f0550 37 private:
kenjiArai 6:5e21ac9f0550 38 const int N_;
kenjiArai 6:5e21ac9f0550 39 const int NFFT_;
kenjiArai 6:5e21ac9f0550 40
kenjiArai 6:5e21ac9f0550 41 Array<float> w_;
kenjiArai 6:5e21ac9f0550 42
kenjiArai 6:5e21ac9f0550 43 // disallow copy constructor and assignment operator
kenjiArai 6:5e21ac9f0550 44 HammingWindow(const HammingWindow& );
kenjiArai 6:5e21ac9f0550 45 HammingWindow& operator=(const HammingWindow& );
kenjiArai 6:5e21ac9f0550 46 };
kenjiArai 6:5e21ac9f0550 47 }
kenjiArai 6:5e21ac9f0550 48 #endif // HAMMING_WINDOW_HPP