DWT (Debug-Watchdog-Trace) Counter#

DWT Counter#

Defined in namespace hal::cortex_m

#include <libhal-arm-mcu/dwt_counter.hpp>

class dwt_counter : public hal::steady_clock#

A counter with a frequency fixed to the CPU clock rate.

This driver is supported for Cortex M3 devices and above.

Public Functions

dwt_counter(hertz p_cpu_frequency)#

Construct a new dwt counter object.

Parameters:

p_cpu_frequency – - the operating frequency of the CPU

void register_cpu_frequency(hertz p_cpu_frequency)#

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

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.

Parameters:

p_cpu_frequency – - the operating frequency of the CPU