-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathusb_interface_mouse.h
More file actions
62 lines (46 loc) · 1.86 KB
/
Copy pathusb_interface_mouse.h
File metadata and controls
62 lines (46 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef __USB_INTERFACE_MOUSE_H__
#define __USB_INTERFACE_MOUSE_H__
// Includes:
#include "usb_api.h"
// #include "usb_descriptors/usb_descriptor_device.h"
// Macros:
#define USB_MOUSE_INTERFACE_INDEX 1
#define USB_MOUSE_INTERFACE_COUNT 1
#define USB_MOUSE_ENDPOINT_INDEX 2
#define USB_MOUSE_ENDPOINT_COUNT 1
#define USB_MOUSE_INTERRUPT_IN_PACKET_SIZE (USB_MOUSE_REPORT_LENGTH)
#define USB_MOUSE_INTERRUPT_IN_INTERVAL 1
#define USB_MOUSE_REPORT_LENGTH (sizeof(usb_mouse_report_t))
#define USB_MOUSE_FEAT_REPORT_LENGTH 1
// Typedefs:
// Note: We support boot protocol mode in this interface, thus the mouse
// report may not exceed 8 bytes and must conform to the HID mouse boot
// protocol as specified in the USB HID specification. If a different or
// longer format is desired in the future, we will need to translate sent
// reports to the boot protocol format when the host has set boot protocol
// mode.
typedef struct {
uint32_t buttons : 24;
int16_t x;
int16_t y;
int16_t wheelY;
int16_t wheelX;
} ATTR_PACKED usb_mouse_report_t;
// Variables:
extern uint32_t UsbMouseActionCounter;
extern usb_mouse_report_t* ActiveUsbMouseReport;
// Functions:
#ifndef __ZEPHYR__
usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param);
usb_status_t UsbMouseAction(void);
usb_hid_protocol_t UsbMouseGetProtocol(void);
#endif
void ReportScrolls(void);
float VerticalScrollMultiplier(void);
float HorizontalScrollMultiplier(void);
void UsbMouseResetActiveReport(void);
void UsbMouseSendActiveReport(void);
usb_status_t UsbMouseCheckIdleElapsed();
usb_status_t UsbMouseCheckReportReady(bool* buttonsChanged);
void UsbMouse_MergeReports(usb_mouse_report_t* sourceReport, usb_mouse_report_t* targetReport);
#endif