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

Wireless mouse / trackpad emulator using nRF52

Hi all,

We have implemented the wireless mouse example on some custom hardware and it works great. We need to do something a little different however, and send absolute cursor positions to a Windows PC.

Despite my searches, I haven't found any information that might help with this. I feel like we should be implementing something else, like a digitizer or a touchscreen. A synaptics trackpad is basically what we are reading, but we want to pass the data via BLE.

Can anyone suggest a method of doing this (absolute cursor positioning over BLE)? I'm trying to stay away from custom Windows drivers if possible, and all the better if we can 'hack' the wireless mouse app to do what we want. If nothing else, if you have any possible links, they would be much appreciated!

Thanks....

  • Hi,

    Unfortunately, we do not have any examples showing this behavior straight out-of-the-box. You can use the ble_app_hids_mouse example to perform this. You will have to change the behavior of the application, and parts of the USB descriptor in order to send absolute coordinates.

    The changes done in the X/Y pointer descriptor is fairly straight forward. There is a input field in the descriptor stating if the data is absolute or relative.

        // Report ID 2: Mouse motion
        0x85, 0x02,       //     Report Id 2
        0x09, 0x01,       //     Usage (Pointer)
        0xA1, 0x00,       //     Collection (Physical)
        0x75, 0x0C,       //         Report Size (12)
        0x95, 0x02,       //         Report Count (2)
        0x05, 0x01,       //         Usage Page (Generic Desktop)
        0x09, 0x30,       //             Usage (X)
        0x09, 0x31,       //             Usage (Y)
        0x16, 0x01, 0xF8, //             Logical maximum (2047)
        0x26, 0xFF, 0x07, //             Logical minimum (-2047)
        0x81, 0x06,       //             Input (Data, Variable, Relative)
        0xC0,             //     End Collection (Physical)
        0xC0,             // End Collection (Application)
    

    If you change the "Input" to state absolute on REPORT_ID 2, and you can send X/Y movement (from -2048 to 2047):

          0x81, 0x02,       //             Input (Data, Variable, Absolute)
    

    Cheers, Håkon

  • Thanks Hakon. I swear i tried that last week, but it didn't work. Retrying it now after clearing all remnants of the BLE device info on the PC and the behavior is as you describe. Thank you!

Related