1 extern int slave_get_ble_work_state(void);
2 extern u8 app_get_ble_work_state();
3 extern const vble_smpl_role_ops *vble_smpl_ops;
4 extern const vble_smpl_role_ops ble_master_ops;
5 extern const vble_smpl_role_ops ble_slave_ops;
6 #include "gpio.h"
7 u16 blue_led_control_timer_id;
8 void blue_led_control_timer_func(void*priv)
9 {
10 static u8 blue_led_control_timer_pass_100ms_cnt;
11 if (vble_smpl_ops==&ble_master_ops)
12 {
13 if (app_get_ble_work_state()==BLE_ST_SEARCH_COMPLETE)
14 {
15 if (blue_led_control_timer_pass_100ms_cnt>=100)
16 {
17 blue_led_control_timer_pass_100ms_cnt=0;
18 }
19 if (blue_led_control_timer_pass_100ms_cnt<=0)
20 {
21 gpio_set_mode(IO_PORT_SPILT(IO_PORT_DM), PORT_OUTPUT_HIGH);
22 }
23 else
24 {
25 gpio_set_mode(IO_PORT_SPILT(IO_PORT_DM), PORT_OUTPUT_LOW);
26 }
27 }
28 else
29 {
30 if (blue_led_control_timer_pass_100ms_cnt>=10)
31 {
32 blue_led_control_timer_pass_100ms_cnt=0;
33 }
34 if (blue_led_control_timer_pass_100ms_cnt<=0)
35 {
36 gpio_set_mode(IO_PORT_SPILT(IO_PORT_DM), PORT_OUTPUT_HIGH);
37 }
38 else
39 {
40 gpio_set_mode(IO_PORT_SPILT(IO_PORT_DM), PORT_OUTPUT_LOW);
41 }
42 }
43 }
44 else
45 {
46 if (slave_get_ble_work_state()==BLE_ST_NOTIFY_IDICATE)
47 {
48 if (blue_led_control_timer_pass_100ms_cnt>=100)
49 {
50 blue_led_control_timer_pass_100ms_cnt=0;
51 }
52 if (blue_led_control_timer_pass_100ms_cnt<=0)
53 {
54 gpio_set_mode(IO_PORT_SPILT(IO_PORT_DM), PORT_OUTPUT_HIGH);
55 }
56 else
57 {
58 gpio_set_mode(IO_PORT_SPILT(IO_PORT_DM), PORT_OUTPUT_LOW);
59 }
60 }
61 else
62 {
63 if (blue_led_control_timer_pass_100ms_cnt>=10)
64 {
65 blue_led_control_timer_pass_100ms_cnt=0;
66 }
67 if (blue_led_control_timer_pass_100ms_cnt<=0)
68 {
69 gpio_set_mode(IO_PORT_SPILT(IO_PORT_DM), PORT_OUTPUT_HIGH);
70 }
71 else
72 {
73 gpio_set_mode(IO_PORT_SPILT(IO_PORT_DM), PORT_OUTPUT_LOW);
74 }
75 }
76 }
77 blue_led_control_timer_pass_100ms_cnt++;
78 }