diff options
author | Anton Staaf <robotboy@chromium.org> | 2014-09-10 12:37:06 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-14 23:59:15 +0000 |
commit | c9e71277b4af9199125fbebc389ef19aa70045ab (patch) | |
tree | 00d9fc1c3611227383d3b09163bfb8f73e1c20a0 /board/discovery-stm32f072/board.c | |
parent | 46102d3b4ed4958986b2272237a33513ee32fc92 (diff) | |
download | chrome-ec-c9e71277b4af9199125fbebc389ef19aa70045ab.tar.gz |
discovery-stm32f072: discovery USB GPIO test
Wire up the discovery's four LEDs and one user
button as GPIOs that can be written and read using
the new USB GPIO driver. This also adds an extra
tool called usb_gpio that provides control of GPIOs
from the linux command line.
Signed-off-by: Anton Staaf <robotboy@chromium.org>
BRANCH=None
BUG=None
TEST=cd board/discovery-stm32f072 ; make flash
cd extra/usb_gpio ; make
usb_gpio write 0x1e 0x00
Change-Id: I15115f82b15b6c35d1a34b83b7114a6bfa6a3d67
Reviewed-on: https://chromium-review.googlesource.com/218270
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'board/discovery-stm32f072/board.c')
-rw-r--r-- | board/discovery-stm32f072/board.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/board/discovery-stm32f072/board.c b/board/discovery-stm32f072/board.c index 9d736dcaf5..f7cef5c3cd 100644 --- a/board/discovery-stm32f072/board.c +++ b/board/discovery-stm32f072/board.c @@ -9,6 +9,7 @@ #include "hooks.h" #include "registers.h" #include "task.h" +#include "usb_gpio.h" #include "util.h" void button_event(enum gpio_signal signal); @@ -27,6 +28,28 @@ void button_event(enum gpio_signal signal) count++; } +static enum gpio_signal const usb_gpio_list[] = { + GPIO_USER_BUTTON, + GPIO_LED_U, + GPIO_LED_D, + GPIO_LED_L, + GPIO_LED_R, +}; + +USB_GPIO_CONFIG(usb_gpio, + usb_gpio_list, + USB_IFACE_GPIO, + USB_EP_GPIO) + +const void *const usb_strings[] = { + [USB_STR_DESC] = usb_string_desc, + [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."), + [USB_STR_PRODUCT] = USB_STRING_DESC("discovery-stm32f072"), + [USB_STR_VERSION] = USB_STRING_DESC("v1.0"), +}; + +BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT); + /* Initialize board. */ static void board_init(void) { |