Browse Source

fix the led_examples_project

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@127 bbd45198-f89e-11dd-88c7-29a3b14d5316
wuyangyong 15 years ago
parent
commit
a599ab3b62
1 changed files with 8 additions and 0 deletions
  1. 8 0
      bsp/stm3210/led.c

+ 8 - 0
bsp/stm3210/led.c

@@ -57,8 +57,16 @@ void rt_hw_led_off(rt_uint32_t n)
 
 
 #ifdef RT_USING_FINSH
 #ifdef RT_USING_FINSH
 #include <finsh.h>
 #include <finsh.h>
+static rt_uint8_t led_inited = 0;
 void led(rt_uint32_t led, rt_uint32_t value)
 void led(rt_uint32_t led, rt_uint32_t value)
 {
 {
+    /* init led configuration if it's not inited. */
+    if (!led_inited)
+    {
+        rt_hw_led_init();
+        led_inited = 1;
+    }
+
     if ( led == 0 )
     if ( led == 0 )
     {
     {
         /* set led status */
         /* set led status */