15 #include <hal_samv71/systick_timer.h>
24 static const unsigned REGADDR_CTRL = 0;
25 static const unsigned REGADDR_LOAD = 1;
26 static const unsigned REGADDR_CURRENT_VALUE = 2;
29 static const unsigned SYSTICK_CLK_BIT = (1UL << 2UL);
30 static const unsigned SYSTICK_INT_BIT = (1UL << 1UL);
31 static const unsigned SYSTICK_ENABLE_BIT = (1UL << 0UL);
37 SysTickTimer::SysTickTimer(
38 const u32 cpu_freq_hz,
39 const u32 tick_rate_hz)
40 : TimeRef(tick_rate_hz)
42 , m_ctrl((u32*)SysTick_BASE)
46 m_ctrl[REGADDR_CTRL] = 0;
47 m_ctrl[REGADDR_CURRENT_VALUE] = 0;
50 m_ctrl[REGADDR_LOAD] = (cpu_freq_hz / tick_rate_hz) - 1;
51 m_ctrl[REGADDR_CTRL] = SYSTICK_CLK_BIT | SYSTICK_INT_BIT | SYSTICK_ENABLE_BIT;
61 m_callback = callback;
An "OnDemand" object is polled only on request.
void request_poll()
Call this method to request polling at a later time.
Interrupt handler interface for the Microchip SAM V71.
Microchip SAM V71 implementation of the "TimeRef" API.
u32 raw() override
Get raw tick-count,.
void irq_event() override
Method called whenever an interrupt is triggered.
void timer_callback(satcat5::poll::OnDemand *callback)
Set callback for timer events.
Core event-processing loop for SatCat5 software.