ClearCore Library
List of all members | Public Member Functions
ClearCore::SysTiming Class Reference

Detailed Description

ClearCore system timing class.

This class provides an interface for various timing-related operations.

ClearCore system timing class. More...

#include <SysTiming.h>

Public Member Functions

uint32_t Microseconds ()
 Number of microseconds elapsed since the ClearCore was initialized. More...
 
void ResetMicroseconds ()
 
volatile const uint32_t & Milliseconds ()
 Number of milliseconds elapsed since the ClearCore was initialized. More...
 
void ResetMilliseconds ()
 

Member Function Documentation

uint32_t ClearCore::SysTiming::Microseconds ( )

Number of microseconds elapsed since the ClearCore was initialized.

Uses the processor's cycle counter register to calculate the number of microseconds elapsed.

// Implement a timeout of 750 microseconds.
uint32_t timeout = 750;
uint32_t start = Microseconds();
while (Microseconds() - start < timeout) {
// wait for timeout...
}
Returns
Number of microseconds since board initialization.
Note
Rolls over every ~71.5 minutes (at UINT32_MAX microseconds)
volatile const uint32_t& ClearCore::SysTiming::Milliseconds ( )
inline

Number of milliseconds elapsed since the ClearCore was initialized.

Uses the fast update interrupt counter to retrieve the number of milliseconds elapsed.

// Implement a timeout of 2000 milliseconds.
uint32_t timeout = 2000;
uint32_t start = Milliseconds();
while (Milliseconds() - start < timeout) {
// wait for timeout...
}
Returns
Number of milliseconds since board initialization.
Note
Rolls over every ~49.7 days (at UINT32_MAX milliseconds)
void ClearCore::SysTiming::ResetMicroseconds ( )

Resets the microsecond timer.

// Implement a timeout of 750 microseconds.
uint32_t timeout = 750;
while (Microseconds() < timeout) {
// wait for timeout...
}
void ClearCore::SysTiming::ResetMilliseconds ( )

Resets the millisecond timer.

// Implement a timeout of 2000 milliseconds.
uint32_t timeout = 2000;
while (Milliseconds() < timeout) {
// wait for timeout...
}

The documentation for this class was generated from the following file: