rcbench
Servo and ESC test bench: panel, IOmcu and shared C
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
33extern "C" {
34#endif
35
36typedef struct {
37 char text[UI_ALERT_MAX];
38 bool pending;
39 uint32_t posted;
40 uint32_t taken;
41 uint32_t withdrawn;
43
46uint32_t ui_alert_slot_post(ui_alert_slot_t *s, const char *text);
47
49void ui_alert_slot_withdraw(ui_alert_slot_t *s, uint32_t number);
50
53bool ui_alert_slot_take(ui_alert_slot_t *s, char *out, size_t size);
54
56typedef struct {
57 uint32_t slot;
58 uint32_t band;
60
68bool 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
#define s
Short name for esc_stick_s inside the five stick-class files.
Definition esc_stick_panel_int.h:295
Definition ui_alert_slot.h:56
uint32_t band
Definition ui_alert_slot.h:58
uint32_t slot
Definition ui_alert_slot.h:57
Definition ui_alert_slot.h:36
uint32_t posted
Definition ui_alert_slot.h:39
uint32_t withdrawn
Definition ui_alert_slot.h:41
bool pending
Definition ui_alert_slot.h:38
uint32_t taken
Definition ui_alert_slot.h:40
Screen router.
#define UI_ALERT_MAX
Definition ui_screen.h:321