Skip to content

Class hal::cortex_m::systick_timer

ClassList > hal > cortex_m > systick_timer

SysTick driver for the ARM Cortex Mx series chips. More...

  • #include <systick_timer.hpp>

Inherits the following classes: hal::timer

Public Types

Type Name
enum std::uint8_t clock_source
Defines the set of clock sources for the SysTick timer.

Public Functions

Type Name
void register_cpu_frequency (hertz p_frequency, clock_source p_source=clock_source::processor)
Inform the driver of the operating frequency of the CPU in order to generate the correct uptime.
systick_timer (hertz p_frequency, clock_source p_source=clock_source::processor)
Construct a new systick_timer timer object.
~systick_timer ()
Destroy the system timer object.

Public Functions inherited from hal::timer

See hal::timer

Type Name
result< cancel_t > cancel ()
Stops a scheduled event from happening.
result< is_running_t > is_running ()
Determine if the timer is currently running.
result< schedule_t > schedule (hal::callback< void(void)> p_callback, hal::time_duration p_delay)
Schedule an callback be be executed after the delay time.
virtual ~timer () = default

Detailed Description

Available in all ARM Cortex M series processors. Provides a generic and simple timer for every platform using these processor.

Public Types Documentation

enum clock_source

enum hal::cortex_m::systick_timer::clock_source {
    external = 0,
    processor = 1
};

Public Functions Documentation

function register_cpu_frequency

Inform the driver of the operating frequency of the CPU in order to generate the correct uptime.

void hal::cortex_m::systick_timer::register_cpu_frequency (
    hertz p_frequency,
    clock_source p_source=clock_source::processor
) 

Use this when the CPU's operating frequency has changed and no longer matches the frequency supplied to the constructor. Care should be taken when expecting this function when there is the potentially other parts of the system that depend on this counter's uptime to operate.

This will clear any ongoing scheduled events as the timing will no longer be valid.

Parameters:

  • p_frequency - the clock source's frequency
  • p_source - the source of the clock to the systick timer

function systick_timer

Construct a new systick_timer timer object.

hal::cortex_m::systick_timer::systick_timer (
    hertz p_frequency,
    clock_source p_source=clock_source::processor
) 

PRECONDITION: Interrupt vector table must be initialized before creating an instance of this object.

Parameters:

  • p_frequency - the clock source's frequency
  • p_source - the source of the clock to the systick timer

function ~systick_timer

Destroy the system timer object.

hal::cortex_m::systick_timer::~systick_timer () 

Stop the timer and disable the interrupt service routine.


The documentation for this class was generated from the following file libraries/include/libhal-armcortex/systick_timer.hpp