forked from baycom/tfrec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tfa2.h
45 lines (40 loc) · 818 Bytes
/
tfa2.h
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
36
37
38
39
40
41
42
43
44
45
#ifndef _INCLUDE_TFA2H
#define _INCLUDE_TFA2H
#include <string>
#include "dsp_stuff.h"
#include "decoder.h"
#include "crc8.h"
using std::string;
class tfa2_decoder: public decoder
{
public:
tfa2_decoder(sensor_e type=TFA_2);
void store_bit(int bit);
void flush(int rssi,int offset=0);
private:
void flush_tfa(int rssi,int offset=0);
void flush_tx22(int rssi,int offset=0);
int invert;
uint32_t sr;
int sr_cnt;
int snum;
crc8 *crc;
};
class tfa2_demod: public demodulator {
public:
tfa2_demod(decoder *_dec, double spb, double iir_fac=0.5);
void reset(void);
int demod(int thresh, int pwr, int index, int16_t *iq);
private:
double spb;
int bitcnt;
int dmin,dmax;
int offset;
int timeout_cnt;
int last_i, last_q;
int last_bit;
int rssi;
iir2 *iir;
double est_spb;
};
#endif