v2.0.0
timeout_helper.h
1/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _PICO_TIMEOUT_HELPER_H
8#define _PICO_TIMEOUT_HELPER_H
9
10#include "pico/time.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16 typedef struct timeout_state {
17 absolute_time_t next_timeout;
18 uint64_t param;
19} timeout_state_t;
20
21typedef bool (*check_timeout_fn)(timeout_state_t *ts, bool reset);
22
23check_timeout_fn init_single_timeout_until(timeout_state_t *ts, absolute_time_t target);
24check_timeout_fn init_per_iteration_timeout_us(timeout_state_t *ts, uint64_t per_iteration_timeout_us);
25
26#ifdef __cplusplus
27}
28#endif
29
30#endif
time.h
absolute_time_t
uint64_t absolute_time_t
An opaque 64 bit timestamp in microseconds.
Definition: types.h:43
timeout_state
Definition: timeout_helper.h:16