123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #include "led.h"
- #include "gpio.h"
- led_t led; // 自定义led结构体;
- // 驱动led开关
- void led_on_off(uint8_t leds, uint8_t on_off)
- {
- switch (leds)
- {
- case 0:
- {
- if (0x00 == on_off)
- {
- // GPIO_LED0(0x00);
- led.led_state.bits.led0_state_flag = 0;
- }
- else
- {
- // GPIO_LED0(0x01);
- led.led_state.bits.led0_state_flag = 1;
- }
- break;
- }
- case 1:
- {
- if (0x00 == on_off)
- {
- GPIO_LED1(0x00);
- led.led_state.bits.led1_state_flag = 0;
- }
- else
- {
- GPIO_LED1(0x01);
- led.led_state.bits.led1_state_flag = 1;
- }
- break;
- }
- default:
- break;
- }
- }
|