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 SpectrumDisplay.hpp Source File

SpectrumDisplay.hpp

00001 //-------------------------------------------------------
00002 // Class for display spectrum
00003 // Copyright (c) 2014 MIKAMI, Naoki,  2014/12/28
00004 //-------------------------------------------------------
00005 
00006 #ifndef SPECTRUM_DISPLAY_HPP
00007 #define SPECTRUM_DISPLAY_HPP
00008 
00009 // Following two files were imported from
00010 // http://developer.mbed.org/teams/shields/code/
00011 // Seeed_TFT_Touch_Shield/
00012 #include "SeeedStudioTFTv2.h"   // imported
00013 #include "Arial12x12.h"         // imported
00014 
00015 namespace Mikami
00016 {
00017     class SpectrumDisplay
00018     {
00019     public:
00020         SpectrumDisplay(SeeedStudioTFTv2* lcd,
00021                         int nFft, int x0, int y0,
00022                         float db1, int bin, float maxDb, int fs);
00023         void BarChart(float db[], float offset);
00024         void LineChart(float db[], float offset);
00025         void DisplayVolume(float volume);
00026 
00027     private:
00028         const int N_FFT_;       // number of date for FFT
00029         const int X0_;          // Origin for x axis
00030         const int Y0_;          // Origin for y axis
00031         const float DB1_;       // Pixels for 1 dB
00032         const int BIN_;         // Pixels per bin
00033         const float MAX_DB_;    // Maximum dB
00034         const int FS_;          // Sampling frequency: 10 kHz
00035 
00036         SeeedStudioTFTv2* lcd_;
00037 
00038         void AxisX();       // x-axis
00039         void AxisY();       // y-axis
00040     };
00041 }
00042 #endif  // SPECTRUM_DISPLAY_HPP