@@ -737,14 +737,18 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
737
737
* // The key press event handler.
738
738
* void vKeyPressEventHandler( char cKey )
739
739
* {
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 )
746
744
* {
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
748
752
* // action here.
749
753
* }
750
754
*
@@ -753,16 +757,15 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
753
757
*
754
758
* void main( void )
755
759
* {
756
- * int32_t x;
757
760
*
758
761
* // Create then start the one-shot timer that is responsible for turning
759
762
* // the back-light off if no keys are pressed within a 5 second period.
760
763
* 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.
762
765
* pdFALSE, // The timer is a one-shot timer.
763
766
* 0, // The id is not used by the callback so can take any value.
764
767
* vBacklightTimerCallback // The callback function that switches the LCD back-light off.
765
- * );
768
+ * );
766
769
*
767
770
* if( xBacklightTimer == NULL )
768
771
* {
0 commit comments