Changes types to fast types
This commit is contained in:
parent
6e4b89f520
commit
c6cf6ac590
|
@ -1,7 +1,7 @@
|
|||
# IRremote Arduino Library
|
||||
This library enables you to send and receive using infra-red signals on an Arduino.
|
||||
|
||||
### [Version 3.6.2](https://github.com/Arduino-IRremote/Arduino-IRremote/archive/master.zip) - work in progress
|
||||
### [Version 3.7.0](https://github.com/Arduino-IRremote/Arduino-IRremote/archive/master.zip) - work in progress
|
||||
|
||||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
||||
[![Commits since latest](https://img.shields.io/github/commits-since/Arduino-IRremote/Arduino-IRremote/latest)](https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master)
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
# Changelog
|
||||
The latest version may not be released!
|
||||
See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master
|
||||
## 3.6.2
|
||||
|
||||
## 3.7.0
|
||||
- Changed TOLERANCE to TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING and documented it.
|
||||
- Changed last uint8_t to uint_fast8_t and uint16_t to unsigned integer.
|
||||
- Improved MagiQuest protocol.
|
||||
- Improved prints and documentation.
|
||||
|
||||
## 3.6.1
|
||||
- Switched Bose internal protocol timing for 0 and 1 -> old 1 timing is now 0 and vice versa.
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
// tone() is included in ESP32 core since 2.0.2
|
||||
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t aPinNumber, unsigned int aFrequency){
|
||||
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
|
||||
|
@ -79,6 +81,8 @@ void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
|
|||
void noTone(uint8_t aPinNumber){
|
||||
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
|
||||
}
|
||||
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
|
||||
|
||||
#define IR_RECEIVE_PIN 15 // D15
|
||||
#define IR_SEND_PIN 4 // D4
|
||||
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
|
||||
|
|
|
@ -3,7 +3,7 @@ version=3.6.1
|
|||
author=shirriff, z3t0, ArminJo
|
||||
maintainer=Armin Joachimsmeyer <armin.arduino@gmail.com>
|
||||
sentence=Send and receive infrared signals with multiple protocols
|
||||
paragraph=Currently included protocols: Denon / Sharp, JVC, LG / LG2, NEC / Onkyo / Apple, Panasonic / Kaseikyo, RC5, RC6, Samsung, Sony, (Pronto), BoseWave, Lego, Whynter, MagiQuest.<br/><br/><b>New: </b>RP2040 support and major refactoring of IRTimer.hpp. Switched Bose timing for 0 and 1.<br/><a href="https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/changelog.md">Release notes</a><br/>
|
||||
paragraph=Currently included protocols: Denon / Sharp, JVC, LG / LG2, NEC / Onkyo / Apple, Panasonic / Kaseikyo, RC5, RC6, Samsung, Sony, (Pronto), BoseWave, Lego, Whynter, MagiQuest.<br/><br/><b>New: </b>Minor improvements, changed types to fast ones and improved MagiQuest protocol.<br/><a href="https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/changelog.md">Release notes</a><br/>
|
||||
category=Communication
|
||||
url=https://github.com/Arduino-IRremote/Arduino-IRremote
|
||||
architectures=avr,megaavr,samd,esp8266,esp32,stm32,STM32F1,mbed,mbed_nano,rp2040
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#include "digitalWriteFast.h"
|
||||
|
||||
/**
|
||||
* Contains pin number and enable status of the feedback LED
|
||||
*/
|
||||
|
|
|
@ -58,7 +58,7 @@ IRrecv::IRrecv() {
|
|||
#endif
|
||||
}
|
||||
|
||||
IRrecv::IRrecv(uint8_t aReceivePin) {
|
||||
IRrecv::IRrecv(uint_fast8_t aReceivePin) {
|
||||
decodedIRData.rawDataPtr = &irparams; // for decodePulseDistanceData() etc.
|
||||
setReceivePin(aReceivePin);
|
||||
#if !defined(NO_LED_FEEDBACK_CODE)
|
||||
|
@ -70,7 +70,7 @@ IRrecv::IRrecv(uint8_t aReceivePin) {
|
|||
* @param aReceivePin Arduino pin to use, where a demodulating IR receiver is connected.
|
||||
* @param aFeedbackLEDPin if 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
|
||||
*/
|
||||
IRrecv::IRrecv(uint8_t aReceivePin, uint8_t aFeedbackLEDPin) {
|
||||
IRrecv::IRrecv(uint_fast8_t aReceivePin, uint_fast8_t aFeedbackLEDPin) {
|
||||
decodedIRData.rawDataPtr = &irparams; // for decodePulseDistanceData() etc.
|
||||
setReceivePin(aReceivePin);
|
||||
#if !defined(NO_LED_FEEDBACK_CODE)
|
||||
|
@ -89,7 +89,7 @@ IRrecv::IRrecv(uint8_t aReceivePin, uint8_t aFeedbackLEDPin) {
|
|||
* @param aEnableLEDFeedback if true / ENABLE_LED_FEEDBACK, then let the feedback led blink on receiving IR signal
|
||||
* @param aFeedbackLEDPin if 0 / USE_DEFAULT_FEEDBACK_LED_PIN, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
|
||||
*/
|
||||
void IRrecv::begin(uint8_t aReceivePin, bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin) {
|
||||
void IRrecv::begin(uint_fast8_t aReceivePin, bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin) {
|
||||
|
||||
setReceivePin(aReceivePin);
|
||||
#if !defined(NO_LED_FEEDBACK_CODE)
|
||||
|
@ -109,7 +109,7 @@ void IRrecv::begin(uint8_t aReceivePin, bool aEnableLEDFeedback, uint8_t aFeedba
|
|||
/**
|
||||
* Sets / changes the receiver pin number
|
||||
*/
|
||||
void IRrecv::setReceivePin(uint8_t aReceivePinNumber) {
|
||||
void IRrecv::setReceivePin(uint_fast8_t aReceivePinNumber) {
|
||||
irparams.IRReceivePin = aReceivePinNumber;
|
||||
#if defined(__AVR__)
|
||||
irparams.IRReceivePinMask = digitalPinToBitMask(aReceivePinNumber);
|
||||
|
@ -192,6 +192,9 @@ void IRrecv::resume() {
|
|||
if (irparams.StateForISR == IR_REC_STATE_STOP) {
|
||||
irparams.StateForISR = IR_REC_STATE_IDLE;
|
||||
}
|
||||
#if defined(SEND_PWM_BY_TIMER)
|
||||
TIMER_ENABLE_RECEIVE_INTR; // normally it is stopped by send()
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -205,7 +208,7 @@ void IRrecv::initDecodedIRData() {
|
|||
irparams.OverflowFlag = false;
|
||||
irparams.rawlen = 0; // otherwise we have OverflowFlag again at next ISR call
|
||||
decodedIRData.flags = IRDATA_FLAGS_WAS_OVERFLOW;
|
||||
IR_DEBUG_PRINTLN("Overflow happened");
|
||||
IR_DEBUG_PRINTLN(F("Overflow happened"));
|
||||
|
||||
} else {
|
||||
decodedIRData.flags = IRDATA_FLAGS_EMPTY;
|
||||
|
@ -264,63 +267,63 @@ bool IRrecv::decode() {
|
|||
}
|
||||
|
||||
#if defined(DECODE_NEC)
|
||||
IR_TRACE_PRINTLN("Attempting NEC decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting NEC decode"));
|
||||
if (decodeNEC()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
|
||||
IR_TRACE_PRINTLN("Attempting Panasonic/Kaseikyo decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting Panasonic/Kaseikyo decode"));
|
||||
if (decodeKaseikyo()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_DENON)
|
||||
IR_TRACE_PRINTLN("Attempting Denon/Sharp decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting Denon/Sharp decode"));
|
||||
if (decodeDenon()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_SONY)
|
||||
IR_TRACE_PRINTLN("Attempting Sony decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting Sony decode"));
|
||||
if (decodeSony()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_RC5)
|
||||
IR_TRACE_PRINTLN("Attempting RC5 decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting RC5 decode"));
|
||||
if (decodeRC5()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_RC6)
|
||||
IR_TRACE_PRINTLN("Attempting RC6 decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting RC6 decode"));
|
||||
if (decodeRC6()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_LG)
|
||||
IR_TRACE_PRINTLN("Attempting LG decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting LG decode"));
|
||||
if (decodeLG()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_JVC)
|
||||
IR_TRACE_PRINTLN("Attempting JVC decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting JVC decode"));
|
||||
if (decodeJVC()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_SAMSUNG)
|
||||
IR_TRACE_PRINTLN("Attempting Samsung decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting Samsung decode"));
|
||||
if (decodeSamsung()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -330,28 +333,28 @@ bool IRrecv::decode() {
|
|||
*/
|
||||
|
||||
#if defined(DECODE_WHYNTER)
|
||||
IR_TRACE_PRINTLN("Attempting Whynter decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting Whynter decode"));
|
||||
if (decodeWhynter()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_LEGO_PF)
|
||||
IR_TRACE_PRINTLN("Attempting Lego Power Functions");
|
||||
IR_TRACE_PRINTLN(F("Attempting Lego Power Functions"));
|
||||
if (decodeLegoPowerFunctions()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_BOSEWAVE)
|
||||
IR_TRACE_PRINTLN("Attempting Bosewave decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting Bosewave decode"));
|
||||
if (decodeBoseWave()) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_MAGIQUEST)
|
||||
IR_TRACE_PRINTLN("Attempting MagiQuest decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting MagiQuest decode"));
|
||||
if (decodeMagiQuest()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -361,7 +364,7 @@ bool IRrecv::decode() {
|
|||
* Try the universal decoder for pulse width or pulse distance protocols
|
||||
*/
|
||||
#if defined(DECODE_DISTANCE)
|
||||
IR_TRACE_PRINTLN("Attempting universal Distance decode");
|
||||
IR_TRACE_PRINTLN(F("Attempting universal Distance decode"));
|
||||
if (decodeDistance()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -371,7 +374,7 @@ bool IRrecv::decode() {
|
|||
* Last resort is the universal hash decode which always return true
|
||||
*/
|
||||
#if defined(DECODE_HASH)
|
||||
IR_TRACE_PRINTLN("Hash decode");
|
||||
IR_TRACE_PRINTLN(F("Hash decode"));
|
||||
// decodeHash returns a hash on any input.
|
||||
// Thus, it needs to be last in the list.
|
||||
// If you add any decodes, add them before this.
|
||||
|
@ -400,10 +403,10 @@ bool IRrecv::decode() {
|
|||
* @param aStartOffset must point to a mark
|
||||
* @return true if decoding was successful
|
||||
*/
|
||||
bool IRrecv::decodePulseWidthData(uint8_t aNumberOfBits, uint8_t aStartOffset, uint16_t aOneMarkMicros, uint16_t aZeroMarkMicros,
|
||||
uint16_t aBitSpaceMicros, bool aMSBfirst) {
|
||||
bool IRrecv::decodePulseWidthData(uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset, unsigned int aOneMarkMicros, unsigned int aZeroMarkMicros,
|
||||
unsigned int aBitSpaceMicros, bool aMSBfirst) {
|
||||
|
||||
uint16_t *tRawBufPointer = &decodedIRData.rawDataPtr->rawbuf[aStartOffset];
|
||||
unsigned int *tRawBufPointer = &decodedIRData.rawDataPtr->rawbuf[aStartOffset];
|
||||
uint32_t tDecodedData = 0;
|
||||
|
||||
if (aMSBfirst) {
|
||||
|
@ -441,7 +444,7 @@ bool IRrecv::decodePulseWidthData(uint8_t aNumberOfBits, uint8_t aStartOffset, u
|
|||
tRawBufPointer++;
|
||||
}
|
||||
}
|
||||
IR_TRACE_PRINTLN("");
|
||||
IR_TRACE_PRINTLN(F(""));
|
||||
} else {
|
||||
for (uint32_t tMask = 1UL; aNumberOfBits > 0; tMask <<= 1, aNumberOfBits--) {
|
||||
|
||||
|
@ -478,7 +481,7 @@ bool IRrecv::decodePulseWidthData(uint8_t aNumberOfBits, uint8_t aStartOffset, u
|
|||
tRawBufPointer++;
|
||||
}
|
||||
}
|
||||
IR_TRACE_PRINTLN("");
|
||||
IR_TRACE_PRINTLN(F(""));
|
||||
}
|
||||
decodedIRData.decodedRawData = tDecodedData;
|
||||
return true;
|
||||
|
@ -496,10 +499,10 @@ bool IRrecv::decodePulseWidthData(uint8_t aNumberOfBits, uint8_t aStartOffset, u
|
|||
* @param aStartOffset must point to a mark
|
||||
* @return true if decoding was successful
|
||||
*/
|
||||
bool IRrecv::decodePulseDistanceData(uint8_t aNumberOfBits, uint8_t aStartOffset, uint16_t aBitMarkMicros, uint16_t aOneSpaceMicros,
|
||||
uint16_t aZeroSpaceMicros, bool aMSBfirst) {
|
||||
bool IRrecv::decodePulseDistanceData(uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset, unsigned int aBitMarkMicros, unsigned int aOneSpaceMicros,
|
||||
unsigned int aZeroSpaceMicros, bool aMSBfirst) {
|
||||
|
||||
uint16_t *tRawBufPointer = &decodedIRData.rawDataPtr->rawbuf[aStartOffset];
|
||||
unsigned int *tRawBufPointer = &decodedIRData.rawDataPtr->rawbuf[aStartOffset];
|
||||
uint32_t tDecodedData = 0;
|
||||
|
||||
if (aMSBfirst) {
|
||||
|
@ -534,7 +537,7 @@ bool IRrecv::decodePulseDistanceData(uint8_t aNumberOfBits, uint8_t aStartOffset
|
|||
}
|
||||
tRawBufPointer++;
|
||||
}
|
||||
IR_TRACE_PRINTLN("");
|
||||
IR_TRACE_PRINTLN(F(""));
|
||||
|
||||
} else {
|
||||
for (uint32_t tMask = 1UL; aNumberOfBits > 0; tMask <<= 1, aNumberOfBits--) {
|
||||
|
@ -568,7 +571,7 @@ bool IRrecv::decodePulseDistanceData(uint8_t aNumberOfBits, uint8_t aStartOffset
|
|||
}
|
||||
tRawBufPointer++;
|
||||
}
|
||||
IR_TRACE_PRINTLN("");
|
||||
IR_TRACE_PRINTLN(F(""));
|
||||
}
|
||||
decodedIRData.decodedRawData = tDecodedData;
|
||||
return true;
|
||||
|
@ -577,12 +580,12 @@ bool IRrecv::decodePulseDistanceData(uint8_t aNumberOfBits, uint8_t aStartOffset
|
|||
/*
|
||||
* Static variables for the getBiphaselevel function
|
||||
*/
|
||||
uint8_t sBiphaseDecodeRawbuffOffset; // Index into raw timing array
|
||||
uint16_t sCurrentTimingIntervals; // Number of aBiphaseTimeUnit intervals of the current rawbuf[sBiphaseDecodeRawbuffOffset] timing.
|
||||
uint8_t sUsedTimingIntervals; // Number of already used intervals of sCurrentTimingIntervals.
|
||||
uint16_t sBiphaseTimeUnit;
|
||||
uint_fast8_t sBiphaseDecodeRawbuffOffset; // Index into raw timing array
|
||||
unsigned int sCurrentTimingIntervals; // Number of aBiphaseTimeUnit intervals of the current rawbuf[sBiphaseDecodeRawbuffOffset] timing.
|
||||
uint_fast8_t sUsedTimingIntervals; // Number of already used intervals of sCurrentTimingIntervals.
|
||||
unsigned int sBiphaseTimeUnit;
|
||||
|
||||
void IRrecv::initBiphaselevel(uint8_t aRCDecodeRawbuffOffset, uint16_t aBiphaseTimeUnit) {
|
||||
void IRrecv::initBiphaselevel(uint_fast8_t aRCDecodeRawbuffOffset, unsigned int aBiphaseTimeUnit) {
|
||||
sBiphaseDecodeRawbuffOffset = aRCDecodeRawbuffOffset;
|
||||
sBiphaseTimeUnit = aBiphaseTimeUnit;
|
||||
sUsedTimingIntervals = 0;
|
||||
|
@ -604,8 +607,8 @@ void IRrecv::initBiphaselevel(uint8_t aRCDecodeRawbuffOffset, uint16_t aBiphaseT
|
|||
* A space to mark at a significant clock edge results in a 0 (for RC6)
|
||||
* Returns current level [MARK or SPACE] or -1 for error (measured time interval is not a multiple of sBiphaseTimeUnit).
|
||||
*/
|
||||
uint8_t IRrecv::getBiphaselevel() {
|
||||
uint8_t tLevelOfCurrentInterval; // 0 (SPACE) or 1 (MARK)
|
||||
uint_fast8_t IRrecv::getBiphaselevel() {
|
||||
uint_fast8_t tLevelOfCurrentInterval; // 0 (SPACE) or 1 (MARK)
|
||||
|
||||
if (sBiphaseDecodeRawbuffOffset >= decodedIRData.rawDataPtr->rawlen) {
|
||||
return SPACE; // After end of recorded buffer, assume space.
|
||||
|
@ -617,8 +620,8 @@ uint8_t IRrecv::getBiphaselevel() {
|
|||
* Setup data if sUsedTimingIntervals is 0
|
||||
*/
|
||||
if (sUsedTimingIntervals == 0) {
|
||||
uint16_t tCurrentTimingWith = decodedIRData.rawDataPtr->rawbuf[sBiphaseDecodeRawbuffOffset];
|
||||
uint16_t tMarkExcessCorrection = (tLevelOfCurrentInterval == MARK) ? MARK_EXCESS_MICROS : -MARK_EXCESS_MICROS;
|
||||
unsigned int tCurrentTimingWith = decodedIRData.rawDataPtr->rawbuf[sBiphaseDecodeRawbuffOffset];
|
||||
unsigned int tMarkExcessCorrection = (tLevelOfCurrentInterval == MARK) ? MARK_EXCESS_MICROS : -MARK_EXCESS_MICROS;
|
||||
|
||||
if (matchTicks(tCurrentTimingWith, (sBiphaseTimeUnit) + tMarkExcessCorrection)) {
|
||||
sCurrentTimingIntervals = 1;
|
||||
|
@ -655,7 +658,7 @@ uint8_t IRrecv::getBiphaselevel() {
|
|||
* Use a tolerance of 20% to enable e.g. 500 and 600 (NEC timing) to be equal
|
||||
* @return 0 if newval is shorter, 1 if newval is equal, and 2 if newval is longer
|
||||
*/
|
||||
uint8_t IRrecv::compare(unsigned int oldval, unsigned int newval) {
|
||||
uint_fast8_t IRrecv::compare(unsigned int oldval, unsigned int newval) {
|
||||
if (newval * 10 < oldval * 8) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -694,12 +697,12 @@ bool IRrecv::decodeHash() {
|
|||
return false;
|
||||
}
|
||||
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
|
||||
uint8_t i;
|
||||
uint_fast8_t i;
|
||||
#else
|
||||
uint16_t i;
|
||||
unsigned int i;
|
||||
#endif
|
||||
for (i = 1; (i + 2) < decodedIRData.rawDataPtr->rawlen; i++) {
|
||||
uint8_t value = compare(decodedIRData.rawDataPtr->rawbuf[i], decodedIRData.rawDataPtr->rawbuf[i + 2]);
|
||||
uint_fast8_t value = compare(decodedIRData.rawDataPtr->rawbuf[i], decodedIRData.rawDataPtr->rawbuf[i + 2]);
|
||||
// Add value into the hash
|
||||
hash = (hash * FNV_PRIME_32) ^ value;
|
||||
}
|
||||
|
@ -719,8 +722,13 @@ bool IRrecv::decodeHashOld(decode_results *aResults) {
|
|||
return false;
|
||||
}
|
||||
|
||||
for (unsigned int i = 1; (i + 2) < aResults->rawlen; i++) {
|
||||
uint8_t value = compare(aResults->rawbuf[i], aResults->rawbuf[i + 2]);
|
||||
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
|
||||
uint_fast8_t i;
|
||||
#else
|
||||
unsigned int i;
|
||||
#endif
|
||||
for (i = 1; i < aResults->rawlen - 2; i++) {
|
||||
uint_fast8_t value = compare(aResults->rawbuf[i], aResults->rawbuf[i + 2]);
|
||||
// Add value into the hash
|
||||
hash = (hash * FNV_PRIME_32) ^ value;
|
||||
}
|
||||
|
@ -741,7 +749,7 @@ bool IRrecv::decodeHashOld(decode_results *aResults) {
|
|||
* Match function without compensating for marks exceeded or spaces shortened by demodulator hardware
|
||||
* Currently not used
|
||||
*/
|
||||
bool matchTicks(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
|
||||
bool matchTicks(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros) {
|
||||
#if defined(TRACE)
|
||||
Serial.print(F("Testing: "));
|
||||
Serial.print(TICKS_LOW(aMatchValueMicros), DEC);
|
||||
|
@ -761,14 +769,14 @@ bool matchTicks(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
|
|||
return passed;
|
||||
}
|
||||
|
||||
bool MATCH(uint16_t measured_ticks, uint16_t desired_us) {
|
||||
bool MATCH(unsigned int measured_ticks, unsigned int desired_us) {
|
||||
return matchTicks(measured_ticks, desired_us);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compensate for marks exceeded by demodulator hardware
|
||||
*/
|
||||
bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
|
||||
bool matchMark(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros) {
|
||||
#if defined(TRACE)
|
||||
Serial.print(F("Testing mark (actual vs desired): "));
|
||||
Serial.print(aMeasuredTicks * MICROS_PER_TICK, DEC);
|
||||
|
@ -794,14 +802,14 @@ bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
|
|||
return passed;
|
||||
}
|
||||
|
||||
bool MATCH_MARK(uint16_t measured_ticks, uint16_t desired_us) {
|
||||
bool MATCH_MARK(unsigned int measured_ticks, unsigned int desired_us) {
|
||||
return matchMark(measured_ticks, desired_us);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compensate for spaces shortened by demodulator hardware
|
||||
*/
|
||||
bool matchSpace(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
|
||||
bool matchSpace(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros) {
|
||||
#if defined(TRACE)
|
||||
Serial.print(F("Testing space (actual vs desired): "));
|
||||
Serial.print(aMeasuredTicks * MICROS_PER_TICK, DEC);
|
||||
|
@ -827,7 +835,7 @@ bool matchSpace(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
|
|||
return passed;
|
||||
}
|
||||
|
||||
bool MATCH_SPACE(uint16_t measured_ticks, uint16_t desired_us) {
|
||||
bool MATCH_SPACE(unsigned int measured_ticks, unsigned int desired_us) {
|
||||
return matchSpace(measured_ticks, desired_us);
|
||||
}
|
||||
|
||||
|
@ -923,7 +931,7 @@ void printActiveIRProtocols(Print *aSerial) {
|
|||
*
|
||||
* @param aSerial The Print object on which to write, for Arduino you can use &Serial.
|
||||
*/
|
||||
void printIRResultShort(Print *aSerial, IRData *aIRDataPtr, uint16_t aLeadingSpaceTicks) {
|
||||
void printIRResultShort(Print *aSerial, IRData *aIRDataPtr, unsigned int aLeadingSpaceTicks) {
|
||||
aSerial->print(F("Protocol="));
|
||||
aSerial->print(getProtocolString(aIRDataPtr->protocol));
|
||||
if (aIRDataPtr->protocol == UNKNOWN) {
|
||||
|
@ -1068,9 +1076,9 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
|
|||
aSerial->print(F(" -"));
|
||||
aSerial->println(tDurationMicros, DEC);
|
||||
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
|
||||
uint8_t i;
|
||||
uint_fast8_t i;
|
||||
#else
|
||||
uint16_t i;
|
||||
unsigned int i;
|
||||
#endif
|
||||
for (i = 1; i < decodedIRData.rawDataPtr->rawlen; i++) {
|
||||
if (aOutputMicrosecondsInsteadOfTicks) {
|
||||
|
@ -1129,9 +1137,9 @@ void IRrecv::compensateAndPrintIRResultAsCArray(Print *aSerial, bool aOutputMicr
|
|||
|
||||
// Dump data
|
||||
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
|
||||
uint8_t i;
|
||||
uint_fast8_t i;
|
||||
#else
|
||||
uint16_t i;
|
||||
unsigned int i;
|
||||
#endif
|
||||
for (i = 1; i < decodedIRData.rawDataPtr->rawlen; i++) {
|
||||
uint32_t tDuration = decodedIRData.rawDataPtr->rawbuf[i] * MICROS_PER_TICK;
|
||||
|
@ -1146,7 +1154,7 @@ void IRrecv::compensateAndPrintIRResultAsCArray(Print *aSerial, bool aOutputMicr
|
|||
if (aOutputMicrosecondsInsteadOfTicks) {
|
||||
aSerial->print(tDuration);
|
||||
} else {
|
||||
uint16_t tTicks = (tDuration + (MICROS_PER_TICK / 2)) / MICROS_PER_TICK;
|
||||
unsigned int tTicks = (tDuration + (MICROS_PER_TICK / 2)) / MICROS_PER_TICK;
|
||||
tTicks = (tTicks > UINT8_MAX) ? UINT8_MAX : tTicks; // uint8_t rawTicks above are 8 bit
|
||||
aSerial->print(tTicks);
|
||||
}
|
||||
|
@ -1180,9 +1188,9 @@ void IRrecv::compensateAndStoreIRResultInArray(uint8_t *aArrayPtr) {
|
|||
|
||||
// Store data, skip leading space#
|
||||
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
|
||||
uint8_t i;
|
||||
uint_fast8_t i;
|
||||
#else
|
||||
uint16_t i;
|
||||
unsigned int i;
|
||||
#endif
|
||||
for (i = 1; i < decodedIRData.rawDataPtr->rawlen; i++) {
|
||||
uint32_t tDuration = decodedIRData.rawDataPtr->rawbuf[i] * MICROS_PER_TICK;
|
||||
|
@ -1193,7 +1201,7 @@ void IRrecv::compensateAndStoreIRResultInArray(uint8_t *aArrayPtr) {
|
|||
tDuration += MARK_EXCESS_MICROS;
|
||||
}
|
||||
|
||||
uint16_t tTicks = (tDuration + (MICROS_PER_TICK / 2)) / MICROS_PER_TICK;
|
||||
unsigned int tTicks = (tDuration + (MICROS_PER_TICK / 2)) / MICROS_PER_TICK;
|
||||
*aArrayPtr = (tTicks > UINT8_MAX) ? UINT8_MAX : tTicks; // we store it in an 8 bit array
|
||||
aArrayPtr++;
|
||||
}
|
||||
|
@ -1351,7 +1359,7 @@ ISR () // for functions definitions which are called by separate (board specific
|
|||
#if defined(__AVR__)
|
||||
uint8_t tIRInputLevel = *irparams.IRReceivePinPortInputRegister & irparams.IRReceivePinMask;
|
||||
#else
|
||||
uint8_t tIRInputLevel = (uint8_t) digitalRead(irparams.IRReceivePin);
|
||||
uint_fast8_t tIRInputLevel = (uint_fast8_t) digitalRead(irparams.IRReceivePin);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1472,7 +1480,7 @@ bool IRrecv::decode(decode_results *aResults) {
|
|||
// Copy overflow flag to decodedIRData.flags
|
||||
irparams.OverflowFlag = false;
|
||||
irparams.rawlen = 0; // otherwise we have OverflowFlag again at next ISR call
|
||||
IR_DEBUG_PRINTLN("Overflow happened");
|
||||
IR_DEBUG_PRINTLN(F("Overflow happened"));
|
||||
}
|
||||
aResults->overflow = irparams.OverflowFlag;
|
||||
aResults->value = 0;
|
||||
|
@ -1480,26 +1488,26 @@ bool IRrecv::decode(decode_results *aResults) {
|
|||
decodedIRData.flags = IRDATA_FLAGS_IS_MSB_FIRST; // for print
|
||||
|
||||
#if defined(DECODE_NEC)
|
||||
IR_DEBUG_PRINTLN("Attempting old NEC decode");
|
||||
IR_DEBUG_PRINTLN(F("Attempting old NEC decode"));
|
||||
if (decodeNECMSB(aResults)) {
|
||||
return true ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_SONY)
|
||||
IR_DEBUG_PRINTLN("Attempting old Sony decode");
|
||||
IR_DEBUG_PRINTLN(F("Attempting old Sony decode"));
|
||||
if (decodeSonyMSB(aResults)) {
|
||||
return true ;
|
||||
}
|
||||
#endif
|
||||
|
||||
//#if defined(DECODE_MITSUBISHI)
|
||||
// IR_DEBUG_PRINTLN("Attempting Mitsubishi decode");
|
||||
// IR_DEBUG_PRINTLN(F("Attempting Mitsubishi decode"));
|
||||
// if (decodeMitsubishi(results)) return true ;
|
||||
//#endif
|
||||
|
||||
#if defined(DECODE_RC5)
|
||||
IR_DEBUG_PRINTLN("Attempting RC5 decode");
|
||||
IR_DEBUG_PRINTLN(F("Attempting RC5 decode"));
|
||||
if (decodeRC5()) {
|
||||
aResults->bits = decodedIRData.numberOfBits;
|
||||
aResults->value = decodedIRData.decodedRawData;
|
||||
|
@ -1510,7 +1518,7 @@ bool IRrecv::decode(decode_results *aResults) {
|
|||
#endif
|
||||
|
||||
#if defined(DECODE_RC6)
|
||||
IR_DEBUG_PRINTLN("Attempting RC6 decode");
|
||||
IR_DEBUG_PRINTLN(F("Attempting RC6 decode"));
|
||||
if (decodeRC6()) {
|
||||
aResults->bits = decodedIRData.numberOfBits;
|
||||
aResults->value = decodedIRData.decodedRawData;
|
||||
|
@ -1520,45 +1528,45 @@ bool IRrecv::decode(decode_results *aResults) {
|
|||
#endif
|
||||
|
||||
#if defined( DECODE_PANASONIC)
|
||||
IR_DEBUG_PRINTLN("Attempting old Panasonic decode");
|
||||
IR_DEBUG_PRINTLN(F("Attempting old Panasonic decode"));
|
||||
if (decodePanasonicMSB(aResults)) {
|
||||
return true ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_LG)
|
||||
IR_DEBUG_PRINTLN("Attempting old LG decode");
|
||||
IR_DEBUG_PRINTLN(F("Attempting old LG decode"));
|
||||
if (decodeLGMSB(aResults)) { return true ;}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_JVC)
|
||||
IR_DEBUG_PRINTLN("Attempting old JVC decode");
|
||||
IR_DEBUG_PRINTLN(F("Attempting old JVC decode"));
|
||||
if (decodeJVCMSB(aResults)) {
|
||||
return true ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DECODE_SAMSUNG)
|
||||
IR_DEBUG_PRINTLN("Attempting old SAMSUNG decode");
|
||||
IR_DEBUG_PRINTLN(F("Attempting old SAMSUNG decode"));
|
||||
if (decodeSAMSUNG(aResults)) {
|
||||
return true ;
|
||||
}
|
||||
#endif
|
||||
|
||||
//#if defined(DECODE_WHYNTER)
|
||||
// IR_DEBUG_PRINTLN("Attempting Whynter decode");
|
||||
// IR_DEBUG_PRINTLN(F("Attempting Whynter decode"));
|
||||
// if (decodeWhynter(results)) return true ;
|
||||
//#endif
|
||||
|
||||
#if defined(DECODE_DENON)
|
||||
IR_DEBUG_PRINTLN("Attempting old Denon decode");
|
||||
IR_DEBUG_PRINTLN(F("Attempting old Denon decode"));
|
||||
if (decodeDenonOld(aResults)) {
|
||||
return true ;
|
||||
}
|
||||
#endif
|
||||
|
||||
//#if defined(DECODE_LEGO_PF)
|
||||
// IR_DEBUG_PRINTLN("Attempting Lego Power Functions");
|
||||
// IR_DEBUG_PRINTLN(F("Attempting Lego Power Functions"));
|
||||
// if (decodeLegoPowerFunctions(results)) return true ;
|
||||
//#endif
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ void IRsend::begin(){
|
|||
/**
|
||||
* @param aFeedbackLEDPin if 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
|
||||
*/
|
||||
void IRsend::begin(bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin) {
|
||||
void IRsend::begin(bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin) {
|
||||
#if !defined(NO_LED_FEEDBACK_CODE)
|
||||
bool tEnableLEDFeedback = DO_NOT_ENABLE_LED_FEEDBACK;
|
||||
if(aEnableLEDFeedback) {
|
||||
|
@ -85,7 +85,7 @@ void IRsend::begin(bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin) {
|
|||
}
|
||||
|
||||
#else // defined(IR_SEND_PIN)
|
||||
IRsend::IRsend(uint8_t aSendPin) { // @suppress("Class members should be properly initialized")
|
||||
IRsend::IRsend(uint_fast8_t aSendPin) { // @suppress("Class members should be properly initialized")
|
||||
sendPin = aSendPin;
|
||||
# if !defined(NO_LED_FEEDBACK_CODE)
|
||||
setLEDFeedback(0, DO_NOT_ENABLE_LED_FEEDBACK);
|
||||
|
@ -96,14 +96,14 @@ IRsend::IRsend(uint8_t aSendPin) { // @suppress("Class members should be properl
|
|||
* Initializes the send pin and enable LED feedback with board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
|
||||
* @param aSendPin The Arduino pin number, where a IR sender diode is connected.
|
||||
*/
|
||||
void IRsend::begin(uint8_t aSendPin) {
|
||||
void IRsend::begin(uint_fast8_t aSendPin) {
|
||||
sendPin = aSendPin;
|
||||
# if !defined(NO_LED_FEEDBACK_CODE)
|
||||
setLEDFeedback(USE_DEFAULT_FEEDBACK_LED_PIN, LED_FEEDBACK_ENABLED_FOR_SEND);
|
||||
# endif
|
||||
}
|
||||
|
||||
void IRsend::setSendPin(uint8_t aSendPin) {
|
||||
void IRsend::setSendPin(uint_fast8_t aSendPin) {
|
||||
sendPin = aSendPin;
|
||||
}
|
||||
#endif // defined(IR_SEND_PIN)
|
||||
|
@ -113,7 +113,7 @@ void IRsend::setSendPin(uint8_t aSendPin) {
|
|||
* @param aSendPin The Arduino pin number, where a IR sender diode is connected.
|
||||
* @param aFeedbackLEDPin if 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
|
||||
*/
|
||||
void IRsend::begin(uint8_t aSendPin, bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin) {
|
||||
void IRsend::begin(uint_fast8_t aSendPin, bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin) {
|
||||
#if defined(IR_SEND_PIN)
|
||||
(void) aSendPin; // for backwards compatibility
|
||||
#else
|
||||
|
@ -293,7 +293,7 @@ void IRsend::sendRaw_P(const uint16_t aBufferWithMicroseconds[], uint_fast8_t aL
|
|||
* Raw data starts with a mark
|
||||
*/
|
||||
for (uint_fast8_t i = 0; i < aLengthOfBuffer; i++) {
|
||||
uint16_t duration = pgm_read_word(&aBufferWithMicroseconds[i]);
|
||||
unsigned int duration = pgm_read_word(&aBufferWithMicroseconds[i]);
|
||||
if (i & 1) {
|
||||
// Odd
|
||||
space(duration);
|
||||
|
@ -317,7 +317,7 @@ void IRsend::sendRaw_P(const uint8_t aBufferWithTicks[], uint_fast8_t aLengthOfB
|
|||
enableIROut(aIRFrequencyKilohertz);
|
||||
|
||||
for (uint_fast8_t i = 0; i < aLengthOfBuffer; i++) {
|
||||
uint16_t duration = pgm_read_byte(&aBufferWithTicks[i]) * (uint16_t) MICROS_PER_TICK;
|
||||
unsigned int duration = pgm_read_byte(&aBufferWithTicks[i]) * (unsigned int ) MICROS_PER_TICK;
|
||||
if (i & 1) {
|
||||
// Odd
|
||||
space(duration);
|
||||
|
@ -334,7 +334,7 @@ void IRsend::sendRaw_P(const uint8_t aBufferWithTicks[], uint_fast8_t aLengthOfB
|
|||
* The output always ends with a space
|
||||
*/
|
||||
void IRsend::sendPulseDistanceWidthData(unsigned int aOneMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroMarkMicros,
|
||||
unsigned int aZeroSpaceMicros, uint32_t aData, uint8_t aNumberOfBits, bool aMSBfirst, bool aSendStopBit) {
|
||||
unsigned int aZeroSpaceMicros, uint32_t aData, uint_fast8_t aNumberOfBits, bool aMSBfirst, bool aSendStopBit) {
|
||||
|
||||
if (aMSBfirst) { // Send the MSB first.
|
||||
// send data from MSB to LSB until mask bit is shifted out
|
||||
|
@ -365,7 +365,7 @@ void IRsend::sendPulseDistanceWidthData(unsigned int aOneMarkMicros, unsigned in
|
|||
IR_TRACE_PRINT('S');
|
||||
mark(aZeroMarkMicros); // seems like this is used for stop bits
|
||||
}
|
||||
IR_TRACE_PRINTLN("");
|
||||
IR_TRACE_PRINTLN(F(""));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -381,7 +381,7 @@ void IRsend::sendBiphaseData(unsigned int aBiphaseTimeUnit, uint32_t aData, uint
|
|||
mark(aBiphaseTimeUnit);
|
||||
|
||||
IR_TRACE_PRINT('S');
|
||||
uint8_t tLastBitValue = 1; // Start bit is a 1
|
||||
uint_fast8_t tLastBitValue = 1; // Start bit is a 1
|
||||
|
||||
// Data - Biphase code MSB first
|
||||
for (uint32_t tMask = 1UL << (aNumberOfBits - 1); tMask; tMask >>= 1) {
|
||||
|
@ -408,7 +408,7 @@ void IRsend::sendBiphaseData(unsigned int aBiphaseTimeUnit, uint32_t aData, uint
|
|||
tLastBitValue = 0;
|
||||
}
|
||||
}
|
||||
IR_TRACE_PRINTLN("");
|
||||
IR_TRACE_PRINTLN(F(""));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -606,7 +606,7 @@ void IRsend::customDelayMicroseconds(unsigned long aMicroseconds) {
|
|||
* A few hours staring at the ATmega documentation and this will all make sense.
|
||||
* See my Secrets of Arduino PWM at http://www.righto.com/2009/07/secrets-of-arduino-pwm.html for details.
|
||||
*/
|
||||
void IRsend::enableIROut(uint8_t aFrequencyKHz) {
|
||||
void IRsend::enableIROut(uint_fast8_t aFrequencyKHz) {
|
||||
#if defined(SEND_PWM_BY_TIMER)
|
||||
timerConfigForSend(aFrequencyKHz); // must set output pin mode and disable receive interrupt if required, e.g. uses the same resource
|
||||
|
||||
|
|
|
@ -65,9 +65,17 @@
|
|||
#ifndef _IR_REMOTE_HPP
|
||||
#define _IR_REMOTE_HPP
|
||||
|
||||
#define VERSION_IRREMOTE "3.6.1"
|
||||
#define VERSION_IRREMOTE "3.7.0"
|
||||
#define VERSION_IRREMOTE_MAJOR 3
|
||||
#define VERSION_IRREMOTE_MINOR 6
|
||||
#define VERSION_IRREMOTE_MINOR 7
|
||||
#define VERSION_IRREMOTE_PATCH 0
|
||||
|
||||
/*
|
||||
* Macro to convert 3 version parts into an integer
|
||||
* To be used in preprocessor comparisons, such as #if VERSION_IRREMOTE_HEX >= VERSION_HEX_VALUE(3, 7, 0)
|
||||
*/
|
||||
#define VERSION_HEX_VALUE(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
|
||||
#define VERSION_IRREMOTE_HEX VERSION_HEX_VALUE(VERSION_IRREMOTE_MAJOR, VERSION_IRREMOTE_MINOR, VERSION_IRREMOTE_PATCH)
|
||||
|
||||
// activate it for all cores that does not use the -flto flag, if you get false error messages regarding begin() during compilation.
|
||||
//#define SUPPRESS_ERROR_MESSAGE_FOR_BEGIN
|
||||
|
|
|
@ -81,20 +81,20 @@
|
|||
struct irparams_struct {
|
||||
// The fields are ordered to reduce memory over caused by struct-padding
|
||||
volatile uint8_t StateForISR; ///< State Machine state
|
||||
uint8_t IRReceivePin; ///< Pin connected to IR data from detector
|
||||
uint_fast8_t IRReceivePin; ///< Pin connected to IR data from detector
|
||||
#if defined(__AVR__)
|
||||
volatile uint8_t *IRReceivePinPortInputRegister;
|
||||
uint8_t IRReceivePinMask;
|
||||
#endif
|
||||
uint16_t TickCounterForISR; ///< Counts 50uS ticks. The value is copied into the rawbuf array on every transition.
|
||||
uint_fast16_t TickCounterForISR; ///< Counts 50uS ticks. The value is copied into the rawbuf array on every transition.
|
||||
|
||||
bool OverflowFlag; ///< Raw buffer OverflowFlag occurred
|
||||
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
|
||||
uint8_t rawlen; ///< counter of entries in rawbuf
|
||||
uint_fast8_t rawlen; ///< counter of entries in rawbuf
|
||||
#else
|
||||
unsigned int rawlen; ///< counter of entries in rawbuf
|
||||
uint_fast16_t rawlen; ///< counter of entries in rawbuf
|
||||
#endif
|
||||
uint16_t rawbuf[RAW_BUFFER_LENGTH]; ///< raw data / tick counts per mark/space, first entry is the length of the gap between previous and current command
|
||||
unsigned int rawbuf[RAW_BUFFER_LENGTH]; ///< raw data / tick counts per mark/space, first entry is the length of the gap between previous and current command
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -183,8 +183,8 @@ struct decode_results {
|
|||
bool isRepeat; // deprecated, moved to decodedIRData.flags ///< True if repeat of value is detected
|
||||
|
||||
// next 3 values are copies of irparams values - see IRremoteint.h
|
||||
uint16_t *rawbuf; // deprecated, moved to decodedIRData.rawDataPtr->rawbuf ///< Raw intervals in 50uS ticks
|
||||
uint16_t rawlen; // deprecated, moved to decodedIRData.rawDataPtr->rawlen ///< Number of records in rawbuf
|
||||
unsigned int *rawbuf; // deprecated, moved to decodedIRData.rawDataPtr->rawbuf ///< Raw intervals in 50uS ticks
|
||||
uint_fast8_t rawlen; // deprecated, moved to decodedIRData.rawDataPtr->rawlen ///< Number of records in rawbuf
|
||||
bool overflow; // deprecated, moved to decodedIRData.flags ///< true if IR raw code too long
|
||||
};
|
||||
|
||||
|
@ -195,9 +195,9 @@ class IRrecv {
|
|||
public:
|
||||
|
||||
IRrecv();
|
||||
IRrecv(uint8_t aReceivePin);
|
||||
IRrecv(uint8_t aReceivePin, uint8_t aFeedbackLEDPin);
|
||||
void setReceivePin(uint8_t aReceivePinNumber);
|
||||
IRrecv(uint_fast8_t aReceivePin);
|
||||
IRrecv(uint_fast8_t aReceivePin, uint_fast8_t aFeedbackLEDPin);
|
||||
void setReceivePin(uint_fast8_t aReceivePinNumber);
|
||||
|
||||
void enableIRIn();
|
||||
void disableIRIn();
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
/*
|
||||
* Stream like API
|
||||
*/
|
||||
void begin(uint8_t aReceivePin, bool aEnableLEDFeedback = false, uint8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN);
|
||||
void begin(uint_fast8_t aReceivePin, bool aEnableLEDFeedback = false, uint_fast8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN);
|
||||
void start(); // alias for enableIRIn
|
||||
void start(uint32_t aMicrosecondsToAddToGapCounter);
|
||||
bool available();
|
||||
|
@ -243,17 +243,17 @@ public:
|
|||
/*
|
||||
* The main decoding functions used by the individual decoders
|
||||
*/
|
||||
bool decodePulseDistanceData(uint8_t aNumberOfBits, uint8_t aStartOffset, uint16_t aBitMarkMicros, uint16_t aOneSpaceMicros,
|
||||
uint16_t aZeroSpaceMicros, bool aMSBfirst);
|
||||
bool decodePulseDistanceData(uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset, unsigned int aBitMarkMicros, unsigned int aOneSpaceMicros,
|
||||
unsigned int aZeroSpaceMicros, bool aMSBfirst);
|
||||
|
||||
bool decodePulseWidthData(uint8_t aNumberOfBits, uint8_t aStartOffset, uint16_t aOneMarkMicros, uint16_t aZeroMarkMicros,
|
||||
uint16_t aBitSpaceMicros, bool aMSBfirst);
|
||||
bool decodePulseWidthData(uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset, unsigned int aOneMarkMicros, unsigned int aZeroMarkMicros,
|
||||
unsigned int aBitSpaceMicros, bool aMSBfirst);
|
||||
|
||||
bool decodeBiPhaseData(uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset, uint_fast8_t aStartClockCount,
|
||||
uint_fast8_t aValueOfSpaceToMarkTransition, uint16_t aBiphaseTimeUnit);
|
||||
uint_fast8_t aValueOfSpaceToMarkTransition, unsigned int aBiphaseTimeUnit);
|
||||
|
||||
void initBiphaselevel(uint8_t aRCDecodeRawbuffOffset, uint16_t aBiphaseTimeUnit);
|
||||
uint8_t getBiphaselevel();
|
||||
void initBiphaselevel(uint_fast8_t aRCDecodeRawbuffOffset, unsigned int aBiphaseTimeUnit);
|
||||
uint_fast8_t getBiphaselevel();
|
||||
|
||||
/*
|
||||
* All standard (decode address + command) protocol decoders
|
||||
|
@ -304,7 +304,7 @@ public:
|
|||
* Internal functions
|
||||
*/
|
||||
void initDecodedIRData();
|
||||
uint8_t compare(unsigned int oldval, unsigned int newval);
|
||||
uint_fast8_t compare(unsigned int oldval, unsigned int newval);
|
||||
|
||||
IRData decodedIRData; // New: decoded IR data for the application
|
||||
|
||||
|
@ -316,25 +316,25 @@ public:
|
|||
uint8_t repeatCount; // Used e.g. for Denon decode for autorepeat decoding.
|
||||
};
|
||||
|
||||
extern uint8_t sBiphaseDecodeRawbuffOffset; //
|
||||
extern uint_fast8_t sBiphaseDecodeRawbuffOffset; //
|
||||
|
||||
/*
|
||||
* Mark & Space matching functions
|
||||
*/
|
||||
bool matchTicks(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros);
|
||||
bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros);
|
||||
bool matchSpace(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros);
|
||||
bool matchTicks(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros);
|
||||
bool matchMark(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros);
|
||||
bool matchSpace(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros);
|
||||
|
||||
/*
|
||||
* Old function names
|
||||
*/
|
||||
bool MATCH(uint16_t measured, uint16_t desired);
|
||||
bool MATCH_MARK(uint16_t measured_ticks, uint16_t desired_us);
|
||||
bool MATCH_SPACE(uint16_t measured_ticks, uint16_t desired_us);
|
||||
bool MATCH(unsigned int measured, unsigned int desired);
|
||||
bool MATCH_MARK(unsigned int measured_ticks, unsigned int desired_us);
|
||||
bool MATCH_SPACE(unsigned int measured_ticks, unsigned int desired_us);
|
||||
|
||||
int getMarkExcessMicros();
|
||||
void printActiveIRProtocols(Print *aSerial);
|
||||
void printIRResultShort(Print *aSerial, IRData *aIRDataPtr, uint16_t aLeadingSpaceDuration = 0);
|
||||
void printIRResultShort(Print *aSerial, IRData *aIRDataPtr, unsigned int aLeadingSpaceDuration = 0);
|
||||
|
||||
/****************************************************
|
||||
* Feedback LED related functions
|
||||
|
@ -377,8 +377,8 @@ void setBlinkPin(uint8_t aFeedbackLEDPin) __attribute__ ((deprecated ("Please us
|
|||
#define TICKS_LOW(us) ((us)/67 ) // (us) / ((MICROS_PER_TICK:50 / LTOL:75 ) * 100)
|
||||
#define TICKS_HIGH(us) (((us)/40) + 1) // (us) / ((MICROS_PER_TICK:50 / UTOL:125) * 100) + 1
|
||||
#else
|
||||
#define TICKS_LOW(us) ((uint16_t) ((long) (us) * LTOL / (MICROS_PER_TICK * 100) ))
|
||||
#define TICKS_HIGH(us) ((uint16_t) ((long) (us) * UTOL / (MICROS_PER_TICK * 100) + 1))
|
||||
#define TICKS_LOW(us) ((unsigned int ) ((long) (us) * LTOL / (MICROS_PER_TICK * 100) ))
|
||||
#define TICKS_HIGH(us) ((unsigned int ) ((long) (us) * UTOL / (MICROS_PER_TICK * 100) + 1))
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -409,22 +409,22 @@ public:
|
|||
*/
|
||||
#if defined(IR_SEND_PIN) || (defined(SEND_PWM_BY_TIMER) && !(defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)))
|
||||
void begin();
|
||||
void begin(bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN);
|
||||
void begin(bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN);
|
||||
#else
|
||||
IRsend(uint8_t aSendPin);
|
||||
void begin(uint8_t aSendPin);
|
||||
void setSendPin(uint8_t aSendPinNumber); // required if we use IRsend() as constructor
|
||||
IRsend(uint_fast8_t aSendPin);
|
||||
void begin(uint_fast8_t aSendPin);
|
||||
void setSendPin(uint_fast8_t aSendPinNumber); // required if we use IRsend() as constructor
|
||||
#endif
|
||||
|
||||
// Not guarded for backward compatibility
|
||||
void begin(uint8_t aSendPin, bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN);
|
||||
void begin(uint_fast8_t aSendPin, bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN);
|
||||
|
||||
size_t write(IRData *aIRSendData, uint_fast8_t aNumberOfRepeats = NO_REPEATS);
|
||||
|
||||
void enableIROut(uint8_t aFrequencyKHz);
|
||||
void enableIROut(uint_fast8_t aFrequencyKHz);
|
||||
|
||||
void sendPulseDistanceWidthData(unsigned int aOneMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroMarkMicros,
|
||||
unsigned int aZeroSpaceMicros, uint32_t aData, uint8_t aNumberOfBits, bool aMSBfirst, bool aSendStopBit = false);
|
||||
unsigned int aZeroSpaceMicros, uint32_t aData, uint_fast8_t aNumberOfBits, bool aMSBfirst, bool aSendStopBit = false);
|
||||
void sendBiphaseData(unsigned int aBiphaseTimeUnit, uint32_t aData, uint_fast8_t aNumberOfBits);
|
||||
|
||||
void mark(unsigned int aMarkMicros);
|
||||
|
|
|
@ -82,28 +82,28 @@ bool IRrecv::decodeBoseWave() {
|
|||
|
||||
// Check we have enough data +4 for initial gap, start bit mark and space + stop bit mark
|
||||
if (decodedIRData.rawDataPtr->rawlen != (2 * BOSEWAVE_BITS) + 4) {
|
||||
IR_DEBUG_PRINT("Bose: ");
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Bose: "));
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not 36");
|
||||
IR_DEBUG_PRINTLN(F(" is not 36"));
|
||||
return false;
|
||||
}
|
||||
// Check header "space"
|
||||
if (!matchSpace(decodedIRData.rawDataPtr->rawbuf[2], BOSEWAVE_HEADER_SPACE)) {
|
||||
IR_DEBUG_PRINT("Bose: ");
|
||||
IR_DEBUG_PRINTLN("Header space length is wrong");
|
||||
IR_DEBUG_PRINT(F("Bose: "));
|
||||
IR_DEBUG_PRINTLN(F("Header space length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!decodePulseDistanceData(BOSEWAVE_BITS, 3, BOSEWAVE_BIT_MARK, BOSEWAVE_ONE_SPACE, BOSEWAVE_ZERO_SPACE, PROTOCOL_IS_LSB_FIRST)) {
|
||||
IR_DEBUG_PRINT("Bose: ");
|
||||
IR_DEBUG_PRINTLN("Decode failed");
|
||||
IR_DEBUG_PRINT(F("Bose: "));
|
||||
IR_DEBUG_PRINTLN(F("Decode failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Stop bit
|
||||
if (!matchMark(decodedIRData.rawDataPtr->rawbuf[3 + (2 * BOSEWAVE_BITS)], BOSEWAVE_BIT_MARK)) {
|
||||
IR_DEBUG_PRINT("Bose: ");
|
||||
IR_DEBUG_PRINT(F("Bose: "));
|
||||
IR_DEBUG_PRINTLN(F("Stop bit mark length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
@ -115,8 +115,8 @@ bool IRrecv::decodeBoseWave() {
|
|||
uint8_t tCommandInverted = tDecodedValue >> 8;
|
||||
// parity check for command. Use this variant to avoid compiler warning "comparison of promoted ~unsigned with unsigned [-Wsign-compare]"
|
||||
if ((tCommandNotInverted ^ tCommandInverted) != 0xFF) {
|
||||
IR_DEBUG_PRINT("Bose: ");
|
||||
IR_DEBUG_PRINT("Command and inverted command check failed");
|
||||
IR_DEBUG_PRINT(F("Bose: "));
|
||||
IR_DEBUG_PRINT(F("Command and inverted command check failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,22 +139,22 @@ bool IRrecv::decodeDenon() {
|
|||
// Check we have the right amount of data (32). The + 2 is for initial gap + stop bit mark
|
||||
if (decodedIRData.rawDataPtr->rawlen != (2 * DENON_BITS) + 2) {
|
||||
IR_DEBUG_PRINT(F("Denon: "));
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not 32");
|
||||
IR_DEBUG_PRINTLN(F(" is not 32"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read the bits in
|
||||
if (!decodePulseDistanceData(DENON_BITS, 1, DENON_BIT_MARK, DENON_ONE_SPACE, DENON_ZERO_SPACE, PROTOCOL_IS_MSB_FIRST)) {
|
||||
IR_DEBUG_PRINT("Denon: ");
|
||||
IR_DEBUG_PRINTLN("Decode failed");
|
||||
IR_DEBUG_PRINT(F("Denon: "));
|
||||
IR_DEBUG_PRINTLN(F("Decode failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for stop mark
|
||||
if (!matchMark(decodedIRData.rawDataPtr->rawbuf[(2 * DENON_BITS) + 1], DENON_HEADER_MARK)) {
|
||||
IR_DEBUG_PRINT("Denon: ");
|
||||
IR_DEBUG_PRINT(F("Denon: "));
|
||||
IR_DEBUG_PRINTLN(F("Stop bit mark length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -125,10 +125,10 @@ bool IRrecv::decodeDistance() {
|
|||
* Accept only protocols with at least 8 bits
|
||||
*/
|
||||
if (decodedIRData.rawDataPtr->rawlen < (2 * 8) + 4) {
|
||||
IR_DEBUG_PRINT("PULSE_DISTANCE: ");
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("PULSE_DISTANCE: "));
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is less than 20");
|
||||
IR_DEBUG_PRINTLN(F(" is less than 20"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,9 +106,9 @@ bool IRrecv::decodeJVC() {
|
|||
// Check we have the right amount of data (36 or 34). The +4 is for initial gap, start bit mark and space + stop bit mark. +2 is for repeats
|
||||
if (decodedIRData.rawDataPtr->rawlen != ((2 * JVC_BITS) + 4) && decodedIRData.rawDataPtr->rawlen != ((2 * JVC_BITS) + 2)) {
|
||||
IR_DEBUG_PRINT(F("JVC: "));
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not 34 or 36");
|
||||
IR_DEBUG_PRINTLN(F(" is not 34 or 36"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -133,8 +133,8 @@ bool IRrecv::decodeJVC() {
|
|||
// Check header "mark" and "space"
|
||||
if (!matchMark(decodedIRData.rawDataPtr->rawbuf[1], JVC_HEADER_MARK)
|
||||
|| !matchSpace(decodedIRData.rawDataPtr->rawbuf[2], JVC_HEADER_SPACE)) {
|
||||
IR_DEBUG_PRINT("JVC: ");
|
||||
IR_DEBUG_PRINTLN("Header mark or space length is wrong");
|
||||
IR_DEBUG_PRINT(F("JVC: "));
|
||||
IR_DEBUG_PRINTLN(F("Header mark or space length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -179,9 +179,9 @@ bool IRrecv::decodeJVCMSB(decode_results *aResults) {
|
|||
|
||||
// Check we have enough data - +3 for start bit mark and space + stop bit mark
|
||||
if (aResults->rawlen <= (2 * JVC_BITS) + 3) {
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(aResults->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is too small. >= 36 is required.");
|
||||
IR_DEBUG_PRINTLN(F(" is too small. >= 36 is required."));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -170,29 +170,29 @@ bool IRrecv::decodeKaseikyo() {
|
|||
// Check we have enough data (100)- +4 for initial gap, start bit mark and space + stop bit mark
|
||||
if (decodedIRData.rawDataPtr->rawlen != ((2 * KASEIKYO_BITS) + 4)) {
|
||||
IR_DEBUG_PRINT(F("Kaseikyo: "));
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not 100");
|
||||
IR_DEBUG_PRINTLN(F(" is not 100"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!matchMark(decodedIRData.rawDataPtr->rawbuf[1], KASEIKYO_HEADER_MARK)) {
|
||||
IR_DEBUG_PRINT("Kaseikyo: ");
|
||||
IR_DEBUG_PRINTLN("Header mark length is wrong");
|
||||
IR_DEBUG_PRINT(F("Kaseikyo: "));
|
||||
IR_DEBUG_PRINTLN(F("Header mark length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!matchMark(decodedIRData.rawDataPtr->rawbuf[2], KASEIKYO_HEADER_SPACE)) {
|
||||
IR_DEBUG_PRINT("Kaseikyo: ");
|
||||
IR_DEBUG_PRINTLN("Header space length is wrong");
|
||||
IR_DEBUG_PRINT(F("Kaseikyo: "));
|
||||
IR_DEBUG_PRINTLN(F("Header space length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// decode Vendor ID
|
||||
if (!decodePulseDistanceData(KASEIKYO_VENDOR_ID_BITS, 3, KASEIKYO_BIT_MARK, KASEIKYO_ONE_SPACE, KASEIKYO_ZERO_SPACE,
|
||||
PROTOCOL_IS_LSB_FIRST)) {
|
||||
IR_DEBUG_PRINT("Kaseikyo: ");
|
||||
IR_DEBUG_PRINTLN("Vendor ID decode failed");
|
||||
IR_DEBUG_PRINT(F("Kaseikyo: "));
|
||||
IR_DEBUG_PRINTLN(F("Vendor ID decode failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -220,8 +220,8 @@ bool IRrecv::decodeKaseikyo() {
|
|||
KASEIKYO_VENDOR_ID_PARITY_BITS + KASEIKYO_ADDRESS_BITS + KASEIKYO_COMMAND_BITS + KASEIKYO_PARITY_BITS,
|
||||
3 + (2 * KASEIKYO_VENDOR_ID_BITS), KASEIKYO_BIT_MARK, KASEIKYO_ONE_SPACE,
|
||||
KASEIKYO_ZERO_SPACE, PROTOCOL_IS_LSB_FIRST)) {
|
||||
IR_DEBUG_PRINT("Kaseikyo: ");
|
||||
IR_DEBUG_PRINTLN("Address, command + parity decode failed");
|
||||
IR_DEBUG_PRINT(F("Kaseikyo: "));
|
||||
IR_DEBUG_PRINTLN(F("Address, command + parity decode failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -234,12 +234,12 @@ bool IRrecv::decodeKaseikyo() {
|
|||
uint8_t tParity = tValue.UByte.LowByte ^ tValue.UByte.MidLowByte ^ tValue.UByte.MidHighByte;
|
||||
|
||||
if (tVendorParity != (tValue.UByte.LowByte & 0xF)) {
|
||||
IR_DEBUG_PRINT("Kaseikyo: ");
|
||||
IR_DEBUG_PRINT("4 bit VendorID Parity is not correct. expected=0x");
|
||||
IR_DEBUG_PRINT(F("Kaseikyo: "));
|
||||
IR_DEBUG_PRINT(F("4 bit VendorID Parity is not correct. expected=0x"));
|
||||
IR_DEBUG_PRINT(tVendorParity, HEX);
|
||||
IR_DEBUG_PRINT(" received=0x");
|
||||
IR_DEBUG_PRINT(F(" received=0x"));
|
||||
IR_DEBUG_PRINT(decodedIRData.decodedRawData, HEX);
|
||||
IR_DEBUG_PRINT(" VendorID=0x");
|
||||
IR_DEBUG_PRINT(F(" VendorID=0x"));
|
||||
IR_DEBUG_PRINTLN(tVendorId, HEX);
|
||||
decodedIRData.flags = IRDATA_FLAGS_PARITY_FAILED | IRDATA_FLAGS_IS_LSB_FIRST;
|
||||
}
|
||||
|
@ -251,14 +251,14 @@ bool IRrecv::decodeKaseikyo() {
|
|||
}
|
||||
|
||||
if (tValue.UByte.HighByte != tParity) {
|
||||
IR_DEBUG_PRINT("Kaseikyo: ");
|
||||
IR_DEBUG_PRINT("8 bit Parity is not correct. expected=0x");
|
||||
IR_DEBUG_PRINT(F("Kaseikyo: "));
|
||||
IR_DEBUG_PRINT(F("8 bit Parity is not correct. expected=0x"));
|
||||
IR_DEBUG_PRINT(tParity, HEX);
|
||||
IR_DEBUG_PRINT(" received=0x");
|
||||
IR_DEBUG_PRINT(F(" received=0x"));
|
||||
IR_DEBUG_PRINT(decodedIRData.decodedRawData >> KASEIKYO_COMMAND_BITS, HEX);
|
||||
IR_DEBUG_PRINT(" address=0x");
|
||||
IR_DEBUG_PRINT(F(" address=0x"));
|
||||
IR_DEBUG_PRINT(decodedIRData.address, HEX);
|
||||
IR_DEBUG_PRINT(" command=0x");
|
||||
IR_DEBUG_PRINT(F(" command=0x"));
|
||||
IR_DEBUG_PRINTLN(decodedIRData.command, HEX);
|
||||
decodedIRData.flags |= IRDATA_FLAGS_PARITY_FAILED;
|
||||
}
|
||||
|
|
|
@ -179,9 +179,9 @@ bool IRrecv::decodeLG() {
|
|||
// Check we have the right amount of data (60). The +4 is for initial gap, start bit mark and space + stop bit mark.
|
||||
if (decodedIRData.rawDataPtr->rawlen != ((2 * LG_BITS) + 4) && (decodedIRData.rawDataPtr->rawlen != 4)) {
|
||||
IR_DEBUG_PRINT(F("LG: "));
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not 60 or 4");
|
||||
IR_DEBUG_PRINTLN(F(" is not 60 or 4"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ bool IRrecv::decodeLG() {
|
|||
if (!matchMark(decodedIRData.rawDataPtr->rawbuf[1], LG_HEADER_MARK)) {
|
||||
if (!matchMark(decodedIRData.rawDataPtr->rawbuf[1], LG2_HEADER_MARK)) {
|
||||
IR_DEBUG_PRINT(F("LG: "));
|
||||
IR_DEBUG_PRINTLN("Header mark is wrong");
|
||||
IR_DEBUG_PRINTLN(F("Header mark is wrong"));
|
||||
return false;
|
||||
} else {
|
||||
tProtocol = LG2;
|
||||
|
@ -208,7 +208,7 @@ bool IRrecv::decodeLG() {
|
|||
return true;
|
||||
}
|
||||
IR_DEBUG_PRINT(F("LG: "));
|
||||
IR_DEBUG_PRINT("Repeat header space is wrong");
|
||||
IR_DEBUG_PRINT(F("Repeat header space is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -249,11 +249,11 @@ bool IRrecv::decodeLG() {
|
|||
// Checksum check
|
||||
if ((tChecksum & 0xF) != (decodedIRData.decodedRawData & 0xF)) {
|
||||
IR_DEBUG_PRINT(F("LG: "));
|
||||
IR_DEBUG_PRINT("4 bit checksum is not correct. expected=0x");
|
||||
IR_DEBUG_PRINT(F("4 bit checksum is not correct. expected=0x"));
|
||||
IR_DEBUG_PRINT(tChecksum, HEX);
|
||||
IR_DEBUG_PRINT(" received=0x");
|
||||
IR_DEBUG_PRINT(F(" received=0x"));
|
||||
IR_DEBUG_PRINT((decodedIRData.decodedRawData & 0xF), HEX);
|
||||
IR_DEBUG_PRINT(" data=0x");
|
||||
IR_DEBUG_PRINT(F(" data=0x"));
|
||||
IR_DEBUG_PRINTLN(decodedIRData.command, HEX);
|
||||
decodedIRData.flags |= IRDATA_FLAGS_PARITY_FAILED;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ void IRsend::sendLegoPowerFunctions(uint8_t aChannel, uint8_t aCommand, uint8_t
|
|||
void IRsend::sendLegoPowerFunctions(uint16_t aRawData, uint8_t aChannel, bool aDoSend5Times) {
|
||||
enableIROut(38);
|
||||
|
||||
IR_DEBUG_PRINT("sendLego aRawData=0x");
|
||||
IR_DEBUG_PRINT(F("sendLego aRawData=0x"));
|
||||
IR_DEBUG_PRINTLN(aRawData, HEX);
|
||||
|
||||
aChannel &= 0x03; // we have 4 channels
|
||||
|
@ -153,28 +153,28 @@ bool IRrecv::decodeLegoPowerFunctions() {
|
|||
|
||||
// Check we have enough data - +4 for initial gap, start bit mark and space + stop bit mark
|
||||
if (decodedIRData.rawDataPtr->rawlen != (2 * LEGO_BITS) + 4) {
|
||||
IR_DEBUG_PRINT("LEGO: ");
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("LEGO: "));
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not 36");
|
||||
IR_DEBUG_PRINTLN(F(" is not 36"));
|
||||
return false;
|
||||
}
|
||||
// Check header "space"
|
||||
if (!matchSpace(decodedIRData.rawDataPtr->rawbuf[2], LEGO_HEADER_SPACE)) {
|
||||
IR_DEBUG_PRINT("LEGO: ");
|
||||
IR_DEBUG_PRINTLN("Header space length is wrong");
|
||||
IR_DEBUG_PRINT(F("LEGO: "));
|
||||
IR_DEBUG_PRINTLN(F("Header space length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!decodePulseDistanceData(LEGO_BITS, 3, LEGO_BIT_MARK, LEGO_ONE_SPACE, LEGO_ZERO_SPACE, PROTOCOL_IS_MSB_FIRST)) {
|
||||
IR_DEBUG_PRINT("LEGO: ");
|
||||
IR_DEBUG_PRINTLN("Decode failed");
|
||||
IR_DEBUG_PRINT(F("LEGO: "));
|
||||
IR_DEBUG_PRINTLN(F("Decode failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Stop bit
|
||||
if (!matchMark(decodedIRData.rawDataPtr->rawbuf[3 + (2 * LEGO_BITS)], LEGO_BIT_MARK)) {
|
||||
IR_DEBUG_PRINT("LEGO: ");
|
||||
IR_DEBUG_PRINT(F("LEGO: "));
|
||||
IR_DEBUG_PRINTLN(F("Stop bit mark length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
@ -193,18 +193,18 @@ bool IRrecv::decodeLegoPowerFunctions() {
|
|||
|
||||
// parity check
|
||||
if (tParityReceived != tParityComputed) {
|
||||
IR_DEBUG_PRINT("LEGO: ");
|
||||
IR_DEBUG_PRINT("Parity is not correct. expected=0x");
|
||||
IR_DEBUG_PRINT(F("LEGO: "));
|
||||
IR_DEBUG_PRINT(F("Parity is not correct. expected=0x"));
|
||||
IR_DEBUG_PRINT(tParityComputed, HEX);
|
||||
IR_DEBUG_PRINT(" received=0x");
|
||||
IR_DEBUG_PRINT(F(" received=0x"));
|
||||
IR_DEBUG_PRINT(tParityReceived, HEX);
|
||||
IR_DEBUG_PRINT(", raw=0x");
|
||||
IR_DEBUG_PRINT(F(", raw=0x"));
|
||||
IR_DEBUG_PRINT(tDecodedValue, HEX);
|
||||
IR_DEBUG_PRINT(", 3 nibbles are 0x");
|
||||
IR_DEBUG_PRINT(F(", 3 nibbles are 0x"));
|
||||
IR_DEBUG_PRINT(tToggleEscapeChannel, HEX);
|
||||
IR_DEBUG_PRINT(", 0x");
|
||||
IR_DEBUG_PRINT(F(", 0x"));
|
||||
IR_DEBUG_PRINT(tMode, HEX);
|
||||
IR_DEBUG_PRINT(", 0x");
|
||||
IR_DEBUG_PRINT(F(", 0x"));
|
||||
IR_DEBUG_PRINTLN(tData, HEX);
|
||||
// might not be an error, so just continue
|
||||
decodedIRData.flags = IRDATA_FLAGS_PARITY_FAILED | IRDATA_FLAGS_IS_MSB_FIRST;
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
|
||||
#include <Arduino.h>
|
||||
|
||||
//#define DEBUG // Activate this for lots of lovely debug output from this decoder.
|
||||
#include "IRremoteInt.h" // evaluates the DEBUG for IR_DEBUG_PRINT
|
||||
|
||||
//
|
||||
|
@ -117,7 +116,6 @@ bool IRrecv::decodeMagiQuest() {
|
|||
|
||||
unsigned int tMark;
|
||||
unsigned int tSpace;
|
||||
unsigned int tRatio;
|
||||
|
||||
#if defined(DEBUG)
|
||||
char bitstring[(MAGIQUEST_PACKET_SIZE + 1)];
|
||||
|
@ -125,31 +123,28 @@ bool IRrecv::decodeMagiQuest() {
|
|||
#endif
|
||||
|
||||
// Check we have the right amount of data, magnitude and ID bits and at least 2 start bits + 1 stop bit
|
||||
if (decodedIRData.rawDataPtr->rawlen < 2 * (MAGIQUEST_BITS + 3) && decodedIRData.rawDataPtr->rawlen > 2 * (MAGIQUEST_PACKET_SIZE + 1)) {
|
||||
IR_DEBUG_PRINT("MagiQuest: ");
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
if (decodedIRData.rawDataPtr->rawlen < (2 * (MAGIQUEST_BITS + 3)) || decodedIRData.rawDataPtr->rawlen > (2 * (MAGIQUEST_PACKET_SIZE + 1))) {
|
||||
IR_DEBUG_PRINT(F("MagiQuest: "));
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not between 102 and 114");
|
||||
IR_DEBUG_PRINTLN(F(" is not between 102 and 114"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read the bits in
|
||||
data.llword = 0;
|
||||
while (tOffset < decodedIRData.rawDataPtr->rawlen - 1) {
|
||||
while (tOffset < (unsigned int)(decodedIRData.rawDataPtr->rawlen - 1)) {
|
||||
// get one mark and space pair
|
||||
tMark = decodedIRData.rawDataPtr->rawbuf[tOffset++];
|
||||
tSpace = decodedIRData.rawDataPtr->rawbuf[tOffset++];
|
||||
tRatio = tSpace / tMark;
|
||||
|
||||
IR_TRACE_PRINT("MagiQuest: mark=");
|
||||
IR_TRACE_PRINT(F("MagiQuest: mark="));
|
||||
IR_TRACE_PRINT(tMark * MICROS_PER_TICK);
|
||||
IR_TRACE_PRINT(" space=");
|
||||
IR_TRACE_PRINT(tSpace * MICROS_PER_TICK);
|
||||
IR_TRACE_PRINT(" ratio=");
|
||||
IR_TRACE_PRINTLN(tRatio);
|
||||
IR_TRACE_PRINT(F(" space="));
|
||||
IR_TRACE_PRINTLN(tSpace * MICROS_PER_TICK);
|
||||
|
||||
if (matchMark(tSpace + tMark, MAGIQUEST_PERIOD)) {
|
||||
if (tRatio > 1) {
|
||||
if (tSpace > tMark) {
|
||||
// It's a 0
|
||||
data.llword <<= 1;
|
||||
#if defined(DEBUG)
|
||||
|
@ -163,10 +158,11 @@ bool IRrecv::decodeMagiQuest() {
|
|||
#endif
|
||||
}
|
||||
} else {
|
||||
IR_DEBUG_PRINTLN("Mark and space does not match the constant MagiQuest period");
|
||||
IR_DEBUG_PRINTLN(F("Mark and space does not match the constant MagiQuest period"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
IR_DEBUG_PRINTLN(bitstring);
|
||||
|
||||
// Success
|
||||
|
|
|
@ -196,9 +196,9 @@ bool IRrecv::decodeNEC() {
|
|||
// Check we have the right amount of data (68). The +4 is for initial gap, start bit mark and space + stop bit mark.
|
||||
if (decodedIRData.rawDataPtr->rawlen != ((2 * NEC_BITS) + 4) && (decodedIRData.rawDataPtr->rawlen != 4)) {
|
||||
IR_DEBUG_PRINT(F("NEC: "));
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not 68 or 4");
|
||||
IR_DEBUG_PRINTLN(F(" is not 68 or 4"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -308,17 +308,17 @@ bool IRrecv::decodeNECMSB(decode_results *aResults) {
|
|||
|
||||
// Check we have the right amount of data (32). +4 for initial gap, start bit mark and space + stop bit mark
|
||||
if (aResults->rawlen != (2 * NEC_BITS) + 4) {
|
||||
IR_DEBUG_PRINT("NEC MSB: ");
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("NEC MSB: "));
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(aResults->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not 68");
|
||||
IR_DEBUG_PRINTLN(F(" is not 68"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check header "space"
|
||||
if (!matchSpace(aResults->rawbuf[offset], NEC_HEADER_SPACE)) {
|
||||
IR_DEBUG_PRINT("NEC MSB: ");
|
||||
IR_DEBUG_PRINTLN("Header space length is wrong");
|
||||
IR_DEBUG_PRINT(F("NEC MSB: "));
|
||||
IR_DEBUG_PRINTLN(F("Header space length is wrong"));
|
||||
return false;
|
||||
}
|
||||
offset++;
|
||||
|
@ -331,7 +331,7 @@ bool IRrecv::decodeNECMSB(decode_results *aResults) {
|
|||
|
||||
// Stop bit
|
||||
if (!matchMark(aResults->rawbuf[offset + (2 * NEC_BITS)], NEC_BIT_MARK)) {
|
||||
IR_DEBUG_PRINT("NEC MSB: ");
|
||||
IR_DEBUG_PRINT(F("NEC MSB: "));
|
||||
IR_DEBUG_PRINTLN(F("Stop bit mark length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ static void dumpDuration(Print *aSerial, uint32_t duration, uint16_t timebase) {
|
|||
/*
|
||||
* Compensate received values by MARK_EXCESS_MICROS, like it is done for decoding!
|
||||
*/
|
||||
static void compensateAndDumpSequence(Print *aSerial, const volatile uint16_t *data, size_t length, uint16_t timebase) {
|
||||
static void compensateAndDumpSequence(Print *aSerial, const volatile unsigned int *data, size_t length, uint16_t timebase) {
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
uint32_t tDuration = data[i] * MICROS_PER_TICK;
|
||||
if (i & 1) {
|
||||
|
@ -299,7 +299,7 @@ static size_t dumpDuration(String *aString, uint32_t duration, uint16_t timebase
|
|||
return dumpNumber(aString, (duration + timebase / 2) / timebase);
|
||||
}
|
||||
|
||||
static size_t compensateAndDumpSequence(String *aString, const volatile uint16_t *data, size_t length, uint16_t timebase) {
|
||||
static size_t compensateAndDumpSequence(String *aString, const volatile unsigned int *data, size_t length, uint16_t timebase) {
|
||||
|
||||
size_t size = 0;
|
||||
|
||||
|
|
|
@ -140,16 +140,16 @@ bool IRrecv::decodeRC5() {
|
|||
if (decodedIRData.rawDataPtr->rawlen < MIN_RC5_MARKS + 2 && decodedIRData.rawDataPtr->rawlen > ((2 * RC5_BITS) + 2)) {
|
||||
// no debug output, since this check is mainly to determine the received protocol
|
||||
IR_DEBUG_PRINT(F("RC5: "));
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not between 11 and 26");
|
||||
IR_DEBUG_PRINTLN(F(" is not between 11 and 26"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check start bit, the first space is included in the gap
|
||||
if (getBiphaselevel() != MARK) {
|
||||
IR_DEBUG_PRINT(F("RC5: "));
|
||||
IR_DEBUG_PRINTLN("first getBiphaselevel() is not MARK");
|
||||
IR_DEBUG_PRINTLN(F("first getBiphaselevel() is not MARK"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -353,9 +353,9 @@ bool IRrecv::decodeRC6() {
|
|||
// Check we have the right amount of data (). The +3 for initial gap, start bit mark and space
|
||||
if (decodedIRData.rawDataPtr->rawlen < MIN_RC6_MARKS + 3 && decodedIRData.rawDataPtr->rawlen > ((2 * RC6_BITS) + 3)) {
|
||||
IR_DEBUG_PRINT(F("RC6: "));
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not between 15 and 45");
|
||||
IR_DEBUG_PRINTLN(F(" is not between 15 and 45"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ bool IRrecv::decodeRC6() {
|
|||
|| !matchSpace(decodedIRData.rawDataPtr->rawbuf[2], RC6_HEADER_SPACE)) {
|
||||
// no debug output, since this check is mainly to determine the received protocol
|
||||
IR_DEBUG_PRINT(F("RC6: "));
|
||||
IR_DEBUG_PRINTLN("Header mark or space length is wrong");
|
||||
IR_DEBUG_PRINTLN(F("Header mark or space length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -374,12 +374,12 @@ bool IRrecv::decodeRC6() {
|
|||
// Process first bit, which is known to be a 1 (mark->space)
|
||||
if (getBiphaselevel() != MARK) {
|
||||
IR_DEBUG_PRINT(F("RC6: "));
|
||||
IR_DEBUG_PRINTLN("first getBiphaselevel() is not MARK");
|
||||
IR_DEBUG_PRINTLN(F("first getBiphaselevel() is not MARK"));
|
||||
return false;
|
||||
}
|
||||
if (getBiphaselevel() != SPACE) {
|
||||
IR_DEBUG_PRINT(F("RC6: "));
|
||||
IR_DEBUG_PRINTLN("second getBiphaselevel() is not SPACE");
|
||||
IR_DEBUG_PRINTLN(F("second getBiphaselevel() is not SPACE"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,17 +129,17 @@ bool IRrecv::decodeSamsung() {
|
|||
if (decodedIRData.rawDataPtr->rawlen != ((2 * SAMSUNG_BITS) + 4)
|
||||
&& decodedIRData.rawDataPtr->rawlen != ((2 * SAMSUNG48_BITS) + 4) && (decodedIRData.rawDataPtr->rawlen != 6)) {
|
||||
IR_DEBUG_PRINT(F("Samsung: "));
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not 68 or 100 or 6");
|
||||
IR_DEBUG_PRINTLN(F(" is not 68 or 100 or 6"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check header "mark" + "space"
|
||||
if (!matchMark(decodedIRData.rawDataPtr->rawbuf[1], SAMSUNG_HEADER_MARK)
|
||||
|| !matchSpace(decodedIRData.rawDataPtr->rawbuf[2], SAMSUNG_HEADER_SPACE)) {
|
||||
IR_DEBUG_PRINT("Samsung: ");
|
||||
IR_DEBUG_PRINTLN("Header mark or space length is wrong");
|
||||
IR_DEBUG_PRINT(F("Samsung: "));
|
||||
IR_DEBUG_PRINTLN(F("Header mark or space length is wrong"));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -159,16 +159,16 @@ bool IRrecv::decodeSamsung() {
|
|||
*/
|
||||
// decode address
|
||||
if (!decodePulseDistanceData(SAMSUNG_ADDRESS_BITS, 3, SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE, SAMSUNG_ZERO_SPACE, PROTOCOL_IS_LSB_FIRST)) {
|
||||
IR_DEBUG_PRINT("Samsung: ");
|
||||
IR_DEBUG_PRINTLN("Decode failed");
|
||||
IR_DEBUG_PRINT(F("Samsung: "));
|
||||
IR_DEBUG_PRINTLN(F("Decode failed"));
|
||||
return false;
|
||||
}
|
||||
decodedIRData.address = decodedIRData.decodedRawData;
|
||||
|
||||
// decode 32 bit command
|
||||
if (!decodePulseDistanceData(SAMSUNG_COMMAND32_BITS, 3, SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE, SAMSUNG_ZERO_SPACE, PROTOCOL_IS_LSB_FIRST)) {
|
||||
IR_DEBUG_PRINT("Samsung: ");
|
||||
IR_DEBUG_PRINTLN("Decode failed");
|
||||
IR_DEBUG_PRINT(F("Samsung: "));
|
||||
IR_DEBUG_PRINTLN(F("Decode failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -189,8 +189,8 @@ bool IRrecv::decodeSamsung() {
|
|||
* Samsung32
|
||||
*/
|
||||
if (!decodePulseDistanceData(SAMSUNG_BITS, 3, SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE, SAMSUNG_ZERO_SPACE, PROTOCOL_IS_LSB_FIRST)) {
|
||||
IR_DEBUG_PRINT("Samsung: ");
|
||||
IR_DEBUG_PRINTLN("Decode failed");
|
||||
IR_DEBUG_PRINT(F("Samsung: "));
|
||||
IR_DEBUG_PRINTLN(F("Decode failed"));
|
||||
return false;
|
||||
}
|
||||
LongUnion tValue;
|
||||
|
|
|
@ -111,22 +111,22 @@ bool IRrecv::decodeSony() {
|
|||
if (decodedIRData.rawDataPtr->rawlen != (2 * SONY_BITS_MIN) + 2 && decodedIRData.rawDataPtr->rawlen != (2 * SONY_BITS_MAX) + 2
|
||||
&& decodedIRData.rawDataPtr->rawlen != (2 * SONY_BITS_15) + 2) {
|
||||
// ??? IR_TRACE_PRINT since I saw this too often
|
||||
IR_DEBUG_PRINT("Sony: ");
|
||||
IR_DEBUG_PRINT("Data length=");
|
||||
IR_DEBUG_PRINT(F("Sony: "));
|
||||
IR_DEBUG_PRINT(F("Data length="));
|
||||
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
|
||||
IR_DEBUG_PRINTLN(" is not 12, 15 or 20");
|
||||
IR_DEBUG_PRINTLN(F(" is not 12, 15 or 20"));
|
||||
return false;
|
||||
}
|
||||
// Check header "space"
|
||||
if (!matchSpace(decodedIRData.rawDataPtr->rawbuf[2], SONY_SPACE)) {
|
||||
IR_DEBUG_PRINT("Sony: ");
|
||||
IR_DEBUG_PRINTLN("Header space length is wrong");
|
||||
IR_DEBUG_PRINT(F("Sony: "));
|
||||
IR_DEBUG_PRINTLN(F("Header space length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!decodePulseWidthData((decodedIRData.rawDataPtr->rawlen - 1) / 2, 3, SONY_ONE_MARK, SONY_ZERO_MARK, SONY_SPACE, PROTOCOL_IS_LSB_FIRST)) {
|
||||
IR_DEBUG_PRINT("Sony: ");
|
||||
IR_DEBUG_PRINTLN("Decode failed");
|
||||
IR_DEBUG_PRINT(F("Sony: "));
|
||||
IR_DEBUG_PRINTLN(F("Decode failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ bool IRrecv::decodeSonyMSB(decode_results *aResults) {
|
|||
// Some Sony's deliver repeats fast after first
|
||||
// unfortunately can't spot difference from of repeat from two fast clicks
|
||||
if (aResults->rawbuf[0] < (SONY_DOUBLE_SPACE_USECS / MICROS_PER_TICK)) {
|
||||
IR_DEBUG_PRINTLN("IR Gap found");
|
||||
IR_DEBUG_PRINTLN(F("IR Gap found"));
|
||||
aResults->bits = 0;
|
||||
aResults->value = 0xFFFFFFFF;
|
||||
decodedIRData.flags = IRDATA_FLAGS_IS_REPEAT;
|
||||
|
|
|
@ -176,8 +176,8 @@ bool IRrecv::decodeShuzu() {
|
|||
|
||||
// Check header "space"
|
||||
if (!matchMark(decodedIRData.rawDataPtr->rawbuf[1], SHUZU_HEADER_MARK) || !matchSpace(decodedIRData.rawDataPtr->rawbuf[2], SHUZU_HEADER_SPACE)) {
|
||||
IR_DEBUG_PRINT("Shuzu: ");
|
||||
IR_DEBUG_PRINTLN("Header mark or space length is wrong");
|
||||
IR_DEBUG_PRINT(F("Shuzu: "));
|
||||
IR_DEBUG_PRINTLN(F("Header mark or space length is wrong"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue