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
main.cpp
- Committer:
- henriquer
- Date:
- 2020-10-15
- Revision:
- 0:08d7440bdf68
File content as of revision 0:08d7440bdf68:
// #################### DAC F302 ####################
#include "mbed.h"
AnalogIn Ain(A0); // Entrada sinal de áudio
AnalogOut Aout(A2); // Reconstrução -sinal de áudio
Ticker snyq_tick;
void snyq_task(void);
float data_in, data_out;
int main()
{
snyq_tick.attach_us(&snyq_task,25); // tempo de amostragem do sinal 1/25us
}
// Funcção Amostragem do Sinal - DAC
void snyq_task(void)
{
data_in=Ain;
data_out=data_in;
Aout=data_out;
}
//float LPF(float LPF_in)
//{
//float a[4]= {1,2,1};
//float b[4]= {1,2,1};
//static float LPF_out;
//static float x[4], y[4];
//x[3] = x[2];
//x[2] = x[1];
//x[1] = x[0]; // move x values by one sample
//y[3] = y[2];
//y[2] = y[1];
//y[1] = y[0]; // move y values by one sample
// x[0] = LPF_in; // new value for x[0]
// y[0] = (b[0]*x[0]) + (b[1]*x[1]) + (b[2]*x[2]) + (b[3]*x[3]) + (a[1]*y[1]) + (a[2]*y[2]) + (a[3]*y[3]);
//LPF_out = y[0];
//return LPF_out; // output filtered value
//}