Microchip® Advanced Software Framework

udi_hid_mouse.c File Reference

USB Device Human Interface Device (HID) mouse interface.

Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.

#include "conf_usb.h"
#include "usb_protocol.h"
#include "udd.h"
#include "udc.h"
#include "udi_hid.h"
#include "udi_hid_mouse.h"
#include <string.h>

Functions

bool udi_hid_mouse_btnleft (bool b_state)
 Changes left button state. More...
 
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...
 
void udi_hid_mouse_disable (void)
 
bool udi_hid_mouse_enable (void)
 
uint8_t udi_hid_mouse_getsetting (void)
 
bool udi_hid_mouse_moveScroll (int8_t pos)
 Move the scroll wheel. More...
 
bool udi_hid_mouse_moveX (int8_t pos_x)
 Move the mouse pointer on X axe. More...
 
bool udi_hid_mouse_moveY (int8_t pos_y)
 Move the mouse pointer on Y axe. More...
 
bool udi_hid_mouse_setup (void)
 
Internal routines
static bool udi_hid_mouse_move (int8_t pos, uint8_t index_report)
 Moves an axe. More...
 
static bool udi_hid_mouse_btn (bool b_state, uint8_t btn)
 Changes a button state. More...
 
static bool udi_hid_mouse_send_report (void)
 Send the report. More...
 
static void udi_hid_mouse_report_sent (udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep)
 Callback called when the report is sent. More...
 

Variables

UDC_DESC_STORAGE udi_api_t udi_api_hid_mouse
 Global structure which contains standard UDI interface for UDC. More...
 
UDC_DESC_STORAGE
udi_hid_mouse_report_desc_t 
udi_hid_mouse_report_desc
 HID report descriptor for standard HID mouse. More...
 

Internal defines and variables to manage HID mouse

#define UDI_HID_MOUSE_REPORT_SIZE   4
 Size of report for standard HID mouse. More...
 
static COMPILER_WORD_ALIGNED
uint8_t 
udi_hid_mouse_rate
 To store current rate of HID mouse. More...
 
static COMPILER_WORD_ALIGNED
uint8_t 
udi_hid_mouse_protocol
 To store current protocol of HID mouse. More...
 
static bool udi_hid_mouse_b_report_valid
 To signal if a valid report is ready to send. More...
 
static uint8_t udi_hid_mouse_report [UDI_HID_MOUSE_REPORT_SIZE]
 Report ready to send. More...
 
static bool udi_hid_mouse_report_trans_ongoing
 Signal if a report transfer is on going. More...
 
static COMPILER_WORD_ALIGNED
uint8_t 
udi_hid_mouse_report_trans [UDI_HID_MOUSE_REPORT_SIZE]
 Buffer used to send report. More...
 
static bool udi_hid_mouse_setreport (void)
 Callback for set report setup request. More...