summaryrefslogtreecommitdiff
path: root/board/discovery-stm32f072
diff options
context:
space:
mode:
Diffstat (limited to 'board/discovery-stm32f072')
-rw-r--r--board/discovery-stm32f072/board.c23
-rw-r--r--board/discovery-stm32f072/board.h9
-rw-r--r--board/discovery-stm32f072/echo.c9
3 files changed, 29 insertions, 12 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)
{
diff --git a/board/discovery-stm32f072/board.h b/board/discovery-stm32f072/board.h
index 3ef289691d..1e7d86363e 100644
--- a/board/discovery-stm32f072/board.h
+++ b/board/discovery-stm32f072/board.h
@@ -27,12 +27,13 @@
#define CONFIG_STM_HWTIMER32
#define CONFIG_HW_CRC
#define CONFIG_USB
+#define CONFIG_USB_GPIO
#undef CONFIG_WATCHDOG_HELP
#undef CONFIG_LID_SWITCH
/* USB configuration */
-#define CONFIG_USB_PID 0x5009
+#define CONFIG_USB_PID 0x500f
/*
* Allow dangerous commands all the time, since we don't have a write protect
@@ -61,11 +62,13 @@ enum usb_strings {
/* USB interface indexes (use define rather than enum to expand them) */
#define USB_IFACE_STREAM 0
-#define USB_IFACE_COUNT 1
+#define USB_IFACE_GPIO 1
+#define USB_IFACE_COUNT 2
/* USB endpoint indexes (use define rather than enum to expand them) */
#define USB_EP_CONTROL 0
#define USB_EP_STREAM 1
-#define USB_EP_COUNT 2
+#define USB_EP_GPIO 2
+#define USB_EP_COUNT 3
#endif /* __BOARD_H */
diff --git a/board/discovery-stm32f072/echo.c b/board/discovery-stm32f072/echo.c
index 08550a4b36..8fa6435458 100644
--- a/board/discovery-stm32f072/echo.c
+++ b/board/discovery-stm32f072/echo.c
@@ -39,15 +39,6 @@ USB_STREAM_CONFIG(usb_stream1,
in_ready,
out_ready)
-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] = NULL /* filled at runtime */,
-};
-
-BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
-
struct stream_console_state {
size_t wrote;
};