Skip to content

Commit 6e5be97

Browse files
committed
Release 3.1.0
1 parent adfbfc9 commit 6e5be97

File tree

7 files changed

+39
-19
lines changed

7 files changed

+39
-19
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ A Doxygen documentation of the sources is available on the [project homepage](ht
1818
Click on the LibraryManager badge above to see the [instructions](https://www.ardu-badge.com/IRremote/zip).
1919

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

2424
```
@@ -34,6 +34,7 @@ This is a quite old but maybe useful wiki for this library.
3434
This must be done also for all versions > 3.0.1 if `USE_NO_SEND_PWM` is defined.<br/>
3535
Starting with this version, **the generation of PWM is done by software**, thus saving the hardware timer and **enabling abitrary output pins**.<br/>
3636
Therefore you must change all `IrSender.begin(true);` by `IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK);`.
37+
If you use a core that does not use the `-flto` flag for compile, you can activate the line `#define SUPPRESS_ERROR_MESSAGE_FOR_BEGIN` in IRRemote.h, if you get false error messages regarding begin() during compilation.
3738

3839
# Converting your 2.x program to the 3.x version
3940
- Now there is an **IRreceiver** and **IRsender** object like the well known Arduino **Serial** object.
@@ -84,6 +85,7 @@ If you do not know which protocol your IR transmitter uses, you have several cho
8485
since one IR diode requires only 1.5 volt.
8586
- The line \#include "ATtinySerialOut.h" in PinDefinitionsAndMore.h (requires the library to be installed) saves 370 bytes program space and 38 bytes RAM for **Digispark boards** as well as enables serial output at 8MHz.
8687
- The default software generated PWM has **problems on ATtinies running with 8 MHz**. The PWM frequency is around 30 instead of 38 kHz and RC6 is not reliable. You can switch to timer PWM generation by `#define SEND_PWM_BY_TIMER`.
88+
- Minimal CPU frequency for receiving is 4 MHz, sive the 50 us timer ISR takes around 12 us on a 16 MHz ATmega.
8789

8890
# Examples
8991
In order to fit the examples to the 8K flash of ATtiny85 and ATtiny88, the [Arduino library ATtinySerialOut](https://github.com/ArminJo/ATtinySerialOut) is required for this CPU's.

changelog.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,22 @@
22
The latest version may not be released!
33

44
## 3.1.0
5-
- Replaced `#define DECODE_NEC 1/0` by defining/not defining.
65
- USE_SOFT_SEND_PWM is active by default.
7-
- Refactored Board specific code.
8-
- Separated timer and feedback LED related code.
9-
- Added STM32F1 by (by Roger Clark) support.
10-
- Added stm32 (by ST) support. Thanks to Paolo Malaspina.
11-
- Refactored LED Feedback functions.
12-
- Renamed most irparams_struct values.
13-
- Implemented feedback for send.
146
- Removed decode_results results.
15-
- Added unit test and fixed LG send bug.
16-
- MATCH_MARK() etc. now available as matchMark().
17-
- Added ATtiny88 support.
18-
- Use LED_BUILTIN instead of FEEDBACK_LED FeedbackLEDPin is 0.
7+
- Renamed most irparams_struct values.
8+
- Fixed LG send bug and added unit test.
9+
- Replaced `#define DECODE_NEC 1/0` by defining/not defining.
10+
- Use LED_BUILTIN instead of FEEDBACK_LED if FeedbackLEDPin is 0.
1911
- Use F_CPU instead of SYSCLOCK.
2012
- Removed SENDPIN_ON and SENDPIN_OFF macros.
2113

14+
- Refactored board specific code for timer and feedback LED.
15+
- Extracted common LED feedback functions and implemented feedback for send.
16+
- MATCH_MARK() etc. now available as matchMark().
17+
- Added STM32F1 by (by Roger Clark) support.
18+
- Added stm32 (by ST) support. Thanks to Paolo Malaspina.
19+
- Added ATtiny88 support.
20+
2221
## 3.0.2
2322
- Bug fix for USE_OLD_DECODE.
2423
- Increase RECORD_GAP_MICROS to 11000.

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version=3.1.0
33
author=shirriff, z3t0 <zetoslab@gmail.com>, ArminJo
44
maintainer=Armin Joachimsmeyer <armin.arduino@gmail.com>
55
sentence=Send and receive infrared signals with multiple protocols
6-
paragraph=Currently included protocols: Denon, JVC, LG, NEC, Panasonic / Kaseikyo, RC5, RC6, Samsung, Sharp, Sony, (Pronto), BoseWave, Lego, Whynter, MagiQuest.<br/><br/><b>New: </b><a href="https://github.com/Arduino-IRremote/Arduino-IRremote#converting-your-2x-program-to-the-3x-version">Upgrade instructions</a><br/>Generation of PWM is done by software by default, thus saving the hardware timer and enabling abitrary output pins. STM32 support added. Major refactoring of CPU dependent and feedback LED code.<br/>
6+
paragraph=Currently included protocols: Denon / Sharp, JVC, LG, NEC / Apple, Panasonic / Kaseikyo, RC5, RC6, Samsung, Sony, (Pronto), BoseWave, Lego, Whynter, MagiQuest.<br/><br/><b>New: </b><a href="https://github.com/Arduino-IRremote/Arduino-IRremote#converting-your-program-to-the-31-version">Upgrade instructions</a><br/>Generation of PWM is now done by software by default, thus saving the hardware timer and enabling abitrary output pins. Fixed LG send bug. STM32 and ATtiny88 support added. Removed decode_results results. Renamed most irparams_struct values. The macros FEEDBACK_LED, SYSCLOCK, SENDPIN_ON and SENDPIN_OFF are not longer used / evaluated. Major refactoring of CPU dependent and feedback LED code.<br/>
77
category=Communication
88
url=https://github.com/Arduino-IRremote/Arduino-IRremote
99
architectures=avr,megaavr,samd,esp32,mbed,stm32,STM32F1

src/IRReceive.cpp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,7 @@ const __FlashStringHelper* getProtocolString(decode_type_t aProtocol) {
12341234
* 15 pushs, 1 in, 1 eor before start of code = 2 us @16MHz + * 7.2 us computation time (6us idle time) + * pop + reti = 2.25 us @16MHz => 10.3 to 11.5 us @16MHz
12351235
* With portInputRegister and mask and Feedback LED code commented
12361236
* 9 pushs, 1 in, 1 eor before start of code = 1.25 us @16MHz + * 2.25 us computation time + * pop + reti = 1.5 us @16MHz => 5 us @16MHz
1237+
* => Minimal CPU frequency is 4 MHz
12371238
*
12381239
**********************************************************************************************************************/
12391240
//#define IR_MEASURE_TIMING

src/IRSend.cpp.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ void IRsend::begin(uint8_t aSendPin, bool aEnableLEDFeedback, uint8_t aLEDFeedba
7171
* @param aLEDFeedbackPin if 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
7272
*/
7373
void IRsend::begin(bool aEnableLEDFeedback, uint8_t aLEDFeedbackPin) {
74-
// must exclude NRF5, SAMD and ESP32 because they do not use the -flto flag for compile
74+
// must exclude MEGATINYCORE, NRF5, SAMD and ESP32 because they do not use the -flto flag for compile
7575
#if (defined(USE_SOFT_SEND_PWM) || defined(USE_NO_SEND_PWM)) \
76-
&& !(defined(NRF5) || defined(ARDUINO_ARCH_NRF52840)) && !defined(ARDUINO_ARCH_SAMD) \
76+
&& !defined(SUPPRESS_ERROR_MESSAGE_FOR_BEGIN) \
77+
&& !(defined(NRF5) || defined(ARDUINO_ARCH_NRF52840)) && !defined(ARDUINO_ARCH_SAMD) \
7778
&& !defined(ESP32) && !defined(MEGATINYCORE) \
7879
&& !(defined(__STM32F1__) || defined(ARDUINO_ARCH_STM32F1)) && !(defined(STM32F1xx) || defined(ARDUINO_ARCH_STM32))
7980
UsageError("Error: You must use begin(<sendPin>, <EnableLEDFeedback>, <LEDFeedbackPin>) if USE_SOFT_SEND_PWM or USE_NO_SEND_PWM is defined!");

src/IRremote.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
#define VERSION_IRREMOTE_MAJOR 3
4848
#define VERSION_IRREMOTE_MINOR 1
4949

50+
// activate it for all cores that does not use the -flto flag, if you get false error messages regarding begin() during compilation.
51+
//#define SUPPRESS_ERROR_MESSAGE_FOR_BEGIN
52+
5053
/*
5154
* If activated, BOSEWAVE, MAGIQUEST,WHYNTER and LEGO_PF are excluded in decoding and in sending with IrSender.write
5255
*/

src/TinyIRReceiver.cpp.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* TinIRReceiver.cpp.h
2+
* TinyIRReceiver.cpp.h
33
*
44
* Receives IR protocol data of NEC protocol using pin change interrupts.
55
* NEC is the protocol of most cheap remote controls for Arduino.
@@ -42,6 +42,10 @@
4242
#include "TinyIRReceiver.h"
4343
#include "digitalWriteFast.h"
4444

45+
//#define IR_MEASURE_TIMING
46+
//#define IR_TIMING_TEST_PIN 7
47+
//#define DO_NOT_USE_FEEDBACK_LED
48+
4549
/** \addtogroup TinyReceiver Minimal receiver for NEC protocol
4650
* @{
4751
*/
@@ -62,13 +66,17 @@ void handleReceivedIRData(uint16_t aAddress, uint8_t aCommand, bool isRepetition
6266
/**
6367
* The ISR of TinyIRRreceiver.
6468
* It handles the NEC protocol decoding and calls the user callback function on complete.
69+
* 5 us + 3 us for push + pop for a 16MHz ATmega
6570
*/
6671
#if defined(ESP8266)
6772
ICACHE_RAM_ATTR
6873
#elif defined(ESP32)
6974
IRAM_ATTR
7075
#endif
7176
void IRPinChangeInterruptHandler(void) {
77+
#if defined(IR_MEASURE_TIMING) && defined(IR_TIMING_TEST_PIN)
78+
digitalWriteFast(IR_TIMING_TEST_PIN, HIGH); // 2 clock cycles
79+
#endif
7280
/*
7381
* Save IR input level
7482
* Negative logic, true / HIGH means inactive / IR space, LOW / false means IR mark.
@@ -156,7 +164,7 @@ void IRPinChangeInterruptHandler(void) {
156164
tState = IR_RECEIVER_STATE_WAITING_FOR_START_MARK;
157165
}
158166
} else {
159-
// error wrong state for the received level (should not happen!) -> reset state (2 checks costs 10 bytes programming space)
167+
// error wrong state for the received level, e.g. if we missed one change interrupt -> reset state
160168
tState = IR_RECEIVER_STATE_WAITING_FOR_START_MARK;
161169
}
162170
}
@@ -217,18 +225,24 @@ void IRPinChangeInterruptHandler(void) {
217225
tState = IR_RECEIVER_STATE_WAITING_FOR_START_MARK;
218226
}
219227
} else {
220-
// error wrong state for the received level (should not happen!) -> reset state (2 checks costs 10 bytes programming space)
228+
// error wrong state for the received level, e.g. if we missed one change interrupt -> reset state
221229
tState = IR_RECEIVER_STATE_WAITING_FOR_START_MARK;
222230
}
223231
}
224232

225233
TinyIRReceiverControl.IRReceiverState = tState;
234+
#ifdef IR_MEASURE_TIMING
235+
digitalWriteFast(IR_TIMING_TEST_PIN, LOW); // 2 clock cycles
236+
#endif
226237
}
227238

228239
/**
229240
* Initializes hardware interrupt generation according to IR_INPUT_PIN or use attachInterrupt() function.
230241
*/
231242
void initPCIInterruptForTinyReceiver() {
243+
#if defined(IR_MEASURE_TIMING) && defined(IR_TIMING_TEST_PIN)
244+
pinModeFast(IR_TIMING_TEST_PIN, OUTPUT);
245+
#endif
232246
pinModeFast(IR_INPUT_PIN, INPUT_PULLUP);
233247

234248
#if !defined(DO_NOT_USE_FEEDBACK_LED) && defined(IR_FEEDBACK_LED_PIN)

0 commit comments

Comments
 (0)