Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

callback_timer: expose callback_timer_data::is_active() as icallback_timer public method #919

Closed
ilya-a1 opened this issue Jul 10, 2024 · 1 comment
Assignees

Comments

@ilya-a1
Copy link

ilya-a1 commented Jul 10, 2024

Applications quite often need to check if a timer is active/running or is stopped.
It would be nice if icallback_timer can provide bool is_active( etl::timer::id::type id_ ) method for checking if a timer is active.
Since callback_timer_data struct already implements is_active, icallback_timer's implementation could simply be the following

bool is_active(etl::timer::id::type id_) const
{
  if (has_active)
  {
    // Valid timer id?
    if (id_ != etl::timer::id::NO_TIMER)
    {
      const etl::callback_timer_data& timer = timer_array[id_];

      // Registered timer?
      if (timer.id != etl::timer::id::NO_TIMER)
      {
        return timer.is_active();
      }
    }
  }
  return false;
}
@jwellbelove
Copy link
Contributor

Fixed 20.39.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants