aboutsummaryrefslogtreecommitdiffstats
path: root/templates/6_iir_test.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2021-08-08 22:12:53 -0400
committerClyne Sullivan <clyne@bitgloo.com>2021-08-08 22:12:53 -0400
commitbf0a126e8a9d30b77007829166f4bf91a3900079 (patch)
tree9d4a769daca81393a4562e96d9c2efb96092100a /templates/6_iir_test.cpp
parent707b24dd07236243269cf092728f85172e94e8a4 (diff)
update templates to new api; open template status fix
Diffstat (limited to 'templates/6_iir_test.cpp')
-rw-r--r--templates/6_iir_test.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/templates/6_iir_test.cpp b/templates/6_iir_test.cpp
index cdb4ab3..116a680 100644
--- a/templates/6_iir_test.cpp
+++ b/templates/6_iir_test.cpp
@@ -1,13 +1,13 @@
-adcsample_t *process_data(adcsample_t *samples, unsigned int size)
+Sample *process_data(Samples samples)
{
constexpr float alpha = 0.7;
- static adcsample_t prev = 2048;
+ static Sample prev = 2048;
samples[0] = (1 - alpha) * samples[0] + alpha * prev;
- for (unsigned int i = 1; i < size; i++)
+ for (unsigned int i = 1; i < samples.size(); i++)
samples[i] = (1 - alpha) * samples[i] + alpha * samples[i - 1];
- prev = samples[size - 1];
+ prev = samples[samples.size() - 1];
- return samples;
+ return samples.data();
}