elbear_arduino_bsp/libraries/IRremote/examples/IRremoteInfo/IRremoteInfo.ino

245 lines
6.5 KiB
C++

/*
* IRremote: IRremoteInfo - prints relevant config info & settings for IRremote over serial
* Intended to help identify & troubleshoot the various settings of IRremote
* For example, sometimes users are unsure of which pin is used for Tx or the RAW_BUFFER_LENGTH value
* This example can be used to assist the user directly or with support.
* Intended to help identify & troubleshoot the various settings of IRremote
* Hopefully this utility will be a useful tool for support & troubleshooting for IRremote
* Check out the blog post describing the sketch via http://www.analysir.com/blog/2015/11/28/helper-utility-for-troubleshooting-irremote/
* Version 1.0 November 2015
* Original Author: AnalysIR - IR software & modules for Makers & Pros, visit http://www.AnalysIR.com
*/
#include <Arduino.h>
//#define EXCLUDE_EXOTIC_PROTOCOLS // saves around 240 bytes program memory if IrSender.write is used
//#define SEND_PWM_BY_TIMER
//#define USE_NO_SEND_PWM
//#define NO_LED_FEEDBACK_CODE // saves 566 bytes program memory
#include <IRremote.hpp>
// Function declarations for non Arduino IDE's
void dumpHeader();
void dumpRAW_BUFFER_LENGTH();
void dumpTIMER();
void dumpTimerPin();
void dumpClock();
void dumpPlatform();
void dumpPulseParams();
void dumpSignalParams();
void dumpArduinoIDE();
void dumpDebugMode();
void dumpProtocols();
void dumpFooter();
void setup() {
Serial.begin(9600);
while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores.
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
//Runs only once per restart of the Arduino.
dumpHeader();
dumpRAW_BUFFER_LENGTH();
dumpClock();
dumpPlatform();
dumpPulseParams();
dumpSignalParams();
dumpDebugMode();
dumpProtocols();
dumpFooter();
}
void loop() {
//nothing to do!
}
void dumpRAW_BUFFER_LENGTH() {
Serial.print(F("RAW_BUFFER_LENGTH: "));
Serial.println(RAW_BUFFER_LENGTH);
}
void dumpClock() {
#if defined(F_CPU)
Serial.print(F("MCU Clock: "));
Serial.println(F_CPU);
#endif
}
void dumpPlatform() {
Serial.print(F("MCU Platform: "));
#if defined(MIK32V2)
Serial.println(F("MIK32 Amur"));
#endif
}
void dumpPulseParams() {
Serial.print(F("Mark Excess: "));
Serial.print(MARK_EXCESS_MICROS);
;
Serial.println(F(" uSecs"));
Serial.print(F("Microseconds per tick: "));
Serial.print(MICROS_PER_TICK);
;
Serial.println(F(" uSecs"));
Serial.print(F("Measurement tolerance: "));
Serial.print(TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT);
Serial.println(F("%"));
}
void dumpSignalParams() {
Serial.print(F("Minimum Gap between IR Signals: "));
Serial.print(RECORD_GAP_MICROS);
Serial.println(F(" uSecs"));
}
void dumpDebugMode() {
Serial.print(F("Debug Mode: "));
#if DEBUG
Serial.println(F("ON"));
#else
Serial.println(F("OFF (Normal)"));
#endif
}
void dumpProtocols() {
Serial.println();
Serial.print(F("IR PROTOCOLS "));
Serial.print(F("SEND "));
Serial.println(F("DECODE"));
Serial.print(F("============= "));
Serial.print(F("======== "));
Serial.println(F("========"));
Serial.print(F("RC5: "));
#if defined(DECODE_RC5)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("RC6: "));
#if defined(DECODE_RC6)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("NEC: "));
#if defined(DECODE_NEC)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("SONY: "));
#if defined(DECODE_SONY)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("PANASONIC: "));
#if defined(DECODE_PANASONIC)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("JVC: "));
#if defined(DECODE_JVC)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("SAMSUNG: "));
#if defined(DECODE_SAMSUNG)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("LG: "));
#if defined(DECODE_LG)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("DENON: "));
#if defined(DECODE_DENON)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
#if !defined(EXCLUDE_EXOTIC_PROTOCOLS) // saves around 2000 bytes program memory
Serial.print(F("BANG_OLUFSEN: "));
#if defined(DECODE_BEO)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("BOSEWAVE: "));
#if defined(DECODE_BOSEWAVE)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("WHYNTER: "));
#if defined(DECODE_WHYNTER)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
Serial.print(F("FAST: "));
#if defined(DECODE_FAST)
Serial.println(F("Enabled"));
#else
Serial.println(F("Disabled"));
#endif
#endif
}
void printDecodeEnabled(int flag) {
if (flag) {
Serial.println(F("Enabled"));
} else {
Serial.println(F("Disabled"));
}
}
void dumpHeader() {
Serial.println(F("IRremoteInfo - by AnalysIR (http://www.AnalysIR.com/)"));
Serial.println(
F(
"- A helper sketch to assist in troubleshooting issues with the library by reviewing the settings within the IRremote library"));
Serial.println(
F(
"- Prints out the important settings within the library, which can be configured to suit the many supported platforms"));
Serial.println(F("- When seeking on-line support, please post or upload the output of this sketch, where appropriate"));
Serial.println();
Serial.println(F("IRremote Library Settings"));
Serial.println(F("========================="));
}
void dumpFooter() {
Serial.println();
Serial.println(F("Notes: "));
Serial.println(F("- Most of the settings above can be configured in the following files included as part of the library"));
Serial.println(F("- IRremoteInt.h"));
Serial.println(F("- IRremote.h"));
Serial.println(
F("- You can save SRAM by disabling the Decode or Send features for any protocol (Near the top of IRremoteInt.h)"));
}