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

Loopback test in hid keyboard example

Hi,

How do I-

1. Start a timer when sending data from nrf to host (PC) in form of input report.

2. When the application running on host machine receives this data, send some data to nrf in the form of output report.

3. When nrf received this data, stop the timer.

How do I implement such a timer for a loopback test? How do I connect it with ble_hids_outp_rep_get() and ble_hids_inp_rep_send()?

Parents
  • Hi,

    HID devices are typically managed by the OS, so not sure how easy it is to control this.

    1. My suggestion is to call the following on peripheral to start:

    m_ticks_cnt   = app_timer_cnt_get(); // when the application call keys_send().

    2. Then you can on the host (PC) toggle Caps Lock to indicate that the keys are received.

    3. Then on the peripheral you can call the following when Caps Lock is turned ON or OFF (see on_hid_rep_char_write()):

    loopback_time = app_timer_cnt_diff_compute(app_timer_cnt_get(), m_ticks_cnt);

    Best regards,
    Kenneth

Reply
  • Hi,

    HID devices are typically managed by the OS, so not sure how easy it is to control this.

    1. My suggestion is to call the following on peripheral to start:

    m_ticks_cnt   = app_timer_cnt_get(); // when the application call keys_send().

    2. Then you can on the host (PC) toggle Caps Lock to indicate that the keys are received.

    3. Then on the peripheral you can call the following when Caps Lock is turned ON or OFF (see on_hid_rep_char_write()):

    loopback_time = app_timer_cnt_diff_compute(app_timer_cnt_get(), m_ticks_cnt);

    Best regards,
    Kenneth

Children
No Data
Related