4#define _TMR1_CONTROLLER_CH_ 0
17 static_assert((_TMR1_CONTROLLER_CH_ <= 2 && _TMR1_CONTROLLER_CH_ >= 0),
18 "TMR1Controller: CHID is invalid (try <= 2).");
92 #if _TMR1_CONTROLLER_CH_ == 0
94 #elif _TMR1_CONTROLLER_CH_ == 1
96 #elif _TMR1_CONTROLLER_CH_ == 2
98 #elif _TMR1_CONTROLLER_CH_ == 3
99 static_assert(
false,
"This Channel has no IO Pin");
177 asm volatile (
"dsb");
187 #if _TMR1_CONTROLLER_CH_ == 0
188 IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_00 = 1;
189 IOMUXC_GPR_GPR6 |= IOMUXC_GPR_GPR6_QTIMER1_TRM1_INPUT_SEL;
190 #elif _TMR1_CONTROLLER_CH_ == 1
191 IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_01 = 1;
192 IOMUXC_GPR_GPR6 |= IOMUXC_GPR_GPR6_QTIMER1_TRM2_INPUT_SEL;
193 #elif _TMR1_CONTROLLER_CH_ == 2
194 IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_02 = 1;
195 IOMUXC_GPR_GPR6 |= IOMUXC_GPR_GPR6_QTIMER1_TRM3_INPUT_SEL;
196 #elif _TMR1_CONTROLLER_CH_ == 3
197 static_assert(
false,
"This Channel has no IO Pin");
200 asm volatile (
"dsb");
208 #if _TMR1_CONTROLLER_CH_ == 0
210 #elif _TMR1_CONTROLLER_CH_ == 1
212 #elif _TMR1_CONTROLLER_CH_ == 2
214 #elif _TMR1_CONTROLLER_CH_ == 3
215 static_assert(
false,
"This Channel does not have an assigned capture pin. ");
226 #if _TMR1_CONTROLLER_CH_ == 0
228 #elif _TMR1_CONTROLLER_CH_ == 1
230 #elif _TMR1_CONTROLLER_CH_ == 2
232 #elif _TMR1_CONTROLLER_CH_ == 3
233 static_assert(
false,
"This Channel has no TTL Pin");
244 IOMUXC_GPR_GPR2 |= IOMUXC_GPR_GPR2_QTIMER1_TMR_CNTS_FREEZE;
253 IOMUXC_GPR_GPR2 &= ~IOMUXC_GPR_GPR2_QTIMER1_TMR_CNTS_FREEZE;
Templated interface for Quad Timer 1 channels for Gate Counting. The module uses the macro _TMR1_CONT...
Definition: qtmr1.hpp:8
bool is_overflow() __attribute__((always_inline))
Returns the overflow status of the Counter. Reads the TOF - Timer Overflow Flag.
Definition: qtmr1.hpp:63
int get_ttl_input_pin() __attribute__((always_inline))
Returns the pin number on which the TTL input must be connected.
Definition: qtmr1.hpp:90
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
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.
counter_t get_capture_val() __attribute__((always_inline))
Reads and returns the Capture Register.
Definition: qtmr1.hpp:47
int get_extern_capture_signal_pin()
Returns the pin number on which the capture signal must be connected.
Definition: qtmr1.hpp:224
static constexpr bool Singleton_flag
Singleton template.
Definition: qtmr1.hpp:10
unsigned int get_xbar_out_pin() __attribute__((always_inline))
Returns the corresponding XBAR Output Pin to use for routing the Capture Signal. Reference Manual Pag...
Definition: qtmr1.hpp:206
void start() __attribute__((always_inline))
Starts up-counting from the set counter value.
Definition: qtmr1.hpp:24
void clear_overflow_flag() __attribute__((always_inline))
Definition: qtmr1.hpp:81
static void timers_freeze() __attribute__((always_inline))
Reset Counter and output flags. Reference Manual Page 332.
Definition: qtmr1.hpp:242
void clear_input_edge_flag() __attribute__((always_inline))
Definition: qtmr1.hpp:73
static void timers_anti_freeze() __attribute__((always_inline))
Enable counting normally. Reference Manual Page 332.
Definition: qtmr1.hpp:251
counter_t always_inline
Definition: qtmr1.hpp:56
void reset() __attribute__((always_inline))
Resets the counter to zero. It also cleares the capture register and unsets the Input Edge Flag.
Definition: qtmr1.hpp:38
TMR1Controller()
Default Constructor that assers if the user constructed object with a valid TMR1_CONTROLLER_CH,...
Definition: qtmr1.hpp:15
void init() __attribute__((always_inline))
Definition: qtmr1.hpp:107
void stop() __attribute__((always_inline))
Stops counting and freezes the current counter value.
Definition: qtmr1.hpp:31
const int SAFE_INPUT_DUMP_PIN
Definition: pins.hpp:14
#define _TMR1_CONTROLLER_CH_
Definition: qtmr1.hpp:4
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