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.

Related