-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRF433.h
More file actions
94 lines (72 loc) · 2.14 KB
/
RF433.h
File metadata and controls
94 lines (72 loc) · 2.14 KB
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
94
/*
Rf433 - Arduino libary to transmit arbitrary RF433 signals
Copyright (c) 2018 François Terrier. All right reserved.
Contributors:
- François Terrier / fterrier(at)gmail(dot)com
Project home: https://github.com/fterrier/dwarf433
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef RF433_h
#define RF433_h
#define RF433_DEBUG 0
#include <Arduino.h>
class Encoding {
public:
Encoding();
void setZero(int o1, int t1, int o2, int t2);
void setOne(int o1, int t1, int o2, int t2);
int* getTimingsZero();
int* getOrderZero();
int* getTimingsOne();
int* getOrderOne();
private:
int zero[2];
int zseq[2];
int one[2];
int oseq[2];
};
class Wave {
public:
Wave();
Wave(String command);
Wave(unsigned long command, int len);
void sendWave(int pin, Encoding& encoding);
String toString();
private:
int len;
unsigned long command;
};
class Signal {
public:
Signal();
~Signal();
void setPulse(Wave wave);
void setPulse(Wave wave1, int delay, Wave wave2);
void setPulse(Wave waves[], int delays[], int numWaves);
void setEncoding(Encoding encoding);
void setRepeatIntervals(int intervals[], int numIntervals);
void sendSignal(int pin);
private:
struct Pulse {
int len;
Wave *seqs;
int *delays;
};
void sendPulse(int pin, Pulse& pulse);
void keepDelay(int sync);
int len;
Pulse pulse;
Encoding encoding;
int *delays;
};
#endif