*\r
* Queries a timer to see if it is active or dormant.\r
*\r
- * A timer will be ormant if:\r
+ * A timer will be dormant if:\r
* 1) It has been created but not started, or \r
* 2) It is an expired on-shot timer that has not been restarted.\r
*\r
*\r
* xTimerStart() starts a timer that was previously created using the \r
* xTimerCreate() API function. If the timer had already been started and was\r
- * already in the active state, then xTimerStart() has equaivalent functionality\r
+ * already in the active state, then xTimerStart() has equivalent functionality\r
* to the xTimerReset() API function.\r
*\r
* Starting a timer ensures the timer is in the active state. If the timer\r
* The configUSE_TIMERS configuration constant must be set to 1 for \r
* xTimerChangePeriod() to be available.\r
*\r
- * @param xTimer The handle of the timer being stopped.\r
+ * @param xTimer The handle of the timer that is having its period changed.\r
*\r
* @param xNewPeriod The new period for xTimer. Timer periods are specified in \r
* tick periods, so the constant portTICK_RATE_MS can be used to convert a time \r
* already in the active state, then xTimerReset() will cause the timer to\r
* re-evaluate its expiry time so that it is relative to when xTimerReset() was\r
* called. If the timer was in the dormant state then xTimerReset() has \r
- * equaivalent functionality to the xTimerStart() API function.\r
+ * equivalent functionality to the xTimerStart() API function.\r
*\r
* Resetting a timer ensures the timer is in the active state. If the timer\r
* is not stopped, deleted, or reset in the mean time, the callback function\r
*\r
* Example usage:\r
* \r
- * // This scenario assumes xTimer has already been created. When a key is \r
- * // pressed, an LCD backlight is switched on. If 5 seconds pass without a key \r
- * // being pressed, then the LCD backlight is switched off. In this case, the \r
- * // timer is a one-shot timer.\r
+ * // When a key is pressed, an LCD back-light is switched on. If 5 seconds pass \r
+ * // without a key being pressed, then the LCD back-light is switched off. In \r
+ * // this case, the timer is a one-shot timer.\r
*\r
* xTimerHandle xBacklightTimer = NULL;\r
*\r
* void vBacklightTimerCallback( xTIMER *pxTimer )\r
* {\r
* // The timer expired, therefore 5 seconds must have passed since a key\r
- * // was pressed. Switch off the LCD backlight.\r
+ * // was pressed. Switch off the LCD back-light.\r
* vSetBacklightState( BACKLIGHT_OFF );\r
* }\r
*\r
* // The key press event handler.\r
* void vKeyPressEventHandler( char cKey )\r
* {\r
- * // Ensure the LCD backlight is on, then reset the timer that is\r
- * // responsible for turning the backlight off after 5 seconds of \r
+ * // Ensure the LCD back-light is on, then reset the timer that is\r
+ * // responsible for turning the back-light off after 5 seconds of \r
* // key inactivity. Wait 10 ticks for the command to be successfully sent\r
* // if it cannot be sent immediately.\r
* vSetBacklightState( BACKLIGHT_ON );\r
- * if( vTimerReset( xBacklightTimer, 100 ) != pdPASS )\r
+ * if( xTimerReset( xBacklightTimer, 100 ) != pdPASS )\r
* {\r
* // The reset command was not executed successfully. Take appropriate\r
* // action here.\r
* long x;\r
* \r
* // Create then start the one-shot timer that is responsible for turning\r
- * // the backlight off if no keys are pressed within a 5 second period.\r
+ * // the back-light off if no keys are pressed within a 5 second period.\r
* xBacklightTimer = xTimerCreate( "BacklightTimer", // Just a text name, not used by the kernel.\r
* ( 5000 / portTICK_RATE_MS), // The timer period in ticks.\r
* pdFALSE, // The timer is a one-shot timer.\r
* 0, // The id is not used by the callback so can take any value.\r
- * vBacklightTimerCallback // The callback function that switches the LCD backlight off.\r
+ * vBacklightTimerCallback // The callback function that switches the LCD back-light off.\r
* );\r
* \r
* if( xBacklightTimer == NULL )\r
* portBASE_TYPE xTimerStartFromISR( xTimerHandle xTimer, \r
* portBASE_TYPE *pxHigherPriorityTaskWoken );\r
*\r
- * Description goes here ####\r
+ * A version of xTimerStart() that can be called from an interrupt service\r
+ * routine.\r
*\r
- * @param xTimer\r
+ * @param xTimer The handle of the timer being started/restarted.\r
*\r
- * @return \r
+ * @param pxHigherPriorityTaskWoken The timer service/daemon task spends most\r
+ * of its time in the Blocked state, waiting for messages to arrive on the timer\r
+ * command queue. Calling xTimerStartFromISR() writes a message to the timer\r
+ * command queue, so has the potential to transition the timer service/daemon\r
+ * task out of the Blocked state. If calling xTimerStartFromISR() causes the\r
+ * timer service/daemon task to leave the Blocked state, and the timer service/\r
+ * daemon task has a priority equal to or greater than the currently executing\r
+ * task (the task that was interrupted), then *pxHigherPriorityTaskWoken will\r
+ * get set to pdTRUE internally within the xTimerStartFromISR() function. If\r
+ * xTimerStartFromISR() sets this value to pdTRUE then a context switch should\r
+ * be performed before the interrupt exits.\r
+ *\r
+ * @return pdFAIL will be returned if the start command could not be sent to \r
+ * the timer command queue. pdPASS will be returned if the command was \r
+ * successfully send to the timer command queue. When the command is actually \r
+ * processed will depend on the priority of the timer service/daemon task \r
+ * relative to other tasks in the system, although the timers expiry time is \r
+ * relative to when xTimerStart() is actually called. The timer service/daemon \r
+ * task priority is set by the configTIMER_TASK_PRIORITY configuration constant. \r
*\r
* Example usage:\r
+ * \r
+ * // This scenario assumes xBacklightTimer has already been created. When a \r
+ * // key is pressed, an LCD back-light is switched on. If 5 seconds pass \r
+ * // without a key being pressed, then the LCD back-light is switched off. In \r
+ * // this case, the timer is a one-shot timer, and unlike the example given for \r
+ * // the xTimerReset() function, the key press event handler is an interrupt\r
+ * // service routine.\r
+ *\r
+ * // The callback function assigned to the one-shot timer. In this case the\r
+ * // parameter is not used.\r
+ * void vBacklightTimerCallback( xTIMER *pxTimer )\r
+ * {\r
+ * // The timer expired, therefore 5 seconds must have passed since a key\r
+ * // was pressed. Switch off the LCD back-light.\r
+ * vSetBacklightState( BACKLIGHT_OFF );\r
+ * }\r
+ *\r
+ * // The key press interrupt service routine.\r
+ * void vKeyPressEventInterruptHandler( void )\r
+ * {\r
+ * portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
+ *\r
+ * // Ensure the LCD back-light is on, then restart the timer that is\r
+ * // responsible for turning the back-light off after 5 seconds of \r
+ * // key inactivity. This is an interrupt service routine so can only\r
+ * // call FreeRTOS API functions that end in "FromISR".\r
+ * vSetBacklightState( BACKLIGHT_ON );\r
+ *\r
+ * // xTimerStartFromISR() or xTimerResetFromISR() could be called here\r
+ * // as both cause the timer to re-calculate its expiry time.\r
+ * // xHigherPriorityTaskWoken was initialised to pdFALSE when it was\r
+ * // declared (in this function).\r
+ * if( xTimerStartFromISR( xBacklightTimer, &xHigherPriorityTaskWoken ) != pdPASS )\r
+ * {\r
+ * // The start command was not executed successfully. Take appropriate\r
+ * // action here.\r
+ * }\r
+ *\r
+ * // Perform the rest of the key processing here.\r
+ *\r
+ * // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch\r
+ * // should be performed. The syntax required to perform a context switch\r
+ * // from inside an ISR varies from port to port, and from compiler to\r
+ * // compiler. Inspect the demos for the port you are using to find the\r
+ * // actual syntax required.\r
+ * if( xHigherPriorityTaskWoken != pdFALSE )\r
+ * {\r
+ * // Call the interrupt safe yield function here (actual function\r
+ * // depends on the FreeRTOS port being used.\r
+ * }\r
+ * }\r
*/\r
#define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( xTimer, tmrCOMMAND_START, xTaskGetTickCountFromISR(), pxHigherPriorityTaskWoken, 0 )\r
\r
* portBASE_TYPE xTimerStopFromISR( xTimerHandle xTimer, \r
* portBASE_TYPE *pxHigherPriorityTaskWoken );\r
*\r
- * Description goes here ####\r
+ * A version of xTimerStop() that can be called from an interrupt service\r
+ * routine.\r
*\r
- * @param xTimer\r
+ * @param xTimer The handle of the timer being stopped.\r
*\r
- * @return \r
+ * @param pxHigherPriorityTaskWoken The timer service/daemon task spends most\r
+ * of its time in the Blocked state, waiting for messages to arrive on the timer\r
+ * command queue. Calling xTimerStopFromISR() writes a message to the timer\r
+ * command queue, so has the potential to transition the timer service/daemon\r
+ * task out of the Blocked state. If calling xTimerStopFromISR() causes the\r
+ * timer service/daemon task to leave the Blocked state, and the timer service/\r
+ * daemon task has a priority equal to or greater than the currently executing\r
+ * task (the task that was interrupted), then *pxHigherPriorityTaskWoken will\r
+ * get set to pdTRUE internally within the xTimerStopFromISR() function. If\r
+ * xTimerStopFromISR() sets this value to pdTRUE then a context switch should\r
+ * be performed before the interrupt exits.\r
+ *\r
+ * @return pdFAIL will be returned if the stop command could not be sent to \r
+ * the timer command queue. pdPASS will be returned if the command was \r
+ * successfully send to the timer command queue. When the command is actually \r
+ * processed will depend on the priority of the timer service/daemon task \r
+ * relative to other tasks in the system. The timer service/daemon task \r
+ * priority is set by the configTIMER_TASK_PRIORITY configuration constant. \r
*\r
* Example usage:\r
+ *\r
+ * // This scenario assumes xTimer has already been created and started. When\r
+ * // an interrupt occurs, the timer should be simply stopped.\r
+ *\r
+ * // The interrupt service routine that stops the timer.\r
+ * void vAnExampleInterruptServiceRoutine( void )\r
+ * {\r
+ * portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
+ *\r
+ * // The interrupt has occurred - simply stop the timer.\r
+ * // xHigherPriorityTaskWoken was set to pdFALSE where it was defined\r
+ * // (within this function). As this is an interrupt service routine, only\r
+ * // FreeRTOS API functions that end in "FromISR" can be used.\r
+ * if( xTimerStopFromISR( xTimer, &xHigherPriorityTaskWoken ) != pdPASS )\r
+ * {\r
+ * // The stop command was not executed successfully. Take appropriate\r
+ * // action here.\r
+ * }\r
+ *\r
+ * // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch\r
+ * // should be performed. The syntax required to perform a context switch\r
+ * // from inside an ISR varies from port to port, and from compiler to\r
+ * // compiler. Inspect the demos for the port you are using to find the\r
+ * // actual syntax required.\r
+ * if( xHigherPriorityTaskWoken != pdFALSE )\r
+ * {\r
+ * // Call the interrupt safe yield function here (actual function\r
+ * // depends on the FreeRTOS port being used.\r
+ * }\r
+ * }\r
*/\r
#define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( xTimer, tmrCOMMAND_STOP, 0, pxHigherPriorityTaskWoken, 0 )\r
\r
* portTickType xNewPeriod,\r
* portBASE_TYPE *pxHigherPriorityTaskWoken );\r
*\r
- * Description goes here ####\r
+ * A version of xTimerChangePeriod() that can be called from an interrupt \r
+ * service routine.\r
+ *\r
+ * @param xTimer The handle of the timer that is having its period changed.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken The timer service/daemon task spends most\r
+ * of its time in the Blocked state, waiting for messages to arrive on the timer\r
+ * command queue. Calling xTimerChangePeriodFromISR() writes a message to the \r
+ * timer command queue, so has the potential to transition the timer service/\r
+ * daemon task out of the Blocked state. If calling xTimerChangePeriodFromISR() \r
+ * causes the timer service/daemon task to leave the Blocked state, and the \r
+ * timer service/daemon task has a priority equal to or greater than the \r
+ * currently executing task (the task that was interrupted), then \r
+ * *pxHigherPriorityTaskWoken will get set to pdTRUE internally within the \r
+ * xTimerChangePeriodFromISR() function. If xTimerChangePeriodFromISR() sets \r
+ * this value to pdTRUE then a context switch should be performed before the \r
+ * interrupt exits.\r
+ *\r
+ * @return pdFAIL will be returned if the command to change the timers period\r
+ * could not be sent to the timer command queue. pdPASS will be returned if the \r
+ * command was successfully send to the timer command queue. When the command \r
+ * is actually processed will depend on the priority of the timer service/daemon \r
+ * task relative to other tasks in the system. The timer service/daemon task \r
+ * priority is set by the configTIMER_TASK_PRIORITY configuration constant. \r
*\r
- * @param xTimer\r
+ * Example usage:\r
*\r
- * @return \r
+ * // This scenario assumes xTimer has already been created and started. When\r
+ * // an interrupt occurs, the period of xTimer should be changed to 500ms.\r
*\r
- * Example usage:\r
+ * // The interrupt service routine that changes the period of xTimer.\r
+ * void vAnExampleInterruptServiceRoutine( void )\r
+ * {\r
+ * portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
+ *\r
+ * // The interrupt has occurred - change the period of xTimer to 500ms.\r
+ * // xHigherPriorityTaskWoken was set to pdFALSE where it was defined\r
+ * // (within this function). As this is an interrupt service routine, only\r
+ * // FreeRTOS API functions that end in "FromISR" can be used.\r
+ * if( xTimerChangePeriodFromISR( xTimer, &xHigherPriorityTaskWoken ) != pdPASS )\r
+ * {\r
+ * // The command to change the timers period was not executed \r
+ * // successfully. Take appropriate action here.\r
+ * }\r
+ *\r
+ * // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch\r
+ * // should be performed. The syntax required to perform a context switch\r
+ * // from inside an ISR varies from port to port, and from compiler to\r
+ * // compiler. Inspect the demos for the port you are using to find the\r
+ * // actual syntax required.\r
+ * if( xHigherPriorityTaskWoken != pdFALSE )\r
+ * {\r
+ * // Call the interrupt safe yield function here (actual function\r
+ * // depends on the FreeRTOS port being used.\r
+ * }\r
+ * }\r
*/\r
#define xTimerChangePeriodFromISR( xTimer, xNewPeriod, pxHigherPriorityTaskWoken ) xTimerGenericCommand( xTimer, tmrCOMMAND_CHANGE_PERIOD, xNewPeriod, pxHigherPriorityTaskWoken, 0 )\r
\r
* portBASE_TYPE xTimerResetFromISR( xTimerHandle xTimer, \r
* portBASE_TYPE *pxHigherPriorityTaskWoken );\r
*\r
- * Description goes here ####\r
+ * A version of xTimerReset() that can be called from an interrupt service\r
+ * routine.\r
*\r
- * @param xTimer\r
+ * @param xTimer The handle of the timer that is to be started, reset, or\r
+ * restarted.\r
*\r
- * @return \r
+ * @param pxHigherPriorityTaskWoken The timer service/daemon task spends most\r
+ * of its time in the Blocked state, waiting for messages to arrive on the timer\r
+ * command queue. Calling xTimerResetFromISR() writes a message to the timer\r
+ * command queue, so has the potential to transition the timer service/daemon\r
+ * task out of the Blocked state. If calling xTimerResetFromISR() causes the\r
+ * timer service/daemon task to leave the Blocked state, and the timer service/\r
+ * daemon task has a priority equal to or greater than the currently executing\r
+ * task (the task that was interrupted), then *pxHigherPriorityTaskWoken will\r
+ * get set to pdTRUE internally within the xTimerResetFromISR() function. If\r
+ * xTimerResetFromISR() sets this value to pdTRUE then a context switch should\r
+ * be performed before the interrupt exits.\r
+ *\r
+ * @return pdFAIL will be returned if the reset command could not be sent to \r
+ * the timer command queue. pdPASS will be returned if the command was \r
+ * successfully send to the timer command queue. When the command is actually \r
+ * processed will depend on the priority of the timer service/daemon task \r
+ * relative to other tasks in the system, although the timers expiry time is \r
+ * relative to when xTimerStart() is actually called. The timer service/daemon \r
+ * task priority is set by the configTIMER_TASK_PRIORITY configuration constant. \r
*\r
* Example usage:\r
+ * \r
+ * // This scenario assumes xBacklightTimer has already been created. When a \r
+ * // key is pressed, an LCD back-light is switched on. If 5 seconds pass \r
+ * // without a key being pressed, then the LCD back-light is switched off. In \r
+ * // this case, the timer is a one-shot timer, and unlike the example given for \r
+ * // the xTimerReset() function, the key press event handler is an interrupt\r
+ * // service routine.\r
+ *\r
+ * // The callback function assigned to the one-shot timer. In this case the\r
+ * // parameter is not used.\r
+ * void vBacklightTimerCallback( xTIMER *pxTimer )\r
+ * {\r
+ * // The timer expired, therefore 5 seconds must have passed since a key\r
+ * // was pressed. Switch off the LCD back-light.\r
+ * vSetBacklightState( BACKLIGHT_OFF );\r
+ * }\r
+ *\r
+ * // The key press interrupt service routine.\r
+ * void vKeyPressEventInterruptHandler( void )\r
+ * {\r
+ * portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
+ *\r
+ * // Ensure the LCD back-light is on, then reset the timer that is\r
+ * // responsible for turning the back-light off after 5 seconds of \r
+ * // key inactivity. This is an interrupt service routine so can only\r
+ * // call FreeRTOS API functions that end in "FromISR".\r
+ * vSetBacklightState( BACKLIGHT_ON );\r
+ *\r
+ * // xTimerStartFromISR() or xTimerResetFromISR() could be called here\r
+ * // as both cause the timer to re-calculate its expiry time.\r
+ * // xHigherPriorityTaskWoken was initialised to pdFALSE when it was\r
+ * // declared (in this function).\r
+ * if( xTimerResetFromISR( xBacklightTimer, &xHigherPriorityTaskWoken ) != pdPASS )\r
+ * {\r
+ * // The reset command was not executed successfully. Take appropriate\r
+ * // action here.\r
+ * }\r
+ *\r
+ * // Perform the rest of the key processing here.\r
+ *\r
+ * // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch\r
+ * // should be performed. The syntax required to perform a context switch\r
+ * // from inside an ISR varies from port to port, and from compiler to\r
+ * // compiler. Inspect the demos for the port you are using to find the\r
+ * // actual syntax required.\r
+ * if( xHigherPriorityTaskWoken != pdFALSE )\r
+ * {\r
+ * // Call the interrupt safe yield function here (actual function\r
+ * // depends on the FreeRTOS port being used.\r
+ * }\r
+ * }\r
*/\r
#define xTimerResetFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( xTimer, tmrCOMMAND_START, xTaskGetTickCountFromISR(), pxHigherPriorityTaskWoken, 0 )\r
\r