summaryrefslogtreecommitdiff
path: root/include/button.h
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2017-11-15 22:23:00 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-11-17 20:18:38 -0800
commit34a97f50d5275f1fa2f1cb377683c96286b2421d (patch)
tree2ea62dc537426fb252123fb93b3b4f05db5f1443 /include/button.h
parentf587852570770564e8a94b2c3f7ad7d97883c49a (diff)
downloadchrome-ec-34a97f50d5275f1fa2f1cb377683c96286b2421d.tar.gz
buttons: Make buttons[] common.
Nearly every board had a buttons array defined in which its contents had the standard volume buttons. This commit creates a single common buttons array that can contain the standard volume buttons and recovery buttons. If a board has volume up and down buttons, they can simply define CONFIG_VOLUME_BUTTONS and it will populate the buttons array with the standard definition. The buttons are active low and have a 30 ms debounce period. Similiarly, if a board has a dedicated recovery button, defining CONFIG_DEDICATED_RECOVERY_BUTTON will also populate the buttons array with a recovery button. BUG=chromium:783371 BRANCH=None TEST=make -j buildall. TEST=Flash a device with CONFIG_VOLUME_BUTTONS, verify pressing volume buttons still work. Change-Id: Ie5d63670ca4c6b146ec8ffb64d40ea9ce437b913 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/773794 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'include/button.h')
-rw-r--r--include/button.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/button.h b/include/button.h
index c542d44c47..29b648eb60 100644
--- a/include/button.h
+++ b/include/button.h
@@ -38,9 +38,18 @@ struct button_config {
int flags;
};
-/*
- * Defined in board.c. Should be CONFIG_BUTTON_COUNT elements long.
- */
+enum button {
+#ifdef CONFIG_VOLUME_BUTTONS
+ BUTTON_VOLUME_UP,
+ BUTTON_VOLUME_DOWN,
+#endif /* defined(CONFIG_VOLUME_BUTTONS) */
+#ifdef CONFIG_DEDICATED_RECOVERY_BUTTON
+ BUTTON_RECOVERY,
+#endif /* defined(CONFIG_DEDICATED_RECOVERY_BUTTON) */
+ BUTTON_COUNT,
+};
+
+/* Table of buttons for the board. */
extern const struct button_config buttons[];
/*