MCPcopy Create free account
hub / github.com/Arduino-IRremote/Arduino-IRremote / printIRSendUsage

Method printIRSendUsage

src/IRReceive.hpp:1976–2138  ·  view source on GitHub ↗

* Function to print values and flags of IrReceiver.decodedIRData in one line. * do not print for repeats except IRDATA_FLAGS_IS_PROTOCOL_WITH_DIFFERENT_REPEAT. * Ends with println(). * !!!Attention: The result differs on a 8 bit or 32 bit platform!!! * * @param aSerial The Print object on which to write, for Arduino you can use &Serial. */

Source from the content-addressed store, hash-verified

1974 * @param aSerial The Print object on which to write, for Arduino you can use &Serial.
1975 */
1976void IRrecv::printIRSendUsage(Print *aSerial) {
1977 if (((decodedIRData.flags & (IRDATA_FLAGS_IS_AUTO_REPEAT | IRDATA_FLAGS_IS_REPEAT)) == 0x00
1978 || (decodedIRData.flags & IRDATA_FLAGS_IS_PROTOCOL_WITH_DIFFERENT_REPEAT))) {
1979
1980 /*
1981 * Generating the string:
1982 * Send on a 8 bit platform with:
1983 * uint32_t tRawData[]={0x87654321, 0xAFEDCBA9, 0x5A};
1984 * IrSender.send
1985 * or
1986 * Send on a 8 bit platform with: IrSender.send
1987 * or
1988 * Send with: IrSender.send
1989 */
1990#if defined(DECODE_DISTANCE_WIDTH)
1991 uint_fast8_t tNumberOfArrayData = 0;
1992 if (decodedIRData.protocol == PULSE_DISTANCE || decodedIRData.protocol == PULSE_WIDTH) {
1993# if __INT_WIDTH__ < 32
1994 aSerial->print(F("Send on a 8 bit platform with: "));
1995 tNumberOfArrayData = ((decodedIRData.numberOfBits - 1) / 32) + 1;
1996 if(tNumberOfArrayData > 1) {
1997 aSerial->println();
1998 aSerial->print(F(" uint32_t tRawData[]={0x"));
1999 for (uint_fast8_t i = 0; i < tNumberOfArrayData; ++i) {
2000 aSerial->print(decodedIRData.decodedRawDataArray[i], HEX);
2001# else
2002 aSerial->print(F("Send on a 32 bit platform with: "));
2003 tNumberOfArrayData = ((decodedIRData.numberOfBits - 1) / 64) + 1;
2004 if(tNumberOfArrayData > 1) {
2005 aSerial->println();
2006 aSerial->print(F(" uint64_t tRawData[]={0x"));
2007 for (uint_fast8_t i = 0; i < tNumberOfArrayData; ++i) {
2008 PrintULL::print(aSerial, decodedIRData.decodedRawDataArray[i], HEX);
2009# endif
2010 if (i != tNumberOfArrayData - 1) {
2011 aSerial->print(F(", 0x"));
2012 }
2013 }
2014 aSerial->println(F("};"));
2015 aSerial->print(F(" "));
2016 }
2017 } else { // if (decodedIRData.protocol == PULSE_DISTANCE || decodedIRData.protocol == PULSE_WIDTH)
2018 aSerial->print(F("Send with: "));
2019 }
2020 if (decodedIRData.protocol == UNKNOWN){
2021 aSerial->println();
2022 aSerial->print(F(" "));
2023 printIRResultAsCArray(aSerial);
2024 aSerial->print(F(" "));
2025 }
2026 aSerial->print(F("IrSender.send"));
2027
2028#else
2029 aSerial->print(F("Send with: IrSender.send"));
2030#endif // #if defined(DECODE_DISTANCE_WIDTH)
2031
2032 /*
2033 * Generating the string:

Callers

nothing calls this directly

Calls 3

printFunction · 0.85
printNumberOfRepeatsFunction · 0.85
getProtocolStringFunction · 0.85

Tested by

no test coverage detected