mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_blufi_init_crash_c3_v4.3' into 'release/v4.3'
Blufi [Nimble] Add fix to crash while running blufi on ESP32C3 (v4.3) See merge request espressif/esp-idf!15219
This commit is contained in:
commit
1c1572ed51
@ -13,3 +13,4 @@ int blufi_security_init(void);
|
||||
void blufi_security_deinit(void);
|
||||
int esp_blufi_gap_register_callback(void);
|
||||
esp_err_t esp_blufi_host_init(void);
|
||||
esp_err_t esp_blufi_host_and_cb_init(esp_blufi_callbacks_t *callbacks);
|
||||
|
@ -385,23 +385,11 @@ void app_main(void)
|
||||
return;
|
||||
}
|
||||
|
||||
ret = esp_blufi_host_init();
|
||||
ret = esp_blufi_host_and_cb_init(&example_callbacks);
|
||||
if (ret) {
|
||||
BLUFI_ERROR("%s initialise host failed: %s\n", __func__, esp_err_to_name(ret));
|
||||
BLUFI_ERROR("%s initialise failed: %s\n", __func__, esp_err_to_name(ret));
|
||||
return;
|
||||
}
|
||||
|
||||
BLUFI_INFO("BLUFI VERSION %04x\n", esp_blufi_get_version());
|
||||
|
||||
ret = esp_blufi_register_callbacks(&example_callbacks);
|
||||
if(ret){
|
||||
BLUFI_ERROR("%s blufi register failed, error code = %x\n", __func__, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = esp_blufi_gap_register_callback();
|
||||
if(ret){
|
||||
BLUFI_ERROR("%s gap register failed, error code = %x\n", __func__, ret);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
#include "esp_blufi_api.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_blufi.h"
|
||||
#include "blufi_example.h"
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#include "esp_bt.h"
|
||||
#include "esp_bt_main.h"
|
||||
#include "blufi_example.h"
|
||||
#include "esp_bt_device.h"
|
||||
#endif
|
||||
|
||||
@ -42,15 +42,40 @@ esp_err_t esp_blufi_host_init(void)
|
||||
|
||||
}
|
||||
|
||||
int esp_blufi_gap_register_callback(void)
|
||||
esp_err_t esp_blufi_gap_register_callback(void)
|
||||
{
|
||||
int rc;
|
||||
rc = esp_ble_gap_register_callback(esp_blufi_gap_event_handler);
|
||||
if(rc){
|
||||
return rc;
|
||||
}
|
||||
esp_blufi_profile_init();
|
||||
return 0;
|
||||
return esp_blufi_profile_init();
|
||||
}
|
||||
|
||||
esp_err_t esp_blufi_host_and_cb_init(esp_blufi_callbacks_t *example_callbacks)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
ret = esp_blufi_host_init();
|
||||
if (ret) {
|
||||
BLUFI_ERROR("%s initialise host failed: %s\n", __func__, esp_err_to_name(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = esp_blufi_register_callbacks(example_callbacks);
|
||||
if(ret){
|
||||
BLUFI_ERROR("%s blufi register failed, error code = %x\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = esp_blufi_gap_register_callback();
|
||||
if(ret){
|
||||
BLUFI_ERROR("%s gap register failed, error code = %x\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_BLUEDROID_ENABLED */
|
||||
@ -115,14 +140,42 @@ esp_err_t esp_blufi_host_init(void)
|
||||
/* XXX Need to have template for store */
|
||||
ble_store_config_init();
|
||||
|
||||
nimble_port_freertos_init(bleprph_host_task);
|
||||
esp_blufi_btc_init();
|
||||
|
||||
nimble_port_freertos_init(bleprph_host_task);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
int esp_blufi_gap_register_callback(void)
|
||||
esp_err_t esp_blufi_gap_register_callback(void)
|
||||
{
|
||||
return 0;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_blufi_host_and_cb_init(esp_blufi_callbacks_t *example_callbacks)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
ret = esp_blufi_register_callbacks(example_callbacks);
|
||||
if(ret){
|
||||
BLUFI_ERROR("%s blufi register failed, error code = %x\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = esp_blufi_gap_register_callback();
|
||||
if(ret){
|
||||
BLUFI_ERROR("%s gap register failed, error code = %x\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = esp_blufi_host_init();
|
||||
if (ret) {
|
||||
BLUFI_ERROR("%s initialise host failed: %s\n", __func__, esp_err_to_name(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#endif /* CONFIG_BT_NIMBLE_ENABLED */
|
||||
|
Loading…
Reference in New Issue
Block a user