rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
endpoints_link.h
Go to the documentation of this file.
1
47
48#pragma once
49
50#include <stdatomic.h>
51#include <stdbool.h>
52#include <stdint.h>
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
59#define ENDPOINTS_SETTLE_MS 300u
60
72
90endpoints_next_t endpoints_next(bool owed, bool far_disarmed,
91 uint32_t edit_ms, uint32_t now_ms);
92
116
132
144bool endpoints_page_holds(const uint16_t *page, uint16_t min_us,
145 uint16_t max_us);
146
155
162typedef struct {
163 atomic_uint pair;
164 atomic_uint edit_ms;
165 atomic_bool owed;
172 bool hold;
177 uint8_t refused;
179
190void endpoints_publish(endpoints_debt_t *d, uint16_t min_us, uint16_t max_us,
191 uint32_t now_ms);
192
202
212bool endpoints_owed(const endpoints_debt_t *d);
213
223
235
243
252bool endpoints_held(const endpoints_debt_t *d);
253
260uint16_t endpoints_min(const endpoints_debt_t *d);
267uint16_t endpoints_max(const endpoints_debt_t *d);
268
288 uint32_t now_ms);
289
300
301#ifdef __cplusplus
302}
303#endif
The debt.
Definition endpoints_link.h:162
atomic_uint edit_ms
Definition endpoints_link.h:164
atomic_bool owed
Definition endpoints_link.h:165
atomic_uint pair
Definition endpoints_link.h:163
bool hold
Control task only: raised at a link-up edge, the far end is held disarmed until the debt is paid.
Definition endpoints_link.h:172
uint8_t refused
Control task only: what the last answered payment left, an endpoints_block_t in one byte.
Definition endpoints_link.h:177