Waveform display for input signal using SAI from MEMS microphone or line. MEMS マイクまたはラインから SAI により入力した信号の波形を表示する.

Dependencies:   BSP_DISCO_F746NG F746_GUI F746_SAI_IO LCD_DISCO_F746NG TS_DISCO_F746NG mbed

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Fri Mar 17 01:55:12 2017 +0000
Parent:
3:b16250c9593c
Child:
5:92bb7f2bf714
Commit message:
5

Changed in this revision

F746_GUI.lib Show annotated file Show diff for this revision Revisions of this file
F746_SAI_IO.lib Show annotated file Show diff for this revision Revisions of this file
MyClasses/WaveformDisplay.cpp Show annotated file Show diff for this revision Revisions of this file
MyClasses/WaveformDisplay.hpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/F746_GUI.lib	Mon Jan 16 02:57:01 2017 +0000
+++ b/F746_GUI.lib	Fri Mar 17 01:55:12 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/MikamiUitOpen/code/F746_GUI/#115219bcd9f5
+http://mbed.org/users/MikamiUitOpen/code/F746_GUI/#d7f9f667fa68
--- a/F746_SAI_IO.lib	Mon Jan 16 02:57:01 2017 +0000
+++ b/F746_SAI_IO.lib	Fri Mar 17 01:55:12 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/MikamiUitOpen/code/F746_SAI_IO/#9893f8e53b07
+http://mbed.org/users/MikamiUitOpen/code/F746_SAI_IO/#66f6a85cebc6
--- a/MyClasses/WaveformDisplay.cpp	Mon Jan 16 02:57:01 2017 +0000
+++ b/MyClasses/WaveformDisplay.cpp	Fri Mar 17 01:55:12 2017 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
 //  Class for waveform display
 //
-//  2017/01/16, Copyright (c) 2017 MIKAMI, Naoki
+//  2017/03/17, Copyright (c) 2017 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #include "WaveformDisplay.hpp"
@@ -13,7 +13,7 @@
         uint16_t lim1 = Y0_ + LIMIT2_;
         uint16_t lim2 = Y0_ - LIMIT2_;
         Axis();
-        lcd_->SetTextColor(LINE_COLOR_);
+        lcd_.SetTextColor(LINE_COLOR_);
         uint16_t x1 = X0_;
         uint16_t y1 = Clip(xn_[0]);
         for (int n=1; n<N_DATA_; n++)
@@ -23,18 +23,18 @@
             if ( ((y2 == lim1) && (y1 == lim1)) ||
                  ((y2 == lim2) && (y1 == lim2)) )
             {   // Out of displaying boundaries
-                lcd_->SetTextColor(LCD_COLOR_RED);
-                lcd_->DrawHLine(x1, y1, 1);
-                lcd_->SetTextColor(LINE_COLOR_);
+                lcd_.SetTextColor(LCD_COLOR_RED);
+                lcd_.DrawHLine(x1, y1, 1);
+                lcd_.SetTextColor(LINE_COLOR_);
             }
             else
-                lcd_->DrawLine(x1, y1, x2, y2);
+                lcd_.DrawLine(x1, y1, x2, y2);
             if ((y1 == lim1) || (y1 == lim2))
-                lcd_->DrawPixel(x1, y1, LCD_COLOR_RED);
+                lcd_.DrawPixel(x1, y1, LCD_COLOR_RED);
             x1 = x2;
             y1 = y2;
         }
-        lcd_->SetTextColor(BACK_COLOR_);
+        lcd_.SetTextColor(BACK_COLOR_);
     }
         
     // Clipping
@@ -48,10 +48,10 @@
 
     void WaveformDisplay::Axis()
     {
-        lcd_->SetTextColor(BACK_COLOR_);
-        lcd_->FillRect(X0_, Y0_-LIMIT2_, N_DATA_, LIMIT2_*2+1);
+        lcd_.SetTextColor(BACK_COLOR_);
+        lcd_.FillRect(X0_, Y0_-LIMIT2_, N_DATA_, LIMIT2_*2+1);
 
-        lcd_->SetTextColor(AXIS_COLOR_);
-        lcd_->DrawLine(X0_-5, Y0_, X0_+N_DATA_+5, Y0_);
+        lcd_.SetTextColor(AXIS_COLOR_);
+        lcd_.DrawLine(X0_-5, Y0_, X0_+N_DATA_+5, Y0_);
     }        
 }
--- a/MyClasses/WaveformDisplay.hpp	Mon Jan 16 02:57:01 2017 +0000
+++ b/MyClasses/WaveformDisplay.hpp	Fri Mar 17 01:55:12 2017 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
 //  Class for waveform display ---- Header
 //
-//  2016/07/23, Copyright (c) 2016 MIKAMI, Naoki
+//  2017/03/17, Copyright (c) 2017 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #ifndef F746_WAVEFORM_DISPLAY_HPP
@@ -16,7 +16,7 @@
     class WaveformDisplay
     {
     public:
-        WaveformDisplay(LCD_DISCO_F746NG *lcd,
+        WaveformDisplay(LCD_DISCO_F746NG &lcd,
                         uint16_t x0, uint16_t y0,
                         const Array<int16_t>& xn,
                         uint16_t rShift,
@@ -44,7 +44,7 @@
         static const int LIMIT_ = 32;
         static const int LIMIT2_ = LIMIT_ + 1;
 
-        LCD_DISCO_F746NG *lcd_;
+        LCD_DISCO_F746NG &lcd_;
         
         // Clipping
         uint16_t Clip(int16_t xn);
--- a/main.cpp	Mon Jan 16 02:57:01 2017 +0000
+++ b/main.cpp	Fri Mar 17 01:55:12 2017 +0000
@@ -4,7 +4,7 @@
 //
 //  mbed ライブラリはリビジョン 131 またはそれ以前のものを使うこと
 //
-//  2017/01/15, Copyright (c) 2017 MIKAMI, Naoki
+//  2017/03/17, Copyright (c) 2017 MIKAMI, Naoki
 //--------------------------------------------------------------
 
 #include "F746_GUI.hpp"
@@ -20,11 +20,11 @@
 
     const uint32_t N_DATA_SAI = 600;        // SAI で使うデータ数
     const uint32_t N_DATA = N_DATA_SAI*2/3; // 表示するデータ数
-    SaiIO mySai(SaiIO::INPUT, N_DATA_SAI, I2S_AUDIOFREQ_16K,
+    SaiIO mySai(SaiIO::INPUT, N_DATA_SAI, AUDIO_FREQUENCY_16K,
                 INPUT_DEVICE_DIGITAL_MICROPHONE_2);
 
-    LCD_DISCO_F746NG *lcd = GuiBase::GetLcdPtr();
-    lcd->Clear(BACK_COLOR);
+    LCD_DISCO_F746NG &lcd = GuiBase::GetLcd();
+    lcd.Clear(BACK_COLOR);
 
     Label labelTitle(240, 10, "Simplified Oscilloscope",
                      Label::CENTER, Font16);
@@ -88,8 +88,6 @@
 
             waveDispL.Execute();    // 左チャンネルの波形表示
             waveDispR.Execute();    // 右チャンネルの波形表示
-
-            mySai.ResetCaptured();  // 次のフレームの入力準備
         }    
     }
 }