Skip to content

Commit d652f3b

Browse files
committed
examples: remove the break keyword after return
Signed-off-by: Junbo Zheng <3273070@qq.com>
1 parent fde6c72 commit d652f3b

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

examples/example_callback.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,10 @@ uint8_t read_button_GPIO(uint8_t button_id)
1515
{
1616
case btn1_id:
1717
return HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin);
18-
break;
19-
2018
case btn2_id:
2119
return HAL_GPIO_ReadPin(B2_GPIO_Port, B2_Pin);
22-
break;
23-
2420
default:
2521
return 0;
26-
break;
2722
}
2823
}
2924

examples/example_poll.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,28 @@ uint8_t read_button_GPIO(uint8_t button_id)
1010
{
1111
case btn1_id:
1212
return HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin);
13-
break;
14-
1513
default:
1614
return 0;
17-
break;
1815
}
1916
}
2017

2118

2219
int main()
2320
{
2421
static uint8_t btn1_event_val;
25-
22+
2623
button_init(&btn1, read_button_GPIO, 0, btn1_id);
2724
button_start(&btn1);
28-
25+
2926
//make the timer invoking the button_ticks() interval 5ms.
3027
//This function is implemented by yourself.
31-
__timer_start(button_ticks, 0, 5);
32-
33-
while(1)
28+
__timer_start(button_ticks, 0, 5);
29+
30+
while(1)
3431
{
3532
if(btn1_event_val != get_button_event(&btn1)) {
3633
btn1_event_val = get_button_event(&btn1);
37-
34+
3835
if(btn1_event_val == PRESS_DOWN) {
3936
//do something
4037
} else if(btn1_event_val == PRESS_UP) {
@@ -45,4 +42,3 @@ int main()
4542
}
4643
}
4744
}
48-

0 commit comments

Comments
 (0)