選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

231 行
8.8KB

  1. /*
  2. * IRremote: IRremoteInfo - prints relevant config info & settings for IRremote over serial
  3. * Intended to help identify & troubleshoot the various settings of IRremote
  4. * For example, sometimes users are unsure of which pin is used for Tx or the RAWBUF values
  5. * This example can be used to assist the user directly or with support.
  6. * Intended to help identify & troubleshoot the various settings of IRremote
  7. * Hopefully this utility will be a useful tool for support & troubleshooting for IRremote
  8. * Check out the blog post describing the sketch via http://www.analysir.com/blog/2015/11/28/helper-utility-for-troubleshooting-irremote/
  9. * Version 1.0 November 2015
  10. * Original Author: AnalysIR - IR software & modules for Makers & Pros, visit http://www.AnalysIR.com
  11. */
  12. #include <IRremote.h>
  13. void setup()
  14. {
  15. Serial.begin(115200); //You may alter the BAUD rate here as needed
  16. while (!Serial); //wait until Serial is established - required on some Platforms
  17. //Runs only once per restart of the Arduino.
  18. dumpHeader();
  19. dumpRAWBUF();
  20. dumpTIMER();
  21. dumpTimerPin();
  22. dumpClock();
  23. dumpPlatform();
  24. dumpPulseParams();
  25. dumpSignalParams();
  26. dumpArduinoIDE();
  27. dumpDebugMode();
  28. dumpProtocols();
  29. dumpFooter();
  30. }
  31. void loop() {
  32. //nothing to do!
  33. }
  34. void dumpRAWBUF() {
  35. Serial.print(F("RAWBUF: "));
  36. Serial.println(RAWBUF);
  37. }
  38. void dumpTIMER() {
  39. boolean flag = false;
  40. #ifdef IR_USE_TIMER1
  41. Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer1")); flag = true;
  42. #endif
  43. #ifdef IR_USE_TIMER2
  44. Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer2")); flag = true;
  45. #endif
  46. #ifdef IR_USE_TIMER3
  47. Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer3")); flag = true;
  48. #endif
  49. #ifdef IR_USE_TIMER4
  50. Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer4")); flag = true;
  51. #endif
  52. #ifdef IR_USE_TIMER5
  53. Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer5")); flag = true;
  54. #endif
  55. #ifdef IR_USE_TIMER4_HS
  56. Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer4_HS")); flag = true;
  57. #endif
  58. #ifdef IR_USE_TIMER_CMT
  59. Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer_CMT")); flag = true;
  60. #endif
  61. #ifdef IR_USE_TIMER_TPM1
  62. Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer_TPM1")); flag = true;
  63. #endif
  64. #ifdef IR_USE_TIMER_TINY0
  65. Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer_TINY0")); flag = true;
  66. #endif
  67. if (!flag) {
  68. Serial.print(F("Timer Error: ")); Serial.println(F("not defined"));
  69. }
  70. }
  71. void dumpTimerPin() {
  72. Serial.print(F("IR Tx Pin: "));
  73. Serial.println(TIMER_PWM_PIN);
  74. }
  75. void dumpClock() {
  76. Serial.print(F("MCU Clock: "));
  77. Serial.println(F_CPU);
  78. }
  79. void dumpPlatform() {
  80. Serial.print(F("MCU Platform: "));
  81. #if defined(__AVR_ATmega1280__)
  82. Serial.println(F("Arduino Mega1280"));
  83. #elif defined(__AVR_ATmega2560__)
  84. Serial.println(F("Arduino Mega2560"));
  85. #elif defined(__AVR_AT90USB162__)
  86. Serial.println(F("Teensy 1.0 / AT90USB162"));
  87. // Teensy 2.0
  88. #elif defined(__AVR_ATmega32U4__)
  89. Serial.println(F("Arduino Leonardo / Yun / Teensy 1.0 / ATmega32U4"));
  90. #elif defined(__MK20DX128__) || defined(__MK20DX256__)
  91. Serial.println(F("Teensy 3.0 / Teensy 3.1 / MK20DX128 / MK20DX256"));
  92. #elif defined(__MKL26Z64__)
  93. Serial.println(F("Teensy-LC / MKL26Z64"));
  94. #elif defined(__AVR_AT90USB646__)
  95. Serial.println(F("Teensy++ 1.0 / AT90USB646"));
  96. #elif defined(__AVR_AT90USB1286__)
  97. Serial.println(F("Teensy++ 2.0 / AT90USB1286"));
  98. #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
  99. Serial.println(F("ATmega1284"));
  100. #elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__)
  101. Serial.println(F("ATmega644"));
  102. #elif defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) || defined(__AVR_ATmega324PA__)
  103. Serial.println(F("ATmega324"));
  104. #elif defined(__AVR_ATmega164A__) || defined(__AVR_ATmega164P__)
  105. Serial.println(F("ATmega164"));
  106. #elif defined(__AVR_ATmega128__)
  107. Serial.println(F("ATmega128"));
  108. #elif defined(__AVR_ATmega88__) || defined(__AVR_ATmega88P__)
  109. Serial.println(F("ATmega88"));
  110. #elif defined(__AVR_ATmega64__)
  111. Serial.println(F("ATmega64"));
  112. #elif defined(__AVR_ATmega48__) || defined(__AVR_ATmega48P__)
  113. Serial.println(F("ATmega48"));
  114. #elif defined(__AVR_ATmega32__)
  115. Serial.println(F("ATmega32"));
  116. #elif defined(__AVR_ATmega16__)
  117. Serial.println(F("ATmega16"));
  118. #elif defined(__AVR_ATmega8535__)
  119. Serial.println(F("ATmega8535"));
  120. #elif defined(__AVR_ATmega8__)
  121. Serial.println(F("Atmega8"));
  122. #elif defined(__AVR_ATtiny84__)
  123. Serial.println(F("ATtiny84"));
  124. #elif defined(__AVR_ATtiny85__)
  125. Serial.println(F("ATtiny85"));
  126. #else
  127. Serial.println(F("ATmega328(P) / (Duemilanove, Diecimila, LilyPad, Mini, Micro, Fio, Nano, etc)"));
  128. #endif
  129. }
  130. void dumpPulseParams() {
  131. Serial.print(F("Mark Excess: ")); Serial.print(MARK_EXCESS);; Serial.println(F(" uSecs"));
  132. Serial.print(F("Microseconds per tick: ")); Serial.print(USECPERTICK);; Serial.println(F(" uSecs"));
  133. Serial.print(F("Measurement tolerance: ")); Serial.print(TOLERANCE); Serial.println(F("%"));
  134. }
  135. void dumpSignalParams() {
  136. Serial.print(F("Minimum Gap between IR Signals: ")); Serial.print(_GAP); Serial.println(F(" uSecs"));
  137. }
  138. void dumpDebugMode() {
  139. Serial.print(F("Debug Mode: "));
  140. #if DEBUG
  141. Serial.println(F("ON"));
  142. #else
  143. Serial.println(F("OFF (Normal)"));
  144. #endif
  145. }
  146. void dumpArduinoIDE() {
  147. Serial.print(F("Arduino IDE version: "));
  148. Serial.print(ARDUINO / 10000);
  149. Serial.write('.');
  150. Serial.print((ARDUINO % 10000) / 100);
  151. Serial.write('.');
  152. Serial.println(ARDUINO % 100);
  153. }
  154. void dumpProtocols() {
  155. Serial.println(); Serial.print(F("IR PROTOCOLS ")); Serial.print(F("SEND ")); Serial.println(F("DECODE"));
  156. Serial.print(F("============= ")); Serial.print(F("======== ")); Serial.println(F("========"));
  157. Serial.print(F("RC5: ")); printSendEnabled(SEND_RC5); printDecodeEnabled(DECODE_RC6);
  158. Serial.print(F("RC6: ")); printSendEnabled(SEND_RC6); printDecodeEnabled(DECODE_RC5);
  159. Serial.print(F("NEC: ")); printSendEnabled(SEND_NEC); printDecodeEnabled(DECODE_NEC);
  160. Serial.print(F("SONY: ")); printSendEnabled(SEND_SONY); printDecodeEnabled(DECODE_SONY);
  161. Serial.print(F("PANASONIC: ")); printSendEnabled(SEND_PANASONIC); printDecodeEnabled(DECODE_PANASONIC);
  162. Serial.print(F("JVC: ")); printSendEnabled(SEND_JVC); printDecodeEnabled(DECODE_JVC);
  163. Serial.print(F("SAMSUNG: ")); printSendEnabled(SEND_SAMSUNG); printDecodeEnabled(DECODE_SAMSUNG);
  164. Serial.print(F("WHYNTER: ")); printSendEnabled(SEND_WHYNTER); printDecodeEnabled(DECODE_WHYNTER);
  165. Serial.print(F("AIWA_RC_T501: ")); printSendEnabled(SEND_AIWA_RC_T501); printDecodeEnabled(DECODE_AIWA_RC_T501);
  166. Serial.print(F("LG: ")); printSendEnabled(SEND_LG); printDecodeEnabled(DECODE_LG);
  167. Serial.print(F("SANYO: ")); printSendEnabled(SEND_SANYO); printDecodeEnabled(DECODE_SANYO);
  168. Serial.print(F("MITSUBISHI: ")); printSendEnabled(SEND_MITSUBISHI); printDecodeEnabled(DECODE_MITSUBISHI);
  169. Serial.print(F("DISH: ")); printSendEnabled(SEND_DISH); printDecodeEnabled(DECODE_DISH);
  170. Serial.print(F("SHARP: ")); printSendEnabled(SEND_SHARP); printDecodeEnabled(DECODE_SHARP);
  171. Serial.print(F("DENON: ")); printSendEnabled(SEND_DENON); printDecodeEnabled(DECODE_DENON);
  172. Serial.print(F("PRONTO: ")); printSendEnabled(SEND_PRONTO); Serial.println(F("(Not Applicable)"));
  173. }
  174. void printSendEnabled(int flag) {
  175. if (flag) {
  176. Serial.print(F("Enabled "));
  177. }
  178. else {
  179. Serial.print(F("Disabled "));
  180. }
  181. }
  182. void printDecodeEnabled(int flag) {
  183. if (flag) {
  184. Serial.println(F("Enabled"));
  185. }
  186. else {
  187. Serial.println(F("Disabled"));
  188. }
  189. }
  190. void dumpHeader() {
  191. Serial.println(F("IRremoteInfo - by AnalysIR (http://www.AnalysIR.com/)"));
  192. Serial.println(F(" - A helper sketch to assist in troubleshooting issues with the library by reviewing the settings within the IRremote library"));
  193. Serial.println(F(" - Prints out the important settings within the library, which can be configured to suit the many supported platforms"));
  194. Serial.println(F(" - When seeking on-line support, please post or upload the output of this sketch, where appropriate"));
  195. Serial.println();
  196. Serial.println(F("IRremote Library Settings"));
  197. Serial.println(F("========================="));
  198. }
  199. void dumpFooter() {
  200. Serial.println();
  201. Serial.println(F("Notes: "));
  202. Serial.println(F(" - Most of the seetings above can be configured in the following files included as part of the library"));
  203. Serial.println(F(" - IRremteInt.h"));
  204. Serial.println(F(" - IRremote.h"));
  205. Serial.println(F(" - You can save SRAM by disabling the Decode or Send features for any protocol (Near the top of IRremoteInt.h)"));
  206. Serial.println(F(" - Some Timer conflicts, with other libraries, can be easily resolved by configuring a differnt Timer for your platform"));
  207. }