summaryrefslogtreecommitdiff
path: root/src/cc1111
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-05-15 09:27:34 -0600
committerKeith Packard <keithp@keithp.com>2014-05-15 09:27:34 -0600
commit3225fb54ec1beaf6dc8553ab4f5b86bea6bdf1f3 (patch)
tree0c2bc7e8469621394796ab02dfa20b35368a43ee /src/cc1111
parent940ec6a2d5b054f68da39945a00f4d1b36d1b318 (diff)
altos/cc1111: Add support for CPU-driven USB pullup
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/cc1111')
-rw-r--r--src/cc1111/ao_usb.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cc1111/ao_usb.c b/src/cc1111/ao_usb.c
index 2141eda8..d9d255f8 100644
--- a/src/cc1111/ao_usb.c
+++ b/src/cc1111/ao_usb.c
@@ -274,7 +274,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) {
-
+
/* Receiving data from the host
*/
ao_usb_ep0_state = AO_USB_EP0_DATA_OUT;
@@ -448,6 +448,9 @@ ao_usb_enable(void)
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
@@ -459,6 +462,10 @@ ao_usb_disable(void)
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;
@@ -471,6 +478,9 @@ ao_usb_disable(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");