ShowConfiguration.ino 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #include <AltSoftSerial.h>
  2. // AltSoftSerial show configuration example
  3. // Will print library configuration to default serial port
  4. // Open your serial monitor to see config for your board
  5. // Printout would repeat every 10sec (just in case you missed it somehow)
  6. // Print Configuration
  7. // -----------------------
  8. // Direct include AltSoftSerial internals to obtaion PIN setup (you do not need this in regular code)
  9. // This example code is in the public domain.
  10. #include <config/AltSoftSerial_Boards.h>
  11. void printAltSoftSerialSetup(Stream &port)
  12. {
  13. #define PRINT_PFX "AltSoftSerial:"
  14. #define PRINT_PIN_NAME(pin,name) { char buffer[128+1]; sprintf(buffer, PRINT_PFX "PIN:%2d %s", (int)pin, (const char*)name); port.println(buffer); }
  15. port.println(PRINT_PFX "Setup info: begin");
  16. #if defined(ALTSS_USE_FTM0)
  17. port.println(PRINT_PFX "USE FTM0");
  18. #endif
  19. #if defined(ALTSS_USE_TIMER1)
  20. port.println(PRINT_PFX "USE TIMER1");
  21. #endif
  22. #if defined(ALTSS_USE_TIMER2)
  23. port.println(PRINT_PFX "USE TIMER2");
  24. #endif
  25. #if defined(ALTSS_USE_TIMER3)
  26. port.println(PRINT_PFX "USE TIMER3");
  27. #endif
  28. #if defined(ALTSS_USE_TIMER4)
  29. port.println(PRINT_PFX "USE TIMER4");
  30. #endif
  31. #if defined(ALTSS_USE_TIMER5)
  32. port.println(PRINT_PFX "USE TIMER5");
  33. #endif
  34. #if defined(INPUT_CAPTURE_PIN)
  35. PRINT_PIN_NAME(INPUT_CAPTURE_PIN,"RX");
  36. #endif
  37. #if defined(OUTPUT_COMPARE_A_PIN)
  38. PRINT_PIN_NAME(OUTPUT_COMPARE_A_PIN,"TX");
  39. #endif
  40. #if defined(OUTPUT_COMPARE_B_PIN)
  41. PRINT_PIN_NAME(OUTPUT_COMPARE_B_PIN,"(unused PWM)");
  42. #endif
  43. #if defined(OUTPUT_COMPARE_C_PIN)
  44. PRINT_PIN_NAME(OUTPUT_COMPARE_C_PIN,"(unused PWM)");
  45. #endif
  46. #if defined(OUTPUT_COMPARE_D_PIN)
  47. PRINT_PIN_NAME(OUTPUT_COMPARE_D_PIN,"(unused PWM)");
  48. #endif
  49. #if defined(OUTPUT_COMPARE_E_PIN)
  50. PRINT_PIN_NAME(OUTPUT_COMPARE_E_PIN,"(unused PWM)");
  51. #endif
  52. #if defined(OUTPUT_COMPARE_F_PIN)
  53. PRINT_PIN_NAME(OUTPUT_COMPARE_F_PIN,"(unused PWM)");
  54. #endif
  55. port.println(PRINT_PFX "Setup info: end");
  56. #undef PRINT_PIN_NAME
  57. #undef PRINT_PFX
  58. }
  59. void setup()
  60. {
  61. // Open default serial to dump config to
  62. Serial.begin(9600);
  63. while (!Serial) ; // wait for serial monitor
  64. printAltSoftSerialSetup(Serial);
  65. }
  66. void loop()
  67. {
  68. // Repeat every 10 sec (just in case)
  69. delay(10000);
  70. Serial.println("");
  71. printAltSoftSerialSetup(Serial);
  72. }