rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Toggle main menu visibility
Loading...
Searching...
No Matches
ui_alert_slot.h
1
/*
2
* The control task's alert slot, and the band's record of the alert it
3
* took from it.
4
*
5
* The control task never calls the router (ui_screen.h): it posts an alert
6
* into a slot, and the render loop takes it into the band once a frame.
7
* The slot holds one alert; a later one replaces it. Every alert posted is
8
* numbered, so the control task can tell an alert shown from one replaced
9
* before a frame took it, and can take back one whose cause is over:
10
*
11
* - not yet taken: it is dropped and never shows;
12
* - taken, and still the last one taken: the slot records its number,
13
* and the render loop clears it from the band while the band still
14
* shows it (ui_router_withdraw_alert());
15
* - anything else -- an older alert, one replaced or already withdrawn --
16
* is left alone: the band shows no alert of the slot but the last one
17
* taken, so the record of that one is all a withdrawal needs.
18
*
19
* The slot has no lock of its own; the caller holds the one that guards
20
* the memory it lives in.
21
*
22
* SPDX-License-Identifier: MIT
23
*/
24
#pragma once
25
26
#include <stdbool.h>
27
#include <stddef.h>
28
#include <stdint.h>
29
30
#include "
ui_screen.h
"
31
32
#ifdef __cplusplus
33
extern
"C"
{
34
#endif
35
36
typedef
struct
{
37
char
text[
UI_ALERT_MAX
];
38
bool
pending
;
39
uint32_t
posted
;
40
uint32_t
taken
;
41
uint32_t
withdrawn
;
42
}
ui_alert_slot_t
;
43
46
uint32_t ui_alert_slot_post(
ui_alert_slot_t
*
s
,
const
char
*text);
47
49
void
ui_alert_slot_withdraw(
ui_alert_slot_t
*
s
, uint32_t number);
50
53
bool
ui_alert_slot_take(
ui_alert_slot_t
*
s
,
char
*out,
size_t
size);
54
56
typedef
struct
{
57
uint32_t
slot
;
58
uint32_t
band
;
59
}
ui_alert_band_t
;
60
68
bool
ui_alert_band_update(
ui_alert_band_t
*b,
const
char
*text,
69
uint32_t taken, uint32_t withdrawn);
70
71
#ifdef __cplusplus
72
}
73
#endif
s
#define s
Short name for esc_stick_s inside the five stick-class files.
Definition
esc_stick_panel_int.h:295
ui_alert_band_t
Definition
ui_alert_slot.h:56
ui_alert_band_t::band
uint32_t band
Definition
ui_alert_slot.h:58
ui_alert_band_t::slot
uint32_t slot
Definition
ui_alert_slot.h:57
ui_alert_slot_t
Definition
ui_alert_slot.h:36
ui_alert_slot_t::posted
uint32_t posted
Definition
ui_alert_slot.h:39
ui_alert_slot_t::withdrawn
uint32_t withdrawn
Definition
ui_alert_slot.h:41
ui_alert_slot_t::pending
bool pending
Definition
ui_alert_slot.h:38
ui_alert_slot_t::taken
uint32_t taken
Definition
ui_alert_slot.h:40
ui_screen.h
Screen router.
UI_ALERT_MAX
#define UI_ALERT_MAX
Definition
ui_screen.h:321
shared
ui
include
ui_alert_slot.h
Generated by
1.18.0