summaryrefslogtreecommitdiff
path: root/usb
diff options
context:
space:
mode:
Diffstat (limited to 'usb')
-rw-r--r--usb/SConscript19
-rw-r--r--usb/usb.h22
2 files changed, 19 insertions, 22 deletions
diff --git a/usb/SConscript b/usb/SConscript
new file mode 100644
index 0000000..81d84d4
--- /dev/null
+++ b/usb/SConscript
@@ -0,0 +1,19 @@
+Import('env')
+
+headers = []
+instances = []
+
+periph = env['PLATFORM_SPEC'].get('periph', {})
+
+if 'dwc_otg' in periph:
+ headers.append('dwc_otg.h')
+ for name, data in periph['dwc_otg'].items():
+ instances.append({
+ 'type': 'DWC_OTG_t',
+ 'name': name,
+ 'args': [data['offset']],
+ })
+
+env.Jinja2('usb.h', '../templates/periph_instances.h.j2', headers = headers, instances = instances)
+
+Return()
diff --git a/usb/usb.h b/usb/usb.h
deleted file mode 100644
index b1385b6..0000000
--- a/usb/usb.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef USB_H
-#define USB_H
-
-#if defined(STM32F1) || defined(STM32F3)
-#include "f1_usb.h"
-
-static F1_USB_t USB(0x40005c00, 0x40006000);
-
-#elif defined(STM32F4)
-#include "dwc_otg.h"
-
-static DWC_OTG_t OTG_FS(0x50000000);
-static DWC_OTG_t OTG_HS(0x40040000);
-
-#elif defined(STM32F0) || defined(STM32L0)
-#include "l0_usb.h"
-
-static L0_USB_t USB(0x40005c00, 0x40006000);
-
-#endif
-
-#endif