XDK API  3.6.0
Documentation
Typedefs | Functions
Serval_Timer.h File Reference

An interface to the platform timer. More...

#include <Serval_Types.h>
+ Include dependency graph for Serval_Timer.h:

Typedefs

typedef struct Timer_S Timer_T
 
typedef retcode_t(* TimerFunc_T )(Timer_T *timer_ptr)
 

Functions

retcode_t Timer_config (Timer_T *timer_ptr, unsigned int milliseconds, TimerFunc_T func)
 
retcode_t Timer_init (Timer_T *timer_ptr)
 
bool Timer_isActive (Timer_T *timer_ptr)
 
retcode_t Timer_start (Timer_T *timer_ptr)
 
retcode_t Timer_stop (Timer_T *timer_ptr)
 

Detailed Description

This interface provides functions to handle a periodic timer. It provides functions to initialize, configure, start and stop a timer.

Typedef Documentation

typedef struct Timer_S Timer_T

A data type definition for timers. The platform exports the declaration of the struct Timer_S in the platform header file PBasics.h.

typedef retcode_t(* TimerFunc_T)(Timer_T *timer_ptr)

A data type for timeout functions. A timer is associated with such a function which is invoked every time the timer times out. It is recommended to keep time-out functions as light as possible. If executing a time-out function takes longer than the timer period, some RT problems might occur.

Function Documentation

retcode_t Timer_config ( Timer_T timer_ptr,
unsigned int  milliseconds,
TimerFunc_T  func 
)

This function configures the given timer. Before invoking this function the timer must be initialized via Timer_init(). After invoking this function the given function func is called periodically every x milliseconds. If an existing timer is reconfigured, any internal state must be reset.

Parameters
[out]timer_ptrPointer to the timer to be configured. It is configured with the given milliseconds and the given function func. This must be valid and should have a valid handle. The timer must not be active when this function is called.
[in]millisecondsTime after which timer expires. It is a periodic timer. It must not be zero. The first execution of the timer function is expected to occur after the value of milliseconds after the timer has been started using Timer_start.
[in]funcHandle to a function to be called periodically when the timer times out.
See also
Timer_init()
Returns
RC_OK if function successful, RC_TIMER_INVALID_OPERATION if timer is already active, RC_TIMER_ERROR_FATAL otherwise.
retcode_t Timer_init ( Timer_T timer_ptr)

This function initializes the given timer. After invoking this function the timer can be configured using Timer_config(...) and used (e.g. Timer_start()).

Parameters
[out]timer_ptrHandle to timer. It has to be a valid pointer.
Returns
RC_OK if function successful, RC_TIMER_INIT if initialization fails.
See also
Timer_start()
bool Timer_isActive ( Timer_T timer_ptr)

This function checks if the given timer is active. Before invoking this function the timer should be initialized via Timer_init().

Parameters
[in]timer_ptrPointer reference to timer to be initialized.
Returns
TRUE if timer is active, FALSE if timer is inactive
See also
Timer_init()
retcode_t Timer_start ( Timer_T timer_ptr)

This function starts the given timer. Before invoking this function the timer has to be initialized via Timer_init() and configured via Timer_config().

Parameters
[in,out]timer_ptrTimer handle. It contains the context of the timer including the period (milliseconds) and the timeout function. This must be valid and should have a valid handle.
See also
Timer_init(), Tier_config()
Returns
RC_OK if function successful, RC_TIMER_INVALID_OPERATION if timer is already active, RC_TIMER_ERROR_FATAL otherwise.
retcode_t Timer_stop ( Timer_T timer_ptr)

This function stops the given timer. If the timer is not active, i.e., started using Timer_start(), this function does not have any effect.

Parameters
[in,out]timer_ptrA valid pointer to a Timer. After stopping the timer, it has to be re-configured before it can re-started. This must be valid and should have a valid handle.
See also
Timer_start()
Returns
RC_OK if function successful, RC_TIMER_ERROR_FATAL otherwise.

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:47 by doxygen 1.8.8