aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/Incomplete/BluetoothHost
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-08-05 06:36:31 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-08-05 06:36:31 +0000
commitc5038f1bf44aea75f1ae1ed035cb7d523ccfdacb (patch)
tree5cf62e8642cc53c49eb28f973db843df5f047ba3 /Demos/Host/Incomplete/BluetoothHost
parent357ccc577bc6f8710ff942019e16cfa6a08466b7 (diff)
downloadlufa-c5038f1bf44aea75f1ae1ed035cb7d523ccfdacb.tar.gz
lufa-c5038f1bf44aea75f1ae1ed035cb7d523ccfdacb.tar.bz2
lufa-c5038f1bf44aea75f1ae1ed035cb7d523ccfdacb.zip
Renamed all library events to properly seperate out Device and Host mode events. Changed the firing conditions for some events to ensure that events are fired by their own USB mode only.
Remove VBUS events - not needed as the library takes care of VBUS detection and feedback on supported AVRs via the USB_Device_Connected and USB_Device_Disconnected events. Fixed incorrect Host state assignment in the incomplete BluetoothHost demo.
Diffstat (limited to 'Demos/Host/Incomplete/BluetoothHost')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c15
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h10
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c2
3 files changed, 12 insertions, 15 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
index a52ba7cb6..25c15a922 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
@@ -75,26 +75,26 @@ void SetupHardware(void)
USB_Init();
}
-void EVENT_USB_DeviceAttached(void)
+void EVENT_USB_Host_DeviceAttached(void)
{
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
-void EVENT_USB_DeviceUnattached(void)
+void EVENT_USB_Host_DeviceUnattached(void)
{
puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
-void EVENT_USB_DeviceEnumerationComplete(void)
+void EVENT_USB_Host_DeviceEnumerationComplete(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
}
-void EVENT_USB_HostError(uint8_t ErrorCode)
+void EVENT_USB_Host_HostError(uint8_t ErrorCode)
{
USB_ShutDown();
@@ -105,7 +105,7 @@ void EVENT_USB_HostError(uint8_t ErrorCode)
for(;;);
}
-void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode)
+void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode)
{
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
@@ -158,9 +158,6 @@ void Bluetooth_Management_Task(void)
break;
}
- USB_HostState = HOST_STATE_Configured;
- break;
- case HOST_STATE_Configured:
puts_P(PSTR("Getting Config Data.\r\n"));
/* Get and process the configuration descriptor data */
@@ -183,7 +180,7 @@ void Bluetooth_Management_Task(void)
puts_P(PSTR("Bluetooth Dongle Enumerated.\r\n"));
- USB_HostState = HOST_STATE_Ready;
+ USB_HostState = HOST_STATE_Configured;
break;
}
}
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
index d44a38a2a..0246bff82 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
@@ -70,11 +70,11 @@
void Bluetooth_Management_Task(void);
/* Event Handlers: */
- void EVENT_USB_DeviceAttached(void);
- void EVENT_USB_DeviceUnattached(void);
- void EVENT_USB_DeviceEnumerationComplete(void);
- void EVENT_USB_HostError(uint8_t ErrorCode);
- void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode);
+ void EVENT_USB_Host_DeviceAttached(void);
+ void EVENT_USB_Host_DeviceUnattached(void);
+ void EVENT_USB_Host_DeviceEnumerationComplete(void);
+ void EVENT_USB_Host_HostError(uint8_t ErrorCode);
+ void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode);
/* Function Prototypes: */
void SetupHardware(void);
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c
index 54291bf75..3b8bcde89 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c
@@ -398,7 +398,7 @@ void Bluetooth_ProcessHCICommands(void)
{
while (!(Bluetooth_GetNextHCIEventHeader()))
{
- if (USB_DeviceState == DEVICE_STATE_Unattached)
+ if (USB_HostState == HOST_STATE_Unattached)
return;
}