Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisMiCa committed Jan 16, 2022
2 parents 9337cfc + af82cc8 commit 574687d
Show file tree
Hide file tree
Showing 49 changed files with 1,956 additions and 673 deletions.
365 changes: 213 additions & 152 deletions README.md

Large diffs are not rendered by default.

37 changes: 25 additions & 12 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
IRsmallDecoder
==============

Release 1.1.0 - 08/02/2020
--------------------------
v1.2.0 (2022-01-16)
-------------------
* Added the dataAvailable() overload method
* Added methods to enable/disable the decoder
* Added an example for the enable/disable methods
* Fixed the possibility of needlessly dismissed codes (issue #5)
* Improved the NEC/NECx and SIRC12/15 decoders (small improvement)
* Improved some of the examples
* Formatted the code in a more normalized way
* Corrected and added code comments
* Corrected and updated the documentation


v1.1.0 (2020-02-08)
-------------------
* Added SAMSUNG protocol (old standard)
* Added SAMSUNG32 protocol
* Added Samsung example sketch
* Added support for ATtiny 24/44/84/25/45/85


Release 1.0.0 - 24/01/2020
--------------------------
v1.0.0 (2020-01-24)
-------------------
This is the first public release

Main features:
* NEC, RC5 and SIRC protocols are supported;
* IR Codes' data is separated;
* Unwanted initial repetitions are ignored;
* Held keys signalization is standardized;
* Signal tolerances are very loose;
* SRAM and Flash memory usage is low;
* No timers required;
* Uses one hardware interrupt.
* NEC, RC5 and SIRC protocols are supported
* IR Codes' data is separated
* Unwanted initial repetitions are ignored
* Held keys are signalized by a boolean variable
* Signal tolerances are very loose
* SRAM and Flash memory usage is low
* No timers required
* Uses one hardware interrupt
27 changes: 14 additions & 13 deletions examples/HelloNEC/HelloNEC.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,32 @@
*
* Note: for the NEC extended protocol, just define IR_SMALLD_NECx instead of IR_SMALLD_NEC
*
* In this example it's assumed that the IR sensor is connected to digital pin 2 and
* In this example it's assumed that the IR receiver is connected to digital pin 2 and
* the pin is usable for external interrupts.
*
* For more information on the boards' usable pins, see the library documentation at:
* https://github.com/LuisMiCa/IRsmallDecoder
* or the README.pdf file in the extras folder of this library.
*/

#define IR_SMALLD_NEC //1st: define which protocol to use and then,
#include <IRsmallDecoder.h> //2nd: include the library;
IRsmallDecoder irDecoder(2); //3rd: create one decoder object with the correct digital pin;
irSmallD_t irData; //4th: declare one decoder data structure;


#define IR_SMALLD_NEC //1st: define which protocol to use and then,
//#define IR_SMALLD_NECx
#include <IRsmallDecoder.h> //2nd: include the library;
IRsmallDecoder irDecoder(2); //3rd: create one decoder object with the correct digital pin;
irSmallD_t irData; //4th: declare one decoder data structure;

void setup() {
Serial.begin(250000);
Serial.println("Waiting for a NEC remote control IR signal...");
Serial.println("held\t addr\t cmd");
}

void loop() {
if(irDecoder.dataAvailable(irData)) { //5th: if the decoder has some new data available,
Serial.print(irData.keyHeld,HEX); //6th: do something with the data.
if (irDecoder.dataAvailable(irData)) { //5th: if the decoder has some new data available,
Serial.print(irData.keyHeld, HEX); //6th: do something with the data.
Serial.print("\t ");
Serial.print(irData.addr,HEX);
Serial.print(irData.addr, HEX);
Serial.print("\t ");
Serial.println(irData.cmd,HEX);
Serial.println(irData.cmd, HEX);
}
}

}
21 changes: 11 additions & 10 deletions examples/HelloRC5/HelloRC5.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,31 @@
*
* Note: this works for both RC5 and RC5 extended.
*
* In this example it's assumed that the IR sensor is connected to digital pin 2 and
* In this example it's assumed that the IR receiver is connected to digital pin 2 and
* the pin is usable for external interrupts (that work with the CHANGE mode).
*
* For more information on the boards' usable pins, see the library documentation at:
* https://github.com/LuisMiCa/IRsmallDecoder
* or the README.pdf file in the extras folder of this library.
*/

#define IR_SMALLD_RC5 //1st: define which protocol to use and then,
#include <IRsmallDecoder.h> //2nd: include the library;
IRsmallDecoder irDecoder(2); //3rd: create one decoder object with the correct digital pin;
irSmallD_t irData; //4th: declare one decoder data structure;
#define IR_SMALLD_RC5 //1st: define which protocol to use and then,
#include <IRsmallDecoder.h> //2nd: include the library;
IRsmallDecoder irDecoder(2); //3rd: create one decoder object with the correct digital pin;
irSmallD_t irData; //4th: declare one decoder data structure;

void setup() {
Serial.begin(250000);
Serial.println("Waiting for a RC5 remote control IR signal...");
Serial.println("held\t addr\t cmd");
}

void loop() {
if(irDecoder.dataAvailable(irData)) { //5th: if the decoder has some new data available,
Serial.print(irData.keyHeld,HEX); //6th: do something with the data.
if (irDecoder.dataAvailable(irData)) { //5th: if the decoder has some new data available,
Serial.print(irData.keyHeld, HEX); //6th: do something with the data.
Serial.print("\t ");
Serial.print(irData.addr,HEX);
Serial.print(irData.addr, HEX);
Serial.print("\t ");
Serial.println(irData.cmd,HEX);
Serial.println(irData.cmd, HEX);
}
}
23 changes: 12 additions & 11 deletions examples/HelloSAMSUNG/HelloSAMSUNG.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,31 @@
* - The SAMSUNG32 protocol corresponds to the standard described in this application note:
* http://elektrolab.wz.cz/katalog/samsung_protocol.pdf
*
* In this example it's assumed that the IR sensor is connected to digital pin 2 and
* In this example it's assumed that the IR receiver is connected to digital pin 2 and
* the pin is usable for external interrupts.
*
* For more information on the boards' usable pins, see the library documentation at:
* https://github.com/LuisMiCa/IRsmallDecoder
* or the README.pdf file in the extras folder of this library.
*/
#define IR_SMALLD_SAMSUNG //1st: define which protocol to use and then,
#include <IRsmallDecoder.h> //2nd: include the library;
IRsmallDecoder irDecoder(2); //3rd: create one decoder object with the correct interrupt pin;
irSmallD_t irData; //4th: declare one decoder data structure;

#define IR_SMALLD_SAMSUNG //1st: define which protocol to use and then,
#include <IRsmallDecoder.h> //2nd: include the library;
IRsmallDecoder irDecoder(2); //3rd: create one decoder object with the correct interrupt pin;
irSmallD_t irData; //4th: declare one decoder data structure;

void setup() {
Serial.begin(250000);
Serial.println("Waiting for a SAMSUNG remote control IR signal...");
Serial.println("held\t addr\t cmd");
}

void loop() {
if(irDecoder.dataAvailable(irData)) { //5th: if the decoder has some new data available,
Serial.print(irData.keyHeld,HEX); //6th: do something with the data.
if (irDecoder.dataAvailable(irData)) { //5th: if the decoder has some new data available,
Serial.print(irData.keyHeld, HEX); //6th: do something with the data.
Serial.print("\t ");
Serial.print(irData.addr,HEX);
Serial.print(irData.addr, HEX);
Serial.print("\t ");
Serial.println(irData.cmd,HEX);
Serial.println(irData.cmd, HEX);
}
}
37 changes: 22 additions & 15 deletions examples/HelloSIRC/HelloSIRC.ino
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
/* A simple example, using the IRsmallDecoder library,
* for testing remote controls that use the Sony SIRC protocol.
*
* Note: this example uses an advanced implementation of the SIRC decoder which
*
* This example uses an advanced implementation of the SIRC decoder which
* takes advantage of the fact that most SIRC remotes will send three signal frames
* every time one key is pressed. That allows the decoder to:
* - identify the number of bits of the protocol;
* - identify the number of bits of the protocol (12, 15 or 20);
* - ignore the two additional repetitions;
* - use the repetitions to check for errors;
* - determine if a key is being held.
*
* In this example it's assumed that the IR sensor is connected to digital pin 2 and
* If the decoder detects 12 or 15 bits, the ext data member is set to 0.
* If it detects a 20-bit code, it will save the extended data in the ext member.
*
* In this example it's assumed that the IR receiver is connected to digital pin 2 and
* the pin is usable for external interrupts.
*
* For more information on the boards' usable pins, see the library documentation at:
* https://github.com/LuisMiCa/IRsmallDecoder
* or the README.pdf file in the extras folder of this library.
*/

#define IR_SMALLD_SIRC //1st: define which protocol to use and then,
#include <IRsmallDecoder.h> //2nd: include the library;
IRsmallDecoder irDecoder(2); //3rd: create one decoder object with the correct digital pin;
irSmallD_t irData; //4th: declare one decoder data structure;
#define IR_SMALLD_SIRC //1st: define which protocol to use and then,
#include <IRsmallDecoder.h> //2nd: include the library;
IRsmallDecoder irDecoder(2); //3rd: create one decoder object with the correct digital pin;
irSmallD_t irData; //4th: declare one decoder data structure;

void setup() {
Serial.begin(250000);
Serial.println("Waiting for a SIRC remote control IR signal...");
Serial.println("held\t addr\t cmd");
Serial.println("held\taddr\tcmd \tExt");
}

void loop() {
if(irDecoder.dataAvailable(irData)) { //5th: if the decoder has some new data available,
Serial.print(irData.keyHeld,HEX); //6th: do something with the data.
Serial.print("\t ");
Serial.print(irData.addr,HEX);
Serial.print("\t ");
Serial.println(irData.cmd,HEX);
if (irDecoder.dataAvailable(irData)) { //5th: if the decoder has some new data available,
Serial.print(irData.keyHeld, HEX); //6th: do something with the data.
Serial.print(" \t");
Serial.print(irData.addr, HEX);
Serial.print(" \t");
Serial.print(irData.cmd, HEX);
Serial.print(" \t");
Serial.println(irData.ext, HEX);
}
}
39 changes: 0 additions & 39 deletions examples/HelloSIRC12/HelloSIRC12.ino

This file was deleted.

55 changes: 55 additions & 0 deletions examples/HelloSIRCbasic/HelloSIRCbasic.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* A simple example, using the IRsmallDecoder library, for testing remote controls
* that use the Sony SIRC12, SIRC15 or SIRC20 protocols.
*
* Notes:
* - Unlike IR_SMALLD_SIRC, IR_SMALLD_SIRC12/15/20 do not have the keyHeld data member;
* - IR_SMALLD_SIRC20 has an additional data member (ext);
* - Each keypress on a SIRC remote, usually sends three signal frames. The two additional
* signal repetitions are ignored in the IR_SMALLD_SIRC, but not in the IR_SMALLD_SIRC12/15/20;
* - IR_SMALLD_SIRC12 will receive signals from SIRC15 and SIRC20, but the codes will not be correct;
* - In a similar way, IR_SMALLD_SIRC15 will receive signals from SIRC20, but not from SIRC12.
*
* In this example it's assumed that the IR receiver is connected to digital pin 2 and
* the pin is usable for external interrupts.
*
* For more information on the boards' usable pins, see the library documentation at:
* https://github.com/LuisMiCa/IRsmallDecoder
* or the README.pdf file in the extras folder of this library.
*/


#define IR_SMALLD_SIRC12 //1st: define which protocol to use;
//#define IR_SMALLD_SIRC15
//#define IR_SMALLD_SIRC20

#include <IRsmallDecoder.h> //2nd: include the library;
IRsmallDecoder irDecoder(2); //3rd: create one decoder object with the correct digital pin;
irSmallD_t irData; //4th: declare one decoder data structure;

void setup() {
Serial.begin(250000);
#if defined(IR_SMALLD_SIRC12)
Serial.println("Waiting for a SIRC12 remote control IR signal...");
Serial.println("Addr\tCmd");
#elif defined(IR_SMALLD_SIRC15)
Serial.println("Waiting for a SIRC15 remote control IR signal...");
Serial.println("Addr\tCmd");
#elif defined(IR_SMALLD_SIRC20)
Serial.println("Waiting for a SIRC20 remote control IR signal...");
Serial.println("Addr\tCmd \tExt");
#endif
}

void loop() {
if (irDecoder.dataAvailable(irData)) { //5th: if the decoder has some new data available,
Serial.print(irData.addr, HEX); //6th: do something with the data.
Serial.print(" \t");
#if defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15)
Serial.println(irData.cmd, HEX);
#else
Serial.print(irData.cmd, HEX);
Serial.print(" \t");
Serial.println(irData.ext, HEX);
#endif
}
}
Loading

0 comments on commit 574687d

Please sign in to comment.