Components/Libraries/XF/FreeRTOS/ITimer

(Difference between revisions)
Jump to: navigation, search
Line 12: Line 12:
  
 
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.
 
 
=== Parameters ===
 
=== Parameters ===
 
oPeriod : how long to wait (in ms) to send this command
 
oPeriod : how long to wait (in ms) to send this command
Line 19: Line 18:
  
 
== ~ITimer() [virtual] ==
 
== ~ITimer() [virtual] ==
 +
=== Description ===
 
Destroy the ITimer and the FreeRTOS timer.
 
Destroy the ITimer and the FreeRTOS timer.
  
 
== bool setPeriod(timeSize oNewPeriod, timeSize oTimeToWait) ==
 
== bool setPeriod(timeSize oNewPeriod, timeSize oTimeToWait) ==
 +
=== Description ===
 
Set the period of the timer to the value of oNewPeriod.
 
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.
 
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.
 
Do not use this method in an ISR. If you need it see setPeriodFromISR.
 +
=== Parameters ===
 +
oNewPeriod : the new period of the timer in millisecond
 +
 +
oTimeToWait : how long to wait (in ms) to send this command
 +
=== Return ===
 +
Return true if period has been changed successfully, else false
  
 
== bool setPeriodFromISR(timeSize oNewPeriod) ==
 
== bool setPeriodFromISR(timeSize oNewPeriod) ==
 +
=== Description ===
 
Set the period of the timer to the value of oNewPeriod from an ISR.
 
Set the period of the timer to the value of oNewPeriod from an ISR.
 
+
=== Parameters ===
Methods from ISR never send errors same if useErrorHandler is defined. See the return value to know if the command success.
+
oNewPeriod : the new period of the timer in millisecond
 +
=== Return ===
 +
Return true if period has been changed successfully, else false
  
 
== bool start(timeSize timeToWait) ==
 
== bool start(timeSize timeToWait) ==
Starts the timer.
+
=== Description ===
 
+
Start the timer. If timer was in the active state it will reset the timer period to 0, if it was not in the active state it just will start.
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.
 
If the command fails and useErrorHandler is define an error "TIMER_START_FAIL" is sent.
 +
=== Parameters ===
 +
timeToWait : how long to wait (in ms) to send this command
 +
=== Return ===
 +
Return true if period has been started successfully, else false
 +
 +
== bool startFromISR() ==
 +
=== Description ===
 +
Start the timer from an ISR context. If timer was in the active state it will reset the timer period to 0, if it was not in the active state it just will start.
 +
=== Return ===
 +
Return true if timer has been started successfully, else false
 +
 +
== bool stop(timeSize timeToWait) ==
 +
=== Description ===
 +
Stop the timer. This change the state to inactive
 +
=== Parameters ===
 +
timeToWait : how long to wait (in ms) to send this command
 +
=== Return ===
 +
Return true if timer has been stopped successfully, else false
 +
 +
== bool stopFromISR() ==
 +
=== Description ===
 +
Stop the timer from an ISR context. This change the state to inactive
 +
=== Return ===
 +
Return true if timer has been stopped successfully, else false
 +
 +
== bool reset(timeSize timeToWait) ==
 +
=== Description ===
 +
Reset the timer. If timer was in the active state it will reset the timer period to 0, if it was not in the active state it just will start.
 +
=== Parameters ===
 +
timeToWait : how long to wait (in ticks) to send this command
 +
=== Return ===
 +
Return true if timer has been reset successfully, else false
 +
 +
== bool resetFromISR() ==
 +
=== Description ===
 +
Reset the timer from an ISR context. If timer was in the active state it will reset the timer period to 0. If it was not in the active state it just will start.
 +
=== Return ===
 +
Return true if timer has been reset successfully, else false
  
==
+
== bool isActive() ==
 +
=== Description ===
 +
Inidicate if the timer is in the active state else false
 +
=== Return ===
 +
Return true if timer is in the active state else false

Revision as of 11:07, 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]

Description

Destroy the ITimer and the FreeRTOS timer.

bool setPeriod(timeSize oNewPeriod, timeSize oTimeToWait)

Description

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

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.

Parameters

oNewPeriod : the new period of the timer in millisecond

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

Return

Return true if period has been changed successfully, else false

bool setPeriodFromISR(timeSize oNewPeriod)

Description

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

Parameters

oNewPeriod : the new period of the timer in millisecond

Return

Return true if period has been changed successfully, else false

bool start(timeSize timeToWait)

Description

Start the timer. If timer was in the active state it will reset the timer period to 0, if it was not in the active state it just will start.

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

Parameters

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

Return

Return true if period has been started successfully, else false

bool startFromISR()

Description

Start the timer from an ISR context. If timer was in the active state it will reset the timer period to 0, if it was not in the active state it just will start.

Return

Return true if timer has been started successfully, else false

bool stop(timeSize timeToWait)

Description

Stop the timer. This change the state to inactive

Parameters

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

Return

Return true if timer has been stopped successfully, else false

bool stopFromISR()

Description

Stop the timer from an ISR context. This change the state to inactive

Return

Return true if timer has been stopped successfully, else false

bool reset(timeSize timeToWait)

Description

Reset the timer. If timer was in the active state it will reset the timer period to 0, if it was not in the active state it just will start.

Parameters

timeToWait : how long to wait (in ticks) to send this command

Return

Return true if timer has been reset successfully, else false

bool resetFromISR()

Description

Reset the timer from an ISR context. If timer was in the active state it will reset the timer period to 0. If it was not in the active state it just will start.

Return

Return true if timer has been reset successfully, else false

bool isActive()

Description

Inidicate if the timer is in the active state else false

Return

Return true if timer is in the active state else false

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox