summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2012-01-21 21:54:13 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2012-01-21 21:54:13 +0100
commitd734fc168e94f0bdb42f6b28e702d5a909146cef (patch)
tree6a0680f2cb0f76c72810c379ea196e3b96c31c83
parent7891595ded1db9afb0ddffdc7d1292844bdc385d (diff)
Set some flags for USB initialization.
-rw-r--r--.gitignore1
-rw-r--r--main.cpp16
2 files changed, 17 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index f22d170..b137a4a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
*.o
*.a
*.elf
+*.swp
.sconsign.dblite
diff --git a/main.cpp b/main.cpp
index 807c0b0..3ea82b8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -28,6 +28,22 @@ int main() {
led_blue.set_mode(Pin::Output);
RCC.enable(RCC.OTGFS);
+
+ // USB configuration
+ OTG_FS.reg.GUSBCFG = (1 << 30) | (0xf << 10) | (1 << 9) | (1 << 8);
+ // FDMOD TRDT HNPCAP SRPCAP
+
+ // interrupt mask
+ OTG_FS.reg.GINTMSK = (1 << 13) | (1 << 12) | (1 << 11) | (1 << 10) | (1 << 3) | (1 << 2) | (1 << 1);
+ // ENUMDNEM USBRST USBSUSPM ESUSPM SOFM OTGINT MMISM
+
+ // device configuration
+ OTG_FS.dev_reg.DCFG = (1 << 2) | 3;
+ // NZLSOHSK DSPD
+
+ // core configuration
+ OTG_FS.reg.GCCFG = (1 << 19);
+ // VBUSBSEN
while(1) {
led_green.on();