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

what can I do ,if I want to send left or right button data with ble_hids_inp_rep_send()

I what to send button data , how to construct button data array : uint8_t buffer[INPUT_REP_BUTTONS_LEN]; in function ble_hids_inp_rep_send() ?

In SDK mouse demo I can see that, if I want to send mouse move data I can do like this :

    APP_ERROR_CHECK_BOOL(INPUT_REP_MOVEMENT_LEN == 3);
    
    x_delta = MIN(x_delta, 0x0fff);
    y_delta = MIN(y_delta, 0x0fff);

    buffer[0] = x_delta & 0x00ff;
    buffer[1] = ((y_delta & 0x000f) << 4) | ((x_delta & 0x0f00) >> 8);
    buffer[2] = (y_delta & 0x0ff0) >> 4;
    
    err_code = ble_hids_inp_rep_send(&m_hids,
                                     INPUT_REP_MOVEMENT_INDEX, 
                                     INPUT_REP_MOVEMENT_LEN, 
                                     buffer);

but I don't know why buffer[] construct like this and how can I construct it in button data array.

  • I think there's a mismatch between the comment and the actual value: 0x95, 0x05, // Report Count (3) The actual value is 5, and the comment is wrong. This means that there's 5 bits for buttons, not just 3.

    The report size will stay the same until you redefine it. If you go back in the descriptor and find the last time Report Size was written, that value is still valid for the AC Pan. If you want a different size, you need to insert another Report Size.

  • I think there's a mismatch between the comment and the actual value: 0x95, 0x05, // Report Count (3) The actual value is 5, and the comment is wrong. This means that there's 5 bits for buttons, not just 3.

    The report size will stay the same until you redefine it. If you go back in the descriptor and find the last time Report Size was written, that value is still valid for the AC Pan. If you want a different size, you need to insert another Report Size.

Related