1 #ifndef INCLUDE_RTL_433_H_
2 #define INCLUDE_RTL_433_H_
12 #include "rtl_433_devices.h"
13 #include "bitbuffer.h"
23 #include "getopt/getopt.h"
29 #define DEFAULT_SAMPLE_RATE 250000
30 #define DEFAULT_FREQUENCY 433920000
31 #define DEFAULT_HOP_TIME (60*10)
32 #define DEFAULT_HOP_EVENTS 2
33 #define DEFAULT_ASYNC_BUF_NUMBER 32
34 #define DEFAULT_BUF_LENGTH (16 * 16384)
37 * Theoretical high level at I/Q saturation is 128x128 = 16384 (above is ripple)
38 * 0 = automatic adaptive level limit, else fixed level limit
39 * 8000 = previous fixed default
41 #define DEFAULT_LEVEL_LIMIT 0
43 #define MINIMAL_BUF_LENGTH 512
44 #define MAXIMAL_BUF_LENGTH (256 * 16384)
45 #define MAX_PROTOCOLS 77
46 #define SIGNAL_GRABBER_BUFFER (12 * DEFAULT_BUF_LENGTH)
48 /* Supported modulation types */
49 #define OOK_PULSE_MANCHESTER_ZEROBIT 3 // Manchester encoding. Hardcoded zerobit. Rising Edge = 0, Falling edge = 1
50 #define OOK_PULSE_PCM_RZ 4 // Pulse Code Modulation with Return-to-Zero encoding, Pulse = 0, No pulse = 1
51 #define OOK_PULSE_PPM_RAW 5 // Pulse Position Modulation. No startbit removal. Short gap = 0, Long = 1
52 #define OOK_PULSE_PWM_PRECISE 6 // Pulse Width Modulation with precise timing parameters
53 #define OOK_PULSE_PWM_RAW 7 // Pulse Width Modulation. Short pulses = 1, Long = 0
54 #define OOK_PULSE_PWM_TERNARY 8 // Pulse Width Modulation with three widths: Sync, 0, 1. Sync determined by argument
55 #define OOK_PULSE_CLOCK_BITS 9 // Level shift within the clock cycle.
56 #define OOK_PULSE_PWM_OSV1 10 // Pulse Width Modulation. Oregon Scientific v1
58 #define FSK_DEMOD_MIN_VAL 16 // Dummy. FSK demodulation must start at this value
59 #define FSK_PULSE_PCM 16 // FSK, Pulse Code Modulation
60 #define FSK_PULSE_PWM_RAW 17 // FSK, Pulse Width Modulation. Short pulses = 1, Long = 0
61 #define FSK_PULSE_MANCHESTER_ZEROBIT 18 // FSK, Manchester encoding
63 extern int debug_output;
64 extern float sample_file_pos;
66 struct protocol_state {
67 int (*callback)(bitbuffer_t *bitbuffer);
69 // Bits state (for old sample based decoders)
72 unsigned int modulation;
74 /* pwm limits (provided by driver in µs and converted to samples) */
79 unsigned long demod_arg;
82 void data_acquired_handler(data_t *data);
84 #endif /* INCLUDE_RTL_433_H_ */