High level interface for interacting with the Cypress LPTIMER.
This can be used to measure timing between events, or to perform some action the ability after a set interval. It continues to operate in some low power modes; see the device datasheet for details.
◆ cyhal_lptimer_event_callback_t
Handler for LPTIMER interrupts
◆ cyhal_lptimer_event_t
LPTIMER interrupt triggers
◆ cyhal_lptimer_init()
Initialize the LPTIMER
Initialize or re-initialize the LPTIMER. This resets all the clocking and prescaler registers, along with disabling the compare interrupt. Refer to the BSP for the clock source for the LPTIMER.
- Parameters
-
| [out] | obj | The LPTIMER object |
- Returns
- The status of the init request
◆ cyhal_lptimer_free()
Deinitialize the LPTIMER
Powers down the LPTIMER. After calling this function no other LPTIMER functions should be called except cyhal_lptimer_init(). Calling any function other than init after freeing is undefined.
- Parameters
-
| [in,out] | obj | The LPTIMER object |
◆ cyhal_lptimer_reload()
Reload/Reset the Low-Power timer.
- Parameters
-
| [in] | obj | The LPTIMER object |
- Returns
- The status of the reload request
◆ cyhal_lptimer_set_time()
Set timeframe between interrupts
Configures the LPTIMER in free-running mode. Generates an interrupt on match. This function is for initial configuration. For quick updates to the match value, use cyhal_lptimer_set_time().
- Parameters
-
| [in] | obj | The LPTIMER object |
| [in] | time | The time in ticks to be set |
- Returns
- The status of the set_time request
◆ cyhal_lptimer_set_match()
Update the match/compare value
Update the match value of an already configured LPTIMER set up to generate an interrupt on match. Note that this function does not reinitialize the counter or the associated peripheral initialization sequence.
- Parameters
-
| [in] | obj | The LPTIMER object |
| [in] | value | The match value in ticks |
- Returns
- The status of the set_match request
◆ cyhal_lptimer_read()
Read the current tick
If no rollover has occurred, the seconds passed since cyhal_lptimer_init() or cyhal_lptimer_set_time() was called can be found by dividing the ticks returned by this function by the frequency of the source clock (refer to the BSP for the clock source).
- Parameters
-
| [in] | obj | The LPTIMER object |
- Returns
- The timer's timer value in ticks
◆ cyhal_lptimer_register_callback()
The LPTIMER match event handler registration
- Parameters
-
| [in] | obj | The LPTIMER object |
| [in] | callback | The callback handler which will be invoked when the interrupt triggers |
| [in] | callback_arg | Generic argument that will be provided to the handler when called |
◆ cyhal_lptimer_enable_event()
Configure and Enable/Disable the LPTIMER events
- Parameters
-
| [in] | obj | The LPTIMER object |
| [in] | event | The LPTIMER event type |
| [in] | intrPriority | The priority for NVIC interrupt events |
| [in] | enable | True to turn on event, False to turn off |
◆ cyhal_lptimer_irq_trigger()
Manually trigger the LPTIMER interrupt.
- Parameters
-
| [in] | obj | The LPTIMER object |