Bumped TinyIR version to 2.1.0

This commit is contained in:
Armin 2024-02-15 13:12:12 +01:00
parent 483aaa2cc3
commit 2c2be06431
5 changed files with 32 additions and 26 deletions

View File

@ -30,6 +30,6 @@ These are the active contributors of this project that you may contact if there
- [Daniel Wallner](https://github.com/danielwallner) Bang & Olufsen protocol. - [Daniel Wallner](https://github.com/danielwallner) Bang & Olufsen protocol.
- [slott](https://stackoverflow.com/users/11680056/sklott) Seeduino print(unsigned long long...) support. - [slott](https://stackoverflow.com/users/11680056/sklott) Seeduino print(unsigned long long...) support.
- [Joe Ostrander](https://github.com/joeostrander) Added support for attiny1614. - [Joe Ostrander](https://github.com/joeostrander) Added support for attiny1614.
- [Buzzerb](https://github.com/Buzzerb) Added Extended NEC Protocol macro to TinyIR. - [Buzzerb](https://github.com/Buzzerb) Added Extended NEC protocol to TinyIR and making it more consistent.
Note: Please let [ArminJo](https://github.com/ArminJo) know if you have been missed. Note: Please let [ArminJo](https://github.com/ArminJo) know if you have been missed.

View File

@ -1,10 +1,10 @@
/* /*
* TinySender.ino * TinySender.cpp
* *
* Example for sending using TinyIR. By default sends simultaneously using all supported protocols * Example for sending using TinyIR. By default sends simultaneously using all supported protocols
* To use a single protocol, simply delete or comment out all unneeded protocols in the main loop * To use a single protocol, simply delete or comment out all unneeded protocols in the main loop
* Program size is significantly reduced when using a single protocol * Program size is significantly reduced when using a single protocol
* For example, sending only 8 bit address and command NEC codes saves 780 bytes program memory and 26 bytes RAM compared to SimpleSender, * For example, sending only 8 bit address and command NEC codes saves 780 bytes program memory and 26 bytes RAM compared to SimpleSender,
* which does the same, but uses the IRRemote library (and is therefore much more flexible). * which does the same, but uses the IRRemote library (and is therefore much more flexible).
* *
* *
@ -23,7 +23,7 @@
************************************************************************************ ************************************************************************************
* MIT License * MIT License
* *
* Copyright (c) 2022-2023 Armin Joachimsmeyer * Copyright (c) 2022-2024 Armin Joachimsmeyer
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -85,32 +85,32 @@ void loop() {
Serial.print(F(" repeats=")); Serial.print(F(" repeats="));
Serial.print(sRepeats); Serial.print(sRepeats);
Serial.println(); Serial.println();
// Send with FAST // Send with FAST
// No address and only 16 bits of data, interpreted as 8 bit command and 8 bit inverted command for parity checking // No address and only 16 bits of data, interpreted as 8 bit command and 8 bit inverted command for parity checking
Serial.println(F("Send FAST with 8 bit command")); Serial.println(F("Send FAST with 8 bit command"));
Serial.flush(); Serial.flush();
sendFAST(IR_SEND_PIN, sCommand, sRepeats); sendFAST(IR_SEND_PIN, sCommand, sRepeats);
// Send with NEC // Send with NEC
// NEC uses 8 bit address and 8 bit command each with 8 bit inverted parity checks // NEC uses 8 bit address and 8 bit command each with 8 bit inverted parity checks
// However, sendNEC will accept 16 bit address and commands too (but remove the parity checks) // However, sendNEC will accept 16 bit address and commands too (but remove the parity checks)
Serial.println(F("Send NEC with 8 bit address and command")); Serial.println(F("Send NEC with 8 bit address and command"));
Serial.flush(); Serial.flush();
sendNEC(IR_SEND_PIN, sAddress, sCommand, sRepeats); sendNEC(IR_SEND_PIN, sAddress, sCommand, sRepeats);
// Send with Extended NEC // Send with Extended NEC
// Like NEC, but the address is forced 16 bits with no parity check // Like NEC, but the address is forced 16 bits with no parity check
Serial.println(F("Send ExtendedNEC with 16 bit address and 8 bit command")); Serial.println(F("Send ExtendedNEC with 16 bit address and 8 bit command"));
Serial.flush(); Serial.flush();
sendExtendedNEC(IR_SEND_PIN, sAddress, sCommand, sRepeats); sendExtendedNEC(IR_SEND_PIN, sAddress, sCommand, sRepeats);
// Send with ONKYO // Send with ONKYO
// Like NEC, but both the address and command are forced 16 bits with no parity check // Like NEC, but both the address and command are forced 16 bits with no parity check
Serial.println(F("Send ONKYO with 16 bit address and command")); Serial.println(F("Send ONKYO with 16 bit address and command"));
Serial.flush(); Serial.flush();
sendONKYO(IR_SEND_PIN, sAddress, sCommand, sRepeats); sendONKYO(IR_SEND_PIN, sAddress, sCommand, sRepeats);
// Send with NEC2 // Send with NEC2
// Instead of sending the NEC special repeat code, sends the full original frame for repeats // Instead of sending the NEC special repeat code, sends the full original frame for repeats
// Sending NEC2 is done by setting the optional bool NEC2Repeats argument to true (defaults to false) // Sending NEC2 is done by setting the optional bool NEC2Repeats argument to true (defaults to false)
@ -118,7 +118,7 @@ void loop() {
Serial.println(F("Send NEC2 with 8 bit address and command and original frame repeats")); Serial.println(F("Send NEC2 with 8 bit address and command and original frame repeats"));
Serial.flush(); Serial.flush();
sendNEC(IR_SEND_PIN, sAddress, sCommand, sRepeats, true); sendNEC(IR_SEND_PIN, sAddress, sCommand, sRepeats, true);
/* /*
* Increment send values * Increment send values
* Also increment address just for demonstration, which normally makes no sense * Also increment address just for demonstration, which normally makes no sense

View File

@ -34,9 +34,9 @@
* @{ * @{
*/ */
#define VERSION_TINYIR "2.0.0" #define VERSION_TINYIR "2.1.0"
#define VERSION_TINYIR_MAJOR 2 #define VERSION_TINYIR_MAJOR 2
#define VERSION_TINYIR_MINOR 0 #define VERSION_TINYIR_MINOR 1
#define VERSION_TINYIR_PATCH 0 #define VERSION_TINYIR_PATCH 0
// The change log is at the bottom of the file // The change log is at the bottom of the file
@ -256,13 +256,16 @@ void printTinyReceiverResultMinimal(Print *aSerial);
void sendFAST(uint8_t aSendPin, uint16_t aCommand, uint_fast8_t aNumberOfRepeats = 0); void sendFAST(uint8_t aSendPin, uint16_t aCommand, uint_fast8_t aNumberOfRepeats = 0);
void sendFast8BitAndParity(uint8_t aSendPin, uint8_t aCommand, uint_fast8_t aNumberOfRepeats = 0); void sendFast8BitAndParity(uint8_t aSendPin, uint8_t aCommand, uint_fast8_t aNumberOfRepeats = 0);
void sendONKYO(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats = 0, bool NEC2Repeats = false); // Send NEC with 16 bit command, even if aCommand < 0x100 void sendONKYO(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats = 0, bool aSendNEC2Repeats = false); // Send NEC with 16 bit command, even if aCommand < 0x100
void sendNECMinimal(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats = 0) void sendNECMinimal(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats = 0)
__attribute__ ((deprecated ("Renamed to sendNEC()."))); __attribute__ ((deprecated ("Renamed to sendNEC().")));
void sendNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats = 0, bool NEC2Repeats = false); void sendNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats = 0, bool aSendNEC2Repeats = false);
void sendExtendedNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats = 0, bool NEC2Repeats = false); void sendExtendedNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats = 0, bool aSendNEC2Repeats = false);
/* /*
* Version 2.1.0 - 2/2024
* - New sendExtendedNEC() function and new parameter aSendNEC2Repeats.
*
* Version 2.0.0 - 10/2023 * Version 2.0.0 - 10/2023
* - New TinyIRReceiverData which is filled with address, command and flags. * - New TinyIRReceiverData which is filled with address, command and flags.
* - Removed parameters address, command and flags from callback handleReceivedTinyIRData() and printTinyReceiverResultMinimal(). * - Removed parameters address, command and flags from callback handleReceivedTinyIRData() and printTinyReceiverResultMinimal().

View File

@ -28,7 +28,7 @@
************************************************************************************ ************************************************************************************
* MIT License * MIT License
* *
* Copyright (c) 2022-2023 Armin Joachimsmeyer * Copyright (c) 2022-2024 Armin Joachimsmeyer
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal

View File

@ -19,7 +19,7 @@
************************************************************************************ ************************************************************************************
* MIT License * MIT License
* *
* Copyright (c) 2022-2023 Armin Joachimsmeyer * Copyright (c) 2022-2024 Armin Joachimsmeyer
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -109,8 +109,9 @@ void sendMark(uint8_t aSendPin, unsigned int aMarkMicros) {
* @param aAddress - The 16 bit address to send. * @param aAddress - The 16 bit address to send.
* @param aCommand - The 16 bit command to send. * @param aCommand - The 16 bit command to send.
* @param aNumberOfRepeats - Number of repeats send at a period of 110 ms. * @param aNumberOfRepeats - Number of repeats send at a period of 110 ms.
* @param aSendNEC2Repeats - Instead of sending the NEC special repeat code, send the original frame for repeat.
*/ */
void sendONKYO(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool NEC2Repeats) { void sendONKYO(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendNEC2Repeats) {
pinModeFast(aSendPin, OUTPUT); pinModeFast(aSendPin, OUTPUT);
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1; uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
@ -118,7 +119,7 @@ void sendONKYO(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast
unsigned long tStartOfFrameMillis = millis(); unsigned long tStartOfFrameMillis = millis();
sendMark(aSendPin, NEC_HEADER_MARK); sendMark(aSendPin, NEC_HEADER_MARK);
if ((!NEC2Repeats) && (tNumberOfCommands < aNumberOfRepeats + 1)) { if ((!aSendNEC2Repeats) && (tNumberOfCommands < aNumberOfRepeats + 1)) {
// send the NEC special repeat // send the NEC special repeat
delayMicroseconds(NEC_REPEAT_HEADER_SPACE); // - 2250 delayMicroseconds(NEC_REPEAT_HEADER_SPACE); // - 2250
} else { } else {
@ -159,11 +160,12 @@ void sendONKYO(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast
* @param aAddress - If aAddress < 0x100 send 8 bit address and 8 bit inverted address, else send 16 bit address. * @param aAddress - If aAddress < 0x100 send 8 bit address and 8 bit inverted address, else send 16 bit address.
* @param aCommand - If aCommand < 0x100 send 8 bit command and 8 bit inverted command, else send 16 bit command. * @param aCommand - If aCommand < 0x100 send 8 bit command and 8 bit inverted command, else send 16 bit command.
* @param aNumberOfRepeats - Number of repeats send at a period of 110 ms. * @param aNumberOfRepeats - Number of repeats send at a period of 110 ms.
* @param aSendNEC2Repeats - Instead of sending the NEC special repeat code, send the original frame for repeat.
*/ */
void sendNECMinimal(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats) { void sendNECMinimal(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats) {
sendNEC(aSendPin, aAddress, aCommand, aNumberOfRepeats); // sendNECMinimal() is deprecated sendNEC(aSendPin, aAddress, aCommand, aNumberOfRepeats); // sendNECMinimal() is deprecated
} }
void sendNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool NEC2Repeats) { void sendNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendNEC2Repeats) {
pinModeFast(aSendPin, OUTPUT); pinModeFast(aSendPin, OUTPUT);
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1; uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
@ -171,7 +173,7 @@ void sendNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_
unsigned long tStartOfFrameMillis = millis(); unsigned long tStartOfFrameMillis = millis();
sendMark(aSendPin, NEC_HEADER_MARK); sendMark(aSendPin, NEC_HEADER_MARK);
if ((!NEC2Repeats) && (tNumberOfCommands < aNumberOfRepeats + 1)) { if ((!aSendNEC2Repeats) && (tNumberOfCommands < aNumberOfRepeats + 1)) {
// send the NEC special repeat // send the NEC special repeat
delayMicroseconds(NEC_REPEAT_HEADER_SPACE); // - 2250 delayMicroseconds(NEC_REPEAT_HEADER_SPACE); // - 2250
} else { } else {
@ -227,8 +229,9 @@ void sendNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_
* @param aAddress - Send 16 bit address. * @param aAddress - Send 16 bit address.
* @param aCommand - If aCommand < 0x100 send 8 bit command and 8 bit inverted command, else send 16 bit command. * @param aCommand - If aCommand < 0x100 send 8 bit command and 8 bit inverted command, else send 16 bit command.
* @param aNumberOfRepeats - Number of repeats send at a period of 110 ms. * @param aNumberOfRepeats - Number of repeats send at a period of 110 ms.
* @param aSendNEC2Repeats - Instead of sending the NEC special repeat code, send the original frame for repeat.
*/ */
void sendExtendedNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool NEC2Repeats) { void sendExtendedNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendNEC2Repeats) {
pinModeFast(aSendPin, OUTPUT); pinModeFast(aSendPin, OUTPUT);
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1; uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
@ -236,7 +239,7 @@ void sendExtendedNEC(uint8_t aSendPin, uint16_t aAddress, uint16_t aCommand, uin
unsigned long tStartOfFrameMillis = millis(); unsigned long tStartOfFrameMillis = millis();
sendMark(aSendPin, NEC_HEADER_MARK); sendMark(aSendPin, NEC_HEADER_MARK);
if ((!NEC2Repeats) && (tNumberOfCommands < aNumberOfRepeats + 1)) { if ((!aSendNEC2Repeats) && (tNumberOfCommands < aNumberOfRepeats + 1)) {
// send the NEC special repeat // send the NEC special repeat
delayMicroseconds(NEC_REPEAT_HEADER_SPACE); // - 2250 delayMicroseconds(NEC_REPEAT_HEADER_SPACE); // - 2250
} else { } else {