Skip to content

Commit d7b2dd4

Browse files
committedNov 23, 2015
dos2unixed the rest
1 parent 250af07 commit d7b2dd4

File tree

9 files changed

+208
-208
lines changed

9 files changed

+208
-208
lines changed
 

‎RCSwitch.h

+64-64
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
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
3838

3939

4040
// At least for the ATTiny X4/X5, receiving has to be disabled due to
4141
// missing libm depencies (udivmodhi4)
4242
#if defined( __AVR_ATtinyX5__ ) or defined ( __AVR_ATtinyX4__ )
4343
#define RCSwitchDisableReceiving
4444
#endif
45-
46-
// Number of maximum High/Low changes per packet.
45+
46+
// Number of maximum High/Low changes per packet.
4747
// We can handle up to (unsigned long) => 32 bit * 2 H/L changes per bit + 2 for sync
4848
#define RCSWITCH_MAX_CHANGES 67
4949

@@ -55,12 +55,12 @@
5555

5656
class RCSwitch {
5757

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);
6464
void switchOff(char* sGroup, int nSwitchNumber);
6565
void switchOn(char sFamily, int nGroup, int nDevice);
6666
void switchOff(char sFamily, int nGroup, int nDevice);
@@ -71,10 +71,10 @@ class RCSwitch {
7171

7272
void sendTriState(char* Code);
7373
void send(unsigned long Code, unsigned int length);
74-
void send(char* Code);
75-
74+
void send(char* Code);
75+
7676
#if not defined( RCSwitchDisableReceiving )
77-
void enableReceive(int interrupt);
77+
void enableReceive(int interrupt);
7878
void enableReceive();
7979
void disableReceive();
8080
bool available();
@@ -88,7 +88,7 @@ class RCSwitch {
8888
#endif
8989

9090
void enableTransmit(int nTransmitterPin);
91-
void disableTransmit();
91+
void disableTransmit();
9292
void setPulseLength(int nPulseLength);
9393
void setRepeatTransmit(int nRepeatTransmit);
9494
#if not defined( RCSwitchDisableReceiving )
@@ -99,18 +99,18 @@ class RCSwitch {
9999

100100
private:
101101
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+
114114
static char* dec2binWzerofill(unsigned long dec, unsigned int length);
115115
static char* dec2binWcharfill(unsigned long dec, unsigned int length, char fill);
116116

@@ -139,6 +139,6 @@ class RCSwitch {
139139
static unsigned int timings[RCSWITCH_MAX_CHANGES];
140140

141141

142-
};
143-
144-
#endif
142+
};
143+
144+
#endif

‎examples/ReceiveDemo_Advanced/ReceiveDemo_Advanced.pde

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ void loop() {
2121
output(mySwitch.getReceivedValue(), mySwitch.getReceivedBitlength(), mySwitch.getReceivedDelay(), mySwitch.getReceivedRawdata(),mySwitch.getReceivedProtocol());
2222
mySwitch.resetAvailable();
2323
}
24-
}
24+
}

‎examples/ReceiveDemo_Advanced/helperfunctions.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ static char * dec2binWzerofill(unsigned long Dec, unsigned int bitLength){
1717
bin[bitLength] = '\0';
1818

1919
return bin;
20-
}
20+
}

‎examples/ReceiveDemo_Advanced/output.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ static char* bin2tristate(char* bin) {
4949
returnValue[pos2] = '\0';
5050
return returnValue;
5151
}
52-
52+

‎examples/ReceiveDemo_Simple/ReceiveDemo_Simple.pde

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ void loop() {
3232

3333
mySwitch.resetAvailable();
3434
}
35-
}
35+
}

