Hello Everyone,
When i use malloc function in on_ble_event function ble advertising get stuck and not working
below is my implement code:
static void on_ble_evt(ble_evt_t * p_ble_evt) { uint32_t err_code; struct Addnode *rssi_node; int8_t strengthnew_signal = 0; bool new_addr = 0; bool f_match = 0; rssi_node = head;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
APP_ERROR_CHECK(err_code);
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
break;
case BLE_GAP_EVT_DISCONNECTED:
err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
err_code = bsp_indication_set(BSP_INDICATE_ALERT_OFF);
APP_ERROR_CHECK(err_code);
break;
case BLE_GAP_EVT_ADV_REPORT:
{
// Advertising data received
const ble_gap_evt_adv_report_t *p_adv = &p_ble_evt->evt.gap_evt.params.adv_report;
// create node for every new ble address
new_node=(struct node *)malloc(sizeof(struct node)); ---> this will stop the bluetooth (I think its get stuck to initialize heap memory)
}
break;
Any help will be appreciate.