extern "C" {\r
#endif\r
\r
-/* IDs for commands that can be sent/received on the timer queue. */\r
+/* IDs for commands that can be sent/received on the timer queue. These are to\r
+be used solely through the macros that make up the public software timer API,\r
+as defined below. */\r
#define tmrCOMMAND_START 0\r
#define tmrCOMMAND_STOP 1\r
#define tmrCOMMAND_CHANGE_PERIOD 2\r
* MACROS AND DEFINITIONS\r
*----------------------------------------------------------*/\r
\r
+ /**\r
+ * Type by which software timers are referenced. For example, a call to \r
+ * xTimerCreate() returns an xTimerHandle variable that can then be used to\r
+ * reference the subject timer in calls to other software timer API functions\r
+ * (for example, xTimerStart(), xTimerReset(), etc.).\r
+ */\r
typedef void * xTimerHandle;\r
\r
/* Define the prototype to which timer callback functions must conform. */\r
typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );\r
\r
-portBASE_TYPE xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;\r
+/**\r
+ * xTimerHandle xTimerCreate( const signed char *pcTimerName, \r
+ * portTickType xTimerPeriod, \r
+ * unsigned portBASE_TYPE uxAutoReload, \r
+ * void * pvTimerID, \r
+ * tmrTIMER_CALLBACK pxCallbackFunction );\r
+ *\r
+ * Creates a new software timer instance. This allocates the storage required \r
+ * by the new timer, initialises the new timers internal state, and returns a \r
+ * handle by which the new timer can be referenced.\r
+ *\r
+ * Timers are created in the dormant state. The xTimerStart(), xTimerReset(),\r
+ * xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and\r
+ * xTimerChangePeriodFromISR() can all be used to transition a timer into the\r
+ * active state.\r
+ *\r
+ * @param pcTimerName A text name that is assigned to the timer. This is done\r
+ * purely to assist debugging. The kernel itself only ever references a timer by\r
+ * its handle, and never by its name.\r
+ *\r
+ * @param xTimerPeriod The timer period. The time is defined in tick periods so \r
+ * the constant portTICK_RATE_MS can be used to convert a time that has been\r
+ * specified in milliseconds. For example, if the timer must expire after 100\r
+ * ticks, then xTimerPeriod should be set to 100. Alternatively, if the timer\r
+ * must expire after 500ms, then xPeriod can be set to ( 500 / portTICK_RATE_MS )\r
+ * provided configTICK_RATE_HZ is set to less than or equal to 1000.\r
+ *\r
+ * @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will\r
+ * expire repeatedly with a frequency set by the xTimerPeriod parameter. If\r
+ * uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and\r
+ * will expire once only xTimerPeriod ticks from the time it is started.\r
+ *\r
+ * @param pvTimerID An identifier to assign to the timer being created. \r
+ * Typically this would be used to identify the timer that expired within the\r
+ * timers callback function when multiple timers are assigned the same callback\r
+ * function.\r
+ *\r
+ * @param pxCallbackFunction The function to call when the timer expires.\r
+ *\r
+ * @return If the timer is successfully create then a handle to the newly\r
+ * created timer is returned. If the timer cannot be created (because either\r
+ * there is insufficient FreeRTOS heap remaining to allocate the timer \r
+ * structures, or the timer period was set to 0) then 0 is returned.\r
+ *\r
+ * Example usage:\r
+ *\r
+ * \r
+ * #define NUM_TIMERS 5\r
+ * \r
+ * // An array to hold handles to the created timers.\r
+ * xTimerHandle xTimers[ NUM_TIMERS ];\r
+ * \r
+ * // An array to hold a count of the number of times each timer expires.\r
+ * long lExpireCounters[ NUM_TIMERS ] = { 0 };\r
+ * \r
+ * // Define a callback function that will be used by multiple timer instances. \r
+ * // The callback function does nothing but count the number of times the \r
+ * // associated timer expires, and stop the timer once the timer has expired\r
+ * // 10 times.\r
+ * void vTimerCallback( xTIMER *pxTimer )\r
+ * {\r
+ * long lArrayIndex;\r
+ * const long xMaxExpiryCountBeforeStopping = 10;\r
+ * \r
+ * // Optionally do something if the pxTimer parameter is NULL.\r
+ * configASSERT( pxTimer );\r
+ * \r
+ * // Which timer expired?\r
+ * lArrayIndex = ( long ) pvTimerGetTimerID( pxTimer );\r
+ * \r
+ * // Increment the number of times that pxTimer has expired.\r
+ * lExpireCounters[ lArrayIndex ] += 1;\r
+ *\r
+ * // If the timer has expired 10 times then stop it from running.\r
+ * if( lExpireCounters[ lArrayIndex ] == xMaxExpiryCountBeforeStopping )\r
+ * {\r
+ * // Do not use a block time if calling a timer API function from a\r
+ * // timer callback function, as doing so could cause a deadlock!\r
+ * xTimerStop( pxTimer, 0 );\r
+ * }\r
+ * }\r
+ * \r
+ * void main( void )\r
+ * {\r
+ * long x;\r
+ * \r
+ * // Create then start some timers. Starting the timers before the scheduler\r
+ * // has been started means the timers will start running immediately that\r
+ * // the scheduler starts.\r
+ * for( x = 0; x < NUM_TIMERS; x++ )\r
+ * {\r
+ * xTimers[ x ] = xTimerCreate( "Timer", // Just a text name, not used by the kernel.\r
+ * ( 100 * x ), // The timer period in ticks.\r
+ * pdTRUE, // The timers will auto-reload themselves when they expire.\r
+ * ( void * ) x, // Assign each timer a unique id equal to its array index.\r
+ * vTimerCallback // Each timer calls the same callback when it expires.\r
+ * );\r
+ * \r
+ * if( xTimers[ x ] == NULL )\r
+ * {\r
+ * // The timer was not created.\r
+ * }\r
+ * else\r
+ * {\r
+ * // Start the timer. No block time is specified, and even if one was\r
+ * // it would be ignored because the scheduler has not yet been\r
+ * // started. \r
+ * if( xTimerStart( xTimers[ x ], 0 ) != pdPASS )\r
+ * {\r
+ * // The timer could not be set into the Active state.\r
+ * }\r
+ * }\r
+ * }\r
+ * \r
+ * // ...\r
+ * // Create tasks here.\r
+ * // ...\r
+ * \r
+ * // Starting the scheduler will start the timers running as they have already\r
+ * // been set into the active state.\r
+ * xTaskStartScheduler();\r
+ * \r
+ * // Should not reach here.\r
+ * for( ;; );\r
+ * }\r
+ */\r
xTimerHandle xTimerCreate( const signed char *pcTimerName, portTickType xTimerPeriod, unsigned portBASE_TYPE uxAutoReload, void * pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * void *pvTimerGetTimerID( xTimerHandle xTimer );\r
+ *\r
+ * Returns the ID assigned to the xTimer parameter. \r
+ * \r
+ * IDs are assigned to timers using the pvTimerID parameter of the call to\r
+ * xTimerCreated() used to create the timer.\r
+ *\r
+ * If the same callback function is assigned to multiple tasks then the timer\r
+ * ID can be used within the callback function to identify which timer actually\r
+ * expired.\r
+ *\r
+ * @param xTimer The timer being queried.\r
+ *\r
+ * @return The ID assigned to the timer being queried.\r
+ *\r
+ * Example usage:\r
+ *\r
+ * See the xTimerCreate() API function example usage scenario.\r
+ */\r
void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;\r
-portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer );\r
+ *\r
+ * Queries a timer to see if it is active or dormant.\r
+ *\r
+ * A timer will be ormant 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
+ * Timers can be started using the xTimerStart(), xTimerReset(),\r
+ * xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and\r
+ * xTimerChangePeriodFromISR() API functions.\r
+ *\r
+ * @param xTimer The timer being queried.\r
+ *\r
+ * @return pdFALSE will be returned if the timer is dormant. A value other than\r
+ * pdFALSE will be returned if the timer is active.\r
+ *\r
+ * Example usage:\r
+ *\r
+ * // This function assumes xTimer has already been created.\r
+ * void vAFunction( xTimerHandle xTimer )\r
+ * {\r
+ * if( xTimerIsTimerActive( xTimer ) != pdFALSE ) // or more simply and equivalently "if( xTimerIsTimerActive( xTimer )" )\r
+ * {\r
+ * // xTimer is active, do something.\r
+ * }\r
+ * else\r
+ * {\r
+ * // xTimer is not active, do something else.\r
+ * } \r
+ * }\r
+ */\r
portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;\r
\r
+/**\r
+ * portBASE_TYPE xTimerStart( xTimerHandle xTimer, portTickType xBlockTime );\r
+ *\r
+ * Timer functionality is provided by a timer service/daemon task. Many of the\r
+ * public FreeRTOS timer API functions send commands to the timer service task \r
+ * though a queue called the timer command queue. The timer command queue is \r
+ * private to the kernel itself and is not directly accessible to application \r
+ * code. The length of the timer command queue is set by the \r
+ * configTIMER_QUEUE_LENGTH configuration constant.\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
+ * to the xTimerReset() API function.\r
+ *\r
+ * Starting 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
+ * associated with the timer will get called 'n 'ticks after xTimerStart() was \r
+ * called, where 'n' is the timers defined period.\r
+ *\r
+ * It is valid to call xTimerStart() before the scheduler has been started, but\r
+ * when this is done the timer will not actually start until the scheduler is\r
+ * started, and the timers expiry time will be relative to when the scheduler is\r
+ * started, not relative to when xTimerStart() was called.\r
+ *\r
+ * The configUSE_TIMERS configuration constant must be set to 1 for xTimerStart()\r
+ * to be available.\r
+ *\r
+ * @param xTimer The handle of the timer being started/restarted.\r
+ *\r
+ * @param xBlockTime Specifies the time, in ticks, that the calling task should\r
+ * be held in the Blocked state to wait for the start command to be successfully\r
+ * sent to the timer command queue, should the queue already be full when \r
+ * xTimerStart() was called. xBlockTime is ignored if xTimerStart() is called\r
+ * before the scheduler is started. \r
+ *\r
+ * @return pdFAIL will be returned if the start command could not be sent to \r
+ * the timer command queue even after xBlockTime ticks had passed. pdPASS will\r
+ * be returned if the command was successfully send to the timer command queue.\r
+ * When the command is actually processed will depend on the priority of the\r
+ * timer service/daemon task relative to other tasks in the system, although the\r
+ * timers expiry time is relative to when xTimerStart() is actually called. The \r
+ * timer service/daemon task priority is set by the configTIMER_TASK_PRIORITY \r
+ * configuration constant.\r
+ *\r
+ * Example usage:\r
+ * \r
+ * See the xTimerCreate() API function example usage scenario.\r
+ *\r
+ */\r
#define xTimerStart( xTimer, xBlockTime ) xTimerGenericCommand( xTimer, tmrCOMMAND_START, xTaskGetTickCount(), NULL, xBlockTime )\r
+\r
+/**\r
+ * portBASE_TYPE xTimerStop( xTimerHandle xTimer, portTickType xBlockTime );\r
+ *\r
+ * Timer functionality is provided by a timer service/daemon task. Many of the\r
+ * public FreeRTOS timer API functions send commands to the timer service task \r
+ * though a queue called the timer command queue. The timer command queue is \r
+ * private to the kernel itself and is not directly accessible to application \r
+ * code. The length of the timer command queue is set by the \r
+ * configTIMER_QUEUE_LENGTH configuration constant.\r
+ *\r
+ * xTimerStop() stops a timer that was previously started using either of the \r
+ * The xTimerStart(), xTimerReset(), xTimerStartFromISR(), xTimerResetFromISR(), \r
+ * xTimerChangePeriod() or xTimerChangePeriodFromISR() API functions.\r
+ *\r
+ * Stopping a timer ensures the timer is not in the active state.\r
+ *\r
+ * The configUSE_TIMERS configuration constant must be set to 1 for xTimerStop()\r
+ * to be available.\r
+ *\r
+ * @param xTimer The handle of the timer being stopped.\r
+ *\r
+ * @param xBlockTime Specifies the time, in ticks, that the calling task should\r
+ * be held in the Blocked state to wait for the stop command to be successfully\r
+ * sent to the timer command queue, should the queue already be full when \r
+ * xTimerStop() was called. xBlockTime is ignored if xTimerStop() is called\r
+ * before the scheduler is started. \r
+ *\r
+ * @return pdFAIL will be returned if the stop command could not be sent to \r
+ * the timer command queue even after xBlockTime ticks had passed. pdPASS will\r
+ * be returned if the command was successfully send to the timer command queue.\r
+ * When the command is actually processed will depend on the priority of the\r
+ * timer service/daemon task relative to other tasks in the system. The timer \r
+ * service/daemon task priority is set by the configTIMER_TASK_PRIORITY \r
+ * configuration constant.\r
+ *\r
+ * Example usage:\r
+ * \r
+ * See the xTimerCreate() API function example usage scenario.\r
+ *\r
+ */\r
#define xTimerStop( xTimer, xBlockTime ) xTimerGenericCommand( xTimer, tmrCOMMAND_STOP, 0, NULL, xBlockTime )\r
-#define xTimerChangePeriod( xTimer, xNewPeriod, xBlockTime ) xTimerGenericCommand( xTimer, tmrCOMMAND_CHANGE_PERIOD, xNewPeriod, NULL, xBlockTime )\r
+\r
+/**\r
+ * portBASE_TYPE xTimerChangePeriod( xTimerHandle xTimer, \r
+ * portTickType xNewPeriod,\r
+ * portTickType xBlockTime );\r
+ *\r
+ * Timer functionality is provided by a timer service/daemon task. Many of the\r
+ * public FreeRTOS timer API functions send commands to the timer service task \r
+ * though a queue called the timer command queue. The timer command queue is \r
+ * private to the kernel itself and is not directly accessible to application \r
+ * code. The length of the timer command queue is set by the \r
+ * configTIMER_QUEUE_LENGTH configuration constant.\r
+ *\r
+ * xTimerChangePeriod() changes the period of a timer that was previously \r
+ * created using the xTimerCreate() API function.\r
+ *\r
+ * xTimerChangePeriod() can be called to change the period of an active or\r
+ * dormant state timer.\r
+ *\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
+ *\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
+ * that has been specified in milliseconds. For example, if the timer must \r
+ * expire after 100 ticks, then xNewPeriod should be set to 100. Alternatively, \r
+ * if the timer must expire after 500ms, then xNewPeriod can be set to \r
+ * ( 500 / portTICK_RATE_MS ) provided configTICK_RATE_HZ is set to less than\r
+ * or equal to 1000.\r
+ *\r
+ * @param xBlockTime Specifies the time, in ticks, that the calling task should\r
+ * be held in the Blocked state to wait for the change period command to be \r
+ * successfully sent to the timer command queue, should the queue already be \r
+ * full when xTimerChangePeriod() was called. xBlockTime is ignored if \r
+ * xTimerChangePeriod() is called before the scheduler is started. \r
+ *\r
+ * @return pdFAIL will be returned if the change period command could not be \r
+ * sent to the timer command queue even after xBlockTime ticks had passed. \r
+ * pdPASS will be returned if the command was successfully send to the timer \r
+ * command queue. When the command is actually processed will depend on the \r
+ * priority of the timer service/daemon task relative to other tasks in the \r
+ * system. The timer service/daemon task priority is set by the \r
+ * configTIMER_TASK_PRIORITY configuration constant.\r
+ *\r
+ * Example usage:\r
+ *\r
+ * // This function assumes xTimer has already been created. If the timer\r
+ * // referenced by xTimer is already active when it is called, then the timer \r
+ * // is deleted. If the timer referenced by xTimer is not active when it is\r
+ * // called, then the period of the timer is set to 500ms and the timer is\r
+ * // started.\r
+ * void vAFunction( xTimerHandle xTimer )\r
+ * {\r
+ * if( xTimerIsTimerActive( xTimer ) != pdFALSE ) // or more simply and equivalently "if( xTimerIsTimerActive( xTimer )" )\r
+ * {\r
+ * // xTimer is already active - delete it.\r
+ * xTimerDelete( xTimer );\r
+ * }\r
+ * else\r
+ * {\r
+ * // xTimer is not active, change its period to 500ms. This will also\r
+ * // cause the timer to start. Block for a maximum of 100 ticks if the\r
+ * // change period command cannot immediately be sent to the timer\r
+ * // command queue.\r
+ * if( xTimerChangePeriod( xTimer, 500 / portTICK_RATE_MS, 100 ) == pdPASS )\r
+ * {\r
+ * // The command was successfully sent.\r
+ * }\r
+ * else\r
+ * {\r
+ * // The command could not be sent, even after waiting for 100 ticks\r
+ * // to pass. Take appropriate action here.\r
+ * {\r
+ * } \r
+ * }\r
+ */\r
+ #define xTimerChangePeriod( xTimer, xNewPeriod, xBlockTime ) xTimerGenericCommand( xTimer, tmrCOMMAND_CHANGE_PERIOD, xNewPeriod, NULL, xBlockTime )\r
+\r
+/**\r
+ * portBASE_TYPE xTimerDelete( xTimerHandle xTimer, portTickType xBlockTime );\r
+ *\r
+ * Timer functionality is provided by a timer service/daemon task. Many of the\r
+ * public FreeRTOS timer API functions send commands to the timer service task \r
+ * though a queue called the timer command queue. The timer command queue is \r
+ * private to the kernel itself and is not directly accessible to application \r
+ * code. The length of the timer command queue is set by the \r
+ * configTIMER_QUEUE_LENGTH configuration constant.\r
+ *\r
+ * xTimerDelete() deletes a timer that was previously created using the\r
+ * xTimerCreate() API function.\r
+ *\r
+ * The configUSE_TIMERS configuration constant must be set to 1 for \r
+ * xTimerDelete() to be available.\r
+ *\r
+ * @param xTimer The handle of the timer being stopped.\r
+ *\r
+ * @param xBlockTime Specifies the time, in ticks, that the calling task should\r
+ * be held in the Blocked state to wait for the delete command to be \r
+ * successfully sent to the timer command queue, should the queue already be \r
+ * full when xTimerDelete() was called. xBlockTime is ignored if xTimerDelete() \r
+ * is called before the scheduler is started. \r
+ *\r
+ * @return pdFAIL will be returned if the delete command could not be sent to \r
+ * the timer command queue even after xBlockTime ticks had passed. pdPASS will\r
+ * be returned if the command was successfully send to the timer command queue.\r
+ * When the command is actually processed will depend on the priority of the\r
+ * timer service/daemon task relative to other tasks in the system. The timer \r
+ * service/daemon task priority is set by the configTIMER_TASK_PRIORITY \r
+ * configuration constant.\r
+ *\r
+ * Example usage:\r
+ * \r
+ * See the xTimerChangePeriod() API function example usage scenario.\r
+ */\r
#define xTimerDelete( xTimer, xBlockTime ) xTimerGenericCommand( xTimer, tmrCOMMAND_DELETE, 0, NULL, xBlockTime )\r
+\r
+/**\r
+ * portBASE_TYPE xTimerReset( xTimerHandle xTimer, portTickType xBlockTime );\r
+ *\r
+ * Timer functionality is provided by a timer service/daemon task. Many of the\r
+ * public FreeRTOS timer API functions send commands to the timer service task \r
+ * though a queue called the timer command queue. The timer command queue is \r
+ * private to the kernel itself and is not directly accessible to application \r
+ * code. The length of the timer command queue is set by the \r
+ * configTIMER_QUEUE_LENGTH configuration constant.\r
+ *\r
+ * xTimerReset() re-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 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
+ *\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
+ * associated with the timer will get called 'n 'ticks after xTimerReset() was \r
+ * called, where 'n' is the timers defined period.\r
+ *\r
+ * It is valid to call xTimerReset() before the scheduler has been started, but\r
+ * when this is done the timer will not actually start until the scheduler is\r
+ * started, and the timers expiry time will be relative to when the scheduler is\r
+ * started, not relative to when xTimerReset() was called.\r
+ *\r
+ * The configUSE_TIMERS configuration constant must be set to 1 for xTimerReset()\r
+ * to be available.\r
+ *\r
+ * @param xTimer The handle of the timer being started/restarted.\r
+ *\r
+ * @param xBlockTime Specifies the time, in ticks, that the calling task should\r
+ * be held in the Blocked state to wait for the reset command to be successfully\r
+ * sent to the timer command queue, should the queue already be full when \r
+ * xTimerReset() was called. xBlockTime is ignored if xTimerReset() is called\r
+ * before the scheduler is started. \r
+ *\r
+ * @return pdFAIL will be returned if the reset command could not be sent to \r
+ * the timer command queue even after xBlockTime ticks had passed. pdPASS will\r
+ * be returned if the command was successfully send to the timer command queue.\r
+ * When the command is actually processed will depend on the priority of the\r
+ * timer service/daemon task relative to other tasks in the system, although the\r
+ * timers expiry time is relative to when xTimerStart() is actually called. The \r
+ * timer service/daemon task priority is set by the configTIMER_TASK_PRIORITY \r
+ * configuration constant.\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
+ *\r
+ * xTimerHandle xBacklightTimer = NULL;\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 backlight.\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
+ * // 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
+ * {\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
+ *\r
+ * void main( void )\r
+ * {\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
+ * 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
+ * );\r
+ * \r
+ * if( xBacklightTimer == NULL )\r
+ * {\r
+ * // The timer was not created.\r
+ * }\r
+ * else\r
+ * {\r
+ * // Start the timer. No block time is specified, and even if one was\r
+ * // it would be ignored because the scheduler has not yet been\r
+ * // started. \r
+ * if( xTimerStart( xBacklightTimer, 0 ) != pdPASS )\r
+ * {\r
+ * // The timer could not be set into the Active state.\r
+ * }\r
+ * }\r
+ * \r
+ * // ...\r
+ * // Create tasks here.\r
+ * // ...\r
+ * \r
+ * // Starting the scheduler will start the timer running as it has already\r
+ * // been set into the active state.\r
+ * xTaskStartScheduler();\r
+ * \r
+ * // Should not reach here.\r
+ * for( ;; );\r
+ * }\r
+ */\r
#define xTimerReset( xTimer, xBlockTime ) xTimerGenericCommand( xTimer, tmrCOMMAND_START, xTaskGetTickCount(), NULL, xBlockTime )\r
\r
+/**\r
+ * portBASE_TYPE xTimerStartFromISR( xTimerHandle xTimer, \r
+ * portBASE_TYPE *pxHigherPriorityTaskWoken );\r
+ *\r
+ * Description goes here ####\r
+ *\r
+ * @param xTimer\r
+ *\r
+ * @return \r
+ *\r
+ * Example usage:\r
+ */\r
#define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( xTimer, tmrCOMMAND_START, xTaskGetTickCountFromISR(), pxHigherPriorityTaskWoken, 0 )\r
+\r
+/**\r
+ * portBASE_TYPE xTimerStopFromISR( xTimerHandle xTimer, \r
+ * portBASE_TYPE *pxHigherPriorityTaskWoken );\r
+ *\r
+ * Description goes here ####\r
+ *\r
+ * @param xTimer\r
+ *\r
+ * @return \r
+ *\r
+ * Example usage:\r
+ */\r
#define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( xTimer, tmrCOMMAND_STOP, 0, pxHigherPriorityTaskWoken, 0 )\r
+\r
+/**\r
+ * portBASE_TYPE xTimerChangePeriodFromISR( xTimerHandle xTimer, \r
+ * portTickType xNewPeriod,\r
+ * portBASE_TYPE *pxHigherPriorityTaskWoken );\r
+ *\r
+ * Description goes here ####\r
+ *\r
+ * @param xTimer\r
+ *\r
+ * @return \r
+ *\r
+ * Example usage:\r
+ */\r
#define xTimerChangePeriodFromISR( xTimer, xNewPeriod, pxHigherPriorityTaskWoken ) xTimerGenericCommand( xTimer, tmrCOMMAND_CHANGE_PERIOD, xNewPeriod, pxHigherPriorityTaskWoken, 0 )\r
+\r
+/**\r
+ * portBASE_TYPE xTimerResetFromISR( xTimerHandle xTimer, \r
+ * portBASE_TYPE *pxHigherPriorityTaskWoken );\r
+ *\r
+ * Description goes here ####\r
+ *\r
+ * @param xTimer\r
+ *\r
+ * @return \r
+ *\r
+ * Example usage:\r
+ */\r
#define xTimerResetFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( xTimer, tmrCOMMAND_START, xTaskGetTickCountFromISR(), pxHigherPriorityTaskWoken, 0 )\r
\r
+/*\r
+ * Functions beyond this part are not part of the public API and are intended\r
+ * for use by the kernel only.\r
+ */\r
+portBASE_TYPE xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;\r
+portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime ) PRIVILEGED_FUNCTION;\r
+\r
#ifdef __cplusplus\r
}\r
#endif\r