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: HIDScope MODSERIAL mbed-dsp mbed
Fork of emg_filter by
Revision 32:1bc34d137942, committed 2014-10-17
- Comitter:
- Tanja2211
- Date:
- Fri Oct 17 11:05:48 2014 +0000
- Parent:
- 31:b6f7ba4938d4
- Child:
- 33:51e066cf3f5e
- Commit message:
- hakjes
Changed in this revision
| EMGfilter.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/EMGfilter.cpp Fri Oct 17 10:52:54 2014 +0000
+++ b/EMGfilter.cpp Fri Oct 17 11:05:48 2014 +0000
@@ -2,7 +2,6 @@
#include "HIDScope.h"
#include "MODSERIAL.h"
#include "arm_math.h"
-#include "MAF.h"
HIDScope::HIDScope(int channels) : hid(64,64)
{
@@ -101,35 +100,34 @@
scope.set(1,filtered_emgB); //processed float
scope.send();
- MAF::MAF() {}
float MAF::update(float filtered_emgB) {
- B[0]=filtered_emgB;
- MOVAVG_B=B[0]*0.1+B[1]*0.1+B[2]*0.1+B[3]*0.1+B[4]*0.1+B[5]*0.1+B[7]*0.1+B[8]*0.1+B[9]*0.1
- B[9]=B[8];
- B[8]=B[7];
- B[7]=B[6];
- B[6]=B[5];
- B[5]=B[4];
- B[4]=B[3];
- B[3]=B[2];
- B[2]=B[1];
- B[1]=B[0];
+ B0=filtered_emgB;
+ MOVAVG_B=B0*0.1+B1*0.1+B2*0.1+B3*0.1+B4*0.1+B5*0.1+B7*0.1+B8*0.1+B9*0.1
+ B9=B8;
+ B8=B7;
+ B7=B6;
+ B6=B5;
+ B5=B4;
+ B4=B3;
+ B3=B2;
+ B2=B1;
+ B1=B0;
return MOVAVG_B;
}
- MAF::MAF() {}
+
float MAF::update(float filtered_emgT) {
- T[0]=filtered_emgT;
- MOVAVG_T=T[0]*0.1+T[1]*0.1+T[2]*0.1+T[3]*0.1+T[4]*0.1+T[5]*0.1+T[7]*0.1+T[8]*0.1+T[9]*0.1
- T[9]=T[8];
- T[8]=T[7];
- T[7]=T[6];
- T[6]=T[5];
- T[5]=T[4];
- T[4]=T[3];
- T[3]=T[2];
- T[2]=T[1];
- T[1]=T[0];
+ T0=filtered_emgT;
+ MOVAVG_T=T0*0.1+T1*0.1+T2*0.1+T3*0.1+T4*0.1+T5*0.1+T7*0.1+T8*0.1+T9*0.1
+ T9=T8;
+ T8=T7;
+ T7=T6;
+ T6=T5;
+ T5=T4;
+ T4=T3;
+ T3=T2;
+ T2=T1;
+ T1=T0;
return MOVAVG_T;
}
