This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Joystick

Hi,

I'm trying to implement scroll buttons (not the up-down buttons) using buttons provided on the development board. The scroll buttons will scroll in left-right and up-down directions. The array used is as follows and I also know that absolute should be used for joystick. I'm not understanding how to implement send function. Please assist. Thanks.

0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
		0x09, 0x04,                    // USAGE (Joystick)
		0xa1, 0x01,                    // COLLECTION (Application)
		0x85, 0x01,                    //   REPORT_ID (1)
		0xa1, 0x02,                    //   COLLECTION (Logical)
		0x09, 0x32,                    //     USAGE (Z)
		0x09, 0x31,                    //     USAGE (Y)
		0x09, 0x30,                    //     USAGE (X)
		0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
		0x26, 0xff, 0x00,              //     LOGICAL_MAXIMUM (255)
		0x35, 0x00,                    //     PHYSICAL_MINIMUM (0)
		0x46, 0xff, 0x00,              //     PHYSICAL_MAXIMUM (255)
		0x75, 0x08,                    //     REPORT_SIZE (8)
		0x95, 0x03,                    //     REPORT_COUNT (3)
		0x81, 0x02,                    //     INPUT (Data,Var,Abs)
		0xc0,                          //   END_COLLECTION
    
		0x85, 0x02,                    // REPORT_ID (2)
		
		0xa1, 0x02,                    //   COLLECTION (Logical)
		0x05, 0x09,                    //     USAGE_PAGE (Button)
		0x29, 0x02,                    //     USAGE_MAXIMUM (Button 2)
		0x19, 0x01,                    //     USAGE_MINIMUM (Button 1)
		0x95, 0x02,                    //     REPORT_COUNT (2)
		0x75, 0x01,                    //     REPORT_SIZE (1)
		0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
		0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
		0x81, 0x02,                    //     Input (Data, Variable, Absolute)
		0x95, 0x01,                    //     Report Count (1)
		0x75, 0x06,                    //     Report Size (6)
		0x81, 0x01,                    //     Input (Constant) for padding    
		0xc0,                          //   END_COLLECTION
		0xc0                           // END_COLLECTION

Parents
  • Hi Sonal

    If you have a look at this example it shows you how you can implement send functions for a HID descriptor with multiple report ID's:
    https://github.com/Rallare/nrf51_ble_app_hids_kbd_consumercontrol/blob/master/main.c

    You can implement scrolling like this:

            0x05, 0x01,                     //         Usage Page (Generic Desktop)

            0x09, 0x38,                     //             Usage (Wheel)

            0x15, 0x81,                     //             Logical Minimum (-127)

            0x25, 0x7F,                     //             Logical Maximum (127)

            0x81, 0x06,                     //             Input (Data, Variable, Relative)

    When implementing a mouse you would usually add this together with the mouse buttons. 

    I have looked through the HID Usage Table document, but can't seem to find any usage for vertical scroll unfortunately, only regular horisontal scroll. 

    Best regards
    Torbjørn

Reply
  • Hi Sonal

    If you have a look at this example it shows you how you can implement send functions for a HID descriptor with multiple report ID's:
    https://github.com/Rallare/nrf51_ble_app_hids_kbd_consumercontrol/blob/master/main.c

    You can implement scrolling like this:

            0x05, 0x01,                     //         Usage Page (Generic Desktop)

            0x09, 0x38,                     //             Usage (Wheel)

            0x15, 0x81,                     //             Logical Minimum (-127)

            0x25, 0x7F,                     //             Logical Maximum (127)

            0x81, 0x06,                     //             Input (Data, Variable, Relative)

    When implementing a mouse you would usually add this together with the mouse buttons. 

    I have looked through the HID Usage Table document, but can't seem to find any usage for vertical scroll unfortunately, only regular horisontal scroll. 

    Best regards
    Torbjørn

Children
Related