![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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
my_class_and_function/waveform_display.hpp@0:c35b8a23a863, 2015-10-26 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Mon Oct 26 08:06:57 2015 +0000
- Revision:
- 0:c35b8a23a863
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:c35b8a23a863 | 1 | //----------------------------------------------------------- |
MikamiUitOpen | 0:c35b8a23a863 | 2 | // Function for waveform display |
MikamiUitOpen | 0:c35b8a23a863 | 3 | // |
MikamiUitOpen | 0:c35b8a23a863 | 4 | // 2015/10/26, Copyright (c) 2015 MIKAMI, Naoki |
MikamiUitOpen | 0:c35b8a23a863 | 5 | //----------------------------------------------------------- |
MikamiUitOpen | 0:c35b8a23a863 | 6 | |
MikamiUitOpen | 0:c35b8a23a863 | 7 | #ifndef F746_WAVEFORM_DISPLAY_HPP |
MikamiUitOpen | 0:c35b8a23a863 | 8 | #define F746_WAVEFORM_DISPLAY_HPP |
MikamiUitOpen | 0:c35b8a23a863 | 9 | |
MikamiUitOpen | 0:c35b8a23a863 | 10 | #include "mbed.h" |
MikamiUitOpen | 0:c35b8a23a863 | 11 | |
MikamiUitOpen | 0:c35b8a23a863 | 12 | namespace Mikami |
MikamiUitOpen | 0:c35b8a23a863 | 13 | { |
MikamiUitOpen | 0:c35b8a23a863 | 14 | void WaveformDisplay(LCD_DISCO_F746NG &lcd, uint16_t x0, uint16_t y0, |
MikamiUitOpen | 0:c35b8a23a863 | 15 | int16_t xn[], int nData, uint32_t backColor) |
MikamiUitOpen | 0:c35b8a23a863 | 16 | { |
MikamiUitOpen | 0:c35b8a23a863 | 17 | lcd.SetTextColor(backColor); |
MikamiUitOpen | 0:c35b8a23a863 | 18 | lcd.FillRect(x0, y0-32, nData, 64); |
MikamiUitOpen | 0:c35b8a23a863 | 19 | |
MikamiUitOpen | 0:c35b8a23a863 | 20 | lcd.SetTextColor(LCD_COLOR_BLUE); |
MikamiUitOpen | 0:c35b8a23a863 | 21 | lcd.DrawLine(x0-5, y0, x0+nData+5, y0); |
MikamiUitOpen | 0:c35b8a23a863 | 22 | |
MikamiUitOpen | 0:c35b8a23a863 | 23 | lcd.SetTextColor(LCD_COLOR_CYAN); |
MikamiUitOpen | 0:c35b8a23a863 | 24 | uint16_t x1 = x0; |
MikamiUitOpen | 0:c35b8a23a863 | 25 | uint16_t y1 = y0 - (xn[0] >> 9); |
MikamiUitOpen | 0:c35b8a23a863 | 26 | for (int n=1; n<nData; n++) |
MikamiUitOpen | 0:c35b8a23a863 | 27 | { |
MikamiUitOpen | 0:c35b8a23a863 | 28 | uint16_t x2 = x0 + n; |
MikamiUitOpen | 0:c35b8a23a863 | 29 | uint16_t y2 = y0 - (xn[n] >> 9); |
MikamiUitOpen | 0:c35b8a23a863 | 30 | lcd.DrawLine(x1, y1, x2, y2); |
MikamiUitOpen | 0:c35b8a23a863 | 31 | x1 = x2; |
MikamiUitOpen | 0:c35b8a23a863 | 32 | y1 = y2; |
MikamiUitOpen | 0:c35b8a23a863 | 33 | } |
MikamiUitOpen | 0:c35b8a23a863 | 34 | } |
MikamiUitOpen | 0:c35b8a23a863 | 35 | } |
MikamiUitOpen | 0:c35b8a23a863 | 36 | #endif // F746_WAVEFORM_DISPLAY_HPP |