‎examples/TypeA_WithDIPSwitches/TypeA_WithDIPSwitches.pde

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ void loop() {
3737
// Wait another second
3838
delay(1000);
3939

40-
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
/*
2-
This is a minimal sketch without using the library at all but only works for
3-
the 10 pole dip switch sockets. It saves a lot of memory and thus might be
4-
very useful to use with ATTinys :)
5-
6-
http://code.google.com/p/rc-switch/
7-
*/
8-
9-
int RCLpin = 7;
10-
11-
void setup() {
12-
pinMode(RCLpin, OUTPUT);
13-
}
14-
15-
void loop() {
16-
RCLswitch(0b010001000001); // DIPs an Steckdose: 0100010000 An:01
17-
delay(2000);
18-
19-
RCLswitch(0b010001000010); // DIPs an Steckdose: 0100010000 Aus:10
20-
delay(2000);
21-
}
22-
23-
void RCLswitch(uint16_t code) {
24-
for (int nRepeat=0; nRepeat<6; nRepeat++) {
25-
for (int i=4; i<16; i++) {
26-
RCLtransmit(1,3);
27-
if (((code << (i-4)) & 2048) > 0) {
28-
RCLtransmit(1,3);
29-
} else {
30-
RCLtransmit(3,1);
31-
}
32-
}
33-
RCLtransmit(1,31);
34-
}
35-
}
36-
37-
void RCLtransmit(int nHighPulses, int nLowPulses) {
38-
digitalWrite(RCLpin, HIGH);
39-
delayMicroseconds( 350 * nHighPulses);
40-
digitalWrite(RCLpin, LOW);
41-
delayMicroseconds( 350 * nLowPulses);
42-
}
43-
1+
/*
2+
This is a minimal sketch without using the library at all but only works for
3+
the 10 pole dip switch sockets. It saves a lot of memory and thus might be
4+
very useful to use with ATTinys :)
5+
6+
http://code.google.com/p/rc-switch/
7+
*/
8+
9+
int RCLpin = 7;
10+
11+
void setup() {
12+
pinMode(RCLpin, OUTPUT);
13+
}
14+
15+
void loop() {
16+
RCLswitch(0b010001000001); // DIPs an Steckdose: 0100010000 An:01
17+
delay(2000);
18+
19+
RCLswitch(0b010001000010); // DIPs an Steckdose: 0100010000 Aus:10
20+
delay(2000);
21+
}
22+
23+
void RCLswitch(uint16_t code) {
24+
for (int nRepeat=0; nRepeat<6; nRepeat++) {
25+
for (int i=4; i<16; i++) {
26+
RCLtransmit(1,3);
27+
if (((code << (i-4)) & 2048) > 0) {
28+
RCLtransmit(1,3);
29+
} else {
30+
RCLtransmit(3,1);
31+
}
32+
}
33+
RCLtransmit(1,31);
34+
}
35+
}
36+
37+
void RCLtransmit(int nHighPulses, int nLowPulses) {
38+
digitalWrite(RCLpin, HIGH);
39+
delayMicroseconds( 350 * nHighPulses);
40+
digitalWrite(RCLpin, LOW);
41+
delayMicroseconds( 350 * nLowPulses);
42+
}
43+
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
/*
2-
Example for Intertechno outlets
3-
4-
http://code.google.com/p/rc-switch/
5-
*/
6-
7-
#include <RCSwitch.h>
8-
9-
RCSwitch mySwitch = RCSwitch();
10-
11-
void setup() {
12-
13-
// Transmitter is connected to Arduino Pin #10
14-
mySwitch.enableTransmit(10);
15-
16-
// Optional set pulse length.
17-
// mySwitch.setPulseLength(320);
18-
19-
}
20-
21-
void loop() {
22-
23-
// Switch on:
24-
// The first parameter represents the familycode (a, b, c, ... f)
25-
// The second parameter represents the group number
26-
// The third parameter represents the device number
27-
//
28-
// In this example it's family 'b', group #3, device #2
29-
mySwitch.switchOn('b', 3, 2);
30-
31-
// Wait a second
32-
delay(1000);
33-
34-
// Switch off
35-
mySwitch.switchOff('b', 3, 2);
36-
37-
// Wait another second
38-
delay(1000);
39-
1+
/*
2+
Example for Intertechno outlets
3+
4+
http://code.google.com/p/rc-switch/
5+
*/
6+
7+
#include <RCSwitch.h>
8+
9+
RCSwitch mySwitch = RCSwitch();
10+
11+
void setup() {
12+
13+
// Transmitter is connected to Arduino Pin #10
14+
mySwitch.enableTransmit(10);
15+
16+
// Optional set pulse length.
17+
// mySwitch.setPulseLength(320);
18+
19+
}
20+
21+
void loop() {
22+
23+
// Switch on:
24+
// The first parameter represents the familycode (a, b, c, ... f)
25+
// The second parameter represents the group number
26+
// The third parameter represents the device number
27+
//
28+
// In this example it's family 'b', group #3, device #2
29+
mySwitch.switchOn('b', 3, 2);
30+
31+
// Wait a second
32+
delay(1000);
33+
34+
// Switch off
35+
mySwitch.switchOff('b', 3, 2);
36+
37+
// Wait another second
38+
delay(1000);
39+
4040
}

‎keywords.txt

+57-57
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
1-
#######################################
2-
# Syntax Coloring Map For RCSwitch
3-
#######################################
4-
5-
#######################################
6-
# Datatypes (KEYWORD1)
7-
#######################################
8-
9-
RCSwitch KEYWORD1
10-
11-
#######################################
12-
# Methods and Functions (KEYWORD2)
13-
#######################################
14-
15-
##########
16-
#SENDS Begin
17-
##########
18-
switchOn KEYWORD2
19-
switchOff KEYWORD2
20-
sendTriState KEYWORD2
21-
send KEYWORD2
22-
##########
23-
#SENDS End
24-
##########
25-
26-
##########
27-
#RECEIVE Begin
28-
##########
29-
enableReceive KEYWORD2
30-
disableReceive KEYWORD2
31-
available KEYWORD2
32-
resetAvailable KEYWORD2
33-
setReceiveTolerance KEYWORD2
34-
getReceivedValue KEYWORD2
35-
getReceivedBitlength KEYWORD2
36-
getReceivedDelay KEYWORD2
37-
getReceivedProtocol KEYWORD2
38-
getReceivedRawdata KEYWORD2
39-
##########
40-
#RECEIVE End
41-
##########
42-
43-
##########
44-
#OTHERS Begin
45-
##########
46-
enableTransmit KEYWORD2
47-
disableTransmit KEYWORD2
48-
setPulseLength KEYWORD2
49-
setProtocol KEYWORD2
50-
setRepeatTransmit KEYWORD2
51-
##########
52-
#OTHERS End
53-
##########
54-
55-
#######################################
56-
# Constants (LITERAL1)
57-
#######################################
1+
#######################################
2+
# Syntax Coloring Map For RCSwitch
3+
#######################################
4+
5+
#######################################
6+
# Datatypes (KEYWORD1)
7+
#######################################
8+
9+
RCSwitch KEYWORD1
10+
11+
#######################################
12+
# Methods and Functions (KEYWORD2)
13+
#######################################
14+
15+
##########
16+
#SENDS Begin
17+
##########
18+
switchOn KEYWORD2
19+
switchOff KEYWORD2
20+
sendTriState KEYWORD2
21+
send KEYWORD2
22+
##########
23+
#SENDS End
24+
##########
25+
26+
##########
27+
#RECEIVE Begin
28+
##########
29+
enableReceive KEYWORD2
30+
disableReceive KEYWORD2
31+
available KEYWORD2
32+
resetAvailable KEYWORD2
33+
setReceiveTolerance KEYWORD2
34+
getReceivedValue KEYWORD2
35+
getReceivedBitlength KEYWORD2
36+
getReceivedDelay KEYWORD2
37+
getReceivedProtocol KEYWORD2
38+
getReceivedRawdata KEYWORD2
39+
##########
40+
#RECEIVE End
41+
##########
42+
43+
##########
44+
#OTHERS Begin
45+
##########
46+
enableTransmit KEYWORD2
47+
disableTransmit KEYWORD2
48+
setPulseLength KEYWORD2
49+
setProtocol KEYWORD2
50+
setRepeatTransmit KEYWORD2
51+
##########
52+
#OTHERS End
53+
##########
54+
55+
#######################################
56+
# Constants (LITERAL1)
57+
#######################################

0 commit comments

Comments
 (0)
Please sign in to comment.