1
- /*
2
- RCSwitch - Arduino libary for remote control outlet switches
3
- Copyright (c) 2011 Suat Özgür. All right reserved.
4
-
5
- Contributors:
6
- - Andre Koehler / info(at)tomate-online(dot)de
7
- - Gordeev Andrey Vladimirovich / gordeev(at)openpyro(dot)com
8
- - Skineffect / http://forum.ardumote.com/viewtopic.php?f=2&t=46
9
- - Dominik Fischer / dom_fischer(at)web(dot)de
10
- - Frank Oltmanns / <first name>.<last name>(at)gmail(dot)com
11
-
12
- Project home: http://code.google.com/p/rc-switch/
13
-
14
- This library is free software; you can redistribute it and/or
15
- modify it under the terms of the GNU Lesser General Public
16
- License as published by the Free Software Foundation; either
17
- version 2.1 of the License, or (at your option) any later version.
18
-
19
- This library is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
- Lesser General Public License for more details.
23
-
24
- You should have received a copy of the GNU Lesser General Public
25
- License along with this library; if not, write to the Free Software
26
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
- */
28
- #ifndef _RCSwitch_h
29
- #define _RCSwitch_h
30
-
31
- #if defined(ARDUINO) && ARDUINO >= 100
32
- #include " Arduino.h"
33
- #elif defined(ENERGIA) // LaunchPad, FraunchPad and StellarPad specific
34
- #include " Energia.h"
35
- #else
36
- #include " WProgram.h"
37
- #endif
1
+ /*
2
+ RCSwitch - Arduino libary for remote control outlet switches
3
+ Copyright (c) 2011 Suat Özgür. All right reserved.
4
+
5
+ Contributors:
6
+ - Andre Koehler / info(at)tomate-online(dot)de
7
+ - Gordeev Andrey Vladimirovich / gordeev(at)openpyro(dot)com
8
+ - Skineffect / http://forum.ardumote.com/viewtopic.php?f=2&t=46
9
+ - Dominik Fischer / dom_fischer(at)web(dot)de
10
+ - Frank Oltmanns / <first name>.<last name>(at)gmail(dot)com
11
+
12
+ Project home: http://code.google.com/p/rc-switch/
13
+
14
+ This library is free software; you can redistribute it and/or
15
+ modify it under the terms of the GNU Lesser General Public
16
+ License as published by the Free Software Foundation; either
17
+ version 2.1 of the License, or (at your option) any later version.
18
+
19
+ This library is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
+ Lesser General Public License for more details.
23
+
24
+ You should have received a copy of the GNU Lesser General Public
25
+ License along with this library; if not, write to the Free Software
26
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
+ */
28
+ #ifndef _RCSwitch_h
29
+ #define _RCSwitch_h
30
+
31
+ #if defined(ARDUINO) && ARDUINO >= 100
32
+ #include " Arduino.h"
33
+ #elif defined(ENERGIA) // LaunchPad, FraunchPad and StellarPad specific
34
+ #include " Energia.h"
35
+ #else
36
+ #include " WProgram.h"
37
+ #endif
38
38
39
39
40
40
// At least for the ATTiny X4/X5, receiving has to be disabled due to
41
41
// missing libm depencies (udivmodhi4)
42
42
#if defined( __AVR_ATtinyX5__ ) or defined ( __AVR_ATtinyX4__ )
43
43
#define RCSwitchDisableReceiving
44
44
#endif
45
-
46
- // Number of maximum High/Low changes per packet.
45
+
46
+ // Number of maximum High/Low changes per packet.
47
47
// We can handle up to (unsigned long) => 32 bit * 2 H/L changes per bit + 2 for sync
48
48
#define RCSWITCH_MAX_CHANGES 67
49
49
55
55
56
56
class RCSwitch {
57
57
58
- public:
59
- RCSwitch ();
60
-
61
- void switchOn (int nGroupNumber, int nSwitchNumber);
62
- void switchOff (int nGroupNumber, int nSwitchNumber);
63
- void switchOn (char * sGroup , int nSwitchNumber);
58
+ public:
59
+ RCSwitch ();
60
+
61
+ void switchOn (int nGroupNumber, int nSwitchNumber);
62
+ void switchOff (int nGroupNumber, int nSwitchNumber);
63
+ void switchOn (char * sGroup , int nSwitchNumber);
64
64
void switchOff (char * sGroup , int nSwitchNumber);
65
65
void switchOn (char sFamily , int nGroup, int nDevice);
66
66
void switchOff (char sFamily , int nGroup, int nDevice);
@@ -71,10 +71,10 @@ class RCSwitch {
71
71
72
72
void sendTriState (char * Code);
73
73
void send (unsigned long Code, unsigned int length);
74
- void send (char * Code);
75
-
74
+ void send (char * Code);
75
+
76
76
#if not defined( RCSwitchDisableReceiving )
77
- void enableReceive (int interrupt);
77
+ void enableReceive (int interrupt);
78
78
void enableReceive ();
79
79
void disableReceive ();
80
80
bool available ();
@@ -88,7 +88,7 @@ class RCSwitch {
88
88
#endif
89
89
90
90
void enableTransmit (int nTransmitterPin);
91
- void disableTransmit ();
91
+ void disableTransmit ();
92
92
void setPulseLength (int nPulseLength);
93
93
void setRepeatTransmit (int nRepeatTransmit);
94
94
#if not defined( RCSwitchDisableReceiving )
@@ -99,18 +99,18 @@ class RCSwitch {
99
99
100
100
private:
101
101
char * getCodeWordB (int nGroupNumber, int nSwitchNumber, boolean bStatus);
102
- char * getCodeWordA (char * sGroup , int nSwitchNumber, boolean bStatus);
103
- char * getCodeWordA (char * sGroup , char * sDevice , boolean bStatus);
104
- char * getCodeWordC (char sFamily , int nGroup, int nDevice, boolean bStatus);
105
- char * getCodeWordD (char group, int nDevice, boolean bStatus);
106
- void sendT0 ();
107
- void sendT1 ();
108
- void sendTF ();
109
- void send0 ();
110
- void send1 ();
111
- void sendSync ();
112
- void transmit (int nHighPulses, int nLowPulses);
113
-
102
+ char * getCodeWordA (char * sGroup , int nSwitchNumber, boolean bStatus);
103
+ char * getCodeWordA (char * sGroup , char * sDevice , boolean bStatus);
104
+ char * getCodeWordC (char sFamily , int nGroup, int nDevice, boolean bStatus);
105
+ char * getCodeWordD (char group, int nDevice, boolean bStatus);
106
+ void sendT0 ();
107
+ void sendT1 ();
108
+ void sendTF ();
109
+ void send0 ();
110
+ void send1 ();
111
+ void sendSync ();
112
+ void transmit (int nHighPulses, int nLowPulses);
113
+
114
114
static char * dec2binWzerofill (unsigned long dec, unsigned int length);
115
115
static char * dec2binWcharfill (unsigned long dec, unsigned int length, char fill);
116
116
@@ -139,6 +139,6 @@ class RCSwitch {
139
139
static unsigned int timings[RCSWITCH_MAX_CHANGES];
140
140
141
141
142
- };
143
-
144
- #endif
142
+ };
143
+
144
+ #endif
0 commit comments