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

Nrf52832 resets after implementing Advanced buttons as HID device

     I added the corresponding function in ble_app_hids_mouse in the ble_app_template project, and added the function to send Advanced buttons, as shown in the following program, but each time I press the button to call the function mouse_media_key_send(MM_KEY_VOL_UP); Immediately after the function is reset, the DEBUG function has been turned on and no error message has been entered

    // This enum is mapped to "rep_map_data[]", Report ID 3.
// Please see the USB descriptor for detailed information.
typedef enum
{
MM_KEY_RELEASE = 0x00,
MM_KEY_PLAY_PAUSE = 0x01,
MM_KEY_AL_CCC = 0x02,
MM_KEY_SCAN_NEXT_TRACK = 0x04,
MM_KEY_SCAN_PREV_TRACK = 0x08,
MM_KEY_VOL_DOWN = 0x10,
MM_KEY_VOL_UP = 0x20,
MM_KEY_AC_FORWARD = 0x40,
MM_KEY_AC_BACK = 0x80,
} multimedia_keys_t;

void mouse_media_key_send(multimedia_keys_t mm_key)
{
uint32_t err_code;

if (m_in_boot_mode)
return;

err_code = ble_hids_inp_rep_send(&m_hids,
INPUT_REP_MPLAYER_INDEX,
INPUT_REP_MEDIA_PLAYER_LEN,
(uint8_t*)&mm_key);

if( (err_code != NRF_SUCCESS)
&&(err_code != NRF_ERROR_INVALID_STATE)
&&(err_code != NRF_ERROR_INVALID_STATE)
&&(err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING )
)
{
APP_ERROR_CHECK(err_code);
}

multimedia_keys_t mm_key_release = MM_KEY_RELEASE;
err_code = ble_hids_inp_rep_send(&m_hids,
INPUT_REP_MPLAYER_INDEX,
INPUT_REP_MEDIA_PLAYER_LEN,
(uint8_t*)&mm_key_release);

if( (err_code != NRF_SUCCESS)
&&(err_code != NRF_ERROR_INVALID_STATE)
&&(err_code != NRF_ERROR_INVALID_STATE)
&&(err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING )
)
{
APP_ERROR_CHECK(err_code);
}

}

Parents Reply Children
No Data
Related