Components/Libraries/XF/FreeRTOS/ITimer

(Difference between revisions)
Jump to: navigation, search
(Created page with "{{TOC right}} =ITimer= The class ITimer is a C++ class that manage a FreeRTOS software timer. It implements a callback function that is called when the define time expire The...")
 
Line 9: Line 9:
 
== ITimer(timeSize oPeriod, bool oPeriodic) ==
 
== ITimer(timeSize oPeriod, bool oPeriodic) ==
 
=== Description ===
 
=== Description ===
Construct a ITimer to manage a FreeRTOS timer. This timer is just create, he does not start until start is called.
+
Construct a ITimer to manage a FreeRTOS timer. This timer is just create, he does not start until start() is called.
 
+
The timer could be set a periodic, it mean that when it ends it is restarted automatically. The parameter oPeriodic is basically set as true.
+
  
 
If the timer could not be create and useErrorHandler is define also an error "OS_MEMORY_COULD_NOT_BE_ALLOCATED" is sent.
 
If the timer could not be create and useErrorHandler is define also an error "OS_MEMORY_COULD_NOT_BE_ALLOCATED" is sent.

Revision as of 10:42, 10 August 2017

Contents

ITimer

The class ITimer is a C++ class that manage a FreeRTOS software timer. It implements a callback function that is called when the define time expire

The timer callback function must be reimplemented in a subclass.


Member Function Documentation

ITimer(timeSize oPeriod, bool oPeriodic)

Description

Construct a ITimer to manage a FreeRTOS timer. This timer is just create, he does not start until start() is called.

If the timer could not be create and useErrorHandler is define also an error "OS_MEMORY_COULD_NOT_BE_ALLOCATED" is sent.

Parameters

oPeriod : how long to wait (in ms) to send this command

oPeriodic : indicate if the timer is auto reload (true) or not (false)

~ITimer() [virtual]

Destroy the ITimer and the FreeRTOS timer.

bool setPeriod(timeSize oNewPeriod, timeSize oTimeToWait)

Set the period of the timer to the value of oNewPeriod.

oTimeToWait indicate the maximal amount of time that the thread that send this command must wait. This value is normally set as INFINIT_TIME. It mean that the thread will wait until the command works.

If the command fail and useErrorHandler is define an error "TIMER_PERIOD_NOT_CHANGED" is sent.

Do not use this method in an ISR. If you need it see setPeriodFromISR.

bool setPeriodFromISR(timeSize oNewPeriod)

Set the period of the timer to the value of oNewPeriod from an ISR.

Methods from ISR never send errors same if useErrorHandler is defined. See the return value to know if the command success.

bool start(timeSize timeToWait)

Starts the timer.

oTimeToWait indicate the maximal amount of time that the thread that send this command must wait. This value is normally set as INFINIT_TIME. It mean that the thread will wait until the command works.

If the command fails and useErrorHandler is define an error "TIMER_START_FAIL" is sent.

==

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox