summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2016-06-24 00:47:47 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2016-06-25 10:09:54 +0200
commit40192caee01bd5fe6c8ed2c61798c95782ccfdd2 (patch)
tree651640e2926dc249c12b4431056dd24225f2705f
parent0432429aa6bcecfeeeccf4ba9b4cca28206b4863 (diff)
downloadsecure-hid-40192caee01bd5fe6c8ed2c61798c95782ccfdd2.tar.gz
secure-hid-40192caee01bd5fe6c8ed2c61798c95782ccfdd2.tar.bz2
secure-hid-40192caee01bd5fe6c8ed2c61798c95782ccfdd2.zip
let the user build an array of lld drivers
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
-rw-r--r--include/usbh_lld_stm32f4.h3
-rw-r--r--src/demo.c7
-rw-r--r--src/usbh_lld_stm32f4.c13
3 files changed, 10 insertions, 13 deletions
diff --git a/include/usbh_lld_stm32f4.h b/include/usbh_lld_stm32f4.h
index c55c615..a8f7b0a 100644
--- a/include/usbh_lld_stm32f4.h
+++ b/include/usbh_lld_stm32f4.h
@@ -30,7 +30,8 @@
BEGIN_DECLS
// pass this to usbh init
-extern const void *usbh_lld_stm32f4_drivers[];
+extern const void *usbh_lld_stm32f4_driver_fs;
+extern const void *usbh_lld_stm32f4_driver_hs;
#ifdef USART_DEBUG
void print_channels(const void *drvdata);
diff --git a/src/demo.c b/src/demo.c
index 76c33fd..f6cccf5 100644
--- a/src/demo.c
+++ b/src/demo.c
@@ -214,7 +214,12 @@ int main(void)
*
* Pass array of supported device drivers
*/
- usbh_init(usbh_lld_stm32f4_drivers, device_drivers);
+ const void *lld_drivers[] = {
+ &usbh_lld_stm32f4_driver_fs, // Make sure USE_STM32F4_USBH_DRIVER_FS is defined in usbh_config.h
+// &usbh_lld_stm32f4_driver_hs, // Make sure USE_STM32F4_USBH_DRIVER_HS is defined in usbh_config.h
+ 0
+ };
+ usbh_init(lld_drivers, device_drivers);
gpio_clear(GPIOD, GPIO13);
LOG_PRINTF("USB init complete\n");
diff --git a/src/usbh_lld_stm32f4.c b/src/usbh_lld_stm32f4.c
index 8b98321..49f6cc2 100644
--- a/src/usbh_lld_stm32f4.c
+++ b/src/usbh_lld_stm32f4.c
@@ -1025,6 +1025,7 @@ static const usbh_driver_t driver_fs = {
.root_speed = root_speed,
.driver_data = &driver_data_fs
};
+const void *usbh_lld_stm32f4_driver_fs = &driver_fs;
#endif
// USB High Speed - OTG_HS
@@ -1044,15 +1045,5 @@ static const usbh_driver_t driver_hs = {
.root_speed = root_speed,
.driver_data = &driver_data_hs
};
+const void *usbh_lld_stm32f4_driver_hs = &driver_hs;
#endif
-
-const void *usbh_lld_stm32f4_drivers[] = {
-#if defined(USE_STM32F4_USBH_DRIVER_FS)
- &driver_fs,
-#endif
-
-#if defined(USE_STM32F4_USBH_DRIVER_HS)
- &driver_hs,
-#endif
- 0
-};