Skip to content

Commit 20bd179

Browse files
committed
Including assertions
1 parent b7d0e3a commit 20bd179

File tree

15 files changed

+70
-56
lines changed

15 files changed

+70
-56
lines changed

.github/workflows/LibraryBuild.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
- ATTinyCore:avr:attinyx5:chip=85,clock=1internal
5858
- TinyCore:avr:tiny32
5959
- arduino:samd:arduino_zero_native
60-
- MegaCore:avr:128:bootloader=no_bootloader,eeprom=keep,BOD=2v7,LTO=Os,clock=8MHz_internal # ATmega128
60+
- MegaCore:avr:128:bootloader=no_bootloader,eeprom=keep,BOD=2v7,LTO=Os_flto,clock=8MHz_internal # ATmega128
6161
- esp32:esp32:featheresp32:FlashFreq=80
6262
- SparkFun:avr:promicro
6363
- sandeepmistry:nRF5:BBCmicrobit
@@ -87,13 +87,15 @@ jobs:
8787
- arduino-boards-fqbn: arduino:avr:uno|SEND_PWM_BY_TIMER
8888
sketches-exclude: IR2Keyboard
8989
build-properties: # the flags were put in compiler.cpp.extra_flags
90-
All: -DUSE_SOFT_SEND_PWM
90+
All: -DSEND_PWM_BY_TIMER
9191

9292
- arduino-boards-fqbn: arduino:megaavr:nona4809:mode=off
9393
sketches-exclude: IR2Keyboard,MinimalReceiver,IRDispatcherDemo
9494

9595
- arduino-boards-fqbn: arduino:samd:arduino_zero_native
9696
sketches-exclude: MinimalReceiver,IRDispatcherDemo
97+
build-properties: # the flags were put in compiler.cpp.extra_flags
98+
All: -DUSE_SOFT_SEND_PWM
9799

98100
- arduino-boards-fqbn: SparkFun:avr:promicro
99101
arduino-platform: arduino:avr,SparkFun:avr
@@ -103,33 +105,32 @@ jobs:
103105
platform-url: https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json
104106
sketches-exclude: IR2Keyboard,IRUnitTest,IRrelay,ReceiveAndSend,IRreceiveDump,IRsendProntoDemo,MicroGirs,IRDispatcherDemo,LGAirConditionerSendDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
105107
build-properties: # the flags were put in compiler.cpp.extra_flags
106-
All:
107-
-DEXCLUDE_EXOTIC_PROTOCOLS
108+
All: -DEXCLUDE_EXOTIC_PROTOCOLS
108109

109110
- arduino-boards-fqbn: ATTinyCore:avr:attinyx5:chip=85,clock=1internal
110111
platform-url: http://drazzy.com/package_drazzy.com_index.json
111112
sketches-exclude: IR2Keyboard,IRUnitTest,IRrelay,ReceiveAndSend,IRreceiveDump,IRsendProntoDemo,MicroGirs,IRDispatcherDemo,LGAirConditionerSendDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM
112113
build-properties: # the flags were put in compiler.cpp.extra_flags
113-
All:
114-
-DEXCLUDE_EXOTIC_PROTOCOLS
114+
All: -DEXCLUDE_EXOTIC_PROTOCOLS
115115

116116
- arduino-boards-fqbn: TinyCore:avr:tiny32
117117
platform-url: https://raw.githubusercontent.com/xukangmin/TinyCore/master/avr/package/package_tinycore_index.json
118118
sketches-exclude: IR2Keyboard
119119

120-
- arduino-boards-fqbn: MegaCore:avr:128:bootloader=no_bootloader,eeprom=keep,BOD=2v7,LTO=Os,clock=8MHz_internal
120+
- arduino-boards-fqbn: MegaCore:avr:128:bootloader=no_bootloader,eeprom=keep,BOD=2v7,LTO=Os_flto,clock=8MHz_internal
121121
platform-url: https://mcudude.github.io/MegaCore/package_MCUdude_MegaCore_index.json
122122
arduino-platform: arduino:avr,MegaCore:avr # gcc is taken from arduino:avr
123123
sketches-exclude: IR2Keyboard,MinimalReceiver,IRDispatcherDemo # no HID.h
124124

