Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USB Device Interface (UDI) for Human Interface Device Mouse (HID Mouse)

USB Device Interface (UDI) for Human Interface Device Mouse (HID mouse) provides an interface for the configuration and management of USB HID mouse device.

The outline of this documentation is as follows:

For more details for Atmel® Software Framework (ASF) USB Device Stack and USB Device HID Mouse, refer to following application notes:

API Overview

Data Structures

struct  udi_hid_mouse_desc_t
 Interface descriptor structure for HID mouse. More...
 
struct  udi_hid_mouse_report_desc_t
 Report descriptor for HID mouse. More...
 

Interface with USB Device Core (UDC)

Structure required by UDC.

UDC_DESC_STORAGE udi_api_t udi_api_hid_mouse
 Global structure which contains standard UDI API for UDC. More...
 

USB Interface Descriptors

The following structures provide predefined USB interface descriptors.

It must be used to define the final USB descriptors.

#define UDI_HID_MOUSE_STRING_ID   0
 By default no string associated to this interface. More...
 
#define UDI_HID_MOUSE_EP_SIZE   8
 HID mouse endpoints size. More...
 
#define UDI_HID_MOUSE_DESC
 Content of HID mouse interface descriptor for all speed. More...
 

Interfaces for Mouse Events

bool udi_hid_mouse_moveScroll (int8_t pos)
 Move the scroll wheel. More...
 
bool udi_hid_mouse_moveY (int8_t pos_y)
 Move the mouse pointer on Y axe. More...
 
bool udi_hid_mouse_moveX (int8_t pos_x)
 Move the mouse pointer on X axe. More...
 

Interfaces for Buttons Events

bool udi_hid_mouse_btnmiddle (bool b_state)
 Changes middle button state. More...
 
bool udi_hid_mouse_btnright (bool b_state)
 Changes right button state. More...
 
bool udi_hid_mouse_btnleft (bool b_state)
 Changes left button state. More...
 
#define HID_MOUSE_BTN_DOWN   true
 Value to signal a button down (pressed). More...
 
#define HID_MOUSE_BTN_UP   false
 Value to signal a button up (released). More...
 

#define HID_MOUSE_BTN_DOWN   true

Value to signal a button down (pressed).

#define HID_MOUSE_BTN_UP   false

Value to signal a button up (released).

#define UDI_HID_MOUSE_DESC
Value:
{\
.iface.bLength = sizeof(usb_iface_desc_t),\
.iface.bDescriptorType = USB_DT_INTERFACE,\
.iface.bInterfaceNumber = UDI_HID_MOUSE_IFACE_NUMBER,\
.iface.bAlternateSetting = 0,\
.iface.bNumEndpoints = 1,\
.iface.bInterfaceClass = HID_CLASS,\
.iface.bInterfaceSubClass = HID_SUB_CLASS_BOOT,\
.iface.bInterfaceProtocol = HID_PROTOCOL_MOUSE,\
.iface.iInterface = UDI_HID_MOUSE_STRING_ID,\
.hid.bLength = sizeof(usb_hid_descriptor_t),\
.hid.bDescriptorType = USB_DT_HID,\
.hid.bcdHID = LE16(USB_HID_BDC_V1_11),\
.hid.bCountryCode = USB_HID_NO_COUNTRY_CODE,\
.hid.bNumDescriptors = USB_HID_NUM_DESC,\
.hid.bRDescriptorType = USB_DT_HID_REPORT,\
.hid.wDescriptorLength = LE16(sizeof(udi_hid_mouse_report_desc_t)),\
.ep.bLength = sizeof(usb_ep_desc_t),\
.ep.bDescriptorType = USB_DT_ENDPOINT,\
.ep.bEndpointAddress = UDI_HID_MOUSE_EP_IN,\
.ep.bmAttributes = USB_EP_TYPE_INTERRUPT,\
.ep.wMaxPacketSize = LE16(UDI_HID_MOUSE_EP_SIZE),\
.ep.bInterval = 10,\
}
#define UDI_HID_MOUSE_EP_SIZE
HID mouse endpoints size.
Definition: udi_hid_mouse_doc.h:107
#define HID_SUB_CLASS_BOOT
Interface subclass support BOOT protocol.
Definition: usb_protocol_hid.h:60
HID Descriptor.
Definition: usb_protocol_hid.h:116
#define UDI_HID_MOUSE_IFACE_NUMBER
Interface number.
Definition: common/services/usb/class/composite/device/example1/conf_usb.h:168
#define UDI_HID_MOUSE_EP_IN
USB HID Mouse low level configuration In standalone these configurations are defined by the HID Mouse...
Definition: common/services/usb/class/composite/device/example1/conf_usb.h:165
#define USB_HID_NUM_DESC
Numeric expression specifying the number of class descriptors Note: Always at least one i...
Definition: usb_protocol_hid.h:143
Definition: usb_protocol_hid.h:86
Definition: usb_protocol.h:194
#define UDI_HID_MOUSE_STRING_ID
By default no string associated to this interface.
Definition: udi_hid_mouse_doc.h:103
Definition: usb_protocol.h:193
#define USB_HID_NO_COUNTRY_CODE
Definition: usb_protocol_hid.h:147
#define HID_CLASS
Definition: usb_protocol_hid.h:52
Standard USB interface descriptor structure.
Definition: usb_protocol.h:446
Report descriptor for HID mouse.
Definition: udi_hid_mouse.h:75
Definition: usb_protocol_hid.h:87
#define USB_HID_BDC_V1_11
Numeric expression identifying the HID Class Specification release (here V1.11)
Definition: usb_protocol_hid.h:140
Standard USB endpoint descriptor structure.
Definition: usb_protocol.h:461
#define LE16(x)
Definition: compiler.h:773
Definition: usb_protocol.h:252
#define HID_PROTOCOL_MOUSE
Protocol mouse standard.
Definition: usb_protocol_hid.h:70

