123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #include "dev_led.h"
- #include "hal_conf.h"
- dev_led_t dev_led; // 自定义led结构体;
- // 驱动led开关
- void dev_led_on_off(uint8_t leds, uint8_t on_off)
- {
- switch (leds)
- {
- case 0:
- {
- if (0x00 == on_off)
- {
- // HAL_GPIO_LED0(0x00);
- dev_led.dev_led_state.bits.led0_state_flag = 0;
- }
- else
- {
- // HAL_GPIO_LED0(0x01);
- dev_led.dev_led_state.bits.led0_state_flag = 1;
- }
- break;
- }
- case 1:
- {
- if (0x00 == on_off)
- {
- HAL_GPIO_LED1(0x00);
- dev_led.dev_led_state.bits.led1_state_flag = 0;
- }
- else
- {
- HAL_GPIO_LED1(0x01);
- dev_led.dev_led_state.bits.led1_state_flag = 1;
- }
- break;
- }
- default:
- break;
- }
- }
|