125125
- arduino-boards-fqbn: esp32:esp32:featheresp32:FlashFreq=80
126126
platform-url: https://dl.espressif.com/dl/package_esp32_index.json
127-
sketches-exclude: IR2Keyboard,LGAirConditionerSendDemo,MinimalReceiver # undefined reference to `TwoWire::onReceive(void (*)(int))'
127+
sketches-exclude: IR2Keyboard,MinimalReceiver # undefined reference to `TwoWire::onReceive(void (*)(int))'
128128

129129
- arduino-boards-fqbn: sandeepmistry:nRF5:BBCmicrobit
130130
platform-url: https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json
131-
sketches-exclude: BoseWaveSendDemo,IR2Keyboard,IRDispatcherDemo,ReceiveAndSend,IRsendProntoDemo,IRsendRawDemo,IRUnitTest,LGAirConditionerSendDemo,MicroGirs,MinimalReceiver,SimpleSender # no sending yet, no tone()
132-
131+
sketches-exclude: IR2Keyboard,IRDispatcherDemo,MicroGirs,MinimalReceiver # no tone()
132+
build-properties: # the flags were put in compiler.cpp.extra_flags
133+
All: -DUSE_SOFT_SEND_PWM
133134

134135
# Do not cancel all jobs / architectures if one job fails
135136
fail-fast: false

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ Protocols can be switched off and on by definining macros before the line `#incu
3030
# [Wiki](https://github.com/Arduino-IRremote/Arduino-IRremote/wiki)
3131
This is a quite old but maybe useful wiki for this library.
3232

33+
# Converting your program to the 3.1 version
34+
This must be done also for all versions > 3.0.1 if `USE_NO_SEND_PWM` is defined.<br/>
35+
Starting with this version, the generation of PWM is done by software, thus saving the hardware timer and enabling abitrary output pins.<br/>
36+
Therefore you must change all `IrSender.begin(true);` by `IrSender.begin(IR_SEND_PIN, true);`.
37+
For cores like MegaCore where you can choose between enabling or disabling lto, lto must be enabled, otherwise you will get an assertion.
38+
3339
# Converting your 2.x program to the 3.x version
3440
- Now there is an **IRreceiver** and **IRsender** object like the well known Arduino **Serial** object.
3541
- 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`.
@@ -78,13 +84,32 @@ If you do not know which protocol your IR transmitter uses, you have several cho
7884
- To **increase strength of sent output signal** you can increase the current through the send diode, and/or use 2 diodes in series,
7985
since one IR diode requires only 1.5 volt.
8086

