rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
sense_map_link.h
Go to the documentation of this file.
1
49
50#pragma once
51
52#include <stdbool.h>
53#include <stdint.h>
54
55#include "link_pages.h"
56#include "sense_link.h"
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
63#define SENSE_MAP_LINK_SETTLE_MS SENSE_LINK_SETTLE_MS
67#define SENSE_MAP_LINK_READ_MS 500u
69#define SENSE_MAP_LINK_EVENT_GAP_MS SENSE_LINK_EVENT_GAP_MS
70
71#define SENSE_MAP_LINK_ACK SENSE_LINK_ACK
72#define SENSE_MAP_LINK_NO_ANSWER SENSE_LINK_NO_ANSWER
73
75enum {
87};
88
108
110typedef struct {
111 uint16_t regs[LINK_SM_KEPT];
112 uint8_t dark;
114 uint8_t i228_addr;
119 bool nobus;
121
131
135typedef struct {
137 bool write;
138 uint8_t page;
139 uint8_t off, n;
140 const uint16_t *regs;
142
146typedef struct {
147 bool up;
148 bool page;
149 bool known;
150
151 bool want_set;
152 uint16_t want[LINK_SM_KEPT];
153 uint8_t dark;
154 uint8_t clash;
155 uint8_t fitted;
156 bool nobus;
157 uint32_t want_ms;
158
159 uint16_t held[LINK_SM_KEPT];
160 bool refused;
161 bool reread;
162 bool forced;
164 uint32_t setup_ms;
165
167 bool asked;
168 uint32_t asked_ms;
170 uint16_t ids[LINK_SM_PARTS];
171 uint16_t wrong_id[LINK_SM_PARTS];
172 uint16_t flags;
173 uint16_t was_flags;
174
175 bool silent_told[LINK_SM_PARTS];
176 bool online_seen[LINK_SM_PARTS];
177 uint8_t ev_parts[4];
178 uint8_t events;
179 bool told;
180 uint32_t told_ms;
182
189
196
205void sense_map_link_came_up(sense_map_link_t *s, uint16_t minor,
206 uint32_t now_ms);
207
216 uint32_t now_ms);
217
230bool sense_map_link_next(sense_map_link_t *s, uint32_t now_ms, bool idle,
232
243void sense_map_link_done(sense_map_link_t *s, int result,
244 const uint16_t *regs, uint32_t now_ms);
245
254
266uint16_t sense_map_link_mirror_dmohm(const sense_map_link_t *s, unsigned ch);
267
281 const sense_link_t *sl);
282
293
305
316
332uint8_t sense_map_link_event(sense_map_link_t *s, uint32_t now_ms,
333 uint8_t *part, uint16_t *id);
334
345bool sense_map_link_event_stands(const sense_map_link_t *s, uint8_t ev,
346 uint8_t part);
347
360 uint8_t part);
361
377 const sense_link_t *sl, unsigned a,
378 unsigned mirror, uint32_t now_ms);
379
392 const sense_link_t *sl, unsigned mirror,
393 uint32_t now_ms);
394
396#define SENS_PART_OF(word, a) ((sens_part_t)(((word) >> (4u * (a))) & 0x0Fu))
397
398#ifdef __cplusplus
399}
400#endif
#define s
Short name for esc_stick_s inside the five stick-class files.
Definition esc_stick_panel_int.h:295
The map SENSORS asks for (settings_sensors_map()).
Definition sense_map_link.h:110
uint8_t dark
Definition sense_map_link.h:112
bool nobus
The sensor bus's SDA or SCL is unset: no part is enabled, as SENSE enables no monitor then.
Definition sense_map_link.h:119
uint16_t regs[LINK_SM_KEPT]
Definition sense_map_link.h:111
uint8_t i228_addr
The INA228's address while it is on, 0 while it is off.
Definition sense_map_link.h:114