Skip to content

Commit 36c0226

Browse files
committed
Replaced #define DECODE_NEC 1/0 by defining/not defining, USE_SOFT_SEND_PWM is active by default
1 parent 6c7cfb2 commit 36c0226

File tree

24 files changed

+211
-130
lines changed

24 files changed

+211
-130
lines changed

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# IRremote Arduino Library
22
Available as Arduino library "IRremote"
33

4-
### [Version 3.0.2](https://github.com/z3t0/Arduino-IRremote/archive/master.zip) - work in progress
4+
### [Version 3.1.0](https://github.com/z3t0/Arduino-IRremote/archive/master.zip) - work in progress
55

66
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
77
[![Commits since latest](https://img.shields.io/github/commits-since/z3t0/Arduino-IRremote/latest)](https://github.com/z3t0/Arduino-IRremote/commits/master)
@@ -18,20 +18,29 @@ Click on the LibraryManager badge above to see the [instructions](https://www.ar
1818

1919
# Supported IR Protocols
2020
Denon, JVC, LG, NEC / Apple, Panasonic / Kaseikyo, RC5, RC6, Samsung, Sharp, Sony, (Pronto), BoseWave, Lego, Whynter, MagiQuest.<br/>
21-
Protocols can be switched off and on by changing the lines in *IRremote.h*:
21+
Protocols can be switched off and on by definining macros like [here]((https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/SimpleReceiver/SimpleReceiver.ino#L18):
2222

2323
```
24-
#define DECODE_<PROTOCOL_NAME> 1
25-
#define SEND_<PROTOCOL_NAME> 1
24+
#define DECODE_NEC
25+
//#define DECODE_DENON
26+
#incude <IRremote.h>
2627
```
28+
or by activating the lines in [IRremote.h]((https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremote.h#L54):
29+
30+
```
31+
#define DECODE_<PROTOCO_NAME>
32+
#define SEND_<PROTOCO_NAME>
33+
```
34+
35+
2736
# [Wiki](https://github.com/z3t0/Arduino-IRremote/wiki)
2837
This is a quite old but maybe useful wiki for this library.
2938

3039
# Converting your 2.x program to the 3.x version
3140
- Now there is an **IRreceiver** and **IRsender** object like the well known Arduino **Serial** object.
3241
- Just remove the line `IRrecv IrReceiver(IR_RECEIVE_PIN);` and/or `IRsend IrSender;` in your program, and replace all occurrences of `IRrecv.` or `irrecv.` with `IrReceiver`.
3342
- Since the decoded values are now in `IrReceiver.decodedIRData` and not in `results` any more, remove the line `decode_results results` or similar.
34-
- Like for the Serial object, call [`IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/IRreceiveDemo/IRreceiveDemo.ino#L38) or `IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK);` instead of the `IrReceiver.enableIRIn();` or `irrecv.enableIRIn();` in setup().
43+
- ike for the Serial object, call [`IrReceiver.begin(IR_RECEIVE_PIN, ENABE_ED_FEEDBACK);`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/IRreceiveDemo/IRreceiveDemo.ino#L38) or `IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK);` instead of the `IrReceiver.enableIRIn();` or `irrecv.enableIRIn();` in setup().
3544
- Old `decode(decode_results *aResults)` function is replaced by simple `decode()`. So if you have a statement `if(irrecv.decode(&results))` replace it with `if (IrReceiver.decode())`.
3645
- The decoded result is now in in `IrReceiver.decodedIRData` and not in `results` any more, therefore replace any occurrences of `results.value` and / or `results.decode_type` (and similar) to `IrReceiver.decodedIRData.decodedRawData` and / or `IrReceiver.decodedIRData.decodedRawData`.
3746
- Overflow, Repeat and other flags are now in [`IrReceiver.receivedIRData.flags`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremote.h#L126).
@@ -84,15 +93,13 @@ Modify it by commenting them out or in, or change the values if applicable. Or d
8493
| `USE_OLD_DECODE` | IRremoteInt.h | disabled | Enables the old decoder in order to be version 2.x compatible, where all protocols were MSB first. |
8594
| `EXCLUDE_EXOTIC_PROTOCOLS` | Before `#include <IRremote.h>` | disabled | If activated, BOSEWAVE, MAGIQUEST,WHYNTER and LEGO_PF are excluded in `decode()` and in sending with `IrSender.write()`. Saves up to 900 bytes program space. |
8695
| `MARK_EXCESS_MICROS` | Before `#include <IRremote.h>` | 20 | MARK_EXCESS_MICROS is subtracted from all marks and added to all spaces before decoding, to compensate for the signal forming of different IR receiver modules. |
96+
| `USE_NO_SEND_PWM` | Before `#include <IRremote.h>` | disabled | Use no carrier PWM, just simulate an active low receiver signal. |
97+
| `SEND_PWM_BY_TIMER` | Before `#include <IRremote.h>` | disabled | Disable carrier PWM generation in software and use (restricted) hardware PWM. |
8798
| `IR_INPUT_IS_ACTIVE_HIGH` | IRremoteInt.h | disabled | Enable it if you use a RF receiver, which has an active HIGH output signal. |
8899
| `DEBUG` | IRremoteInt.h | disabled | Enables lots of lovely debug output. |
89-
| `USE_NO_SEND_PWM` | IRremoteInt.h | disabled | Use no carrier PWM, just simulate an active low receiver signal. |
90-
| `USE_SOFT_SEND_PWM` | IRremoteInt.h | disabled | Use carrier PWM generation in software, instead of hardware PWM. |
91-
| `PULSE_CORRECTION_MICROS` | IRremoteInt.h | 3 | If USE_SOFT_SEND_PWM, this amount is subtracted from the on-time of the pulses. |
92100
| `RAW_BUFFER_LENGTH` | IRremoteint.h | 101 | Buffer size of raw input buffer. Must be odd! |
93101
| `IR_SEND_DUTY_CYCLE` | IRremoteBoardDefs.h | 30 | Duty cycle of IR send signal. |
94102
| `MICROS_PER_TICK` | IRremoteBoardDefs.h | 50 | Resolution of the raw input buffer data. |
95-
| `USE_CUSTOM_DELAY` | irSend.cpp | disabled | Use old custom_delay_usec() function for mark and space delays. |
96103
|-|-|-|-|
97104
| `IR_INPUT_PIN` | TinyIRReceiver.h | 2 | The pin number for TinyIRReceiver IR input, which gets compiled in. |
98105
| `IR_FEEDBACK_LED_PIN` | TinyIRReceiver.h | `LED_BUILTIN` | The pin number for TinyIRReceiver feedback LED, which gets compiled in. |

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.1.0
2+
- Replaced #define DECODE_NEC 1/0 by defining/not defining.
3+
- USE_SOFT_SEND_PWM is active by default.
4+
15
## 3.0.2
26
- Bug fix for USE_OLD_DECODE.
37
- Increase RECORD_GAP_MICROS to 11000.

examples/BoseWaveSendDemo/BoseWaveSendDemo.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ void setup() {
5151

5252
Serial.begin(115200);
5353
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
54-
delay(2000); // To be able to connect Serial monitor after reset or power up and before first printout
54+
delay(4000); // To be able to connect Serial monitor after reset or power up and before first printout
5555
#endif
5656
// Just to know which program is running on my Arduino
5757
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
5858

59-
#if defined(USE_SOFT_SEND_PWM) || defined(USE_NO_SEND_PWM)
60-
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
61-
#else
59+
#if defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
6260
IrSender.begin(true); // Enable feedback LED at default feedback LED pin
61+
#else
62+
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
6363
#endif
6464

6565
prompt = true;

examples/IR2Keyboard/IR2Keyboard.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void setup() {
5353

5454
Serial.begin(115200);
5555
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
56-
delay(2000); // To be able to connect Serial monitor after reset or power up and before first printout
56+
delay(4000); // To be able to connect Serial monitor after reset or power up and before first printout
5757
#endif
5858
// Just to know which program is running on my Arduino
5959
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));

examples/IRDispatcherDemo/IRDispatcherDemo.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void setup()
115115
pinMode(LED_BUILTIN, OUTPUT);
116116
Serial.begin(115200);
117117
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
118-
delay(2000); // To be able to connect Serial monitor after reset or power up and before first printout
118+
delay(4000); // To be able to connect Serial monitor after reset or power up and before first printout
119119
#endif
120120
#if defined(ESP8266)
121121
Serial.println(); // to separate it from the internal boot output

examples/IRreceiveDump/IRreceiveDump.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void setup() {
3737

3838
Serial.begin(115200); // Status message will be sent to PC at 9600 baud
3939
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
40-
delay(2000); // To be able to connect Serial monitor after reset or power up and before first printout
40+
delay(4000); // To be able to connect Serial monitor after reset or power up and before first printout
4141
#endif
4242
// Just to know which program is running on my Arduino
4343
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));

examples/IRrelay/IRrelay.ino

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ int RELAY_PIN = 4; // is labeled D2 on the Chinese SAMD21 M0-Mini clone
2323
//#define LED_BUILTIN 25 // Or choose pin 25, it is the RX pin, but active low.
2424
#endif
2525

26-
void dump();
27-
2826
void setup() {
2927
pinMode(LED_BUILTIN, OUTPUT);
3028
pinMode(RELAY_PIN, OUTPUT);
3129

3230
Serial.begin(115200);
3331
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
34-
delay(2000); // To be able to connect Serial monitor after reset or power up and before first printout
32+
delay(4000); // To be able to connect Serial monitor after reset or power up and before first printout
3533
#endif
3634
// Just to know which program is running on my Arduino
3735
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));

examples/IRremoteInfo/IRremoteInfo.ino

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ void dumpArduinoIDE();
2525
void dumpDebugMode();
2626
void dumpProtocols();
2727
void dumpFooter();
28-
void printDecodeEnabled(int flag);
2928

3029
void setup() {
3130
Serial.begin(115200);
3231
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
33-
delay(2000); // To be able to connect Serial monitor after reset or power up and before first printout
32+
delay(4000); // To be able to connect Serial monitor after reset or power up and before first printout
3433
#endif
3534
// Just to know which program is running on my Arduino
3635
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
@@ -223,42 +222,91 @@ void dumpProtocols() {
223222
Serial.print(F("======== "));
224223
Serial.println(F("========"));
225224
Serial.print(F("RC5: "));
226-
printDecodeEnabled(DECODE_RC6);
225+
#if defined(DECODE_RC5)
226+
Serial.println(F("Enabled"));
227+
#else
228+
Serial.println(F("Disabled"));
229+
#endif
227230

228231
Serial.print(F("RC6: "));
229-
printDecodeEnabled(DECODE_RC5);
232+
#if defined(DECODE_RC6)
233+
Serial.println(F("Enabled"));
234+
#else
235+
Serial.println(F("Disabled"));
236+
#endif
230237

231238
Serial.print(F("NEC: "));
232-
printDecodeEnabled(DECODE_NEC);
239+
#if defined(DECODE_NEC)
240+
Serial.println(F("Enabled"));
241+
#else
242+
Serial.println(F("Disabled"));
243+
#endif
233244

234245
Serial.print(F("SONY: "));
235-
printDecodeEnabled(DECODE_SONY);
246+
#if defined(DECODE_SONY)
247+
Serial.println(F("Enabled"));
248+
#else
249+
Serial.println(F("Disabled"));
250+
#endif
236251

237252
Serial.print(F("PANASONIC: "));
238-
printDecodeEnabled(DECODE_PANASONIC);
253+
#if defined(DECODE_PANASONIC)
254+
Serial.println(F("Enabled"));
255+
#else
256+
Serial.println(F("Disabled"));
257+
#endif
239258

240259
Serial.print(F("JVC: "));
241-
printDecodeEnabled(DECODE_JVC);
260+
#if defined(DECODE_JVC)
261+
Serial.println(F("Enabled"));
262+
#else
263+
Serial.println(F("Disabled"));
264+
#endif
242265

243266
Serial.print(F("SAMSUNG: "));
244-
printDecodeEnabled(DECODE_SAMSUNG);
267+
#if defined(DECODE_SAMSUNG)
268+
Serial.println(F("Enabled"));
269+
#else
270+
Serial.println(F("Disabled"));
271+
#endif
245272

246273
Serial.print(F("LG: "));
247-
printDecodeEnabled(DECODE_LG);
274+
#if defined(DECODE_LG)
275+
Serial.println(F("Enabled"));
276+
#else
277+
Serial.println(F("Disabled"));
278+
#endif
248279

249280
Serial.print(F("SHARP: "));
250-
printDecodeEnabled(DECODE_SHARP);
281+
#if defined(DECODE_SHARP)
282+
Serial.println(F("Enabled"));
283+
#else
284+
Serial.println(F("Disabled"));
285+
#endif
251286

252287
Serial.print(F("DENON: "));
253-
printDecodeEnabled(DECODE_DENON);
288+
#if defined(DECODE_DENON)
289+
Serial.println(F("Enabled"));
290+
#else
291+
Serial.println(F("Disabled"));
292+
#endif
254293

255294
#if !defined(EXCLUDE_EXOTIC_PROTOCOLS) // saves around 2000 bytes program space
256295

257296
Serial.print(F("BOSEWAVE: "));
258-
printDecodeEnabled(DECODE_BOSEWAVE);
297+
#if defined(DECODE_BOSEWAVE)
298+
Serial.println(F("Enabled"));
299+
#else
300+
Serial.println(F("Disabled"));
301+
#endif
259302

260303
Serial.print(F("WHYNTER: "));
261-
printDecodeEnabled(DECODE_WHYNTER);
304+
#if defined(DECODE_WHYNTER)
305+
Serial.println(F("Enabled"));
306+
#else
307+
Serial.println(F("Disabled"));
308+
#endif
309+
262310
#endif
263311
}
264312

examples/IRsendDemo/IRsendDemo.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
*/
1414

1515
//#define EXCLUDE_EXOTIC_PROTOCOLS // saves around 240 bytes program space if IrSender.write is used
16+
//#define SEND_PWM_BY_TIMER
17+
1618
#include <IRremote.h>
19+
1720
#if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
1821
#include "ATtinySerialOut.h"
1922
#endif
@@ -35,10 +38,10 @@ void setup() {
3538
Serial.print(F("Ready to send IR signals at pin "));
3639
Serial.println(IR_SEND_PIN);
3740

38-
#if defined(USE_SOFT_SEND_PWM) || defined(USE_NO_SEND_PWM)
39-
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
40-
#else
41+
#if defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
4142
IrSender.begin(true); // Enable feedback LED at default feedback LED pin
43+
#else
44+
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
4245
#endif
4346
}
4447

examples/IRsendProntoDemo/IRsendProntoDemo.ino

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,16 @@ void setup() {
1919

2020
// Just to know which program is running on my Arduino
2121
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
22-
23-
Serial.print(F("Will send IR signals at pin "));
22+
Serial.print(F("Ready to send IR signals at pin "));
2423
Serial.println(IR_SEND_PIN);
24+
25+
#if defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
26+
IrSender.begin(true); // Enable feedback LED at default feedback LED pin
27+
#else
28+
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
29+
#endif
30+
31+
2532
}
2633

2734
void loop() {

0 commit comments

Comments
 (0)