( 配套程序2.2 ) LED可以作为程序调试的指示灯,协议栈中的LED操作函 数如下: /******************************************************************** * @fn HalLedSet * * @brief Tun ON/OFF/TOGGLE given LEDs * * @param leds - HAL_LED_1 ,HAL_LED_2 * mode - BLINK, FLASH, TOGGLE, ON-1, OFF-0 * @return None ********************************************************************/ uint8HalLedSet (uint8 leds, uint8 mode) { #if(defined (BLINK_LEDS)) && (HAL_LED == TRUE) uint8 led; HalLedControl_t *sts; switch (mode) { case HAL_LED_MODE_BLINK: /* Default blink, 1 time, D% duty cycle*/ HalLedBlink (leds, 1,HAL_LED_DEFAULT_DUTY_CYCLE, HAL_LED_DEFAULT_FLASH_TIME); break; case HAL_LED_MODE_FLASH: /* Default flash, N times, D% duty cycle*/ HalLedBlink (leds,HAL_LED_DEFAULT_FLASH_COUNT, HAL_LED_DEFAULT_DUTY_CYCLE,HAL_LED_DEFAULT_FLASH_TIME); break; case HAL_LED_MODE_ON: case HAL_LED_MODE_OFF: case HAL_LED_MODE_TOGGLE: led = HAL_LED_1; leds &= HAL_LED_ALL; sts= HalLedStatusControl.HalLedControlTable; while (leds) { if (leds & led) { if (mode != HAL_LED_MODE_TOGGLE) { sts->mode = mode; /* ON or OFF */ } else { sts->mode ^= HAL_LED_MODE_ON; /* Toggle */ } HalLedOnOff (led, sts->mode); leds ^= led; } led <<= 1; sts++; } break; default: break; } #elif(HAL_LED == TRUE) LedOnOff(leds, mode); #else // HAL LED is disabled, suppress unusedargument warnings (void) leds; (void) mode; #endif/* BLINK_LEDS && HAL_LED */ return ( HalLedState ); } 请调用上面的函数,使在使开发套件复位后LED1闪烁一下(10分)