MDK-ARM Keil, MDK-ARM Datasheet - Page 134

KIT REALVIEW MCU DEVELOPMENT

MDK-ARM

Manufacturer Part Number
MDK-ARM
Description
KIT REALVIEW MCU DEVELOPMENT
Manufacturer
Keil
Type
Compiler and IDEr
Datasheets

Specifications of MDK-ARM

For Use With/related Products
ARM MCUs
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
134
Once we have located the driver and opened the connection, two further read and
write functions allow us to exchange data with the attached HID device.
BOOL HID_Read (BYTE *buf, DWORD sz, DWORD *cnt);
BOOL HID_Write (BYTE *buf, DWORD sz, DWORD *cnt);
void HID_Close ();
Finally we can end our connection with the HID driver by calling the
HID_Close() function.
Enlarging the IN & OUT Endpoint Packet
Sizes
In a practical application, it will be necessary to transfer more than a single byte
of data between the USB host and device. You can change the Report descriptor
to transfer the maximum packet size of 64 bytes in both directions, as shown
below.
#define INREPORT_SIZE
#define OUTREPORT_SIZE
BYTE InReport [INREPORT_SIZE];
BYTE OutReport [OUTREPORT_SIZE];
const BYTE HID_ReportDescriptor[] =
};
This is a more general Report descriptor, which can be modified easily to
accommodate any custom IN and OUT packet size. We can also move the OUT
data pipe from Endpoint 0 to the Endpoint 1 OUT by defining an additional
interrupt Endpoint descriptor, as shown below.
HID_UsagePageVendor (0x00),
HID_Usage (0x01),
HID_Collection (HID_Application),
HID_LogicalMin (0),
HID_LogicalMaxS (0xFF),
HID_ReportSize (8),
HID_ReportCount (INREPORT_SIZE),
HID_Usage (0x01),
HID_Input (HID_Data | HID_Variable | HID_Absolute),
HID_ReportCount (OUTREPORT_SIZE),
HID_Usage (0x01),
HID_Output (HID_Data | HID_Variable | HID_Absolute),
HID_EndCollection
64
64
{
// HID Input Report
// HID Output Report
// HID Report Descriptor
// bits
// Bytes
// Bytes
Chapter 5. RL-USB Introduction

Related parts for MDK-ARM