diff options
author | Josh Allen <axlecrusher@gmail.com> | 2017-02-13 16:00:19 -0500 |
---|---|---|
committer | Josh Allen <axlecrusher@gmail.com> | 2017-02-13 16:00:19 -0500 |
commit | 7fdfd9fff265d38ae002d8007a02f746f42fd3f2 (patch) | |
tree | 5fc7e797c66e6d3af40f8c2830c267b399be3765 /src/disambiguator.h | |
parent | 56a6bbc24962251d223536285aa407c7652c7c46 (diff) | |
parent | 6c99f7abf29463df723221dcaa8c3fe7c93c3371 (diff) | |
download | libsurvive-7fdfd9fff265d38ae002d8007a02f746f42fd3f2.tar.gz libsurvive-7fdfd9fff265d38ae002d8007a02f746f42fd3f2.tar.bz2 |
Merge branch 'master' of github.com:axlecrusher/libsurvive into ootx_decoder_context_cleanup
Diffstat (limited to 'src/disambiguator.h')
-rw-r--r-- | src/disambiguator.h | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/disambiguator.h b/src/disambiguator.h deleted file mode 100644 index 8258a18..0000000 --- a/src/disambiguator.h +++ /dev/null @@ -1,68 +0,0 @@ -// (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 - -// Determines the number of samples stored in the disambiguator struct. -// Has to be higher than the maximum number of pulses expected between sync pulses. -#define DIS_NUM_VALUES 48 -#define DIS_NUM_PULSES_BEFORE_LOCK 30 -#include <stdint.h> - -/** - * internal disambiguator state - */ -typedef enum { - D_STATE_INVALID = 0, - D_STATE_LOCKED = 1, - D_STATE_UNLOCKED = -1, -} dis_state; - -/** - * classification result - */ -typedef enum { - P_UNKNOWN = 0, - P_MASTER = 1, - P_SWEEP = 2, - P_SLAVE = 3, -} pulse_type; - -/** - * internal state of the disambiguator - */ -struct disambiguator { - // the timestamps of the recorded pulses - uint32_t times[DIS_NUM_VALUES]; - // countes how many sync pulses we have seen, that match the time offset at the same offset - uint16_t scores[DIS_NUM_VALUES]; - // current state - dis_state state; - // last sync pulse time - uint32_t last; - // the absolute maximum counter value - int max_confidence; - // the last code type seen - char code; -}; - - -/** - * Initialize a new disambiguator. calloc or memset with 0x00 will work just as well. - * - * @param d Pointer to the struct - */ -void disambiguator_init( struct disambiguator * d); - -/** - * Feed in one pulse to have if classified. - * - * @param d Pointer to disambiguator state - * @param time Rising edge of the pulse - * @param length Length of the pulse - * @return Classification result - */ -pulse_type disambiguator_step( struct disambiguator * d, uint32_t time, int length); - -#endif /* DISAMBIGUATOR_H */
\ No newline at end of file |