Components/Libraries/XF/FreeRTOS/ITimer

From UIT
(Difference between revisions)
Jump to: navigation, search
(Parameters)
(void callback() [pure virtual] [protected])
 
(12 intermediate revisions by one user not shown)
Line 36: Line 36:
 
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 ===
 
=== Parameters ===
oNewPeriod : the new period of the timer in millisecond
+
timeSize '''oNewPeriod''' : the new period of the timer in millisecond
  
oTimeToWait : the maximal time (in ms) to wait if this command fails
+
timeSize '''oTimeToWait''' : the maximal time (in ms) to wait if this command fails
  
 
=== Return ===
 
=== Return ===
Return true if period has been changed successfully, else false
+
Returns true if period has been changed successfully, else false
  
 
== bool setPeriodFromISR(timeSize oNewPeriod) ==
 
== bool setPeriodFromISR(timeSize oNewPeriod) ==
Line 47: Line 47:
 
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 ===
 
=== Parameters ===
oNewPeriod : the new period of the timer in millisecond
+
timeSize '''oNewPeriod''' : the new period of the timer in millisecond
 +
 
 
=== Return ===
 
=== Return ===
 
Return true if period has been changed successfully, else false
 
Return true if period has been changed successfully, else false
Line 53: Line 54:
 
== bool start(timeSize timeToWait) ==
 
== bool start(timeSize timeToWait) ==
 
=== Description ===
 
=== 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.
+
Starts 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.
 
If the command fails and useErrorHandler is define an error "TIMER_START_FAIL" is sent.
 +
 +
Do not call this method in an ISR context, if you need to do this see startFromISR().
 +
 
=== Parameters ===
 
=== Parameters ===
timeToWait : how long to wait (in ms) to send this command
+
timeSize '''timeToWait''' : the maximal time (in ms) to wait if the command fails
 +
 
 
=== Return ===
 
=== Return ===
 
Return true if period has been started successfully, else false
 
Return true if period has been started successfully, else false
Line 63: Line 68:
 
== bool startFromISR() ==
 
== bool startFromISR() ==
 
=== Description ===
 
=== 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.
+
Starts 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 ===
Return true if timer has been started successfully, else false
+
Returns true if timer has been started successfully, else false
  
 
== bool stop(timeSize timeToWait) ==
 
== bool stop(timeSize timeToWait) ==
 
=== Description ===
 
=== Description ===
 
Stop the timer. This change the state to inactive
 
Stop the timer. This change the state to inactive
 +
 +
Do not call this method in an ISR context, if you need to do this see stopFromISR().
 
=== Parameters ===
 
=== Parameters ===
timeToWait : how long to wait (in ms) to send this command
+
timeSize '''timeToWait''' : maximal time (in ms) to wait if this command fails
 +
 
 
=== Return ===
 
=== Return ===
 
Return true if timer has been stopped successfully, else false
 
Return true if timer has been stopped successfully, else false
Line 83: Line 91:
 
== bool reset(timeSize timeToWait) ==
 
== bool reset(timeSize timeToWait) ==
 
=== Description ===
 
=== 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.
+
Reset the timer. If the 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.
 +
 
 +
Do not call this method in an ISR context, if you need to do this see startFromISR().
 +
 
 
=== Parameters ===
 
=== Parameters ===
 
timeToWait : how long to wait (in ticks) to send this command
 
timeToWait : how long to wait (in ticks) to send this command
Line 104: Line 115:
 
=== Description ===
 
=== Description ===
 
The callback function of the Timer. You must override this function for your application.
 
The callback function of the Timer. You must override this function for your application.
 
== void timerCallbackWrapper(TimerHandle_t xTimer) [static] [private]
 
=== Description ===
 
Adapter function that allow you to write a class specific callback() function that interfaces with Free RTOS.
 
=== Parameters ===
 
TimerHandle_t : the Free RTOS timer that expire
 

Latest revision as of 13:02, 21 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 defined time expires

The timer callback function must be reimplemented in a subclass.

Member Attibutes

TimerHandle_t _timerHandler : the FreeRTOS timer

bool _isActive  : indicate if the ITimer is active or not

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.

If you do not use the error handler and want to know if the timer has been created successfully you can call the method isCreated().

Parameters

timeSize oPeriod : the maximal time (in ms) to wait if this command fails

bool 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

timeSize oNewPeriod : the new period of the timer in millisecond

timeSize oTimeToWait : the maximal time (in ms) to wait if this command fails

Return

Returns 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

timeSize 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

Starts 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.

Do not call this method in an ISR context, if you need to do this see startFromISR().

Parameters

timeSize timeToWait : the maximal time (in ms) to wait if the command fails

Return

Return true if period has been started successfully, else false

bool startFromISR()

Description

Starts 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

Returns true if timer has been started successfully, else false

bool stop(timeSize timeToWait)

Description

Stop the timer. This change the state to inactive

Do not call this method in an ISR context, if you need to do this see stopFromISR().

Parameters

timeSize timeToWait : maximal time (in ms) to wait if this command fails

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 the 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.

Do not call this method in an ISR context, if you need to do this see startFromISR().

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

void callback() [pure virtual] [protected]

Description

The callback function of the Timer. You must override this function for your application.

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox