Changing ble_app_hids_mouse for trackpad application

Hello guys. I'm helping a customer to work with a trackpad application using the nRF52840 and the nRF5_SDK_17.0.2_d674dde.

For this customer, she wants to use Microchip's touchpad solution (like https://www.microchip.com/en-us/solutions/machine-learning/smart-human-machine-interface)

and add nRF for BLE HID. Since the rep_map_data[] already has the mouse buttons, scroll/pan, mouse motion, advanced buttons (play pause volume down up etc),

I thought I simply need to call mouse_movement_send() - ble_hids_inp_rep_send(INPUT_REP_MOVEMENT_INDEX, INPUT_REP_MOVEMENT_LEN), using the trackpad as the parameter input.

First, for trackpads, do I need to change the rep_map_data[] or can I use it as it is?

We want to create a simple trackpad, like a mouse with volume control gestures, no keys/keyboard.

I was wondering whether a trackpad like this needs additional report map data during the initialization in hids_init().

Next, is it true that DIS - PnP characteristic is mandatory for wireless trackpad/mouse/keyboard applications?

Also, regarding DIS PnP,

PNP_ID_VENDOR_ID_SOURCE = 0x02 /**< Vendor ID Source. */
PNP_ID_VENDOR_ID = 0x1915 /**< Vendor ID. */

am I allowed to use these DIS PNP vendor ID values for this nRF product?

I'm slightly confused with this Nordic thread here  nRF52840 - USB Vendor ID and USB Product ID 

so I was wondering whether I have to register my own vendor ID.

 

Lastly, I want to check how to send a volume key. Is it ble_hids_inp_rep_send(INPUT_REP_MPLAYER_INDEX, INPUT_REP_MEDIA_PLAYER_LEN) ?

I read that I have to send a "mask" value to stop increasing or decreasing the volume so I need your help how to do this properly.

Thank you so much for your help!

REFERENCEs

https://www.bluetooth.com/specifications/specs/hid-over-gatt-profile-1-0/

https://www.usb.org/sites/default/files/hid1_11.pdf

  • Thank you Edvin. Then back to my last original question

    I want to check how to send a volume key in the mouse example.

    Is it

    uint8_t media_buffer[INPUT_REP_MEDIA_PLAYER_LEN] = {0xEA} // from rep_map_data[] Volume Down ?

    ble_hids_inp_rep_send(&m_hids, INPUT_REP_MPLAYER_INDEX, INPUT_REP_MEDIA_PLAYER_LEN,

    media_buffer, m_conn_handle) ?

    I wasn't sure what value should I send for Volume Down.

  • What I tried to say is that these are more generic USB questions than Nordic related questions. 

    Perhaps you want to have a look at the Zephyr sample found in NCS\zephyr\samples\subsys\usb\hid-cnc

    Look in the main.c file, in the function ascii_to_hid, and you will see the enum from NCS\zephyr\include\zephyr\usb\class\hid.h.

    This is an enum (that should have been used in our samples as well). It doesn't cover volume control, but you can look in usb_audio.h.

    Perhaps something like this is what you are looking for:

    https://usb.org/sites/default/files/hut1_3_0.pdf

    Scroll down to page 91, and search for "volume". 

    Best regards,

    Edvin

  • Hi Edvin. Luckily, I found a old nRF51 example sending volume up/down

    https://github.com/Rallare/nrf51_ble_app_hids_kbd_consumercontrol/blob/eb9253685fe097f9b0c88212bb51c5e5ff3f7e08/main.c#L220

    consumer_control_send(CONSUMER_CTRL_VOL_UP)

    consumer_control_send(RELEASE_KEY) // not pressed

    where the ENUM (consumer_control_t) was following the usage order from the report_map_data[]:

    0x09, 0xCD,                     //     Usage (Play/Pause) = CONSUMER_CTRL_PLAY 0x01

    0x0A, 0x83, 0x01,               //     Usage (AL Consumer Control Configuration) = CONSUMER_CTRL_ALCCC 0x02

    0x09, 0xB5,                     //     Usage (Scan Next Track) = CONSUMER_CTRL_SCAN_NEXT_TRACK 0x04

    0x09, 0xB6,                     //     Usage (Scan Previous Track) = CONSUMER_CTRL_SCAN_PREV_TRACK 0x08

    0x09, 0xEA,                     //     Usage (Volume Down) = CONSUMER_CTRL_VOL_DW 0x10

    0x09, 0xE9,                     //     Usage (Volume Up) = CONSUMER_CTRL_VOL_UP 0x20

    0x0A, 0x25, 0x02,               //     Usage (AC Forward) = CONSUMER_CTRL_AC_FORWARD 0x40

    0x0A, 0x24, 0x02,               //     Usage (AC Back) = CONSUMER_CTRL_AC_BACK 0x80

    Now I understood so let's close this ticket. Thanks for the help!

Related