Adding relative movement mouse key support
- Still very basic (lots of room for improvement) - Capability format will likely change at some point - 16 bit movement control, however repeat rate limits usability (will need KLL 0.4 to make better)
This commit is contained in:
parent
3c9a97d51a
commit
18aef02a1f
5 changed files with 64 additions and 33 deletions
|
@ -309,32 +309,33 @@ static uint8_t sys_ctrl_report_desc[] = {
|
|||
static uint8_t mouse_report_desc[] = {
|
||||
0x05, 0x01, // Usage Page (Generic Desktop)
|
||||
0x09, 0x02, // Usage (Mouse)
|
||||
0xa1, 0x01, // Collection (Application)
|
||||
0xA1, 0x01, // Collection (Application)
|
||||
0x09, 0x02, // Usage (Mouse)
|
||||
0xa1, 0x02, // Collection (Logical)
|
||||
0xA1, 0x02, // Collection (Logical)
|
||||
0x09, 0x01, // Usage (Pointer)
|
||||
|
||||
// Buttons (8 bits)
|
||||
0xa1, 0x00, // Collection (Physical) - Buttons
|
||||
// Buttons (16 bits)
|
||||
0xA1, 0x00, // Collection (Physical) - Buttons
|
||||
0x05, 0x09, // Usage Page (Button)
|
||||
0x19, 0x01, // Usage Minimum (Button 1)
|
||||
0x29, 0x08, // Usage Maximum (Button 8)
|
||||
0x29, 0x10, // Usage Maximum (Button 16)
|
||||
0x15, 0x00, // Logical Minimum (0)
|
||||
0x25, 0x01, // Logical Maximum (1)
|
||||
0x75, 0x01, // Report Size (1)
|
||||
0x95, 0x08, // Report Count (8)
|
||||
0x95, 0x10, // Report Count (16)
|
||||
0x81, 0x02, // Input (Data,Var,Abs)
|
||||
|
||||
// Pointer (16 bits)
|
||||
// Pointer (32 bits)
|
||||
0x05, 0x01, // Usage PAGE (Generic Desktop)
|
||||
0x09, 0x30, // Usage (X)
|
||||
0x09, 0x31, // Usage (Y)
|
||||
0x15, 0x81, // Logical Minimum (-127)
|
||||
0x25, 0x7f, // Logical Maximum (127)
|
||||
0x75, 0x08, // Report Size (8)
|
||||
0x16, 0x01, 0x80, // Logical Minimum (-32 767)
|
||||
0x26, 0xFF, 0x7F, // Logical Maximum (32 767)
|
||||
0x75, 0x10, // Report Size (16)
|
||||
0x95, 0x02, // Report Count (2)
|
||||
0x81, 0x06, // Input (Data,Var,Rel)
|
||||
|
||||
/*
|
||||
// Vertical Wheel
|
||||
// - Multiplier (2 bits)
|
||||
0xa1, 0x02, // Collection (Logical)
|
||||
|
@ -377,6 +378,7 @@ static uint8_t mouse_report_desc[] = {
|
|||
0x81, 0x06, // Input (Data,Var,Rel)
|
||||
0xc0, // End Collection - Horizontal Wheel
|
||||
|
||||
*/
|
||||
0xc0, // End Collection - Buttons
|
||||
0xc0, // End Collection - Mouse Logical
|
||||
0xc0 // End Collection - Mouse Application
|
||||
|
|
|
@ -171,18 +171,18 @@ void usb_mouse_send()
|
|||
transmit_previous_timeout = 0;
|
||||
|
||||
// Prepare USB Mouse Packet
|
||||
// TODO Document each byte
|
||||
// TODO Dynamically generate this code based on KLL requirements
|
||||
*(tx_packet->buf + 0) = USBMouse_Buttons;
|
||||
*(tx_packet->buf + 1) = 0;
|
||||
*(tx_packet->buf + 2) = 0;
|
||||
*(tx_packet->buf + 3) = 0;
|
||||
*(tx_packet->buf + 4) = 0;
|
||||
tx_packet->len = 5;
|
||||
uint16_t *packet_data = (uint16_t*)(&tx_packet->buf[0]);
|
||||
packet_data[0] = USBMouse_Buttons;
|
||||
packet_data[1] = USBMouse_Relative_x;
|
||||
packet_data[2] = USBMouse_Relative_y;
|
||||
tx_packet->len = 6;
|
||||
usb_tx( MOUSE_ENDPOINT, tx_packet );
|
||||
|
||||
// Clear status and state
|
||||
USBMouse_Buttons = 0;
|
||||
USBMouse_Relative_x = 0;
|
||||
USBMouse_Relative_y = 0;
|
||||
USBMouse_Changed = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue