blob: 07b10934d0ec37ca612a9c2af591f56e668fe195 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/**
* Operator INI texts + sense tuning — defaults in FW, overlay from flash.
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef C1224_CONFIG_H
#define C1224_CONFIG_H
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#define C1224_TEXT_MAX 48
typedef struct {
char starting[C1224_TEXT_MAX];
char ready[C1224_TEXT_MAX];
char fault[C1224_TEXT_MAX];
char sending[C1224_TEXT_MAX];
char signal[C1224_TEXT_MAX];
char packet[C1224_TEXT_MAX];
char power[C1224_TEXT_MAX];
char idle[C1224_TEXT_MAX];
/* Terminal-facing identity (CDC ID) */
char callsign[C1224_TEXT_MAX];
char device_id[C1224_TEXT_MAX];
/* Extra CDC ASCII — quiet=1 default; never suppresses fixed boot banner */
bool quiet; /* true = no unsolicited STATUS/PROBE/CONFIG ASCII */
/* Sense tuning */
bool cdt_active_high; /* false = active-low (default pull-up idle) */
uint16_t packet_hold_ms;
uint16_t packet_edge_min;
uint16_t packet_window_ms;
} c1224_config_t;
void config_init(void);
const c1224_config_t *config_get(void);
c1224_config_t *config_mutable(void);
/** True when extra unsolicited CDC ASCII (STATUS/PROBE/CONFIG) is allowed. */
bool config_unsolicited_ok(void);
/** Apply defaults (RAM only). */
void config_load_defaults(void);
/** Load overlay from flash INI region if valid. */
bool config_load_flash(void);
/** Persist current config as INI text to flash. */
bool config_save_flash(void);
/** Erase flash overlay (next boot = defaults only until SAVE). */
bool config_erase_flash(void);
/** SET KEY=value (case-insensitive key). Returns false if unknown key. */
bool config_set_kv(const char *key, const char *value);
/** GET KEY → copy value into buf. */
bool config_get_kv(const char *key, char *buf, size_t buflen);
/** Dump INI-like text to USB (printf). */
void config_dump_ini(void);
#endif
|