2021-06-30 18:39:29 +02:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
2022-10-11 16:31:57 +02:00
|
|
|
*
|
2021-06-30 18:39:29 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2023-03-20 12:17:36 +01:00
|
|
|
#include "bsd/string.h"
|
2021-06-30 18:39:29 +02:00
|
|
|
|
2023-04-14 15:57:12 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2021-06-30 18:39:29 +02:00
|
|
|
typedef struct esp_timer *esp_timer_handle_t;
|
|
|
|
|
|
|
|
typedef void (*esp_timer_cb_t)(void *arg);
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
ESP_TIMER_TASK,
|
|
|
|
} esp_timer_dispatch_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
esp_timer_cb_t callback; //!< Function to call when timer expires
|
|
|
|
void *arg; //!< Argument to pass to the callback
|
|
|
|
esp_timer_dispatch_t dispatch_method; //!< Call the callback from task or from ISR
|
|
|
|
const char *name; //!< Timer name, used in esp_timer_dump function
|
|
|
|
bool skip_unhandled_events; //!< Skip unhandled events for periodic timers
|
|
|
|
} esp_timer_create_args_t;
|
|
|
|
|
|
|
|
esp_err_t esp_timer_create(const esp_timer_create_args_t *create_args,
|
|
|
|
esp_timer_handle_t *out_handle);
|
|
|
|
esp_err_t esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period);
|
|
|
|
|
|
|
|
esp_err_t esp_timer_stop(esp_timer_handle_t timer);
|
|
|
|
|
|
|
|
esp_err_t esp_timer_delete(esp_timer_handle_t timer);
|
2023-04-04 12:57:38 +02:00
|
|
|
|
|
|
|
int64_t esp_timer_get_time(void);
|
2023-04-14 15:57:12 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|