projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/stmf0: Change tests for AO_BOOT_CHAIN and AO_BOOT_PIN to #if
[fw/altos]
/
src
/
cc1111
/
ao_usb.c
diff --git
a/src/cc1111/ao_usb.c
b/src/cc1111/ao_usb.c
index a655d1be903589374bae5c5d1af63244ac873697..259f6512bc5510f7d504fc220f56534bad4bc7c4 100644
(file)
--- a/
src/cc1111/ao_usb.c
+++ b/
src/cc1111/ao_usb.c
@@
-3,7
+3,8
@@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-24,7
+25,7
@@
static __xdata uint16_t ao_usb_in_bytes;
static __pdata uint16_t ao_usb_in_bytes_last;
static __xdata uint16_t ao_usb_out_bytes;
static __pdata uint8_t ao_usb_iif;
static __pdata uint16_t ao_usb_in_bytes_last;
static __xdata uint16_t ao_usb_out_bytes;
static __pdata uint8_t ao_usb_iif;
-
static __pdata uint8_t
ao_usb_running;
+
__pdata uint8_t
ao_usb_running;
static void
ao_usb_set_interrupts(void)
static void
ao_usb_set_interrupts(void)
@@
-111,7
+112,7
@@
ao_usb_ep0_flush(void)
USBCS0 = cs0;
}
USBCS0 = cs0;
}
-__xdata st
atic st
ruct ao_usb_line_coding ao_usb_line_coding = {115200, 0, 0, 8};
+__xdata struct ao_usb_line_coding ao_usb_line_coding = {115200, 0, 0, 8};
/* Walk through the list of descriptors and find a match
*/
/* Walk through the list of descriptors and find a match
*/
@@
-201,6
+202,11
@@
ao_usb_ep0_setup(void)
ao_usb_ep0_queue_byte(0);
break;
case AO_USB_REQ_SET_ADDRESS:
ao_usb_ep0_queue_byte(0);
break;
case AO_USB_REQ_SET_ADDRESS:
+#if USB_FORCE_FLIGHT_IDLE
+ /* Go to idle mode if USB is connected
+ */
+ ao_flight_force_idle = 1;
+#endif
ao_usb_set_address(ao_usb_setup.value);
break;
case AO_USB_REQ_GET_DESCRIPTOR:
ao_usb_set_address(ao_usb_setup.value);
break;
case AO_USB_REQ_GET_DESCRIPTOR:
@@
-269,7
+275,7
@@
ao_usb_ep0_setup(void)
ao_usb_ep0_in_len = ao_usb_setup.length;
ao_usb_ep0_flush();
} else if (ao_usb_ep0_out_len) {
ao_usb_ep0_in_len = ao_usb_setup.length;
ao_usb_ep0_flush();
} else if (ao_usb_ep0_out_len) {
-
+
/* Receiving data from the host
*/
ao_usb_ep0_state = AO_USB_EP0_DATA_OUT;
/* Receiving data from the host
*/
ao_usb_ep0_state = AO_USB_EP0_DATA_OUT;
@@
-443,6
+449,9
@@
ao_usb_enable(void)
USBCIF = 0;
USBOIF = 0;
USBIIF = 0;
USBCIF = 0;
USBOIF = 0;
USBIIF = 0;
+#if HAS_USB_PULLUP
+ ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 0);
+#endif
}
void
}
void
@@
-454,6
+463,10
@@
ao_usb_disable(void)
USBCIE = 0;
IEN2 &= ~IEN2_USBIE;
USBCIE = 0;
IEN2 &= ~IEN2_USBIE;
+#if HAS_USB_PULLUP
+ ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 0);
+#endif
+
/* Clear any pending interrupts */
USBCIF = 0;
USBOIF = 0;
/* Clear any pending interrupts */
USBCIF = 0;
USBOIF = 0;
@@
-466,6
+479,9
@@
ao_usb_disable(void)
void
ao_usb_init(void)
{
void
ao_usb_init(void)
{
+#if HAS_USB_PULLUP
+ ao_enable_output(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 0);
+#endif
ao_usb_enable();
ao_add_task(&ao_usb_task, ao_usb_ep0, "usb");
ao_usb_enable();
ao_add_task(&ao_usb_task, ao_usb_ep0, "usb");