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 UDI_HID_MOUSE_STRING_ID
By default no string associated to this interface.
Definition: udi_hid_mouse_doc.h:103
Report descriptor for HID mouse.
Definition: udi_hid_mouse_doc.h:92

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.
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.
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.
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.
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.
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.

UDC_DESC_STORAGE udi_api_t udi_api_hid_mouse

Global structure which contains standard UDI API for UDC.