8#include "./../code/hardware/pins.hpp"
9#include "./../code/hardware/ledpanel.hpp"
10#include "./../code/hardware/errors.hpp"
11#include "./../code/hardware/pit.hpp"
12#include "./../code/hardware/qtmr1.hpp"
14#include "./../code/software/monitor_channel.hpp"
23#if DEVICE_FEATURELINE == 3
33 IMXRT_TMR1.CH[0].SCTRL &= ~TMR_SCTRL_IEF;
39 IMXRT_TMR1.CH[0].CNTR = 0;
46 #if ISR_PIN_TOGGLE == 1
47 digitalToggleFast(ISR_TEST_TOOGLE_PIN);
61 #if ISR_PIN_TOGGLE == 1
62 pinMode(ISR_TEST_TOOGLE_PIN, OUTPUT);
68 PI_t.sel_FBUS_clock();
81 extern uint32_t
serial_max_count(
double Gate_time_u,
double Serial_out_time_ms);
118 #if DEVICE_FEATURELINE == 3
125 Serial.print(
"cv: ");
128 #if DEVICE_FEATURELINE == 3
129 float mean = CounterMean.
mean();
130 Serial.print(
" m: ");
133 Serial.print(
" c: ");
134 Serial.print(CounterMean.
Count);
136 Serial.print(
" a: ");
static Error_t Precison_Threshold(double error_val, double error_limit)
Receives error value and error threshold and returns an appropriate error state.
Definition: errors.hpp:44
static void Validate(const Error_t error)
Receives an error state and sets up the corresponding LED indicator.
Definition: errors.hpp:31
Template specialization.
Definition: monitor_channel.hpp:14
void push_back(DataType data)
Adds datum to the channel.
Definition: monitor_channel.hpp:23
float_t mean() const __attribute__((always_inline))
Returns the estimated mean.
Definition: monitor_channel.hpp:31
volatile uint32_t Count
Count of the received values (Initialized to prevent DivideByZero error)
Definition: monitor_channel.hpp:19
volatile AccumulateType Accumulate
Sum of the received values.
Definition: monitor_channel.hpp:18
void init_pins() __attribute__((always_inline))
Sets the Primary and Secondary inputs for Capture Mode, routed through XBAR. Reference XBAR and IOMUX...
Definition: qtmr1.hpp:185
void start() __attribute__((always_inline))
Starts up-counting from the set counter value.
Definition: qtmr1.hpp:24
void init() __attribute__((always_inline))
Definition: qtmr1.hpp:107
Error_t
Enumarates the error codes thrown by the different modules.
Definition: errors.hpp:17
#define PIT_CHANNEL_IN_USE
Definition: types.hpp:12
void sampler_setup()
Definition: featureline3.hpp:54
void isr_fn3()
This featureline (see featurelines.md) samples Counter values at periodic intervals and prints it to ...
Definition: featureline3.hpp:27
void sampler_loop()
Definition: featureline3.hpp:98
const double Gate_time_us
Serial output is done after these many updates (default → overriden in the setup function).
Definition: global.cpp:29
TMR1Controller TTL_c
TTL_c Resource.
Definition: global.cpp:19
uint32_t SerialOut_After
Definition: global.cpp:28
const double Allowed_period_error_us
The gate time of TTL_C in microseconds (us)
Definition: global.cpp:30
volatile unsigned int Update_count
Stores the number of updates made on the correlator channels since the last serialout.
Definition: global.cpp:25
PITController< PIT_CHANNEL_IN_USE > PI_t
PI_t Resource.
Definition: global.cpp:18
volatile bool Update_flag
Indicates if a new value has arrived from the counting module.
Definition: global.cpp:24
volatile counter_t Counter_val
Stores the value read from the counter.
Definition: global.cpp:23
LEDSet< 5 > LEDPanel({LED_BUILTIN, LED_RED, LED_GREEN, LED_WHITE, LED_BLUE})
const int LED_WHITE
Definition: pins.hpp:9
const int LOOP_LED
Definition: pins.hpp:30
const int TTL_C_PULSE_INPUT_PIN
Definition: pins.hpp:19
uint32_t serial_max_count(double Gate_time_us, double Serial_out_time_ms)
Definition: utilities.cpp:7