DIY Auto-Correlator 1.0
Auto-Correlator Card implementation using Teensy 4.x microcontrollers.
accumulator.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "./../types.hpp"
4
8{
10 unsigned int Update_count = 0;
11
12public:
13 unsigned int Buffer_count = 0;
14
16 void do_accumulate(unsigned int buffer_cnt)
17 {
18 Buffer_count = buffer_cnt;
19 Update_count = buffer_cnt;
20 }
21
25 template <typename LinCorrType>
26 void inline pipe(LinCorrType &channel, const counter_t datum)
27 {
28 Accumulate += datum;
30
31 if(Update_count == 0)
32 {
33 channel.push_datum(Accumulate); //Push to Channel
34 Accumulate = 0; // Reset Sccumulate
35 Update_count = Buffer_count; //Recharge Local Counter
36 }
37 }
38
39};
Adapter object responsible for accumulating the points and coarsening the time-series as per the rela...
Definition: accumulator.hpp:8
unsigned int Buffer_count
Number of points accumulated and binned together.
Definition: accumulator.hpp:13
counter_t Accumulate
Stores the value of the accumulate.
Definition: accumulator.hpp:9
void pipe(LinCorrType &channel, const counter_t datum)
Accumulates data points until the BufferPoints criteria is satisfied, after which the points are push...
Definition: accumulator.hpp:26
void do_accumulate(unsigned int buffer_cnt)
Sets the number of points to buffer(accumulate) before pushing to Correlator object.
Definition: accumulator.hpp:16
unsigned int Update_count
Maintains a counter of the items to accumuate.
Definition: accumulator.hpp:10
uint32_t counter_t
Data type received from the pulse counter. It is the fundamental type used for representing series da...
Definition: types.hpp:7