aboutsummaryrefslogtreecommitdiff
path: root/include/disambiguator.h
blob: 58bce48d33f840d0c82e87d92913938d0a24b6ad (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
#ifndef DISAMBIGUATOR_H
#define DISAMBIGUATOR_H

#define DIS_NUM_VALUES 8

typedef enum {
	D_STATE_INVALID = 0,
	D_STATE_LOCKED = 1,
	D_STATE_UNLOCKED = -1,
} dis_state;

typedef enum {
	P_UNKNOWN = 0,
	P_SYNC = 1,
	P_SWEEP = 2,
} pulse_type;

typedef struct disambiguator_ {
	long times[DIS_NUM_VALUES];
	int scores[DIS_NUM_VALUES];
	dis_state state;
	long last;
	int max_confidence;
	char code;
} disambiguator;

typedef struct classified_pulse_ {
	pulse_type t;
	int length;
} classified_pulse;

void disambiguator_init(disambiguator * d);
pulse_type disambiguator_step(disambiguator * d, long time, int length);

#endif /* DISAMBIGUATOR_H */