NetBurner 3.5.0
PDF Version
 
TickTimeout Class Reference

TickTimeout objects are used to facilitate sequential function calls with timeout parameters that need to indexed from an initial start time, and to prevent TimeTick rollover errors. More...

#include <nbrtos.h>

Public Member Functions

 TickTimeout (uint32_t timeout)
 Create and initialize the Timeout.
 
uint32_t val () const
 Get the timeout duration to be passed to a function utilizing timeout ticks.
 
bool expired () const
 Determine whether the timeout duration has elapsed.
 
 operator bool () const
 Use the Timeout as a boolean (such as in a branch condition).
 
void SetUntil (uint32_t when)
 Set the TimeTick value to expire.
 

Friends

void OSTimeWaitUntil (uint32_t systemTickValue)
 Delay the task until the specified value of the system timer tick. The number of system ticks per second is defined by the constant: TICKS_PER_SECOND in <nburn_install>/nbrtos/include/constants.h. The default value is 20 ticks per second.
 

Detailed Description

TickTimeout objects are used to facilitate sequential function calls with timeout parameters that need to indexed from an initial start time, and to prevent TimeTick rollover errors.

Constructor & Destructor Documentation

◆ TickTimeout()

TickTimeout::TickTimeout ( uint32_t timeout)
inline

Create and initialize the Timeout.

Parameters
timeoutThe maximum allowed time duration in ticks. Note: The maximum delay that can be used is INT32_MAX

Member Function Documentation

◆ expired()

bool TickTimeout::expired ( ) const
inline

Determine whether the timeout duration has elapsed.

Return values
trueThe timeout has expired
falseThe timeout has not expired

◆ operator bool()

TickTimeout::operator bool ( ) const
inline

Use the Timeout as a boolean (such as in a branch condition).

Since the intention is to be used for while() loop or in a precondition check, the boolean value represents whether the duration is still valid and has not expired. As a result this is the opposite behavior of the expired() method.

Return values
trueThe Timeout duration is still valid
falseThe Timeout duration is expired

◆ SetUntil()

void TickTimeout::SetUntil ( uint32_t when)
inline

Set the TimeTick value to expire.

Parameters
whenTimeTick value in which to expire

◆ val()

uint32_t TickTimeout::val ( ) const
inline

Get the timeout duration to be passed to a function utilizing timeout ticks.

Returns
The timeout duration in TimeTicks

Friends And Related Symbol Documentation

◆ OSTimeWaitUntil

void OSTimeWaitUntil ( uint32_t systemTickValue)
friend

Delay the task until the specified value of the system timer tick. The number of system ticks per second is defined by the constant: TICKS_PER_SECOND in <nburn_install>/nbrtos/include/constants.h. The default value is 20 ticks per second.

Parameters
systemTickValueThe system time tick value to wait for
uint32_t Now = TimeTick;
while(1)
{
Now += 60 * TICKS_PER_SECOND;
// Do whatever every 60 seconds, no mater how long this takes to run the interval will have a consistant spacing
}
friend void OSTimeWaitUntil(uint32_t systemTickValue)
Delay the task until the specified value of the system timer tick. The number of system ticks per sec...
#define TICKS_PER_SECOND
System clock ticks per second.
Definition nbrtos/include/constants.h:41
See also
OSChangeTaskDly(), OSTimeDly()

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