DIY Auto-Correlator 1.0
Auto-Correlator Card implementation using Teensy 4.x microcontrollers.
Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Attributes | List of all members
TMR1Controller Class Reference

Templated interface for Quad Timer 1 channels for Gate Counting. The module uses the macro _TMR1_CONTROLLER_CH_ to identify the main channel and then assigns the next channel's (TMR1_CONTROLLER_CH + 1) external pin to the TMR1_CONTROLLER_CH as the "Capture Pin" or the "Secondary Count Source". More...

#include <qtmr1.hpp>

Public Member Functions

 TMR1Controller ()
 Default Constructor that assers if the user constructed object with a valid TMR1_CONTROLLER_CH, and asserts a singleton template. More...
 
void start () __attribute__((always_inline))
 Starts up-counting from the set counter value. More...
 
void stop () __attribute__((always_inline))
 Stops counting and freezes the current counter value. More...
 
void reset () __attribute__((always_inline))
 Resets the counter to zero. It also cleares the capture register and unsets the Input Edge Flag. More...
 
counter_t get_capture_val () __attribute__((always_inline))
 Reads and returns the Capture Register. More...
 
counter_t get_capture_double_range () __attribute__((flatten
 Returns a value that has range (2 X 2**n - 1). This is done by checking the overflow flag. More...
 
bool is_overflow () __attribute__((always_inline))
 Returns the overflow status of the Counter. Reads the TOF - Timer Overflow Flag. More...
 
void clear_input_edge_flag () __attribute__((always_inline))
 
void clear_overflow_flag () __attribute__((always_inline))
 
int get_ttl_input_pin () __attribute__((always_inline))
 Returns the pin number on which the TTL input must be connected. More...
 
void init () __attribute__((always_inline))
 
void init_pins () __attribute__((always_inline))
 Sets the Primary and Secondary inputs for Capture Mode, routed through XBAR. Reference XBAR and IOMUX input selections → IOMUXC_GPR_GPR6 Manual Page 347. More...
 
unsigned int get_xbar_out_pin () __attribute__((always_inline))
 Returns the corresponding XBAR Output Pin to use for routing the Capture Signal. Reference Manual Page 70. More...
 
int get_extern_capture_signal_pin ()
 Returns the pin number on which the capture signal must be connected. More...
 

Static Public Member Functions

static void timers_freeze () __attribute__((always_inline))
 Reset Counter and output flags. Reference Manual Page 332. More...
 
static void timers_anti_freeze () __attribute__((always_inline))
 Enable counting normally. Reference Manual Page 332. More...
 

Public Attributes

counter_t always_inline
 

Static Private Attributes

static constexpr bool Singleton_flag = false
 Singleton template. More...
 

Detailed Description

Templated interface for Quad Timer 1 channels for Gate Counting. The module uses the macro _TMR1_CONTROLLER_CH_ to identify the main channel and then assigns the next channel's (TMR1_CONTROLLER_CH + 1) external pin to the TMR1_CONTROLLER_CH as the "Capture Pin" or the "Secondary Count Source".

Constructor & Destructor Documentation

◆ TMR1Controller()

TMR1Controller::TMR1Controller ( )
inline

Default Constructor that assers if the user constructed object with a valid TMR1_CONTROLLER_CH, and asserts a singleton template.

Member Function Documentation

◆ clear_input_edge_flag()

void TMR1Controller::clear_input_edge_flag ( )
inline

◆ clear_overflow_flag()

void TMR1Controller::clear_overflow_flag ( )
inline

◆ get_capture_double_range()

counter_t TMR1Controller::get_capture_double_range ( )

Returns a value that has range (2 X 2**n - 1). This is done by checking the overflow flag.

◆ get_capture_val()

counter_t TMR1Controller::get_capture_val ( )
inline

Reads and returns the Capture Register.

◆ get_extern_capture_signal_pin()

int TMR1Controller::get_extern_capture_signal_pin ( )
inline

Returns the pin number on which the capture signal must be connected.

Attention
This function does not configure the pin and assign it to the QTMR module, for that TMR1Controller::init_pin() must be called. It can only be used if the input is actually routed to GPIO instead of XBAR.

◆ get_ttl_input_pin()

int TMR1Controller::get_ttl_input_pin ( )
inline

Returns the pin number on which the TTL input must be connected.

Attention
This function does not configure the pin or assign it to the QTMR module. For that TMR1Controller::init_pin() must be called.

◆ get_xbar_out_pin()

unsigned int TMR1Controller::get_xbar_out_pin ( )
inline

Returns the corresponding XBAR Output Pin to use for routing the Capture Signal. Reference Manual Page 70.

◆ init()

void TMR1Controller::init ( )
inline

◆ init_pins()

void TMR1Controller::init_pins ( )
inline

Sets the Primary and Secondary inputs for Capture Mode, routed through XBAR. Reference XBAR and IOMUX input selections → IOMUXC_GPR_GPR6 Manual Page 347.

◆ is_overflow()

bool TMR1Controller::is_overflow ( )
inline

Returns the overflow status of the Counter. Reads the TOF - Timer Overflow Flag.

◆ reset()

void TMR1Controller::reset ( )
inline

Resets the counter to zero. It also cleares the capture register and unsets the Input Edge Flag.

◆ start()

void TMR1Controller::start ( )
inline

Starts up-counting from the set counter value.

◆ stop()

void TMR1Controller::stop ( )
inline

Stops counting and freezes the current counter value.

◆ timers_anti_freeze()

static void TMR1Controller::timers_anti_freeze ( )
inlinestatic

Enable counting normally. Reference Manual Page 332.

Attention
This setting applies to all the channels of the Timer 1 group.

◆ timers_freeze()

static void TMR1Controller::timers_freeze ( )
inlinestatic

Reset Counter and output flags. Reference Manual Page 332.

Attention
This setting applies to all the channels of the Timer 1 group.

Member Data Documentation

◆ always_inline

counter_t TMR1Controller::always_inline
Initial value:
{
return (this->is_overflow() * 65535) + (this->get_capture_val())
bool is_overflow() __attribute__((always_inline))
Returns the overflow status of the Counter. Reads the TOF - Timer Overflow Flag.
Definition: qtmr1.hpp:63
counter_t get_capture_val() __attribute__((always_inline))
Reads and returns the Capture Register.
Definition: qtmr1.hpp:47

◆ Singleton_flag

constexpr bool TMR1Controller::Singleton_flag = false
staticconstexprprivate

Singleton template.


The documentation for this class was generated from the following file: