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: mbed-dsp
Fork of mbed-os-example-blinky by
main.cpp
- Committer:
- KlaraBengtsson
- Date:
- 2017-04-10
- Revision:
- 57:d15ff81fbeeb
- Parent:
- 55:360b5bcdf9a7
- Child:
- 58:afa7b146b6bf
File content as of revision 57:d15ff81fbeeb:
#include "mbed.h" const int FFT_SIZE = 32; int sampleCounter; void samplingBegin(){ sampleCounter = 0; } void samplingCallback() { //read sample from our created test data samples[sampleCounter] = testData[sampleCounter]; // sätter imaginär till 0 samples[sampleCounter + 1] = 0.0; sampleCounter += 2; if (sampleCounter >= FFT_SIZE *2 ) { //här är sampling klar, buffert är full //skriv kod här } bool samplingIsDone() { //return true; } // main() runs in its own thread in the OS int main() { samplingBegin(); S = & arm_cfft_sR_f32_len1024; while(1) { if(samplingIsDone()){ arm_cfft_f32(S,samples,0,1); arm_cmplx_mag_f32(samples,magnitudes,FFT_SIZE); samplingBegin(); } } }