I try to get rssi , but it didnt work. I tried to control what is the problem? , I just want that ; if there is any change , My red led will blink and then I will controll my rssi parameters . Please help me , why it doesnt work ? I can use connected function . should ı use sd_ble_gap_rssi_get function ? Thanks
static void on_ble_evt(ble_evt_t * p_ble_evt){
uint32_t err_code;
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);
//sd_ble_gap_rssi_get(0x1A,&rssi); //changed for
//sd_ble_gap_rssi_get(0x10,&rssi); //connected for
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
sd_ble_gap_rssi_start(m_conn_handle,1,0);
NRF_UART0->ENABLE = 1;
NRF_UART0->TASKS_STARTTX = 1;
NRF_UART0->TASKS_STARTRX = 1;
pinOn(LED_B);
nrf_delay_ms(500);
pinOff(LED_B);
nrf_delay_ms(500);
nrf_delay_ms(400);
app_timer_start(will_close_timer, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
//vibra_init();
break;
switch ( p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_RSSI_CHANGED:
rssi = p_ble_evt->evt.gap_evt.params.rssi_changed.rssi;
pinOn(LED_R);
nrf_delay_ms(500);
pinOff(LED_R);
nrf_delay_ms(500);
pinOn(LED_R);
nrf_delay_ms(500);
pinOff(LED_R);
nrf_delay_ms(500);
pinOn(LED_R);
nrf_delay_ms(500);
pinOff(LED_R);
nrf_delay_ms(500);
pinOn(LED_R);
nrf_delay_ms(500);
pinOff(LED_R);
nrf_delay_ms(500);
break;
default:
break;
}
case BLE_GAP_EVT_DISCONNECTED:
err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
sd_ble_gap_rssi_stop(m_conn_handle);
m_conn_handle = BLE_CONN_HANDLE_INVALID;
NRF_UART0->TASKS_STOPTX = 1;
NRF_UART0->TASKS_STOPRX = 1;
NRF_UART0->ENABLE = 0;
pinOn(LED_G);
nrf_delay_ms(500);
pinOff(LED_G);
nrf_delay_ms(500);
//mpu6050_register_write(0x6B, 0x71);
break;