Loading...
Searching...
No Matches

ztimer mock clock backend More...

Detailed Description

ztimer mock clock backend

This ztimer module implements a virtual clock that can be used for unittests. It can be manually adjusted to different timestamps and manually fired to simulate different scenarios and test the ztimer implementation using this as a backing timer.

Files

file  mock.h
 ztimer mock clock backend API
 

Data Structures

struct  ztimer_mock_t
 ztimer mock clock class More...
 

Functions

void ztimer_mock_advance (ztimer_mock_t *self, uint32_t val)
 Advance the mock clock counter and update target.
 
void ztimer_mock_jump (ztimer_mock_t *self, uint32_t target)
 Set the mock clock counter value without updating timer target.
 
void ztimer_mock_fire (ztimer_mock_t *self)
 Trigger the timer handlers.
 
void ztimer_mock_init (ztimer_mock_t *self, unsigned width)
 Constructor.
 

Function Documentation

◆ ztimer_mock_advance()

void ztimer_mock_advance ( ztimer_mock_t self,
uint32_t  val 
)

Advance the mock clock counter and update target.

This will call ztimer_handler if the target was passed.

Parameters
[in]selfinstance to operate on
[in]valcounter increment value

◆ ztimer_mock_fire()

void ztimer_mock_fire ( ztimer_mock_t self)

Trigger the timer handlers.

This is equivalent to a hardware timer interrupt

Parameters
[in]selfinstance to operate on

◆ ztimer_mock_init()

void ztimer_mock_init ( ztimer_mock_t self,
unsigned  width 
)

Constructor.

Parameters
[in]selfinstance to operate on
[in]widthcounter width, 1 <= width <= 32

◆ ztimer_mock_jump()

void ztimer_mock_jump ( ztimer_mock_t self,
uint32_t  target 
)

Set the mock clock counter value without updating timer target.

This will not touch the timer target.

Parameters
[in]selfinstance to operate on
[in]targetnew absolute counter value