![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
working wavelet transform
Dependencies: CMSIS_DSP_5 include mbed
Fork of Nucleo-Heart-Rate by
main.cpp
- Committer:
- MockyBirdTwo
- Date:
- 2018-06-20
- Revision:
- 3:e44f3e92cb34
- Parent:
- 2:3d6a6b9afee0
- Child:
- 5:182ee08ee2b0
File content as of revision 3:e44f3e92cb34:
//#include <math.h> #include "arm_common_tables.h" #include "arm_const_structs.h" #include "arm_math.h" #include "mbed.h" #include "vals.h" #include "../header/wavelib.h" DigitalOut myled(LED1); Serial usb_serial(SERIAL_TX, SERIAL_RX); // tx, rx const int baud_rate = 115200; // Baud rate. //static float32_t cosSum[320]; // //float32_t *cosArray(int length, int freq, int fs){ // float *p = (float *) malloc(sizeof(float) * length); // double Ts = (double) 1/fs; // double w = 2*PI*freq; // // for(int i = 0; i < length; i++){ // p[i] = arm_cos_f32(w * Ts * i); // } // // return p; //} int main() { usb_serial.baud(baud_rate); // Set serial USB connection baud rate (variable is declared in config part). uint32_t N = 3000; uint32_t fs = 160; // uint32_t freq1 = 1; // uint32_t freq2 = 12; // float32_t *testCos1 = cosArray(N, freq1, fs); // float32_t *testCos2 = cosArray(N, freq2, fs); wave_object obj; wt_object wt; double *inp; //,*out,*diff; int i, J = 3; char *name = "db4"; obj = wave_init(name);// Initialize the wavelet inp = signal_in; //out = (double*)malloc(sizeof(double)* N); // diff = (double*)malloc(sizeof(double)* N); myled = !myled; wt = wt_init(obj, "modwt", N, 3);// Initialize the wavelet transform object myled = !myled; modwt(wt, inp);// Perform MODW while(1){ for (i = 0; i < wt->outlength; ++i) { usb_serial.printf("%d %e \n",i, wt->output[i]); } myled = !myled; } // setDWTExtension(wt, "sym");// Options are "per" and "sym". Symmetric is the default option // setWTConv(wt, "direct"); }