28 void init() __attribute__((always_inline))
34 PIT_LDVAL1 = 0xFFFFFFFF;
36 PIT_TCTRL1 |= PIT_TCTRL_CHN;
39 PIT_LDVAL0 = 0xFFFFFFFF;
48 void start() __attribute__((always_inline))
50 PIT_TCTRL1 |= PIT_TCTRL_TEN;
51 PIT_TCTRL0 |= PIT_TCTRL_TEN;
56 void stop() __attribute__((always_inline))
58 PIT_TCTRL0 &= ~PIT_TCTRL_TEN;
59 PIT_TCTRL1 &= ~PIT_TCTRL_TEN;
64 void reset() __attribute__((always_inline))
67 PIT_LDVAL1 = 0xFFFFFFFF;
68 PIT_LDVAL0 = 0xFFFFFFFF;
73 uint64_t
read_val() __attribute__((always_inline))
76 uint64_t current_uptime = (PIT_LTMR64H << 32);
77 current_uptime = current_uptime + PIT_LTMR64L;
78 return current_uptime;
101 return 0xFFFFFFFFFFFFFFFF -
read_val();
110 return 0xFFFFFFFF - PIT_LTMR64L;
Interface for using the "Life Time TImer" functionality of the Periodic Interrut Timer on Teensy 4....
Definition: lifetime_timer.hpp:10
uint64_t elapsed64() __attribute__((always_inline))
Returns the elapsed duration from the start call of the timer. The return is the complete 64bit value...
Definition: lifetime_timer.hpp:99
uint32_t read_high_val() __attribute__((always_inline))
Returns the higher 32-bit half of the 64-bit timing value.
Definition: lifetime_timer.hpp:91
uint64_t read_val() __attribute__((always_inline))
Returns the complete 64-bit timing value.
Definition: lifetime_timer.hpp:73
uint32_t read_low_val() __attribute__((always_inline))
Returns the lower 32-bit half of the 64-bit timing value.
Definition: lifetime_timer.hpp:83
void reset() __attribute__((always_inline))
Stops the timers and resets the timer back to the init value (max) - 0xFFFFFFFFFFFFFF.
Definition: lifetime_timer.hpp:64
void start() __attribute__((always_inline))
Starts the timers for down counting.
Definition: lifetime_timer.hpp:48
PIT_LifetimeTimer()
Definition: lifetime_timer.hpp:17
void stop() __attribute__((always_inline))
Stops the timers from counting. The timers values will freeze.
Definition: lifetime_timer.hpp:56
void init() __attribute__((always_inline))
Sets up Timer 0 and Timer 1 channels for Lifetime timing - chained configuration. This function also ...
Definition: lifetime_timer.hpp:28
uint32_t elapsed32() __attribute__((always_inline))
Returns the elapsed duration from the start call of the timer. The return is the lower 32-bit half el...
Definition: lifetime_timer.hpp:108