mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-03 00:21:44 +01:00
gptimer: add API to get captured count value
This commit is contained in:
@@ -31,9 +31,9 @@ typedef struct {
|
||||
/**
|
||||
* @brief Timer alarm callback prototype
|
||||
*
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer()`
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer`
|
||||
* @param[in] edata Alarm event data, fed by driver
|
||||
* @param[in] user_ctx User data, passed from `gptimer_register_event_callbacks()`
|
||||
* @param[in] user_ctx User data, passed from `gptimer_register_event_callbacks`
|
||||
* @return Whether a high priority task has been waken up by this function
|
||||
*/
|
||||
typedef bool (*gptimer_alarm_cb_t) (gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, void *user_ctx);
|
||||
@@ -91,9 +91,9 @@ esp_err_t gptimer_new_timer(const gptimer_config_t *config, gptimer_handle_t *re
|
||||
* @brief Delete the GPTimer handle
|
||||
*
|
||||
* @note A timer can't be in the enable state when this function is invoked.
|
||||
* See also `gptimer_disable()` for how to disable a timer.
|
||||
* See also `gptimer_disable` for how to disable a timer.
|
||||
*
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer()`
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer`
|
||||
* @return
|
||||
* - ESP_OK: Delete GPTimer successfully
|
||||
* - ESP_ERR_INVALID_ARG: Delete GPTimer failed because of invalid argument
|
||||
@@ -109,7 +109,7 @@ esp_err_t gptimer_del_timer(gptimer_handle_t timer);
|
||||
* @note This function is allowed to run within ISR context
|
||||
* @note This function is allowed to be executed when Cache is disabled, by enabling `CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM`
|
||||
*
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer()`
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer`
|
||||
* @param[in] value Count value to be set
|
||||
* @return
|
||||
* - ESP_OK: Set GPTimer raw count value successfully
|
||||
@@ -121,11 +121,12 @@ esp_err_t gptimer_set_raw_count(gptimer_handle_t timer, uint64_t value);
|
||||
/**
|
||||
* @brief Get GPTimer raw count value
|
||||
*
|
||||
* @note This function will trigger a software capture event and then return the captured count value.
|
||||
* @note With the raw count value and the resolution set in the `gptimer_config_t`, you can convert the count value into seconds.
|
||||
* @note This function is allowed to run within ISR context
|
||||
* @note This function is allowed to be executed when Cache is disabled, by enabling `CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM`
|
||||
*
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer()`
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer`
|
||||
* @param[out] value Returned GPTimer count value
|
||||
* @return
|
||||
* - ESP_OK: Get GPTimer raw count value successfully
|
||||
@@ -141,7 +142,7 @@ esp_err_t gptimer_get_raw_count(gptimer_handle_t timer, uint64_t *value);
|
||||
* @note The first call to this function needs to be before the call to `gptimer_enable`
|
||||
* @note User can deregister a previously registered callback by calling this function and setting the callback member in the `cbs` structure to NULL.
|
||||
*
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer()`
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer`
|
||||
* @param[in] cbs Group of callback functions
|
||||
* @param[in] user_data User data, which will be passed to callback functions directly
|
||||
* @return
|
||||
@@ -158,7 +159,7 @@ esp_err_t gptimer_register_event_callbacks(gptimer_handle_t timer, const gptimer
|
||||
* @note This function is allowed to run within ISR context, so that user can set new alarm action immediately in the ISR callback.
|
||||
* @note This function is allowed to be executed when Cache is disabled, by enabling `CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM`
|
||||
*
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer()`
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer`
|
||||
* @param[in] config Alarm configuration, especially, set config to NULL means disabling the alarm function
|
||||
* @return
|
||||
* - ESP_OK: Set alarm action for GPTimer successfully
|
||||
@@ -171,11 +172,11 @@ esp_err_t gptimer_set_alarm_action(gptimer_handle_t timer, const gptimer_alarm_c
|
||||
* @brief Enable GPTimer
|
||||
*
|
||||
* @note This function will transit the timer state from init to enable.
|
||||
* @note This function will enable the interrupt service, if it's lazy installed in `gptimer_register_event_callbacks()`.
|
||||
* @note This function will enable the interrupt service, if it's lazy installed in `gptimer_register_event_callbacks`.
|
||||
* @note This function will acquire a PM lock, if a specific source clock (e.g. APB) is selected in the `gptimer_config_t`, while `CONFIG_PM_ENABLE` is enabled.
|
||||
* @note Enable a timer doesn't mean to start it. See also `gptimer_start()` for how to make the timer start counting.
|
||||
* @note Enable a timer doesn't mean to start it. See also `gptimer_start` for how to make the timer start counting.
|
||||
*
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer()`
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer`
|
||||
* @return
|
||||
* - ESP_OK: Enable GPTimer successfully
|
||||
* - ESP_ERR_INVALID_ARG: Enable GPTimer failed because of invalid argument
|
||||
@@ -187,10 +188,10 @@ esp_err_t gptimer_enable(gptimer_handle_t timer);
|
||||
/**
|
||||
* @brief Disable GPTimer
|
||||
*
|
||||
* @note This function will do the opposite work to the `gptimer_enable()`
|
||||
* @note Disable a timer doesn't mean to stop it. See also `gptimer_stop()` for how to make the timer stop counting.
|
||||
* @note This function will do the opposite work to the `gptimer_enable`
|
||||
* @note Disable a timer doesn't mean to stop it. See also `gptimer_stop` for how to make the timer stop counting.
|
||||
*
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer()`
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer`
|
||||
* @return
|
||||
* - ESP_OK: Disable GPTimer successfully
|
||||
* - ESP_ERR_INVALID_ARG: Disable GPTimer failed because of invalid argument
|
||||
@@ -202,11 +203,11 @@ esp_err_t gptimer_disable(gptimer_handle_t timer);
|
||||
/**
|
||||
* @brief Start GPTimer (internal counter starts counting)
|
||||
*
|
||||
* @note This function should be called when the timer is in the enable state (i.e. after calling `gptimer_enable()`)
|
||||
* @note This function should be called when the timer is in the enable state (i.e. after calling `gptimer_enable`)
|
||||
* @note This function is allowed to run within ISR context
|
||||
* @note This function will be placed into IRAM if `CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM` is on, so that it's allowed to be executed when Cache is disabled
|
||||
*
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer()`
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer`
|
||||
* @return
|
||||
* - ESP_OK: Start GPTimer successfully
|
||||
* - ESP_ERR_INVALID_ARG: Start GPTimer failed because of invalid argument
|
||||
@@ -218,11 +219,11 @@ esp_err_t gptimer_start(gptimer_handle_t timer);
|
||||
/**
|
||||
* @brief Stop GPTimer (internal counter stops counting)
|
||||
*
|
||||
* @note This function should be called when the timer is in the enable state (i.e. after calling `gptimer_enable()`)
|
||||
* @note This function should be called when the timer is in the enable state (i.e. after calling `gptimer_enable`)
|
||||
* @note This function is allowed to run within ISR context
|
||||
* @note This function will be placed into IRAM if `CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM` is on, so that it's allowed to be executed when Cache is disabled
|
||||
*
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer()`
|
||||
* @param[in] timer Timer handle created by `gptimer_new_timer`
|
||||
* @return
|
||||
* - ESP_OK: Stop GPTimer successfully
|
||||
* - ESP_ERR_INVALID_ARG: Stop GPTimer failed because of invalid argument
|
||||
|
||||
Reference in New Issue
Block a user