Skip to content

Commit 58f75ef

Browse files
committed
key: code refactoring
1 parent 30be00c commit 58f75ef

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

main/src/user/key.c

+7-15
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,23 @@
2222

2323
#ifdef CONFIG_ENABLE_SLEEP_KEY
2424
static const uint8_t gpio_pin[] = {
25-
#ifdef CONFIG_ENABLE_SLEEP_KEY
26-
CONFIG_SLEEP_KEY_PIN,
27-
#endif
25+
CONFIG_SLEEP_KEY_PIN
2826
};
2927

3028
static const uint8_t gpio_val[] = {
31-
#ifdef CONFIG_ENABLE_SLEEP_KEY
32-
#ifdef CONFIG_SLEEP_KEY_ACTIVE_LOW
33-
0,
34-
#else
35-
1,
36-
#endif
29+
#ifdef CONFIG_SLEEP_KEY_ACTIVE_LOW
30+
0
31+
#else
32+
1
3733
#endif
3834
};
3935

4036
static const uint16_t gpio_hold[] = {
41-
#ifdef CONFIG_ENABLE_SLEEP_KEY
42-
CONFIG_SLEEP_KEY_HOLD_TIME,
43-
#endif
37+
CONFIG_SLEEP_KEY_HOLD_TIME
4438
};
4539

4640
static void (*key_handle[])(void) = {
47-
#ifdef CONFIG_ENABLE_SLEEP_KEY
48-
sleep_key_handle,
49-
#endif
41+
sleep_key_handle
5042
};
5143
#endif
5244

0 commit comments

Comments
 (0)