Function start_with_idle_hook

Source
pub fn start_with_idle_hook(
    timer: impl TimerSource,
    idle_hook: extern "C" fn() -> !,
)
Expand description

Starts the scheduler, with a custom idle hook.

The current context will be converted into the main task, and will be pinned to the first core.

The idle hook will be called when no tasks are ready to run. The idle hook’s context is not preserved. If you need to execute a longer process to enter a low-power state, make sure to call the relevant code in a critical section.

The timer argument is a timer source that is used by the scheduler to schedule internal tasks. The timer source can be any of the following:

  • A timg Timer instance
  • A systimer Alarm instance
  • An AnyTimer instance
  • A OneShotTimer instance

For an example, see the crate-level documentation.