Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: UIT_ACM1602NI UIT_ADDA mbed
Revision 1:24c33c8719b2, committed 2014-11-10
- Comitter:
- MikamiUitOpen
- Date:
- Mon Nov 10 02:56:27 2014 +0000
- Parent:
- 0:b8bffbcb85fd
- Child:
- 2:6c46c15c45f0
- Commit message:
- 2
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Nov 10 02:45:18 2014 +0000
+++ b/main.cpp Mon Nov 10 02:56:27 2014 +0000
@@ -1,5 +1,5 @@
//------------------------------------------------------------------
-// Cutoff frequency variable LPF and HPF by FIR 160th-order filter
+// Cutoff frequency variable LPF by FIR 160th-order filter
// A0: Signal to be filtered
// A2: Value which controls cutoff frequency
//
@@ -27,8 +27,6 @@
DigitalIn sw1_(D2, PullDown); // 0: disable filter
// 1: enable filter
-DigitalIn sw2_(D3, PullDown); // 0: LPF
- // 1: HPF
WindowingDesign design_(ORDER_, FS_);
DigitalOut dOut_(D7);
@@ -78,7 +76,6 @@
myAdc_.SetIntrVec(AdcIsr); // Assign ISR for ADC interrupt
float fc1 = 0;
- WindowingDesign::Type pb = WindowingDesign::LPF;
while (true)
{
// fc: cutoff frequency, 100 -- 2000 Hz
@@ -87,7 +84,6 @@
if (sw1_ == 0)
{
printf("Through\r\n");
- lcd.ClearLine(1);
lcd.WriteStringXY("Through ", 0, 0);
wait(0.2f);
lcd.ClearLine(0);
@@ -101,22 +97,9 @@
char str[18];
sprintf(str, "fc = %4d Hz", int(fc+0.5f));
lcd.WriteStringXY(str, 0, 0);
- if (sw2_ == 0)
- {
- pb = WindowingDesign::LPF;
- printf("LPF\r\n");
- lcd.WriteStringXY("LPF", 0, 1);
- }
- else
- {
- pb = WindowingDesign::HPF;
- printf("HPF\r\n");
- lcd.WriteStringXY("HPF", 0, 1);
- }
fc1 = fc;
-
// Design new coefficients based on new fc
- design_.Design(ORDER_, pb, fc1, hm_);
+ design_.Design(ORDER_, WindowingDesign::LPF, fc1, hm_);
}
}
wait(0.1f);