Add esp_timer_is_active function for Nimble stack to use esp_timer instead of FreeRTOS timer

This commit is contained in:
Rahul Tank
2021-06-30 14:51:51 +05:30
parent c836cef1a5
commit f1adfaaced
5 changed files with 32 additions and 1 deletions

View File

@ -493,3 +493,9 @@ config BT_NIMBLE_MAX_PERIODIC_SYNCS
Set this option to set the upper limit for number of periodic sync
connections. This should be less than maximum connections allowed by
controller.
config BT_NIMBLE_USE_ESP_TIMER
bool "Enable Esp Timer for Nimble"
default y
help
Set this option to use Esp Timer which has higher priority timer instead of FreeRTOS timer

View File

@ -1374,4 +1374,12 @@
#define MYNEWT_VAL_NEWT_FEATURE_LOGCFG (1)
#endif
#ifndef MYNEWT_VAL_BLE_USE_ESP_TIMER
#ifdef CONFIG_BT_NIMBLE_USE_ESP_TIMER
#define MYNEWT_VAL_BLE_USE_ESP_TIMER (1)
#else
#define MYNEWT_VAL_BLE_USE_ESP_TIMER (0)
#endif
#endif
#endif

View File

@ -228,6 +228,18 @@ int64_t esp_timer_get_next_alarm(void);
*/
esp_err_t esp_timer_dump(FILE* stream);
/**
* @brief Returns status of a timer, active or not
*
* This function is used to identify if the timer is still active or not.
*
* @param timer timer handle created using esp_timer_create
* @return
* - 1 if timer is still active
* - 0 if timer is not active.
*/
bool esp_timer_is_active(esp_timer_handle_t timer);
#ifdef __cplusplus
}
#endif

View File

@ -530,3 +530,8 @@ uint32_t IRAM_ATTR esp_system_get_time_resolution(void)
return 1000;
}
#endif
bool esp_timer_is_active(esp_timer_handle_t timer)
{
return timer_armed(timer);
}