aboutsummaryrefslogtreecommitdiff
path: root/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-07-13 05:34:43 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-07-13 05:34:43 +0000
commitbef20db2b251b7aee94e7cfed6d3186fcd94339d (patch)
tree3c9c1613def7ed9c299d197c9a97fe7622eb987d /Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
parent3760ccaba93daf8902dfbde05f56ec8e0eeaa539 (diff)
Added new HOST_STATE_WaitForDeviceRemoval host state machine state for non-blocking disabling of device communications until the device has been removed (for use when an error occurs or communications with the device have completed). Changed over all host mode demos to use the new state.
Added verbose documentation for each of the USB Host state machine states. git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@642 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
index b8e87cb6..3222b770 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
@@ -139,14 +139,11 @@ void Bluetooth_Management_Task(void)
LEDs_SetAllLEDs(LEDS_LED1);
/* Wait until USB device disconnected */
- while (USB_IsConnected);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
puts_P(PSTR("Bluetooth Dongle Detected.\r\n"));
-
- /* Select the control pipe for the request transfer */
- Pipe_SelectPipe(PIPE_CONTROLPIPE);
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
@@ -158,7 +155,7 @@ void Bluetooth_Management_Task(void)
LEDs_SetAllLEDs(LEDS_LED1);
/* Wait until USB device disconnected */
- while (USB_IsConnected);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -181,7 +178,7 @@ void Bluetooth_Management_Task(void)
LEDs_SetAllLEDs(LEDS_LED1);
/* Wait until USB device disconnected */
- while (USB_IsConnected);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -189,9 +186,5 @@ void Bluetooth_Management_Task(void)
USB_HostState = HOST_STATE_Ready;
break;
- case HOST_STATE_Ready:
- /* Do nothing, Bluetooth stack will take care of enumeration */
-
- break;
}
}