summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2012-01-23 00:43:24 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2012-01-23 00:43:24 +0100
commit74aadcb900f9a82b82bfe0a1e5dfb030a77253ea (patch)
tree4ce21d60bcf13d561b568f4b9bee507307ca34f9
parente9a6cb2cd5f42fe0864bf0430e5169fee92b9d31 (diff)
More interrupt status LEDs.
-rw-r--r--main.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index baad038..04fcae8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -19,9 +19,9 @@ static Pin& usb_vbus = PA9;
template<>
void interrupt<(Interrupt::IRQ)67>() {
- led_blue.toggle();
led_red.toggle();
-
+
+ // USB reset.
if(OTG_FS.reg.GINTSTS & (1 << 12)) {
led_yellow.toggle();
OTG_FS.dev_oep_reg[0].DOEPCTL = (1 << 27);
@@ -32,6 +32,13 @@ void interrupt<(Interrupt::IRQ)67>() {
OTG_FS.dev_oep_reg[0].DOEPTSIZ = (3 << 29);
}
+ // OTG interrupt.
+ if(OTG_FS.reg.GINTSTS & (1 << 2)) {
+ led_blue.toggle();
+
+ OTG_FS.reg.GOTGINT = (1 << 2); // SEDET
+ }
+
OTG_FS.reg.GINTSTS = 0xffffffff;
}
@@ -49,8 +56,9 @@ int main() {
led_red.set_mode(Pin::Output);
led_blue.set_mode(Pin::Output);
- led_red.on();
+ led_red.off();
led_blue.off();
+ led_yellow.off();
usb_vbus.set_mode(Pin::AF);
usb_vbus.set_pull(Pin::PullNone);