diff options
author | cnlohr <lohr85@gmail.com> | 2016-12-20 23:39:58 -0500 |
---|---|---|
committer | cnlohr <lohr85@gmail.com> | 2016-12-20 23:39:58 -0500 |
commit | 2bce90b5a5095c2327bbbba1d0cc4fdb38426ce0 (patch) | |
tree | a3a955f85472f8888e2837eff821e2dc1f2219e8 /src/disambiguator.h | |
parent | 0fb1ec7b12f5c0dbe8e82d7d029e900751fc6c6a (diff) | |
parent | 170219fe413602508b31c39df23c8938adc6c35f (diff) | |
download | libsurvive-2bce90b5a5095c2327bbbba1d0cc4fdb38426ce0.tar.gz libsurvive-2bce90b5a5095c2327bbbba1d0cc4fdb38426ce0.tar.bz2 |
Merge branch 'jpicht-disambiguate'
Diffstat (limited to 'src/disambiguator.h')
-rw-r--r-- | src/disambiguator.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/disambiguator.h b/src/disambiguator.h new file mode 100644 index 0000000..0db19de --- /dev/null +++ b/src/disambiguator.h @@ -0,0 +1,38 @@ +// (C) 2016 Julian Picht, MIT/x11 License. +// +//All MIT/x11 Licensed Code in this file may be relicensed freely under the GPL or LGPL licenses. +#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; + +struct disambiguator { + long times[DIS_NUM_VALUES]; + int scores[DIS_NUM_VALUES]; + dis_state state; + long last; + int max_confidence; + char code; +}; + +struct classified_pulse_ { + pulse_type t; + int length; +}; + +void disambiguator_init( struct disambiguator * d); +pulse_type disambiguator_step( struct disambiguator * d, long time, int length); + +#endif /* DISAMBIGUATOR_H */ |