[rtems-examples commit] led/delay/init.c: Use local variable for one second of ticks

Joel Sherrill joel at rtems.org
Thu Feb 24 23:04:33 UTC 2022


Module:    rtems-examples
Branch:    master
Commit:    94e6defb206c053b5d3a0988acf6b60b272ffd07
Changeset: http://git.rtems.org/rtems-examples/commit/?id=94e6defb206c053b5d3a0988acf6b60b272ffd07

Author:    Joel Sherrill <joel at rtems.org>
Date:      Tue Feb 22 13:20:03 2022 -0600

led/delay/init.c: Use local variable for one second of ticks

---

 led/delay/init.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/led/delay/init.c b/led/delay/init.c
index c965ae1..00cbc7e 100644
--- a/led/delay/init.c
+++ b/led/delay/init.c
@@ -16,22 +16,24 @@ rtems_task Init(
   rtems_task_argument argument
 )
 {
-  rtems_status_code status;
+  rtems_interval    one_second;
 
   puts( "\n\n*** LED BLINKER -- task wake after ***" );
 
+  one_second = 1 * rtems_clock_get_ticks_per_second();
+
   LED_INIT();
 
   while (1) {
 
-    (void) rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() );
+    (void) rtems_task_wake_after( one_second );
     LED_OFF();
-    (void) rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() );
+    (void) rtems_task_wake_after( one_second );
     LED_ON();
 
   }
 
-  status = rtems_task_delete( RTEMS_SELF );
+  (void) rtems_task_delete( RTEMS_SELF );
 }
 
 /**************** START OF CONFIGURATION INFORMATION ****************/



More information about the vc mailing list