]>
Commit | Line | Data |
---|---|---|
1 | #ifndef SENDS_H | |
2 | #define SENDS_H | |
3 | ||
4 | #include "pico/cyw43_arch.h" | |
5 | #include "pico/util/pheap.h" | |
6 | ||
7 | typedef struct { | |
8 | uint32_t timestamp; | |
9 | u16_t seq; | |
10 | u8_t send_count; | |
11 | } press_t; | |
12 | ||
13 | typedef struct { | |
14 | press_t *presses; | |
15 | pheap_t *sleeps_heap; | |
16 | } press_pile_t; | |
17 | ||
18 | press_pile_t *create_press_pile(); | |
19 | ||
20 | /* Adds this press to the pile. | |
21 | * Copies the contents of `press`. */ | |
22 | void add_press(press_pile_t *pp, press_t *press); | |
23 | ||
24 | /* When do we next need to send something (in seconds since boot)? | |
25 | * Returns -1 if there's nothing pending. */ | |
26 | int32_t next_scheduled_send(press_pile_t *pp); | |
27 | ||
28 | #endif |