87+
# Examples
88+
### SimpleReceiver + SimpleSender
89+
This examples are a good starting point.
90+
91+
### IRReceiveDemo + IRSendDemo
92+
More complete examples for the advanced user.
93+
94+
### ReceiveAndSend
95+
Like the name states...
96+
97+
### MinimalReceiver + SmallReceiver
98+
If code size matters look at these examples.
99+
100+
### DispatcherDemo
101+
Framework for calling different functions for different IR codes.
102+
103+
### IRrelay
104+
Control a relay (connected to an output pin) with your remote.
105+
81106
# Compile options / macros for this library
82107
To customize the library to different requirements, there are some compile options / macros available.<br/>
83108
Modify it by commenting them out or in, or change the values if applicable. Or define the macro with the -D compiler option for global compile (the latter is not possible with the Arduino IDE, so consider using [Sloeber](https://eclipse.baeyens.it).
84109

85110
| Name | File | Default value | Description |
86111
|-|-|-|-|
87-
| `SEND_PWM_BY_TIMER` | Before `#include <IRremote.h>` | disabled | Disable carrier PWM generation in software and use (restricted) hardware PWM. |
112+
| `SEND_PWM_BY_TIMER` | Before `#include <IRremote.h>` | disabled | Disable carrier PWM generation in software and use (restricted) hardware PWM ecxept for ESP32 where both modes are using the flexible `hw_timer_t`. |
88113
| `USE_OLD_DECODE` | IRremoteInt.h | disabled | Enables the old decoder in order to be version 2.x compatible, where all protocols were MSB first. |
89114
| `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. |
90115
| `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. |
@@ -99,8 +124,6 @@ Modify it by commenting them out or in, or change the values if applicable. Or d
99124
| `IR_FEEDBACK_LED_PIN` | TinyIRReceiver.h | `LED_BUILTIN` | The pin number for TinyIRReceiver feedback LED, which gets compiled in. |
100125
| `DO_NOT_USE_FEEDBACK_LED` | TinyIRReceiver.h | disabled | Enable it to disable the feedback LED function. |
101126

102-
103-
104127
### Modifying compile options with Arduino IDE
105128
First use *Sketch > Show Sketch Folder (Ctrl+K)*.<br/>
106129
If you did not yet stored the example as your own sketch, then you are instantly in the right library folder.<br/>

examples/BoseWaveSendDemo/BoseWaveSendDemo.ino

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ void setup() {
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(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
60-
IrSender.begin(true); // Enable feedback LED at default feedback LED pin
61-
#else
6259
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
63-
#endif
6460

6561
prompt = true;
6662
}

examples/IRsendDemo/IRsendDemo.ino

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
//#define EXCLUDE_EXOTIC_PROTOCOLS // saves around 240 bytes program space if IrSender.write is used
1616
//#define SEND_PWM_BY_TIMER
17+
//#define USE_NO_SEND_PWM
1718

1819
#include <IRremote.h>
1920

@@ -38,11 +39,7 @@ void setup() {
3839
Serial.print(F("Ready to send IR signals at pin "));
3940
Serial.println(IR_SEND_PIN);
4041

41-
#if defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
42-
IrSender.begin(true); // Enable feedback LED at default feedback LED pin
43-
#else
4442
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
45-
#endif
4643
}
4744

4845
/*

examples/IRsendProntoDemo/IRsendProntoDemo.ino

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,7 @@ void setup() {
2222
Serial.print(F("Ready to send IR signals at pin "));
2323
Serial.println(IR_SEND_PIN);
2424

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
2825
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
29-
#endif
30-
31-
3226
}
3327

3428
void loop() {

examples/IRsendRawDemo/IRsendRawDemo.ino

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ void setup() {
3434
Serial.print(F("Ready to send IR signals at pin "));
3535
Serial.println(IR_SEND_PIN);
3636

37-
#if defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
38-
IrSender.begin(true); // Enable feedback LED at default feedback LED pin
39-
#else
4037
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
41-
#endif
4238
}
4339

4440
/*

examples/LGAirConditionerSendDemo/LGAirConditionerSendDemo.ino

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* For Arduino Uno, Nano etc., an IR LED must be connected to PWM pin 3 (IR_SEND_PIN).
88
*
99
*
10-
* This file is part of Arduino-IRremote https://github.com/z3t0/Arduino-IRremote.
10+
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
1111
*
1212
************************************************************************************
1313
* MIT License
@@ -173,11 +173,7 @@ delay(4000); // To be able to connect Serial monitor after reset or power up and
173173
/*
174174
* The IR library setup. That's all!
175175
*/
176-
#if defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
177-
IrSender.begin(true); // Enable feedback LED at default feedback LED pin
178-
#else
179176
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
180-
#endif
181177

182178
delay(1000);
183179

examples/ReceiveAndSend/ReceiveAndSend.ino

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,7 @@ void setup() {
8383

8484
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); // Start the receiver, enable feedback LED, take LED feedback pin from the internal boards definition
8585

86-
#if defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
87-
IrSender.begin(true); // Enable feedback LED at default feedback LED pin
88-
#else
8986
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
90-
#endif
9187

9288
pinMode(SEND_BUTTON_PIN, INPUT_PULLUP);
9389
pinMode(STATUS_PIN, OUTPUT);

examples/SimpleReceiver/SimpleReceiver.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
//#define DECODE_RC5
2828
//#define DECODE_RC6
2929

30+
//#define DECODE_BOSEWAVE
31+
//#define DECODE_LEGO_PF
32+
//#define DECODE_MAGIQUEST
33+
//#define DECODE_WHYNTER
34+
35+
//#define DECODE_HASH // special decoder for all protocols
36+
3037
#include <IRremote.h>
3138

3239
/*

examples/SimpleSender/SimpleSender.ino

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ void setup() {
2929
/*
3030
* The IR library setup. That's all!
3131
*/
32-
#if defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
33-
IrSender.begin(true); // Enable feedback LED at default feedback LED pin
34-
#else
3532
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
36-
#endif
3733
}
3834

3935
/*

0 commit comments

Comments
 (0)