Content of HID mouse interface descriptor for all speed.

#define UDI_HID_MOUSE_EP_SIZE   8

HID mouse endpoints size.

#define UDI_HID_MOUSE_STRING_ID   0

By default no string associated to this interface.

bool udi_hid_mouse_btnleft ( bool  b_state)

Changes left button state.

Parameters
[in]b_stateNew button state
Returns
1 if function was successfully done, otherwise 0.
Parameters
b_stateNew button state
Returns
1 if function was successfully done, otherwise 0.

References udi_hid_mouse_btn().

bool udi_hid_mouse_btnmiddle ( bool  b_state)

Changes middle button state.

Parameters
[in]b_stateNew button state
Returns
1 if function was successfully done, otherwise 0.
Parameters
b_stateNew button state
Returns
1 if function was successfully done, otherwise 0.

References udi_hid_mouse_btn().

bool udi_hid_mouse_btnright ( bool  b_state)

Changes right button state.

Parameters
[in]b_stateNew button state
Returns
1 if function was successfully done, otherwise 0.
Parameters
b_stateNew button state
Returns
1 if function was successfully done, otherwise 0.

References udi_hid_mouse_btn().

bool udi_hid_mouse_moveScroll ( int8_t  pos)

Move the scroll wheel.

Parameters
[in]posSigned value to move
Returns
1 if function was successfully done, otherwise 0.
Parameters
posSigned value to move
Returns
1 if function was successfully done, otherwise 0.

References udi_hid_mouse_move().

bool udi_hid_mouse_moveX ( int8_t  pos_x)

Move the mouse pointer on X axe.

Parameters
[in]pos_xSigned value to move
Returns
1 if function was successfully done, otherwise 0.
Parameters
pos_xSigned value to move
Returns
1 if function was successfully done, otherwise 0.

References udi_hid_mouse_move().

bool udi_hid_mouse_moveY ( int8_t  pos_y)

Move the mouse pointer on Y axe.

Parameters
[in]pos_ySigned value to move
Returns
1 if function was successfully done, otherwise 0.
Parameters
pos_ySigned value to move
Returns
1 if function was successfully done, otherwise 0.

References udi_hid_mouse_move().

UDC_DESC_STORAGE udi_api_t udi_api_hid_mouse

Global structure which contains standard UDI API for UDC.

Global structure which contains standard UDI API for UDC.