• Create a new timer.

    Parameters

    • timeout: number

      Positive timeout in milliseconds. If timeout is 0, the timer is "put on hold", use Libertas_TimerUpdate later to reschedule the timer.

    • func: LibertasTimerCallback

      Callback function.

    • Optional tag: any

      Developer defined tag value to be passed over to the callback function.

      Optional

    Returns LibertasTimer

    A new timer object.

    Remarks

    Timer is always one-off. When timeout is reached, the callback is called, the timer is then automatically cancelled as if Libertas_TimerCancel is called.

    Both active timer and cancelled timer can be reused by calling Libertas_TimerUpdate. Always try to reuse instead of creating new timers.

    Use timeout of 0 to initialize the timer to save from the "null check".

    Timer API is reactive API. Timers are driven by Libertas_WaitReactive. Never mix imperative and reactive API within same thread.

    See

Generated using TypeDoc