Hi, 

I’m trying to find out a free time slot between Nimble scheduled events.

I try to go through  all items on the schedule queue  global variable 
“g_ble_ll_sched_q” to find out all the scheduled LL events near future, 
function as
/********************************************************************************/
uint32_t ll_eventq_free_time_from_now(void)
{
  struct ble_ll_sched_item *sch;
  uint32_t cpu_time_now;
  uint32_t time_free;
  uint32_t time_tmp;
        
  time_free = 1000000000;
  cpu_time_now = os_cputime_get32();

  /* Look through schedule queue */
  while ((sch = TAILQ_FIRST(&g_ble_ll_sched_q)) != NULL)
  {
    time_tmp = sch->start_time - cpu_time_now;
    if  (time_tmp < time_free)
    {
        time_free = time_tmp;
    }
  }     
        
  return (time_free);
}
/********************************************************************************/

Does above function make sense to find out the free time at any given time 
point? or any suggestion to find out the free time slot between LL events?


Thanks,

Jiacheng

Reply via email to