Support for seeduino
This commit is contained in:
parent
835cddab31
commit
331de71f7f
|
@ -73,6 +73,7 @@ jobs:
|
|||
- STMicroelectronics:stm32:GenL0:pnum=THUNDERPACK_L072
|
||||
- stm32duino:STM32F1:genericSTM32F103C
|
||||
- sandeepmistry:nRF5:BBCmicrobit
|
||||
- Seeeduino:samd:seeed_XIAO_m0:usbstack=arduino,debug=off,sercom4=include
|
||||
|
||||
# Specify parameters for each board.
|
||||
# With sketches-exclude you may exclude specific examples for a board. Use a comma separated list.
|
||||
|
@ -233,6 +234,13 @@ jobs:
|
|||
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
|
||||
All: -DRAW_BUFFER_LENGTH=300
|
||||
|
||||
- arduino-boards-fqbn: Seeeduino:samd:seeed_XIAO_m0:usbstack=arduino,debug=off,sercom4=include
|
||||
platform-url: https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
|
||||
sketches-exclude: AllProtocols
|
||||
build-properties: # the flags were put in compiler.cpp.extra_flags
|
||||
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
|
||||
All: -DRAW_BUFFER_LENGTH=300
|
||||
|
||||
# fail-fast: false # false -> do not cancel all jobs / architectures if one job fails
|
||||
|
||||
steps:
|
||||
|
|
|
@ -28,5 +28,6 @@ These are the active contributors of this project that you may contact if there
|
|||
- [ElectronicsArchiver}(https://github.com/ElectronicsArchiver) improving documentation
|
||||
- [Stephen Humphries](https://github.com/sjahu)Fix for: Prevent long delay caused by overflow when frame duration < repeat period #1028
|
||||
- [Daniel Wallner](https://github.com/danielwallner) Bang & Olufsen protocol.
|
||||
- [slott](https://stackoverflow.com/users/11680056/sklott) Seeduino print(unsigned long long...) support.
|
||||
|
||||
Note: Please let [ArminJo](https://github.com/ArminJo) know if you have been missed.
|
||||
|
|
|
@ -78,7 +78,7 @@ Available as [Arduino library "IRremote"](https://www.arduinolibraries.info/libr
|
|||
|
||||
` JVC ` ` LG ` ` RC5 ` ` RC6 ` ` Samsung ` ` Sony `
|
||||
|
||||
` Universal Distance ` ` Hash ` ` Pronto `
|
||||
` Universal Pulse Distance ` ` Universal Pulse Width ` ` Hash ` ` Pronto `
|
||||
|
||||
` BoseWave ` ` Bang & Olufsen ` ` Lego ` ` Whynter ` ` MagiQuest `
|
||||
|
||||
|
@ -97,11 +97,10 @@ Protocols can be switched off and on by defining macros before the line `#includ
|
|||
- Allows receiving and sending of **raw timing data**.
|
||||
|
||||
## New features with version 4.x
|
||||
- New universal **Pulse Distance Width decoder** added, which covers some previous unknown protocols.
|
||||
- New universal **Pulse Distance / Pulse Width decoder** added, which covers many previous unknown protocols.
|
||||
- Printout of code how to send received command by `IrReceiver.printIRSendUsage(&Serial)`.
|
||||
- Support for more than 64 bit data for universal decoder and sender.
|
||||
- RawData type is now 64 bit for 32 bit platforms and therefore contains complete frame information for more protocols.
|
||||
- Callback after receiving a command - call your own code if a message was received.
|
||||
- Cores for 32 bit platforms, which lack the print function for 64 bit integer `size_t println(unsigned long long, int = DEC)` are no longer supported. E.g. seeduino core for SAMD21. Please open an issue for the core to support printing of 64 bit integer or activate the line [#define LAZY_32_BIT_CORE](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremoteInt.h#L116).
|
||||
|
||||
# Converting your 3.x program to the 4.x version
|
||||
- You must replace `#define DECODE_DISTANCE_WIDTH` by `#define DECODE_DISTANCE_WIDTH` (only if you explicitly enabled this decoder).
|
||||
|
|
|
@ -28,6 +28,7 @@ See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-I
|
|||
- Analyzed Denon code table and therefore changed Denon from MSB to LSB first.
|
||||
- Changed type of decodedRawData and decodedRawDataArray which is now 64 bit for 32 bit platforms.
|
||||
- Renamed sendRC6(aRawData...) to sendRC6Raw( aRawData...).
|
||||
- Support for seeduino which lacks the print(unsigned long long...) method. Thanks to sklott https://stackoverflow.com/users/11680056/sklott
|
||||
|
||||
## 3.9.0
|
||||
- Improved documentation with the help of [ElectronicsArchiver}(https://github.com/ElectronicsArchiver).
|
||||
|
|
|
@ -122,7 +122,11 @@ void receive_ir_data() {
|
|||
Serial.print(F("Decoded protocol: "));
|
||||
Serial.print(getProtocolString(IrReceiver.decodedIRData.protocol));
|
||||
Serial.print(F("Decoded raw data: "));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#endif
|
||||
Serial.print(F(", decoded address: "));
|
||||
Serial.print(IrReceiver.decodedIRData.address, HEX);
|
||||
Serial.print(F(", decoded command: "));
|
||||
|
|
|
@ -202,9 +202,18 @@ void checkReceivedRawData(IRRawDataType aRawData) {
|
|||
if (IrReceiver.decodedIRData.protocol == PULSE_DISTANCE || IrReceiver.decodedIRData.protocol == PULSE_WIDTH) {
|
||||
if (IrReceiver.decodedIRData.decodedRawData != aRawData) {
|
||||
Serial.print(F("ERROR: Received data=0x"));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#endif
|
||||
Serial.print(F(" != sent data=0x"));
|
||||
Serial.println(aRawData, HEX);
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
Serial.print(aRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(&Serial, aRawData, HEX);
|
||||
#endif
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
IrReceiver.resume();
|
||||
|
@ -238,7 +247,11 @@ void checkReceivedArray(uint32_t *aRawDataArrayPointer, uint8_t aArraySize) {
|
|||
for (uint_fast8_t i = 0; i < aArraySize; ++i) {
|
||||
if (IrReceiver.decodedIRData.decodedRawDataArray[i] != *aRawDataArrayPointer) {
|
||||
Serial.print(F("ERROR: Received data=0x"));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
Serial.print(IrReceiver.decodedIRData.decodedRawDataArray[i], HEX);
|
||||
#else
|
||||
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawDataArray[i], HEX);
|
||||
#endif
|
||||
Serial.print(F(" != sent data=0x"));
|
||||
Serial.println(*aRawDataArrayPointer, HEX);
|
||||
}
|
||||
|
@ -528,7 +541,11 @@ void loop() {
|
|||
checkReceive(0xFF00, 0x176);
|
||||
if (IrReceiver.decodedIRData.decodedRawData != 0x6BCDFF00) {
|
||||
Serial.print(F("ERROR: Received address=0x"));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#endif
|
||||
Serial.println(F(" != sent address=0x6BCDFF00"));
|
||||
Serial.println();
|
||||
}
|
||||
|
|
|
@ -72,6 +72,57 @@ const char* getProtocolString(decode_type_t aProtocol) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (__INT_WIDTH__ >= 32)
|
||||
# if __has_include(<type_traits>)
|
||||
/*
|
||||
* This code to handle the missing print(unsigned long long...) function of seeduino core was contributed by sklott
|
||||
* https://stackoverflow.com/questions/74622227/avoid-calling-of-function-size-t-printprintunsigned-long-long-n-int-base-if
|
||||
*/
|
||||
#include <type_traits>
|
||||
|
||||
// If you have C++17 you can just use std::void_t, or use this for all versions
|
||||
#if __cpp_lib_void_t >= 201411L
|
||||
template<typename T>
|
||||
using void_t = std::void_t<T>;
|
||||
#else
|
||||
template<typename ... Ts> struct make_void {
|
||||
typedef void type;
|
||||
};
|
||||
template<typename ... Ts> using void_t = typename make_void<Ts...>::type;
|
||||
#endif
|
||||
|
||||
// Detecting if we have print(unsigned long long value, int base) / print(0ull, 0) overload
|
||||
template<typename T, typename = void>
|
||||
struct has_ull_print: std::false_type {
|
||||
};
|
||||
template<typename T>
|
||||
struct has_ull_print<T, void_t<decltype(std::declval<T>().print(0ull, 0))>> : std::true_type {
|
||||
};
|
||||
|
||||
// Must be namespace, to avoid public and static declarations for class
|
||||
namespace PrintULL {
|
||||
template<typename PrintImplType, typename std::enable_if<!has_ull_print<PrintImplType>::value, bool>::type = true>
|
||||
size_t print(PrintImplType *p, unsigned long long value, int base) {
|
||||
size_t tLength = p->print(static_cast<uint32_t>(value >> 32), base);
|
||||
tLength += p->print(static_cast<uint32_t>(value), base);
|
||||
return tLength;
|
||||
}
|
||||
|
||||
template<typename PrintImplType, typename std::enable_if<has_ull_print<PrintImplType>::value, bool>::type = true>
|
||||
size_t print(PrintImplType *p, unsigned long long value, int base) {
|
||||
return p->print(value, base);
|
||||
}
|
||||
}
|
||||
;
|
||||
# else
|
||||
namespace PrintULL {
|
||||
size_t print(Print *aSerial, unsigned long long n, int base) {
|
||||
return aSerial->print(n, base);
|
||||
}
|
||||
};
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Function to print decoded result and flags in one line.
|
||||
* A static function to be able to print data to send or copied received data.
|
||||
|
@ -91,7 +142,12 @@ void printIRResultShort(Print *aSerial, IRData *aIRDataPtr, bool aPrintRepeatGap
|
|||
if (aIRDataPtr->protocol == UNKNOWN) {
|
||||
#if defined(DECODE_HASH)
|
||||
aSerial->print(F(" Hash=0x"));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
aSerial->print(aIRDataPtr->decodedRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(aSerial,aIRDataPtr->decodedRawData, HEX);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#if !defined(DISABLE_CODE_FOR_RECEIVER)
|
||||
aSerial->print(' ');
|
||||
|
@ -148,8 +204,11 @@ void printIRResultShort(Print *aSerial, IRData *aIRDataPtr, bool aPrintRepeatGap
|
|||
*/
|
||||
if (!(aIRDataPtr->flags & IRDATA_FLAGS_IS_REPEAT) || aIRDataPtr->decodedRawData != 0) {
|
||||
aSerial->print(F(" Raw-Data=0x"));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
aSerial->print(aIRDataPtr->decodedRawData, HEX);
|
||||
|
||||
#else
|
||||
PrintULL::print(aSerial, aIRDataPtr->decodedRawData, HEX);
|
||||
#endif
|
||||
/*
|
||||
* Print number of bits processed
|
||||
*/
|
||||
|
|
|
@ -1024,19 +1024,23 @@ void IRrecv::printIRSendUsage(Print *aSerial) {
|
|||
aSerial->print(F("Send with:"));
|
||||
uint_fast8_t tNumberOfArrayData = 0;
|
||||
if (decodedIRData.protocol == PULSE_DISTANCE || decodedIRData.protocol == PULSE_WIDTH) {
|
||||
#if __INT_WIDTH__ < 32
|
||||
# if __INT_WIDTH__ < 32
|
||||
tNumberOfArrayData = ((decodedIRData.numberOfBits - 1) / 32) + 1;
|
||||
if(tNumberOfArrayData > 1) {
|
||||
aSerial->println();
|
||||
aSerial->print(F(" uint32_t tRawData[]={0x"));
|
||||
#else
|
||||
# else
|
||||
tNumberOfArrayData = ((decodedIRData.numberOfBits - 1) / 64) + 1;
|
||||
if(tNumberOfArrayData > 1) {
|
||||
aSerial->println();
|
||||
aSerial->print(F(" uint64_t tRawData[]={0x"));
|
||||
#endif
|
||||
# endif
|
||||
for (uint_fast8_t i = 0; i < tNumberOfArrayData; ++i) {
|
||||
# if (__INT_WIDTH__ < 32)
|
||||
aSerial->print(decodedIRData.decodedRawDataArray[i], HEX);
|
||||
# else
|
||||
PrintULL::print(aSerial, decodedIRData.decodedRawDataArray[i], HEX);
|
||||
# endif
|
||||
if (i != tNumberOfArrayData - 1) {
|
||||
aSerial->print(F(", 0x"));
|
||||
}
|
||||
|
@ -1057,7 +1061,11 @@ void IRrecv::printIRSendUsage(Print *aSerial) {
|
|||
aSerial->print(F("(0x"));
|
||||
#if defined(DECODE_MAGIQUEST)
|
||||
if (decodedIRData.protocol == MAGIQUEST) {
|
||||
# if (__INT_WIDTH__ < 32)
|
||||
aSerial->print(decodedIRData.decodedRawData, HEX);
|
||||
# else
|
||||
PrintULL::print(aSerial, decodedIRData.decodedRawData, HEX);
|
||||
# endif
|
||||
} else {
|
||||
aSerial->print(decodedIRData.address, HEX);
|
||||
}
|
||||
|
@ -1106,7 +1114,11 @@ void IRrecv::printIRSendUsage(Print *aSerial) {
|
|||
aSerial->print(F(", &tRawData[0], "));
|
||||
} else {
|
||||
aSerial->print(F(", 0x"));
|
||||
# if (__INT_WIDTH__ < 32)
|
||||
aSerial->print(decodedIRData.decodedRawData, HEX);
|
||||
# else
|
||||
PrintULL::print(aSerial, decodedIRData.decodedRawData, HEX);
|
||||
# endif
|
||||
aSerial->print(F(", "));
|
||||
}
|
||||
aSerial->print(decodedIRData.numberOfBits);// aNumberOfBits
|
||||
|
@ -1146,7 +1158,11 @@ void IRrecv::printIRResultMinimal(Print *aSerial) {
|
|||
if (decodedIRData.protocol == UNKNOWN) {
|
||||
#if defined(DECODE_HASH)
|
||||
aSerial->print(F(" #=0x"));
|
||||
# if (__INT_WIDTH__ < 32)
|
||||
aSerial->print(decodedIRData.decodedRawData, HEX);
|
||||
# else
|
||||
PrintULL::print(aSerial, decodedIRData.decodedRawData, HEX);
|
||||
# endif
|
||||
#endif
|
||||
aSerial->print(' ');
|
||||
aSerial->print((decodedIRData.rawDataPtr->rawlen + 1) / 2, DEC);
|
||||
|
@ -1162,7 +1178,11 @@ void IRrecv::printIRResultMinimal(Print *aSerial) {
|
|||
aSerial->print(decodedIRData.command, HEX);
|
||||
|
||||
aSerial->print(F(" Raw=0x"));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
aSerial->print(decodedIRData.decodedRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(aSerial, decodedIRData.decodedRawData, HEX);
|
||||
#endif
|
||||
|
||||
if (decodedIRData.flags & (IRDATA_FLAGS_IS_AUTO_REPEAT | IRDATA_FLAGS_IS_REPEAT)) {
|
||||
aSerial->print(F(" R"));
|
||||
|
@ -1203,12 +1223,12 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
|
|||
// check if we have a protocol with no or 8 start bits
|
||||
#if defined(DECODE_DENON) || defined(DECODE_MAGIQUEST)
|
||||
if (
|
||||
#if defined(DECODE_DENON)
|
||||
# if defined(DECODE_DENON)
|
||||
decodedIRData.protocol == DENON || decodedIRData.protocol == SHARP ||
|
||||
#endif
|
||||
#if defined(DECODE_MAGIQUEST)
|
||||
# endif
|
||||
# if defined(DECODE_MAGIQUEST)
|
||||
decodedIRData.protocol == MAGIQUEST ||
|
||||
#endif
|
||||
# endif
|
||||
false) {
|
||||
tCounterForNewline = 0; // no or 8 start bits
|
||||
}
|
||||
|
@ -1383,7 +1403,11 @@ void IRrecv::printIRResultAsCVariables(Print *aSerial) {
|
|||
#else
|
||||
aSerial->print(F("uint64_t rawData = 0x"));
|
||||
#endif
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
aSerial->print(decodedIRData.decodedRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(aSerial, decodedIRData.decodedRawData, HEX);
|
||||
#endif
|
||||
aSerial->println(';');
|
||||
aSerial->println();
|
||||
}
|
||||
|
|
|
@ -287,11 +287,11 @@
|
|||
/*
|
||||
* Include the sources here to enable compilation with macro values set by user program.
|
||||
*/
|
||||
#include "IRProtocol.hpp" // must be first, it includes definition for PrintULL (unsigned long long)
|
||||
#if !defined(DISABLE_CODE_FOR_RECEIVER)
|
||||
#include "IRReceive.hpp"
|
||||
#endif
|
||||
#include "IRSend.hpp"
|
||||
#include "IRProtocol.hpp"
|
||||
|
||||
/*
|
||||
* Include the sources of all decoders here to enable compilation with macro values set by user program.
|
||||
|
|
|
@ -113,8 +113,7 @@ struct irparams_struct {
|
|||
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
|
||||
};
|
||||
|
||||
//#define LAZY_32_BIT_CORE // Activate it for 32 cores, which are too lazy to specify size_t println(unsigned long long, int = DEC).
|
||||
#if (__INT_WIDTH__ < 32) || defined(LAZY_32_BIT_CORE)
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
typedef uint32_t IRRawDataType;
|
||||
#else
|
||||
typedef uint64_t IRRawDataType;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/*
|
||||
* ir_DistanceWidthProtocol.hpp
|
||||
*
|
||||
* Contains only the decoder functions!
|
||||
* Contains only the decoder functions for universal pulse width or pulse distance protocols!
|
||||
* The send functions are used by almost all protocols and therefore in IRSend.hh.
|
||||
*
|
||||
* This decoder tries to decode a pulse distance or pulse distance width with constant period (or pulse width - not enabled yet) protocol.
|
||||
* 1. Analyze all space and mark length
|
||||
|
|
Loading…
Reference in New Issue