aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/LowLevel/Mouse
diff options
context:
space:
mode:
Diffstat (limited to 'Demos/Device/LowLevel/Mouse')
-rw-r--r--Demos/Device/LowLevel/Mouse/Descriptors.c10
-rw-r--r--Demos/Device/LowLevel/Mouse/Descriptors.h27
-rw-r--r--Demos/Device/LowLevel/Mouse/Mouse.c14
-rw-r--r--Demos/Device/LowLevel/Mouse/Mouse.h32
4 files changed, 13 insertions, 70 deletions
diff --git a/Demos/Device/LowLevel/Mouse/Descriptors.c b/Demos/Device/LowLevel/Mouse/Descriptors.c
index d6caf51cd..dab5425e4 100644
--- a/Demos/Device/LowLevel/Mouse/Descriptors.c
+++ b/Demos/Device/LowLevel/Mouse/Descriptors.c
@@ -140,12 +140,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID_MouseHID =
{
- .Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
+ .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
- .HIDReportType = DTYPE_Report,
+ .HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(MouseReport)
},
@@ -237,11 +237,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
}
break;
- case DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_MouseHID;
- Size = sizeof(USB_Descriptor_HID_t);
+ Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &MouseReport;
Size = sizeof(MouseReport);
break;
diff --git a/Demos/Device/LowLevel/Mouse/Descriptors.h b/Demos/Device/LowLevel/Mouse/Descriptors.h
index 2d9a329d0..6765223b5 100644
--- a/Demos/Device/LowLevel/Mouse/Descriptors.h
+++ b/Demos/Device/LowLevel/Mouse/Descriptors.h
@@ -42,25 +42,6 @@
#include <avr/pgmspace.h>
/* Type Defines: */
- /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
- * specification for details on the structure elements.
- */
- typedef struct
- {
- USB_Descriptor_Header_t Header;
-
- uint16_t HIDSpec;
- uint8_t CountryCode;
-
- uint8_t TotalReportDescriptors;
-
- uint8_t HIDReportType;
- uint16_t HIDReportLength;
- } USB_Descriptor_HID_t;
-
- /** Type define for the data type used to store HID report descriptor elements. */
- typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;
-
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@@ -69,7 +50,7 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID_Interface;
- USB_Descriptor_HID_t HID_MouseHID;
+ USB_HID_Descriptor_HID_t HID_MouseHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
@@ -80,12 +61,6 @@
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
- /** Descriptor header type value, to indicate a HID class HID descriptor. */
- #define DTYPE_HID 0x21
-
- /** Descriptor header type value, to indicate a HID class HID report descriptor. */
- #define DTYPE_Report 0x22
-
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
diff --git a/Demos/Device/LowLevel/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c
index 23df2a610..5df26bde8 100644
--- a/Demos/Device/LowLevel/Mouse/Mouse.c
+++ b/Demos/Device/LowLevel/Mouse/Mouse.c
@@ -44,7 +44,7 @@ bool UsingReportProtocol = true;
/** Current Idle period. This is set by the host via a Set Idle HID class request to silence the device's reports
* for either the entire idle duration, or until the report status changes (e.g. the user moves the mouse).
*/
-uint16_t IdleCount = HID_IDLE_CHANGESONLY;
+uint16_t IdleCount = 0;
/** Current Idle period remaining. When the IdleCount value is set, this tracks the remaining number of idle
* milliseconds. This is separate to the IdleCount timer and is incremented and compared as the host may request
@@ -135,7 +135,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
- case REQ_GetReport:
+ case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
USB_MouseReport_Data_t MouseReportData;
@@ -154,7 +154,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_GetProtocol:
+ case HID_REQ_GetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -167,7 +167,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_SetProtocol:
+ case HID_REQ_SetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -178,7 +178,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_SetIdle:
+ case HID_REQ_SetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -189,7 +189,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
- case REQ_GetIdle:
+ case HID_REQ_GetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@@ -261,7 +261,7 @@ void SendNextReport(void)
SendReport = true;
/* Check if the idle period is set and has elapsed */
- if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))
+ if (IdleCount && (!(IdleMSRemaining)))
{
/* Reset the idle time remaining counter */
IdleMSRemaining = IdleCount;
diff --git a/Demos/Device/LowLevel/Mouse/Mouse.h b/Demos/Device/LowLevel/Mouse/Mouse.h
index f551f5d6e..7158b7736 100644
--- a/Demos/Device/LowLevel/Mouse/Mouse.h
+++ b/Demos/Device/LowLevel/Mouse/Mouse.h
@@ -53,27 +53,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
/* Macros: */
- /** Idle period indicating that reports should be sent only when the inputs have changed */
- #define HID_IDLE_CHANGESONLY 0
-
- /** HID Class specific request to get the next HID report from the device. */
- #define REQ_GetReport 0x01
-
- /** HID Class specific request to get the idle timeout period of the device. */
- #define REQ_GetIdle 0x02
-
- /** HID Class specific request to send the next HID report to the device. */
- #define REQ_SetReport 0x09
-
- /** HID Class specific request to set the idle timeout period of the device. */
- #define REQ_SetIdle 0x0A
-
- /** HID Class specific request to get the current HID protocol in use, either report or boot. */
- #define REQ_GetProtocol 0x03
-
- /** HID Class specific request to set the current HID protocol in use, either report or boot. */
- #define REQ_SetProtocol 0x0B
-
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -86,17 +65,6 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
- /* Type Defines: */
- /** Type define for the mouse HID report structure, for creating and sending HID reports to the host PC.
- * This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
- */
- typedef struct
- {
- uint8_t Button; /**< Bit mask of the currently pressed mouse buttons */
- int8_t X; /**< Current mouse delta X movement, as a signed 8-bit integer */
- int8_t Y; /**< Current mouse delta Y movement, as a signed 8-bit integer */
- } USB_MouseReport_Data_t;
-
/* Function Prototypes: */
void SetupHardware(void);
void Mouse_Task(void);