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
/* iSerial */
0x0e,
AO_USB_DESC_STRING,
- 't', 0, 'e', 0, 'l', 0, 'e', 0, '-', 0, '0', 0,
+ '0', 0, '0', 0, '0', 0, '0', 0, '0', 0, '0', 0,
/* Terminating zero */
0
}
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);
}
void
-ao_usb_init(void)
+ao_usb_enable(void)
{
/* Turn on the USB controller */
SLEEP |= SLEEP_USB_EN;
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");
}