Spectrum analyzer using DISCO-F746NG. Spectrum is calculated by FFT or linear prediction. The vowel data is in "vowel_data.hpp"
Dependencies: BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG UIT_FFT_Real mbed BUTTON_GROUP
Diff: SpactrumAnalysisClasses/SpectrumDisplay.hpp
- Revision:
- 0:c35b8a23a863
diff -r 000000000000 -r c35b8a23a863 SpactrumAnalysisClasses/SpectrumDisplay.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SpactrumAnalysisClasses/SpectrumDisplay.hpp Mon Oct 26 08:06:57 2015 +0000 @@ -0,0 +1,38 @@ +//------------------------------------------------------- +// Class for display spectrum +// Copyright (c) 2015 MIKAMI, Naoki, 2015/10/26 +//------------------------------------------------------- + +#ifndef SPECTRUM_DISPLAY_HPP +#define SPECTRUM_DISPLAY_HPP + +#include "LCD_DISCO_F746NG.h" + +namespace Mikami +{ + class SpectrumDisplay + { + public: + SpectrumDisplay(LCD_DISCO_F746NG &lcd, + int nFft, int x0, int y0, + float db1, int bin, float maxDb, int fs); + void BarChart(float db[], uint32_t backColor); + void LineChart(float db[], uint32_t backColor); + void Clear(uint32_t backColor); + + private: + const int N_FFT_; // number of date for FFT + const int X0_; // Origin for x axis + const int Y0_; // Origin for y axis + const float DB1_; // Pixels for 1 dB + const int BIN_; // Pixels per bin + const float MAX_DB_; // Maximum dB + const int FS_; // Sampling frequency: 10 kHz + + LCD_DISCO_F746NG *const LCD_; + + void AxisX(); // x-axis + void AxisY(); // y-axis + }; +} +#endif // SPECTRUM_DISPLAY_HPP