From 74aadcb900f9a82b82bfe0a1e5dfb030a77253ea Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Mon, 23 Jan 2012 00:43:24 +0100 Subject: More interrupt status LEDs. --- main.cpp | 14 +++++++++++--- 1 file 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); -- cgit v1.2.3