Low-level timer driver
More...
|
| int | timer_prime (int channel, uint32_t speed, int interrupts) |
| | Pre-initialize a timer channel, but do not start it.
|
| |
| int | timer_start (int channel) |
| | Start a timer channel.
|
| |
| int | timer_stop (int channel) |
| | Stop a timer channel.
|
| |
| int | timer_running (int channel) |
| | Checks whether a timer channel is running.
|
| |
| uint32_t | timer_count (int channel) |
| | Obtain the count of a timer channel.
|
| |
| int | timer_clear (int channel) |
| | Clear the underflow bit of a timer channel.
|
| |
| void | timer_enable_ints (int channel) |
| | Enable high-priority timer interrupts.
|
| |
| void | timer_disable_ints (int channel) |
| | Disable timer interrupts.
|
| |
| int | timer_ints_enabled (int channel) |
| | Check whether interrupts are enabled on a timer channel.
|
| |
Low-level timer driver
This API provides a low-level driver abstraction around the TMU peripheral and the control, counter, and reload registers of its 3 channels.
- Note
- You typically want to use the higher-level APIs associated with the functionality implemented by each timer channel.
◆ timer_clear()
| int timer_clear |
( |
int | channel | ) |
|
Clear the underflow bit of a timer channel.
This function clears the underflow bit of a timer channel if it was set.
- Parameters
-
| channel | The timer channel to clear (Channels). |
- Return values
-
| 0 | If the underflow bit was clear (prior to calling). |
| 1 | If the underflow bit was set (prior to calling). |
◆ timer_count()
| uint32_t timer_count |
( |
int | channel | ) |
|
Obtain the count of a timer channel.
This function simply returns the count of the timer channel.
- Parameters
-
| channel | The timer channel to inspect (Channels). |
- Returns
- The timer's count.
◆ timer_disable_ints()
| void timer_disable_ints |
( |
int | channel | ) |
|
Disable timer interrupts.
This function disables interrupts on the specified timer channel.
- Parameters
-
| channel | The timer channel to disable interrupts on (Channels). |
◆ timer_enable_ints()
| void timer_enable_ints |
( |
int | channel | ) |
|
Enable high-priority timer interrupts.
This function enables interrupts on the specified timer.
- Parameters
-
| channel | The timer channel to enable interrupts on (Channels). |
◆ timer_ints_enabled()
| int timer_ints_enabled |
( |
int | channel | ) |
|
Check whether interrupts are enabled on a timer channel.
This function checks whether or not interrupts are enabled on the specified timer channel.
- Parameters
-
| channel | The timer channel to inspect (Channels). |
- Return values
-
| 0 | If interrupts are disabled on the timer. |
| 1 | If interrupts are enabled on the timer. |
◆ timer_prime()
| int timer_prime |
( |
int | channel, |
|
|
uint32_t | speed, |
|
|
int | interrupts ) |
Pre-initialize a timer channel, but do not start it.
This function sets up a timer channel for use, but does not start it.
- Parameters
-
| channel | The timer channel to set up (Channels). |
| speed | The number of ticks per second. |
| interrupts | Set to 1 to receive interrupts when the timer ticks. |
- Return values
-
◆ timer_running()
| int timer_running |
( |
int | channel | ) |
|
Checks whether a timer channel is running.
This function checks whether the given timer channel is actively counting.
- Parameters
-
| channel | The timer channel to check (Channels). |
- Return values
-
| 0 | The timer channel is stopped. |
| 1 | The timer channel is running. |
◆ timer_start()
| int timer_start |
( |
int | channel | ) |
|
Start a timer channel.
This function starts a timer channel that has been initialized with timer_prime(), starting raising interrupts if applicable.
- Parameters
-
| channel | The timer channel to start (Channels). |
- Return values
-
◆ timer_stop()
| int timer_stop |
( |
int | channel | ) |
|
Stop a timer channel.
This function stops a timer channel that was started with timer_start(), and as a result stops interrupts coming in from the timer.
- Parameters
-
| channel | The timer channel to stop (Channels). |
- Return values
-