/int main (void) {/* Configure the GPIO pin mode used by the Shenzhou III LED lamp */Rcc_apb2periphclockcmd (rcc_gpio_led, ENABLE); /* GPIO clock to enable LED lights */Gpio_initstructure.gpio_pin = ds1_pin| ds2_pin| ds3_pin|
Ds4_pin;
Gpio_initstructure.gpio_mode = gpio_mode_out_pp;
Gpio_initstructure.gpio_speed = Gpio_speed_50mhz; Gpio_init (gpio_led, &gpio_initstructure); /* The LED lights associated with Shenzhou III are initialized with the GPIO port */gpio_setbits (gpio_led,ds1_pin| ds2_pin| ds3_pin|
Ds4_pin);/* Turn off all LEDs */while (1) {count=++count%4; Gpio_setbits (gpio_led,ds1_pin| ds2_pin| ds3_pin| Ds4_pin);/* Turn off all LEDs */turn_on_led (count);
Light an LED light Delay (0X2FFFFF); Gpio_resetbits (gpio_led,ds1_pin| ds2_pin| ds3_pin| Ds4_pin);
/* Light all Lights *///delay (0X2FFFFF); }}/* lights the corresponding light */void turn_on_led (U8 led_num) {switch (led_num) {case 0:gpio_resetbits (gpio_led,ds1 _pin);
/* Light DS1 light */break; Case 1:gpio_resetbits (Gpio_leD,ds2_pin);
/* Light DS2 light */break; Case 2:gpio_resetbits (Gpio_led,ds3_pin);
/* Light DS3 light */break; Case 3:gpio_resetbits (Gpio_led,ds4_pin);
/* Light DS4 light */break; Default:gpio_resetbits (gpio_led,ds1_pin| ds2_pin| ds3_pin| Ds4_pin);
/* Light all lights */break; }}///////////////////////////////////int main (void) {/* Enable buzzer to use GPIO clock */Rcc_apb2periphclockcmd (BUZZER_GPIO_CLK, E
nable);
/* GPIO pin used by the INIT buzzer */gpio_initstructure.gpio_pin = Beeper_pin;
Gpio_initstructure.gpio_mode = Gpio_mode_out_od;
Gpio_initstructure.gpio_speed = Gpio_speed_50mhz;
Gpio_init (Gpio_beeper, &gpio_initstructure); while (1) {gpio_setbits (gpio_beeper, Beeper_pin);
/* Turn off the buzzer */Delay (0X2FFFFF); Gpio_resetbits (Gpio_beeper, Beeper_pin);
/* Turn on Buzzer */Delay (0X2FFFFF);
}
}