@@ -737,14 +737,18 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
737737 * // The key press event handler.
738738 * void vKeyPressEventHandler( char cKey )
739739 * {
740- * // Ensure the LCD back-light is on, then reset the timer that is
741- * // responsible for turning the back-light off after 5 seconds of
742- * // key inactivity. Wait 10 ticks for the command to be successfully sent
743- * // if it cannot be sent immediately.
744- * vSetBacklightState( BACKLIGHT_ON );
745- * if( xTimerReset( xBacklightTimer, 100 ) != pdPASS )
740+ * // Reset the timer that is responsible for turning the back-light off after
741+ * // 5 seconds of key inactivity. Wait 10 ticks for the command to be
742+ * // successfully sent if it cannot be sent immediately.
743+ * if( xTimerReset( xBacklightTimer, 10 ) == pdPASS )
746744 * {
747- * // The reset command was not executed successfully. Take appropriate
745+ * // Turn on the LCD back-light. It will be turned off in the
746+ * // vBacklightTimerCallback after 5 seconds of key inactivity.
747+ * vSetBacklightState( BACKLIGHT_ON );
748+ * }
749+ * else
750+ * {
751+ * // The reset command was not executed successfully. Take appropriate
748752 * // action here.
749753 * }
750754 *
@@ -753,16 +757,15 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
753757 *
754758 * void main( void )
755759 * {
756- * int32_t x;
757760 *
758761 * // Create then start the one-shot timer that is responsible for turning
759762 * // the back-light off if no keys are pressed within a 5 second period.
760763 * xBacklightTimer = xTimerCreate( "BacklightTimer", // Just a text name, not used by the kernel.
761- * ( 5000 / portTICK_PERIOD_MS), // The timer period in ticks.
764+ * pdMS_TO_TICKS ( 5000 ), // The timer period in ticks.
762765 * pdFALSE, // The timer is a one-shot timer.
763766 * 0, // The id is not used by the callback so can take any value.
764767 * vBacklightTimerCallback // The callback function that switches the LCD back-light off.
765- * );
768+ * );
766769 *
767770 * if( xBacklightTimer == NULL )
768771 * {
0 commit comments