Remove unused macro in the host mode demos for the maximum Configuration Descriptor size.
this software.\r
*/\r
\r
-/*\r
- Bluetooth Dongle host demo application.\r
- \r
- ** NOT CURRENTLY FUNCTIONAL - DO NOT USE **\r
-*/\r
+/** \file\r
+ *\r
+ * Main source file for the BluetoothHost demo. This file contains the main tasks of\r
+ * the demo and is responsible for the initial application hardware configuration.\r
+ */\r
\r
#include "BluetoothHost.h"\r
\r
Name: "LUFA Bluetooth Demo"\r
};\r
\r
-\r
+/** Main program entry point. This routine configures the hardware required by the application, then\r
+ * enters a loop to run the application tasks in sequence.\r
+ */\r
int main(void)\r
{\r
SetupHardware();\r
+\r
+ puts_P(PSTR(ESC_FG_CYAN "Bluetooth Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
\r
- puts_P(PSTR(ESC_FG_CYAN "Bluetooth Host Demo running.\r\n" ESC_FG_WHITE));\r
- \r
for (;;)\r
{\r
Bluetooth_Stack_Task();\r
- Bluetooth_Management_Task();\r
+ Bluetooth_Host_Task();\r
USB_USBTask();\r
}\r
}\r
\r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
void SetupHardware(void)\r
{\r
/* Disable watchdog if enabled by bootloader/fuses */\r
USB_Init();\r
}\r
\r
+/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
+ * starts the library USB task to begin the enumeration and USB management process.\r
+ */\r
void EVENT_USB_Host_DeviceAttached(void)\r
{\r
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));\r
-\r
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
}\r
\r
+/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
+ * stops the library USB task management process.\r
+ */\r
void EVENT_USB_Host_DeviceUnattached(void)\r
{\r
puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));\r
-\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
}\r
\r
+/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
+ * enumerated by the host and is now ready to be used by the application.\r
+ */\r
void EVENT_USB_Host_DeviceEnumerationComplete(void)\r
{\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
}\r
\r
-void EVENT_USB_Host_HostError(uint8_t ErrorCode)\r
+/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
+void EVENT_USB_Host_HostError(const uint8_t ErrorCode)\r
{\r
USB_ShutDown();\r
\r
for(;;);\r
}\r
\r
-void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode)\r
+/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
+ * enumerating an attached USB device.\r
+ */\r
+void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
{\r
printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"\r
" -- Error Code %d\r\n"\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
}\r
\r
-void Bluetooth_Management_Task(void)\r
+/** Task to set the configuration of the attached device after it has been enumerated. */\r
+void Bluetooth_Host_Task(void)\r
{\r
uint8_t ErrorCode;\r
\r
/* Get and process the configuration descriptor data */\r
if ((ErrorCode = ProcessDeviceDescriptor()) != SuccessfulDeviceRead)\r
{\r
- if (ErrorCode == ControlErrorDuringDeviceRead)\r
+ if (ErrorCode == DevControlError)\r
puts_P(PSTR(ESC_FG_RED "Control Error (Get Device).\r\n"));\r
else\r
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));\r
/* Get and process the configuration descriptor data */\r
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)\r
{\r
- if (ErrorCode == ControlErrorDuringConfigRead)\r
+ if (ErrorCode == ControlError)\r
puts_P(PSTR(ESC_FG_RED "Control Error (Get Configuration).\r\n"));\r
else\r
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));\r
this software.\r
*/\r
\r
+/** \file\r
+ *\r
+ * Header file for BluetoothHost.c.\r
+ */\r
+\r
#ifndef _BLUETOOTH_HOST_H_\r
#define _BLUETOOTH_HOST_H_\r
\r
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
- #define BLUETOOTH_DATA_IN_PIPE 1\r
- #define BLUETOOTH_DATA_OUT_PIPE 2\r
- #define BLUETOOTH_EVENTS_PIPE 3\r
-\r
/* Task Definitions: */\r
- void Bluetooth_Management_Task(void);\r
+ void Bluetooth_Host_Task(void);\r
\r
/* Event Handlers: */\r
void EVENT_USB_Host_DeviceAttached(void);\r
void EVENT_USB_Host_DeviceUnattached(void);\r
void EVENT_USB_Host_DeviceEnumerationComplete(void);\r
- void EVENT_USB_Host_HostError(uint8_t ErrorCode);\r
- void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode);\r
+ void EVENT_USB_Host_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
\r
/* Function Prototypes: */\r
void SetupHardware(void);\r
this software.\r
*/\r
\r
+/** \file\r
+ *\r
+ * USB Device Configuration Descriptor processing routines, to determine the correct pipe configurations\r
+ * needed to communication with an attached USB device. Descriptors are special computer-readable structures\r
+ * which the host requests upon device enumeration, to determine the device's capabilities and functions.\r
+ */\r
+\r
#include "ConfigDescriptor.h"\r
\r
+/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This\r
+ * routine will read in the entire configuration descriptor, and configure the hosts pipes to correctly communicate\r
+ * with compatible devices.\r
+ *\r
+ * This routine searches for a BT interface descriptor containing bulk IN and OUT data endpoints.\r
+ *\r
+ * \return An error code from the \ref Bluetooth_GetConfigDescriptorDataCodes_t enum.\r
+ */\r
uint8_t ProcessConfigurationDescriptor(void)\r
{\r
uint8_t ConfigDescriptorData[512];\r
case HOST_GETCONFIG_BuffOverflow:\r
return DescriptorTooLarge;\r
default:\r
- return ControlErrorDuringConfigRead;\r
+ return ControlError;\r
}\r
\r
/* The bluetooth USB transport addendum mandates that the data (not streaming voice) endpoints\r
\r
/* Ensure that an interface was found, and the end of the descriptor was not reached */\r
if (!(CurrConfigBytesRem))\r
- return NoInterfaceFound;\r
+ return NoBTInterfaceFound;\r
\r
/* Get the data IN, data OUT and event notification endpoints for the bluetooth interface */\r
while (FoundEndpoints != ((1 << BLUETOOTH_DATA_IN_PIPE) | (1 << BLUETOOTH_DATA_OUT_PIPE) |\r
{\r
/* Fetch the next endpoint from the current bluetooth interface */\r
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,\r
- NextInterfaceBluetoothDataEndpoint))\r
+ DComp_NextInterfaceBluetoothDataEndpoint))\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
return SuccessfulConfigRead;\r
}\r
\r
-uint8_t NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor)\r
+uint8_t DComp_NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor)\r
{\r
/* PURPOSE: Find next interface endpoint descriptor before next interface descriptor */\r
\r
this software.\r
*/\r
\r
+/** \file\r
+ *\r
+ * Header file for ConfigDescriptor.c.\r
+ */\r
+\r
#ifndef _CONFIGDESCRIPTOR_H_\r
#define _CONFIGDESCRIPTOR_H_\r
\r
#include <LUFA/Drivers/USB/USB.h>\r
\r
#include "BluetoothHost.h"\r
- \r
- /* Macros: */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Enums: */\r
+ /** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
enum BluetoothHost_GetConfigDescriptorDataCodes_t\r
{\r
- SuccessfulConfigRead = 0,\r
- ControlErrorDuringConfigRead = 1,\r
- InvalidConfigDataReturned = 2,\r
- DescriptorTooLarge = 3,\r
- NoInterfaceFound = 4,\r
- NoEndpointFound = 5,\r
+ SuccessfulConfigRead = 0, /**< Configuration Descriptor was processed successfully */\r
+ DevControlError = 1, /**< A control request to the device failed to complete successfully */\r
+ DescriptorTooLarge = 2, /**< The device's Configuration Descriptor is too large to process */\r
+ InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */\r
+ NoBTInterfaceFound = 4, /**< A compatible Blutooth interface was not found in the device's Configuration Descriptor */\r
+ NoEndpointFound = 5, /**< A compatible set of Bluetooth endpoints were not found in the\r
+ * device's Bluetooth interface\r
+ */\r
};\r
\r
/* Function Prototypes: */\r
uint8_t ProcessConfigurationDescriptor(void);\r
\r
- uint8_t NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor);\r
+ uint8_t DComp_NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor);\r
\r
#endif\r
this software.\r
*/\r
\r
+/** \file\r
+ *\r
+ * USB Device Descriptor processing routines, to determine the overall device parameters. Descriptors are special \r
+ * computer-readable structures which the host requests upon device enumeration, to determine information about\r
+ * the attached device.\r
+ */\r
+\r
#include "DeviceDescriptor.h"\r
\r
+/** Reads and processes an attached device's Device Descriptor, to determine compatibility\r
+ *\r
+ * This routine checks to ensure that the attached device's class codes match those for Bluetooth devices.\r
+ *\r
+ * \return An error code from the \ref BluetoothHost_GetDeviceDescriptorDataCodes_t enum.\r
+ */\r
uint8_t ProcessDeviceDescriptor(void)\r
{\r
USB_Descriptor_Device_t DeviceDescriptor;\r
\r
/* Send the request to retrieve the device descriptor */\r
if (USB_Host_GetDeviceDescriptor(&DeviceDescriptor) != HOST_SENDCONTROL_Successful)\r
- return ControlErrorDuringDeviceRead;\r
+ return DevControlError;\r
\r
/* Validate returned data - ensure the returned data is a device descriptor */\r
if (DeviceDescriptor.Header.Type != DTYPE_Device)\r
(DeviceDescriptor.SubClass != BLUETOOTH_DEVICE_SUBCLASS) ||\r
(DeviceDescriptor.Protocol != BLUETOOTH_DEVICE_PROTOCOL))\r
{\r
- return IncorrectDevice;\r
+ return IncorrectBTDevice;\r
}\r
\r
return SuccessfulDeviceRead;\r
this software.\r
*/\r
\r
+/** \file\r
+ *\r
+ * Header file for DeviceDescriptor.c.\r
+ */\r
+\r
#ifndef _DEVICEDESCRIPTOR_H_\r
#define _DEVICEDESCRIPTOR_H_\r
\r
#include "BluetoothHost.h"\r
\r
/* Macros: */\r
+ /** Device Class value for the Bluetooth Device class */\r
#define BLUETOOTH_DEVICE_CLASS 0xE0\r
+\r
+ /** Device Subclass value for the Bluetooth Device class */\r
#define BLUETOOTH_DEVICE_SUBCLASS 0x01\r
+\r
+ /** Device Protocol value for the Bluetooth Device class */\r
#define BLUETOOTH_DEVICE_PROTOCOL 0x01\r
\r
/* Enums: */\r
enum BluetoothHost_GetDeviceDescriptorDataCodes_t\r
{\r
- SuccessfulDeviceRead = 0,\r
- ControlErrorDuringDeviceRead = 1,\r
- InvalidDeviceDataReturned = 2,\r
- IncorrectDevice = 3,\r
+ SuccessfulDeviceRead = 0, /**< Device Descriptor was processed successfully */\r
+ ControlError = 1, /**< A control request to the device failed to complete successfully */\r
+ InvalidDeviceDataReturned = 2, /**< The device returned an invalid Device Descriptor */\r
+ IncorrectBTDevice = 3, /**< The attached device is not a Bluetooth class device */\r
};\r
\r
/* Function Prototypes: */\r
\r
void Bluetooth_ProcessACLPackets(void)\r
{\r
- Bluetooth_ACL_Header_t ACLPacketHeader;\r
+ Bluetooth_ACL_Header_t ACLPacketHeader;\r
Bluetooth_DataPacket_Header_t DataHeader;\r
\r
Pipe_SelectPipe(BLUETOOTH_DATA_IN_PIPE);\r
- Pipe_SetPipeToken(PIPE_TOKEN_IN);\r
Pipe_Unfreeze();\r
\r
if (!(Pipe_IsReadWriteAllowed()))\r
Pipe_Read_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));\r
Pipe_Read_Stream_LE(&DataHeader, sizeof(DataHeader));\r
\r
- BT_DEBUG("(ACL) Packet Received", NULL);\r
- BT_DEBUG("(ACL) -- Connection Handle: 0x%04X", ACLPacketHeader.ConnectionHandle);\r
- BT_DEBUG("(ACL) -- Data Length: 0x%04X", ACLPacketHeader.DataLength);\r
- BT_DEBUG("(ACL) -- Destination Channel: 0x%04X", DataHeader.DestinationChannel);\r
- BT_DEBUG("(ACL) -- Payload Length: 0x%04X", DataHeader.PayloadLength);\r
+ BT_ACL_DEBUG("Packet Received", NULL);\r
+ BT_ACL_DEBUG("-- Connection Handle: 0x%04X", (ACLPacketHeader.ConnectionHandle & 0x0FFF));\r
+ BT_ACL_DEBUG("-- Data Length: 0x%04X", ACLPacketHeader.DataLength);\r
+ BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DataHeader.DestinationChannel);\r
+ BT_ACL_DEBUG("-- Payload Length: 0x%04X", DataHeader.PayloadLength);\r
\r
if (DataHeader.DestinationChannel == BLUETOOTH_CHANNEL_SIGNALING)\r
{\r
Bluetooth_ProcessSignalPacket_ConfigurationRequest(&ACLPacketHeader, &DataHeader, &SignalCommandHeader);\r
break;\r
case BLUETOOTH_SIGNAL_INFORMATION_REQUEST:\r
- BT_DEBUG("(ACL) -- Information Request, Discarded", NULL);\r
+ BT_ACL_DEBUG(">> Information Request, Discarded", NULL);\r
\r
Pipe_Discard_Stream(ACLPacketHeader.DataLength);\r
Pipe_ClearIN(); \r
Pipe_Freeze();\r
break;\r
default:\r
- BT_DEBUG("(ACL) >> Unknown Signaling Command 0x%02X", SignalCommandHeader.Code);\r
+ BT_ACL_DEBUG(">> Unknown Signaling Command 0x%02X", SignalCommandHeader.Code);\r
\r
Pipe_Discard_Stream(ACLPacketHeader.DataLength);\r
Pipe_ClearIN(); \r
Pipe_Read_Stream_LE(&DataPayload, sizeof(DataPayload));\r
DataHeader.PayloadLength = 0;\r
\r
- BT_DEBUG("(ACL) -- Data Payload: ", NULL);\r
+ BT_ACL_DEBUG("-- Data Payload: ", NULL);\r
for (uint16_t B = 0; B < sizeof(DataPayload); B++)\r
printf("0x%02X ", DataPayload[B]);\r
- BT_DEBUG("", NULL);\r
+ printf("\r\n");\r
\r
Pipe_Discard_Stream(ACLPacketHeader.DataLength);\r
Pipe_ClearIN(); \r
\r
Pipe_Read_Stream_LE(&ConnectionRequest, sizeof(ConnectionRequest));\r
\r
- BT_DEBUG("(ACL) >> L2CAP Connection Request", NULL);\r
- BT_DEBUG("(ACL) -- PSM: 0x%04X", ConnectionRequest.PSM);\r
- BT_DEBUG("(ACL) -- Source Channel: 0x%04X", ConnectionRequest.SourceChannel);\r
+ BT_ACL_DEBUG(">> L2CAP Connection Request", NULL);\r
+ BT_ACL_DEBUG("-- PSM: 0x%04X", ConnectionRequest.PSM);\r
+ BT_ACL_DEBUG("-- Source Channel: 0x%04X", ConnectionRequest.SourceChannel);\r
\r
Pipe_ClearIN();\r
Pipe_Freeze();\r
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);\r
- Pipe_SetPipeToken(PIPE_TOKEN_OUT);\r
Pipe_Unfreeze();\r
\r
Bluetooth_SignalCommand_ConnectionResponse_t ConnectionResponse;\r
Pipe_ClearOUT(); \r
Pipe_Freeze();\r
\r
- BT_DEBUG("(ACL) Packet Sent", NULL);\r
- BT_DEBUG("(ACL) -- Connection Handle: 0x%04X", ACLPacketHeader->ConnectionHandle);\r
- BT_DEBUG("(ACL) -- Data Length: 0x%04X", ACLPacketHeader->DataLength);\r
- BT_DEBUG("(ACL) -- Destination Channel: 0x%04X", DataHeader->DestinationChannel);\r
- BT_DEBUG("(ACL) -- Payload Length: 0x%04X", DataHeader->PayloadLength); \r
- BT_DEBUG("(ACL) >> L2CAP Connection Response", NULL);\r
- BT_DEBUG("(ACL) -- Source Channel: 0x%04X", ConnectionResponse.SourceChannel);\r
- BT_DEBUG("(ACL) -- Destination Channel: 0x%04X", ConnectionResponse.DestinationChannel);\r
+ BT_ACL_DEBUG("Packet Sent", NULL);\r
+ BT_ACL_DEBUG("-- Connection Handle: 0x%04X", (ACLPacketHeader->ConnectionHandle & 0x0FFF));\r
+ BT_ACL_DEBUG("-- Data Length: 0x%04X", ACLPacketHeader->DataLength);\r
+ BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DataHeader->DestinationChannel);\r
+ BT_ACL_DEBUG("-- Payload Length: 0x%04X", DataHeader->PayloadLength); \r
+ BT_ACL_DEBUG(">> L2CAP Connection Response", NULL);\r
+ BT_ACL_DEBUG("-- Source Channel: 0x%04X", ConnectionResponse.SourceChannel);\r
+ BT_ACL_DEBUG("-- Destination Channel: 0x%04X", ConnectionResponse.DestinationChannel);\r
}\r
\r
static inline void Bluetooth_ProcessSignalPacket_ConfigurationRequest(Bluetooth_ACL_Header_t* ACLPacketHeader,\r
\r
Pipe_Read_Stream_LE(&ConfigurationRequest, sizeof(ConfigurationRequest));\r
\r
- BT_DEBUG("(ACL) >> L2CAP Configuration Request", NULL);\r
- BT_DEBUG("(ACL) -- Destination Channel: 0x%04X", ConfigurationRequest.DestinationChannel);\r
+ BT_ACL_DEBUG(">> L2CAP Configuration Request", NULL);\r
+ BT_ACL_DEBUG("-- Destination Channel: 0x%04X", ConfigurationRequest.DestinationChannel);\r
\r
Pipe_ClearIN();\r
Pipe_Freeze();\r
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);\r
- Pipe_SetPipeToken(PIPE_TOKEN_OUT);\r
Pipe_Unfreeze();\r
\r
Bluetooth_SignalCommand_ConfigurationResponse_t ConfigurationResponse;\r
if (ChannelData != NULL)\r
ChannelData->State = Channel_Open;\r
\r
- // TODO: Add channel config data to the tail of ConfigurationResponse\r
+ // TODO: Add channel config data to the tail of ConfigurationResponse\r
\r
ConfigurationResponse.SourceChannel = ChannelData->RemoteNumber;\r
ConfigurationResponse.Flags = 0x00;\r
Pipe_ClearOUT(); \r
Pipe_Freeze();\r
\r
- BT_DEBUG("(ACL) Packet Sent", NULL);\r
- BT_DEBUG("(ACL) -- Connection Handle: 0x%04X", ACLPacketHeader->ConnectionHandle);\r
- BT_DEBUG("(ACL) -- Data Length: 0x%04X", ACLPacketHeader->DataLength);\r
- BT_DEBUG("(ACL) -- Destination Channel: 0x%04X", DataHeader->DestinationChannel);\r
- BT_DEBUG("(ACL) -- Payload Length: 0x%04X", DataHeader->PayloadLength); \r
- BT_DEBUG("(ACL) >> L2CAP Configuration Response", NULL);\r
+ BT_ACL_DEBUG("Packet Sent", NULL);\r
+ BT_ACL_DEBUG("-- Connection Handle: 0x%04X", (ACLPacketHeader->ConnectionHandle & 0x0FFF));\r
+ BT_ACL_DEBUG("-- Data Length: 0x%04X", ACLPacketHeader->DataLength);\r
+ BT_ACL_DEBUG("-- Destination Channel: 0x%04X", DataHeader->DestinationChannel);\r
+ BT_ACL_DEBUG("-- Payload Length: 0x%04X", DataHeader->PayloadLength); \r
+ BT_ACL_DEBUG(">> L2CAP Configuration Response", NULL);\r
}\r
#include "BluetoothStack.h"\r
\r
/* Macros: */\r
+ #define BT_ACL_DEBUG(s, ...) printf_P(PSTR("(ACL) " s "\r\n"), __VA_ARGS__)\r
+\r
#define BLUETOOTH_CHANNEL_SIGNALING 0x0001\r
#define BLUETOOTH_CHANNEL_CONNECTIONLESS 0x0002\r
\r
\r
#include "BluetoothHCICommands.h"\r
\r
-static Bluetooth_HCICommand_Header_t HCICommandHeader;\r
-static Bluetooth_HCIEvent_Header_t HCIEventHeader;\r
+static Bluetooth_HCICommand_Header_t HCICommandHeader;\r
\r
- uint8_t Bluetooth_HCIProcessingState;\r
- uint8_t Bluetooth_HCINextState;\r
-static uint8_t Bluetooth_TempDeviceAddress[6];\r
+ uint8_t Bluetooth_HCIProcessingState;\r
+static uint8_t Bluetooth_HCINextState;\r
+static uint8_t Bluetooth_TempDeviceAddress[6];\r
\r
-static uint8_t Bluetooth_SendHCICommand(void* Parameters, uint8_t ParamLength)\r
+static uint8_t Bluetooth_SendHCICommand(void* Parameters, uint16_t ParameterLength)\r
{\r
+ /* Need to reserve the amount of bytes given in the header for the complete payload */\r
uint8_t CommandBuffer[sizeof(HCICommandHeader) + HCICommandHeader.ParameterLength];\r
\r
USB_ControlRequest = (USB_Request_Header_t)\r
.wIndex = 0,\r
.wLength = sizeof(CommandBuffer)\r
};\r
- \r
- memset(CommandBuffer, 0x00, sizeof(CommandBuffer));\r
+\r
+ /* Copy over the HCI command header to the allocated buffer */\r
memcpy(CommandBuffer, &HCICommandHeader, sizeof(HCICommandHeader));\r
\r
- if (ParamLength)\r
- memcpy(&CommandBuffer[sizeof(HCICommandHeader)], Parameters, ParamLength);\r
+ /* Zero out the parameter section of the response to ensure that any padding bytes do not expose private RAM contents */\r
+ memset(&CommandBuffer[sizeof(HCICommandHeader)], 0x00, HCICommandHeader.ParameterLength);\r
\r
+ /* Copy over the command parameters (if any) to the command buffer - note, the number of actual source parameter bytes\r
+ may differ to those in the header; any difference in length is filled with 0x00 padding bytes */\r
+ memcpy(&CommandBuffer[sizeof(HCICommandHeader)], Parameters, ParameterLength);\r
+ \r
Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
return USB_Host_SendControlRequest(CommandBuffer);\r
}\r
\r
void Bluetooth_ProcessHCICommands(void)\r
{\r
- uint8_t ErrorCode;\r
-\r
switch (Bluetooth_HCIProcessingState)\r
{\r
case Bluetooth_ProcessEvents:\r
\r
if (Pipe_IsReadWriteAllowed())\r
{\r
+ Bluetooth_HCIEvent_Header_t HCIEventHeader;\r
+\r
+ /* Read in the event header to fetch the event code and payload length */\r
Pipe_Read_Stream_LE(&HCIEventHeader, sizeof(HCIEventHeader));\r
\r
+ /* Create a temporary buffer for the event parameters */\r
uint8_t EventParams[HCIEventHeader.ParameterLength];\r
\r
+ /* Read in the event parameters into the temporary buffer */\r
Pipe_Read_Stream_LE(&EventParams, HCIEventHeader.ParameterLength);\r
Pipe_ClearIN();\r
\r
- BT_DEBUG("(HCI) Event Code: 0x%02X", HCIEventHeader.EventCode);\r
+ BT_HCI_DEBUG("Event Code: 0x%02X", HCIEventHeader.EventCode);\r
\r
switch (HCIEventHeader.EventCode)\r
{\r
case EVENT_COMMAND_COMPLETE:\r
Bluetooth_HCIProcessingState = Bluetooth_HCINextState;\r
\r
- BT_DEBUG("(HCI) >> Command Complete (Opcode 0x%04x)", \r
+ BT_HCI_DEBUG(">> Command Complete (Opcode 0x%04x)", \r
((Bluetooth_HCIEvent_CommandComplete_t*)&EventParams)->Opcode);\r
break;\r
case EVENT_COMMAND_STATUS:\r
+ /* If the execution of a command failed, reset the stack */\r
if (((Bluetooth_HCIEvent_CommandStatus_t*)&EventParams)->Status)\r
Bluetooth_HCIProcessingState = Bluetooth_Init;\r
\r
- BT_DEBUG("(HCI) >> Command Status: 0x%02X",\r
+ BT_HCI_DEBUG(">> Command Status: 0x%02X",\r
((Bluetooth_HCIEvent_CommandStatus_t*)&EventParams)->Status); \r
break;\r
case EVENT_CONNECTION_REQUEST:\r
+ /* Need to store the remote device's BT address in a temporary buffer for later use */\r
memcpy(Bluetooth_TempDeviceAddress,\r
&((Bluetooth_HCIEvent_ConnectionRequest_t*)&EventParams)->RemoteAddress,\r
sizeof(Bluetooth_TempDeviceAddress));\r
\r
+ /* Only accept the connection if it is a ACL (data) connection */\r
Bluetooth_HCIProcessingState = (Bluetooth_Connection.IsConnected ||\r
(((Bluetooth_HCIEvent_ConnectionRequest_t*)&EventParams)->LinkType != 0x01)) ?\r
Bluetooth_Conn_RejectConnection : Bluetooth_Conn_AcceptConnection;\r
\r
- BT_DEBUG("(HCI) >> Connection Request from Device %02X:%02X:%02X:%02X:%02X:%02X",\r
+ BT_HCI_DEBUG(">> Connection Request from Device %02X:%02X:%02X:%02X:%02X:%02X",\r
Bluetooth_TempDeviceAddress[5], Bluetooth_TempDeviceAddress[4], Bluetooth_TempDeviceAddress[3],\r
Bluetooth_TempDeviceAddress[2], Bluetooth_TempDeviceAddress[1], Bluetooth_TempDeviceAddress[0]);\r
break;\r
case EVENT_PIN_CODE_REQUEST:\r
+ /* Need to store the remote device's BT address in a temporary buffer for later use */\r
memcpy(Bluetooth_TempDeviceAddress,\r
&((Bluetooth_HCIEvent_PinCodeRequest_t*)&EventParams)->RemoteAddress,\r
sizeof(Bluetooth_TempDeviceAddress));\r
\r
Bluetooth_HCIProcessingState = Bluetooth_Conn_SendPINCode;\r
\r
- BT_DEBUG("(HCI) >> PIN Request from Device %02X:%02X:%02X:%02X:%02X:%02X", \r
+ BT_HCI_DEBUG(">> PIN Request from Device %02X:%02X:%02X:%02X:%02X:%02X", \r
Bluetooth_TempDeviceAddress[5], Bluetooth_TempDeviceAddress[4], Bluetooth_TempDeviceAddress[3],\r
Bluetooth_TempDeviceAddress[2], Bluetooth_TempDeviceAddress[1], Bluetooth_TempDeviceAddress[0]);\r
break;\r
case EVENT_CONNECTION_COMPLETE:\r
+ /* Need to store the remote device's BT address in a temporary buffer for later use */\r
memcpy(Bluetooth_Connection.RemoteAddress,\r
&((Bluetooth_HCIEvent_ConnectionComplete_t*)&EventParams)->RemoteAddress,\r
sizeof(Bluetooth_TempDeviceAddress));\r
\r
+ /* Store the created connection handle and indicate that the connection has been established */\r
Bluetooth_Connection.ConnectionHandle = ((Bluetooth_HCIEvent_ConnectionComplete_t*)&EventParams)->ConnectionHandle;\r
Bluetooth_Connection.IsConnected = true;\r
\r
- BT_DEBUG("(HCI) >> Connection Complete to Device %02X:%02X:%02X:%02X:%02X:%02X, Handle 0x%04x", \r
+ BT_HCI_DEBUG(">> Connection Complete to Device %02X:%02X:%02X:%02X:%02X:%02X, Handle 0x%04x", \r
Bluetooth_Connection.RemoteAddress[5], Bluetooth_Connection.RemoteAddress[4],\r
Bluetooth_Connection.RemoteAddress[3], Bluetooth_Connection.RemoteAddress[2],\r
Bluetooth_Connection.RemoteAddress[1], Bluetooth_Connection.RemoteAddress[0],\r
Bluetooth_Connection.ConnectionHandle);\r
break;\r
+ case EVENT_DISCONNECTION_COMPLETE:\r
+ BT_HCI_DEBUG(">> Disconnection Complete", NULL);\r
+\r
+ /* Device disconnected, indicate connection information no longer valid */\r
+ Bluetooth_Connection.IsConnected = false;\r
+ \r
+ Bluetooth_HCIProcessingState = Bluetooth_Init;\r
+ break; \r
}\r
}\r
\r
\r
break;\r
case Bluetooth_Init:\r
+ /* Reset the connection information structure to destroy any previous connection state */\r
memset(&Bluetooth_Connection, 0x00, sizeof(Bluetooth_Connection));\r
\r
Bluetooth_HCIProcessingState = Bluetooth_Init_Reset; \r
ParameterLength: 0,\r
};\r
\r
- BT_DEBUG("(HCI) Enter State: Bluetooth_Init_Reset", NULL);\r
+ BT_HCI_DEBUG("Enter State: Bluetooth_Init_Reset", NULL);\r
\r
- ErrorCode = Bluetooth_SendHCICommand(NULL, 0);\r
+ /* Send the command to reset the bluetooth dongle controller */\r
+ Bluetooth_SendHCICommand(NULL, 0);\r
\r
- Bluetooth_HCINextState = Bluetooth_Init_ReadBufferSize;\r
- Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
- break;\r
- case Bluetooth_Init_ReadBufferSize:\r
- HCICommandHeader = (Bluetooth_HCICommand_Header_t)\r
- {\r
- OpCode: {OGF: OGF_CTRLR_INFORMATIONAL, OCF: OGF_CTRLR_INFORMATIONAL_READBUFFERSIZE},\r
- ParameterLength: 0,\r
- };\r
- \r
- BT_DEBUG("(HCI) Enter State: Bluetooth_Init_ReadBufferSize", NULL);\r
-\r
- ErrorCode = Bluetooth_SendHCICommand(NULL, 0);\r
-\r
Bluetooth_HCINextState = Bluetooth_Init_SetLocalName;\r
Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
break;\r
ParameterLength: 248,\r
};\r
\r
- BT_DEBUG("(HCI) Enter State: Bluetooth_Init_SetLocalName", NULL);\r
- BT_DEBUG("(HCI) -- Name: %s", Bluetooth_DeviceConfiguration.Name);\r
+ BT_HCI_DEBUG("Enter State: Bluetooth_Init_SetLocalName", NULL);\r
+ BT_HCI_DEBUG("-- Name: %s", Bluetooth_DeviceConfiguration.Name);\r
\r
- ErrorCode = Bluetooth_SendHCICommand(Bluetooth_DeviceConfiguration.Name, strlen(Bluetooth_DeviceConfiguration.Name));\r
+ /* Send the command to set the bluetooth dongle's name for other devices to see */\r
+ Bluetooth_SendHCICommand(Bluetooth_DeviceConfiguration.Name, strlen(Bluetooth_DeviceConfiguration.Name));\r
\r
Bluetooth_HCINextState = Bluetooth_Init_SetDeviceClass;\r
Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
ParameterLength: 3,\r
};\r
\r
- BT_DEBUG("(HCI) Enter State: Bluetooth_Init_SetDeviceClass", NULL);\r
+ BT_HCI_DEBUG("Enter State: Bluetooth_Init_SetDeviceClass", NULL);\r
\r
- ErrorCode = Bluetooth_SendHCICommand(&Bluetooth_DeviceConfiguration.Class, 3);\r
+ /* Send the command to set the class of the device for other devices to see */\r
+ Bluetooth_SendHCICommand(&Bluetooth_DeviceConfiguration.Class, 3);\r
\r
Bluetooth_HCINextState = Bluetooth_Init_WriteScanEnable;\r
Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
ParameterLength: 1,\r
};\r
\r
- BT_DEBUG("(HCI) Enter State: Bluetooth_Init_WriteScanEnable", NULL);\r
+ BT_HCI_DEBUG("Enter State: Bluetooth_Init_WriteScanEnable", NULL);\r
\r
- uint8_t Interval = InquiryAndPageScans;\r
- ErrorCode = Bluetooth_SendHCICommand(&Interval, 1);\r
+ uint8_t Interval = BT_SCANMODE_InquiryAndPageScans;\r
+ \r
+ /* Send the command to set the remote device scanning mode */\r
+ Bluetooth_SendHCICommand(&Interval, 1);\r
\r
Bluetooth_HCINextState = Bluetooth_ProcessEvents;\r
Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
ParameterLength: sizeof(Bluetooth_HCICommand_AcceptConnectionRequest_t),\r
};\r
\r
- BT_DEBUG("(HCI) Enter State: Bluetooth_Conn_AcceptConnection", NULL);\r
+ BT_HCI_DEBUG("Enter State: Bluetooth_Conn_AcceptConnection", NULL);\r
\r
+ /* Copy over the temporary BT device address saved from the Connection Request event, indicate slave\r
+ connection role */\r
Bluetooth_HCICommand_AcceptConnectionRequest_t AcceptConnectionParams;\r
-\r
- memcpy(AcceptConnectionParams.RemoteAddress, Bluetooth_TempDeviceAddress, sizeof(Bluetooth_TempDeviceAddress));\r
+ memcpy(AcceptConnectionParams.RemoteAddress, Bluetooth_TempDeviceAddress,\r
+ sizeof(AcceptConnectionParams.RemoteAddress));\r
AcceptConnectionParams.SlaveRole = true;\r
\r
- ErrorCode = Bluetooth_SendHCICommand(&AcceptConnectionParams, sizeof(AcceptConnectionParams));\r
+ /* Send the command to accept the remote connection request */\r
+ Bluetooth_SendHCICommand(&AcceptConnectionParams, sizeof(Bluetooth_HCICommand_AcceptConnectionRequest_t));\r
\r
Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
break;\r
ParameterLength: sizeof(Bluetooth_HCICommand_RejectConnectionRequest_t),\r
};\r
\r
- BT_DEBUG("(HCI) Enter State: Bluetooth_Conn_RejectConnection", NULL);\r
+ BT_HCI_DEBUG("Enter State: Bluetooth_Conn_RejectConnection", NULL);\r
\r
+ /* Copy over the temporary BT device address saved from the Connection Request event, indicate failure\r
+ to accept the connection due to limited device resources */\r
Bluetooth_HCICommand_RejectConnectionRequest_t RejectConnectionParams;\r
-\r
memcpy(RejectConnectionParams.RemoteAddress, Bluetooth_TempDeviceAddress, sizeof(RejectConnectionParams.RemoteAddress));\r
RejectConnectionParams.Reason = ERROR_LIMITED_RESOURCES;\r
\r
- ErrorCode = Bluetooth_SendHCICommand(&RejectConnectionParams, sizeof(RejectConnectionParams));\r
+ /* Send the command to reject the remote connection request */\r
+ Bluetooth_SendHCICommand(&RejectConnectionParams, sizeof(Bluetooth_HCICommand_RejectConnectionRequest_t));\r
\r
Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
break;\r
ParameterLength: sizeof(Bluetooth_HCICommand_PinCodeResponse_t),\r
};\r
\r
- BT_DEBUG("(HCI) Enter State: Bluetooth_Conn_SendPINCode", NULL);\r
- BT_DEBUG("(HCI) -- PIN: %s", Bluetooth_DeviceConfiguration.PINCode);\r
+ BT_HCI_DEBUG("Enter State: Bluetooth_Conn_SendPINCode", NULL);\r
+ BT_HCI_DEBUG("-- PIN: %s", Bluetooth_DeviceConfiguration.PINCode);\r
\r
+ /* Copy over the temporary BT device address saved from the PIN Code Request event, copy over the\r
+ local PIN authentication code to the response */\r
Bluetooth_HCICommand_PinCodeResponse_t PINCodeRequestParams;\r
- \r
- memcpy(PINCodeRequestParams.RemoteAddress, Bluetooth_TempDeviceAddress, sizeof(Bluetooth_TempDeviceAddress));\r
+ memcpy(PINCodeRequestParams.RemoteAddress, Bluetooth_TempDeviceAddress, sizeof(PINCodeRequestParams.RemoteAddress));\r
PINCodeRequestParams.PINCodeLength = strlen(Bluetooth_DeviceConfiguration.PINCode);\r
memcpy(PINCodeRequestParams.PINCode, Bluetooth_DeviceConfiguration.PINCode, sizeof(PINCodeRequestParams.PINCode));\r
\r
- ErrorCode = Bluetooth_SendHCICommand(&PINCodeRequestParams, sizeof(PINCodeRequestParams));\r
+ /* Send the command to transmit the device's local PIN number for authentication */\r
+ Bluetooth_SendHCICommand(&PINCodeRequestParams, sizeof(Bluetooth_HCICommand_PinCodeResponse_t));\r
\r
Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
break;\r
#include "BluetoothClassCodes.h"\r
\r
/* Macros: */\r
+ #define BT_HCI_DEBUG(s, ...) printf_P(PSTR("(HCI) " s "\r\n"), __VA_ARGS__)\r
+ \r
#define OGF_LINK_CONTROL 0x01\r
#define OGF_CTRLR_BASEBAND 0x03\r
#define OGF_CTRLR_INFORMATIONAL 0x04\r
/* Enums: */\r
enum Bluetooth_ScanEnable_Modes_t\r
{\r
- NoScansEnabled = 0,\r
- InquiryScanOnly = 1,\r
- PageScanOnly = 2,\r
- InquiryAndPageScans = 3,\r
+ BT_SCANMODE_NoScansEnabled = 0,\r
+ BT_SCANMODE_InquiryScanOnly = 1,\r
+ BT_SCANMODE_PageScanOnly = 2,\r
+ BT_SCANMODE_InquiryAndPageScans = 3,\r
};\r
\r
enum BluetoothStack_States_t\r
{\r
- Bluetooth_ProcessEvents = 0,\r
- Bluetooth_Init = 1,\r
- Bluetooth_Init_Reset = 2,\r
- Bluetooth_Init_ReadBufferSize = 3,\r
- Bluetooth_Init_SetLocalName = 4,\r
- Bluetooth_Init_SetDeviceClass = 5,\r
- Bluetooth_Init_WriteScanEnable = 6,\r
- Bluetooth_Conn_AcceptConnection = 7,\r
- Bluetooth_Conn_RejectConnection = 8,\r
- Bluetooth_Conn_SendPINCode = 9,\r
+ Bluetooth_ProcessEvents = 0,\r
+ Bluetooth_Init = 1,\r
+ Bluetooth_Init_Reset = 2,\r
+ Bluetooth_Init_SetLocalName = 3,\r
+ Bluetooth_Init_SetDeviceClass = 4,\r
+ Bluetooth_Init_WriteScanEnable = 5,\r
+ Bluetooth_Conn_AcceptConnection = 6,\r
+ Bluetooth_Conn_RejectConnection = 7,\r
+ Bluetooth_Conn_SendPINCode = 8,\r
};\r
\r
/* External Variables: */\r
void Bluetooth_ProcessHCIEvents(void);\r
\r
#if defined(INCLUDE_FROM_BLUETOOTHHCICOMMANDS_C)\r
- static uint8_t Bluetooth_SendHCICommand(void* Parameters, uint8_t ParamLength);\r
+ static uint8_t Bluetooth_SendHCICommand(void* Parameters, uint16_t ParameterLength);\r
#endif\r
\r
#endif\r
#include "BluetoothACLPackets.h"\r
\r
/* Macros: */\r
+ #define BLUETOOTH_DATA_IN_PIPE 1\r
+ #define BLUETOOTH_DATA_OUT_PIPE 2\r
+ #define BLUETOOTH_EVENTS_PIPE 3\r
+\r
#define BLUETOOTH_MAX_OPEN_CHANNELS 2\r
#define BLUETOOTH_CHANNELNUMBER_BASEOFFSET 0x0040\r
\r
#define CHANNEL_LOOKUP_BY_SOURCE true\r
#define CHANNEL_LOOKUP_BY_DESTINATION false\r
\r
- #define BT_DEBUG(s, ...) printf_P(PSTR(s "\r\n"), __VA_ARGS__)\r
- \r
/* Enums: */\r
enum Bluetooth_Channel_State_t\r
{\r
/* Macros: */\r
/** Interface Class value for the Human Interface Device class */\r
#define HID_CLASS 0x03\r
-\r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Enums: */\r
/** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
/** Interface Protocol value for a Boot Protocol Mouse compliant device */\r
#define JOYSTICK_PROTOCOL 0x02\r
\r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
-\r
/** Descriptor header type constant for a HID descriptor */\r
#define DTYPE_HID 0x21\r
\r
\r
/** Interface Protocol value for a Boot Protocol Keyboard compliant device */\r
#define KEYBOARD_PROTOCOL 0x01\r
- \r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Enums: */\r
/** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
\r
/** Interface Protocol value for a Boot Protocol Keyboard compliant device */\r
#define KEYBOARD_PROTOCOL 0x01\r
- \r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/** Descriptor header type constant for a HID descriptor */\r
#define DTYPE_HID 0x21\r
\r
/** Interface Class value for the MIDI Audio Streaming protocol */\r
#define MIDI_STREAMING_PROTOCOL 0x00\r
-\r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Enums: */\r
/** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
\r
/** Interface Protocol value for the Bulk Only transport protocol */\r
#define MASS_STORE_PROTOCOL 0x50\r
- \r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Enums: */\r
/** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
\r
/** Interface Protocol value for a Boot Protocol Mouse compliant device */\r
#define MOUSE_PROTOCOL 0x02\r
-\r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Enums: */\r
/** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
\r
/** Interface Protocol value for a Boot Protocol Mouse compliant device */\r
#define MOUSE_PROTOCOL 0x02\r
-\r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
-\r
+ \r
/** Descriptor header type constant for a HID descriptor */\r
#define DTYPE_HID 0x21\r
\r
\r
/** Interface Protocol value for a Bidirectional communication encapsulation */\r
#define PRINTER_PROTOCOL 0x02\r
- \r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Enums: */\r
/** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
\r
/** Interface Class value for the CDC data protocol */\r
#define CDC_DATA_PROTOCOL 0x00\r
-\r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Enums: */\r
/** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
\r
/** Interface Class value for the Still Image Device protocol */\r
#define SIMAGE_PROTOCOL 0x01\r
-\r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Enums: */\r
/** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
\r
/** Interface Class value for the CDC data protocol */\r
#define CDC_DATA_PROTOCOL 0x00\r
-\r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Enums: */\r
/** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
/** Interface Class value for the Human Interface Device class */\r
#define HID_CLASS 0x03\r
\r
- /** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
- #define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
- \r
/* Enums: */\r
/** Enum for the possible return codes of the ProcessConfigurationDescriptor() function. */\r
enum GenericHIDHost_GetConfigDescriptorDataCodes_t\r