rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Toggle main menu visibility
Loading...
Searching...
No Matches
inj_line_id.h
Go to the documentation of this file.
1
27
28
#pragma once
29
30
#include <stdbool.h>
31
#include <stdint.h>
32
33
#ifdef __cplusplus
34
extern
"C"
{
35
#endif
36
37
#define INJ_LINE_GLITCH 2u
38
#define INJ_LINE_IDLE_NS 10000u
39
#define INJ_LINE_MIN_TX 20u
40
#define INJ_LINE_MIN_AGREE_PCT 95u
41
42
/* Bit 0 of a state is GP4, bit 1 GP5; 1 is high. */
43
#define INJ_LINE_GP4 0x1u
44
#define INJ_LINE_GP5 0x2u
45
47
typedef
struct
{
48
uint32_t at;
/* sample index */
49
uint8_t state;
50
}
inj_edge_t
;
51
52
typedef
enum
{
53
INJ_WIRING_NONE = 0,
/* no check run since reset */
54
INJ_WIRING_OK,
/* GP4 is SDA, GP5 is SCL */
55
INJ_WIRING_SWAPPED,
/* GP5 is SDA, GP4 is SCL */
56
INJ_WIRING_IDLE,
/* both lines high, no traffic */
57
INJ_WIRING_LOW,
/* a line low for the whole window */
58
INJ_WIRING_NOISE,
/* edges, but no verdict */
59
} inj_wiring_t;
60
61
typedef
struct
{
62
inj_wiring_t verdict;
63
uint32_t tx;
/* transactions seen whole */
64
uint32_t agree_pct;
/* majority share of the named, % */
65
uint32_t edges4;
/* level changes on GP4, after glitches */
66
uint32_t edges5;
67
uint8_t end_state;
/* the lines at the end of the window */
68
uint32_t rate_ksps;
/* sample rate, ksample/s (as given) */
69
uint32_t named;
/* transactions that name a line */
70
}
inj_line_result_t
;
71
77
void
inj_line_classify
(uint8_t first,
const
inj_edge_t
*edges, uint32_t n,
78
uint32_t samples, uint32_t rate_ksps,
79
inj_line_result_t
*out);
80
82
const
char
*
inj_wiring_name
(inj_wiring_t v);
83
84
#ifdef __cplusplus
85
}
86
#endif
inj_line_classify
void inj_line_classify(uint8_t first, const inj_edge_t *edges, uint32_t n, uint32_t samples, uint32_t rate_ksps, inj_line_result_t *out)
Definition
inj_line_id.c:106
inj_wiring_name
const char * inj_wiring_name(inj_wiring_t v)
Definition
inj_line_id.c:185
inj_edge_t
Definition
inj_line_id.h:47
inj_line_result_t
Definition
inj_line_id.h:61
testbench
touch-injector
core
include
inj_line_id.h
Generated by
1.18.0