You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
343 B
C++
14 lines
343 B
C++
adcsample_t *process_data(adcsample_t *samples, unsigned int size)
|
|
{
|
|
constexpr float alpha = 0.7;
|
|
|
|
static adcsample_t prev = 2048;
|
|
|
|
samples[0] = (1 - alpha) * samples[0] + alpha * prev;
|
|
for (unsigned int i = 1; i < size; i++)
|
|
samples[i] = (1 - alpha) * samples[i] + alpha * samples[i - 1];
|
|
prev = samples[size - 1];
|
|
|
|
return samples;
|
|
}
|