-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRFtrx.h
executable file
·93 lines (61 loc) · 1.95 KB
/
RFtrx.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* RFTRX library v1.0 for Arduino
*
* This library receives and sends RF,IR signals. No protocol decoding is done here.
*
* Copyright 2015 by Arco van Geest <arco@appeltaart.mine.nu>
*
* The purpose of this library is to send and recieve data in manchester or spacelength to support all sort of domotic signals.
*
* 20150107 Initial version
* 20151007 join functions with channel selector
*
* License: GPLv3. See license.txt
*/
#ifndef _RFTRX_h
#define _RFTRX_h
#include <Arduino.h>
#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#ifndef RADIOCOUNT
#define RADIOCOUNT 1
#endif
// buffer can contain max 128 changes/pulse lengths
//#define RX_SIZE 128
#define RX_SIZE 400
class RFtrx {
public:
RFtrx();
void initInterrupt(int vector,int channel);
void enableReceive(int channel);
void disableReceive(int channel);
static void receiveInterrupt(int channel) ;
static void receiveInterruptChannel0();
static void receiveInterruptChannel1();
static void receiveInterruptChannel2();
static void receiveInterruptA();
bool dataready(int channel ) ;
long getNext(int channel) ;
int dataCount(int channel);
void setMinStartLength( unsigned long length );
void setMaxStartLength( unsigned long length );
void setMinPeriodLength( unsigned long length );
void setMaxPeriodLength( unsigned long length );
private:
static bool activedata[RADIOCOUNT];
static bool glitch[RADIOCOUNT];
static unsigned long volatile rxbuffer[RADIOCOUNT][ RX_SIZE +4 ];
static unsigned int rxhead[RADIOCOUNT];
static unsigned int rxtail[RADIOCOUNT];
static unsigned int rxenable[RADIOCOUNT];
static unsigned long minStartLength;
static unsigned long maxStartLength;
static unsigned long minPeriodLength;
static unsigned long maxPeriodLength;
//static unsigned long currentTime;
static unsigned long lastTime[ RADIOCOUNT ];
//static unsigned long lastTime2;
//static unsigned long lastTime3;
};
#endif