#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "esp_err.h"
Go to the source code of this file.
◆ gptimer_handle_t
Opaque handle for a general-purpose timer.
◆ gptimer_alarm_cb_t
User callback invoked from the alarm ISR.
The return value is interpreted by ESP-IDF as "yield to a woken task"; the VSF shim always ignores it.
◆ gptimer_clock_source_t
Timer clock source.
The shim accepts every value for source compatibility but ignores the selection: VSF's vsf_timer_t does not expose per-peripheral clock muxing. Whichever source is wired up by the underlying hardware port is used.
| Enumerator |
|---|
| GPTIMER_CLK_SRC_DEFAULT | |
| GPTIMER_CLK_SRC_APB | |
| GPTIMER_CLK_SRC_XTAL | |
| GPTIMER_CLK_SRC_RC_FAST | |
| GPTIMER_CLK_SRC_PLL_F40M | |
| GPTIMER_CLK_SRC_PLL_F80M | |
◆ gptimer_count_direction_t
Count direction.
Only GPTIMER_COUNT_UP is supported by the VSF backend. Passing GPTIMER_COUNT_DOWN to gptimer_new_timer() yields ESP_ERR_NOT_SUPPORTED.
| Enumerator |
|---|
| GPTIMER_COUNT_DOWN | |
| GPTIMER_COUNT_UP | |
◆ gptimer_new_timer()
Allocate a new gptimer handle drawn from the injected VSF pool.
- Return values
-
| ESP_OK | success |
| ESP_ERR_INVALID_ARG | config / ret_timer is NULL, direction != UP |
| ESP_ERR_INVALID_STATE | shim not initialised or pool exhausted |
| ESP_ERR_NO_MEM | heap exhausted for handle metadata |
◆ gptimer_del_timer()
Release a gptimer handle, stopping the underlying timer first.
- Return values
-
| ESP_OK | success |
| ESP_ERR_INVALID_ARG | timer is NULL |
| ESP_ERR_INVALID_STATE | timer is still in the enabled state |
◆ gptimer_register_event_callbacks()
Register the alarm callback (and future per-event callbacks).
Must be called while the timer is in the disabled state – mirroring the ESP-IDF contract that forbids hot-patching callbacks.
◆ gptimer_set_alarm_action()
Configure the alarm action applied at the next alarm event.
Passing config == NULL disables alarm generation. Otherwise the shim programs the underlying vsf_timer so that an overflow IRQ fires every alarm_count ticks; reload_count is honoured only when the implemented backend exposes a way to pre-load the counter (currently: only auto_reload_on_alarm is supported by mapping to a continuous timer, other combinations fall back to continuous semantics too).
◆ gptimer_enable()
Transition the timer into the "enabled" state.
The counter is not yet running; call gptimer_start() to start counting.
◆ gptimer_disable()
Transition the timer out of the "enabled" state.
◆ gptimer_start()
Start the counter. The timer must already be enabled.
◆ gptimer_stop()
Stop the counter. The counter value is retained.
◆ gptimer_set_raw_count()
Set the raw counter value.
- Return values
-
| ESP_ERR_NOT_SUPPORTED | the VSF backend does not expose this |
◆ gptimer_get_raw_count()
Read the raw counter value.
- Return values
-
| ESP_ERR_NOT_SUPPORTED | the VSF backend does not expose this |
◆ gptimer_get_resolution()
Query the actual resolution chosen by the underlying hardware.
May differ from the requested resolution_hz when the clock divider is discrete. The shim returns the value programmed by the backend when available, otherwise the originally requested value.
◆ gptimer_get_captured_count()
Return the number of alarms that have fired since enable.
- Return values
-
| ESP_ERR_NOT_SUPPORTED | the VSF backend does not track this |