ble_app_hids_keyboard: why send_key_scan_press_release has to loop?

Hi guys. May I ask one firmware code question for ble_app_hids_keyboard_pca10056_s113 project from 17.1.0 nRF5 SDK:

static uint8_t m_caps_on_key_scan_str[] = /**< Key pattern to be sent when the output report has been written with the CAPS LOCK bit set. */
{
    0x06,       /* Key C */
    0x04,       /* Key a */
    0x13,       /* Key p */
    0x16,       /* Key s */
    0x12,       /* Key o */
    0x11,       /* Key n */
};

keys_send(sizeof(m_caps_on_key_scan_str), m_caps_on_key_scan_str);
// this calls send_key_scan_press_release()

static uint32_t send_key_scan_press_release(){
do{
ble_hids_inp_rep_send(); // Send  C a p s o n
}while (offset <= data_len);
}
}

When sending "C a p s o n", this uses a DO-WHILE LOOP. The data becomes:

1. 00 00 06 04 13 16 12 11

2. 00 00 00 04 13 16 12 11

3. 00 00 00 00 13 16 12 11

4. 00 00 00 00 00 16 12 11

5. 00 00 00 00 00 00 12 11

6. 00 00 00 00 00 00 00 11

7. 00 00 00 00 00 00 00 00

As explained in the INFO center https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/ble_sdk_app_hids_keyboard.html

May I ask why this DO-WHILE loop is needed? Can't we send these two data instead:

1. 00 00 06 04 13 16 12 11

7. 00 00 00 00 00 00 00 00

Skipping the DO-WHILE step 2 to 6? Thank you so much for your help!

Related