SAMV71 Xplained Ultra Software Package 1.3

Usbd_hid

Collaboration diagram for Usbd_hid:

Data Structures

struct  HIDDParseData
struct  HIDDReportHeader
struct  HIDDReport
struct  HIDDFunction

Modules

 HIDD Event codes

Defines

#define _PU8(v)   ((uint8_t*)(&(v)))
#define _Word(a)   (_PU8(a)[0] + (_PU8(a)[1] << 8))

Typedefs

typedef void(* HIDDReportEventCallback )(uint32_t ec, void *pArg)

Functions

void HIDDFunction_Initialize (HIDDFunction *pHidd, USBDDriver *pUsbd, uint8_t bInterfaceNb, const uint8_t *pReportDescriptor, HIDDReport *pInputList[], uint8_t bInputListSize, HIDDReport *pOutputList[], uint8_t bOutputListSize)
USBGenericDescriptor * HIDDFunction_ParseInterface (HIDDFunction *pHidd, USBGenericDescriptor *pDescriptors, uint32_t dwLength)
uint32_t HIDDFunction_StartPollingOutputs (HIDDFunction *pHidd)
uint32_t HIDDFunction_StartSendingInputs (HIDDFunction *pHidd)
uint32_t HIDDFunction_RequestHandler (HIDDFunction *pHidd, const USBGenericRequest *request)
uint32_t HIDDFunction_Read (const HIDDFunction *pHidd, void *pData, uint32_t dwLength, TransferCallback fCallback, void *pArg)
uint32_t HIDDFunction_Write (const HIDDFunction *pHidd, void *pData, uint32_t dwLength, TransferCallback fCallback, void *pArg)
void HIDDFunction_InitializeReport (HIDDReport *pReport, uint16_t wSize, uint8_t bID, HIDDReportEventCallback fCallback, void *pArg)

Define Documentation

#define _PU8 (   v  )     ((uint8_t*)(&(v)))

Get byte pointer

Definition at line 58 of file HIDDFunction.c.

#define _Word (   a  )     (_PU8(a)[0] + (_PU8(a)[1] << 8))

Get word from un-aligned value

Definition at line 63 of file HIDDFunction.c.


Typedef Documentation

typedef void(* HIDDReportEventCallback)(uint32_t ec, void *pArg)

Callback function for HID report events.

Definition at line 87 of file HIDDFunction.h.


Function Documentation

void HIDDFunction_Initialize ( HIDDFunction pHidd,
USBDDriver pUsbd,
uint8_t  bInterfaceNb,
const uint8_t *  pReportDescriptor,
HIDDReport pInputList[],
uint8_t  bInputListSize,
HIDDReport pOutputList[],
uint8_t  bOutputListSize 
)

Initialize the USB Device HID function, for general HID device support.

Parameters:
pHidd Pointer to HIDDFunction instance.
pUsbd Pointer to USBDDriver instance.
bInterfaceNb Interface number, can be 0xFF to obtain from descriptors.
pReportDescriptor Pointer to report descriptor.
pInputList Pointer to an HID input report list
bInputListSize HID input report list size
pOutputList Pointer to an HID output report list
bOutputListSize HID output report list size
void HIDDFunction_InitializeReport ( HIDDReport pReport,
uint16_t  wSize,
uint8_t  bID,
HIDDReportEventCallback  fCallback,
void *  pArg 
)

Initialize a report.

Parameters:
pReport Pointer to HIDDReport instance.
wSize Size of the report data.
bID Report ID.
fCallback Callback function for report events.
pArg Pointer to event handler arguments.
USBGenericDescriptor * HIDDFunction_ParseInterface ( HIDDFunction pHidd,
USBGenericDescriptor *  pDescriptors,
uint32_t  dwLength 
)

Parse the USB HID Function Interface. Only first interface and its endpoints parsed.

Parameters:
pHidd Pointer to HIDDFunction instance.
pDescriptors Pointer to descriptor list.
dwLength Descriptor list block length in bytes.
Returns:
Pointer to next descriptor. 0 means no other descriptor.
uint32_t HIDDFunction_Read ( const HIDDFunction pHidd,
void *  pData,
uint32_t  dwLength,
TransferCallback  fCallback,
void *  pArg 
)

Read raw data through USB interrupt OUT EP.

Parameters:
pHidd Pointer to HIDDFunction instance.
pData Pointer to the data buffer.
dwLength The data length.
fCallback Callback function invoked when transferring done.
pArg Pointer to additional arguments.
uint32_t HIDDFunction_RequestHandler ( HIDDFunction pHidd,
const USBGenericRequest request 
)

Handles HID-specific SETUP request sent by the host.

Parameters:
pHidd Pointer to HIDDFunction instance.
request Pointer to a USBGenericRequest instance
uint32_t HIDDFunction_StartPollingOutputs ( HIDDFunction pHidd  ) 

Start polling interrupt OUT pipe (output report, host to device) if there is.

Parameters:
pHidd Pointer to HIDDFunction instance.
uint32_t HIDDFunction_StartSendingInputs ( HIDDFunction pHidd  ) 

Start sending reports via interrupt IN pipe (input report, device to host) if there is.

Parameters:
pHidd Pointer to HIDDFunction instance.
uint32_t HIDDFunction_Write ( const HIDDFunction pHidd,
void *  pData,
uint32_t  dwLength,
TransferCallback  fCallback,
void *  pArg 
)

Write raw data through USB interrupt IN EP.

Parameters:
pHidd Pointer to HIDDFunction instance.
pData Pointer to the data sent.
dwLength The data length.
fCallback Callback function invoked when transferring done.
pArg Pointer to additional arguments.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines