-
Notifications
You must be signed in to change notification settings - Fork 231
TIMER module
This module contains functions for accessing the hardware timers, and include delays in your programs.
The delay functions introduces a delay in the program for a specified period of time. The delay is executed in the current thread, and no context switch is done, at least until the next context switch scheduled by Lua RTOS.
Waits for the specified seconds, then returns.
Arguments:
- seconds: number of seconds to wait.
Returns: nothing, or an exception.
Waits for the specified milliseconds, then returns.
Arguments:
- milliseconds: number of milliseconds to wait.
Returns: nothing, or an exception.
Waits for the specified microseconds, then returns.
Arguments:
- microseconds: number of microseconds to wait.
Returns: nothing, or an exception.
The sleep functions suspend the program's execution for a specified period of time by suspending the current thread.
Sleeps for the specified seconds, then returns.
Arguments:
- seconds: number of seconds to sleep.
Returns: nothing, or an exception.
Sleeps for the specified milliseconds, then returns.
Arguments:
- milliseconds: number of milliseconds to sleep.
Returns: nothing, or an exception.
Sleeps for the specified microseconds, then returns.
Arguments:
- microseconds: number of microseconds to sleep.
Returns: nothing, or an exception.
Attach a hardware timer with a certain period, and calling a callback when the period expires. The timer is reloaded automatically after calling the callback.
Arguments:
- id: the timer id. Can be either tmr.TMR0, tmr.TMR1, tmr.TMR2, or tmr.TMR3.
- period: the timer's period in microseconds.
- callback: the call back function to call when the timer expires.
Returns: the timer instance, or an exception.