不韋 呂 / Mbed 2 deprecated UIT2_VariableIIR_LPF

Dependencies:   UIT_IIR_Filter UIT_ACM1602NI UITDSP_ADDA mbed UIT_AQM1602

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Mon Nov 10 06:07:42 2014 +0000
Parent:
0:a9412b9e85b7
Child:
2:0d954a85ff0a
Commit message:
2

Changed in this revision

UIT_ACM1602NI.lib Show annotated file Show diff for this revision Revisions of this file
UIT_ADDA.lib 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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/UIT_ACM1602NI.lib	Thu Oct 23 06:44:40 2014 +0000
+++ b/UIT_ACM1602NI.lib	Mon Nov 10 06:07:42 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/MikamiUitOpen/code/UIT_ACM1602NI/#d8048b36d982
+http://mbed.org/users/MikamiUitOpen/code/UIT_ACM1602NI/#7c6b2df4e60b
--- a/UIT_ADDA.lib	Thu Oct 23 06:44:40 2014 +0000
+++ b/UIT_ADDA.lib	Mon Nov 10 06:07:42 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/MikamiUitOpen/code/UIT_ADDA/#77bc5550dc10
+http://mbed.org/users/MikamiUitOpen/code/UIT_ADDA/#651809e96a2d
--- a/main.cpp	Thu Oct 23 06:44:40 2014 +0000
+++ b/main.cpp	Mon Nov 10 06:07:42 2014 +0000
@@ -3,7 +3,7 @@
 //      A0: Signal to be filtered
 //      A2: Value which controls cutoff frequency
 //
-// 2014/10/23, Copyright (c) 2014 MIKAMI, Naoki
+// 2014/11/10, Copyright (c) 2014 MIKAMI, Naoki
 //--------------------------------------------------------------
 
 #include "mbed.h"
@@ -68,30 +68,40 @@
         // fc: cutoff frequency, 200 -- 1000 Hz
         float fc = 800.0f*(a2_/4095.6f) + 200.0f;
 
-        if (fabs(fc - fc1) > 10.0f)
+        if (sw1_ == 0)
         {
-            printf("fc = %4d\r\n", int(fc+0.5f));
-            char str[18];
-            sprintf(str, "fc = %4d Hz", int(fc+0.5f));
-            lcd.SetXY(0, 0);
-            lcd.WriteString(str);
-            fc1 = fc;
+            printf("Through\r\n");
+            lcd.WriteStringXY("Through         ", 0, 0);
+            wait(0.2f);
+            lcd.ClearLine(0);
+            fc1 = 0;
+        }
+        else
+        {
+            if (fabs(fc - fc1) > 10.0f)
+            {
+                printf("fc = %4d\r\n", int(fc+0.5f));
+                char str[18];
+                sprintf(str, "fc = %4d Hz", int(fc+0.5f));
+                lcd.WriteStringXY(str, 0, 0);
+                fc1 = fc;
 
-            // Design new coefficients based on new fc
-            BiliearDesign::Coefs coefsLpf[ORDER/2];
-            float g0;
-            lpfDsgn.Execute(fc, coefsLpf, g0);
+                // Design new coefficients based on new fc
+                BiliearDesign::Coefs coefsLpf[ORDER/2];
+                float g0;
+                lpfDsgn.Execute(fc, coefsLpf, g0);
 
-            // Update new coefficients
-            Biquad::Coefs coefsIir[ORDER/2];
-            for (int n=0; n<ORDER/2; n++)
-            {
-                coefsIir[n].a1 = coefsLpf[n].a1;
-                coefsIir[n].a2 = coefsLpf[n].a2;
-                coefsIir[n].b1 = coefsLpf[n].b1;
-                coefsIir[n].b2 = 1.0f;
+                // Update new coefficients
+                Biquad::Coefs coefsIir[ORDER/2];
+                for (int n=0; n<ORDER/2; n++)
+                {
+                    coefsIir[n].a1 = coefsLpf[n].a1;
+                    coefsIir[n].a2 = coefsLpf[n].a2;
+                    coefsIir[n].b1 = coefsLpf[n].b1;
+                    coefsIir[n].b2 = 1.0f;
+                }
+                iirLpf_.SetCoefs(g0, coefsIir);
             }
-            iirLpf_.SetCoefs(g0, coefsIir);
         }
         wait(0.1f);
     }
--- a/mbed.bld	Thu Oct 23 06:44:40 2014 +0000
+++ b/mbed.bld	Mon Nov 10 06:07:42 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file