aboutsummaryrefslogtreecommitdiffstats
path: root/examples/5_fir_differentiator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/5_fir_differentiator.cpp')
-rw-r--r--examples/5_fir_differentiator.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/5_fir_differentiator.cpp b/examples/5_fir_differentiator.cpp
index 72415c6..1500dee 100644
--- a/examples/5_fir_differentiator.cpp
+++ b/examples/5_fir_differentiator.cpp
@@ -7,23 +7,23 @@
* A scaling factor is applied so that the output's form is more clearly visible.
*/
-Sample *process_data(Samples samples)
+Sample* process_data(Samples samples)
{
constexpr int scaling_factor = 4;
- static Sample output[samples.size()];
+ static Samples output;
static Sample prev = 2048;
// Compute the first output value using the saved sample.
output[0] = 2048 + ((samples[0] - prev) * scaling_factor);
- for (unsigned int i = 1; i < samples.size(); i++) {
+ for (unsigned int i = 1; i < SIZE; i++) {
// Take the rate of change and scale it.
// 2048 is added as the output should be centered in the voltage range.
output[i] = 2048 + ((samples[i] - samples[i - 1]) * scaling_factor);
}
// Save the last sample for the next iteration.
- prev = samples[samples.size() - 1];
+ prev = samples[SIZE - 1];
return output;
}