projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean up monitor output a bit
[fw/altos]
/
ao_usb.c
diff --git
a/ao_usb.c
b/ao_usb.c
index a7462ed55009eb6545fcdbfc3ebebfba528c37bf..1868ec3cea8355fd1de3e4e09f3e0cb987e86d6a 100644
(file)
--- a/
ao_usb.c
+++ b/
ao_usb.c
@@
-102,7
+102,7
@@
ao_usb_ep0_flush(void)
USBCS0 = cs0;
}
USBCS0 = cs0;
}
-#define LE_WORD(x) ((x)&0xFF),((
x)>>8
)
+#define LE_WORD(x) ((x)&0xFF),((
uint8_t) (((uint16_t) (x))>>8)
)
/* CDC definitions */
#define CS_INTERFACE 0x24
/* CDC definitions */
#define CS_INTERFACE 0x24
@@
-369,6
+369,7
@@
ao_usb_ep0_setup(void)
}
break;
case AO_USB_RECIP_INTERFACE:
}
break;
case AO_USB_RECIP_INTERFACE:
+ #pragma disable_warning 110
switch(ao_usb_setup.request) {
case AO_USB_REQ_GET_STATUS:
ao_usb_ep0_queue_byte(0);
switch(ao_usb_setup.request) {
case AO_USB_REQ_GET_STATUS:
ao_usb_ep0_queue_byte(0);
@@
-513,7
+514,7
@@
ao_usb_getchar(void) __critical
}
void
}
void
-ao_usb_
init
(void)
+ao_usb_
enable
(void)
{
/* Turn on the USB controller */
SLEEP |= SLEEP_USB_EN;
{
/* Turn on the USB controller */
SLEEP |= SLEEP_USB_EN;
@@
-536,6
+537,30
@@
ao_usb_init(void)
USBCIF = 0;
USBOIF = 0;
USBIIF = 0;
USBCIF = 0;
USBOIF = 0;
USBIIF = 0;
+}
+
+void
+ao_usb_disable(void)
+{
+ /* Disable USB interrupts */
+ USBIIE = 0;
+ USBOIE = 0;
+ USBCIE = 0;
+ IEN2 &= ~IEN2_USBIE;
- ao_add_task(&ao_usb_task, ao_usb_ep0);
+ /* Clear any pending interrupts */
+ USBCIF = 0;
+ USBOIF = 0;
+ USBIIF = 0;
+
+ /* Turn off the USB controller */
+ SLEEP &= ~SLEEP_USB_EN;
+}
+
+void
+ao_usb_init(void)
+{
+ ao_usb_enable();
+
+ ao_add_task(&ao_usb_task, ao_usb_ep0, "usb");
}
}