My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pinsDebug.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * HAL Pins Debugging for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
  25. */
  26. #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
  27. #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
  28. #define FTM0_CH0_PIN 22
  29. #define FTM0_CH1_PIN 23
  30. #define FTM0_CH2_PIN 9
  31. #define FTM0_CH3_PIN 10
  32. #define FTM0_CH4_PIN 6
  33. #define FTM0_CH5_PIN 20
  34. #define FTM0_CH6_PIN 21
  35. #define FTM0_CH7_PIN 5
  36. #define FTM1_CH0_PIN 3
  37. #define FTM1_CH1_PIN 4
  38. #define FTM2_CH0_PIN 29
  39. #define FTM2_CH1_PIN 30
  40. #define FTM3_CH0_PIN 2
  41. #define FTM3_CH1_PIN 14
  42. #define FTM3_CH2_PIN 7
  43. #define FTM3_CH3_PIN 8
  44. #define FTM3_CH4_PIN 35
  45. #define FTM3_CH5_PIN 36
  46. #define FTM3_CH6_PIN 37
  47. #define FTM3_CH7_PIN 38
  48. #ifdef __MK66FX1M0__ // Teensy3.6
  49. #define TPM1_CH0_PIN 16
  50. #define TPM1_CH1_PIN 17
  51. #endif
  52. #define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && (P) <= analogInputToDigitalPin(9)) || ((P) >= analogInputToDigitalPin(12) && (P) <= analogInputToDigitalPin(20))
  53. void HAL_print_analog_pin(char buffer[], int8_t pin) {
  54. if (pin <= 23) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 14));
  55. else if (pin <= 39) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 19));
  56. }
  57. void HAL_analog_pin_state(char buffer[], int8_t pin) {
  58. if (pin <= 23) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 14));
  59. else if (pin <= 39) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 19));
  60. }
  61. #define PWM_PRINT(V) do{ sprintf_P(buffer, PSTR("PWM: %4d"), 22); SERIAL_ECHO(buffer); }while(0)
  62. #define FTM_CASE(N,Z) \
  63. case FTM##N##_CH##Z##_PIN: \
  64. if (FTM##N##_C##Z##V) { \
  65. PWM_PRINT(FTM##N##_C##Z##V); \
  66. return true; \
  67. } else return false
  68. /**
  69. * Print a pin's PWM status.
  70. * Return true if it's currently a PWM pin.
  71. */
  72. bool HAL_pwm_status(int8_t pin) {
  73. char buffer[20]; // for the sprintf statements
  74. switch (pin) {
  75. FTM_CASE(0,0);
  76. FTM_CASE(0,1);
  77. FTM_CASE(0,2);
  78. FTM_CASE(0,3);
  79. FTM_CASE(0,4);
  80. FTM_CASE(0,5);
  81. FTM_CASE(0,6);
  82. FTM_CASE(0,7);
  83. FTM_CASE(1,0);
  84. FTM_CASE(1,1);
  85. FTM_CASE(2,0);
  86. FTM_CASE(2,1);
  87. FTM_CASE(3,0);
  88. FTM_CASE(3,1);
  89. FTM_CASE(3,2);
  90. FTM_CASE(3,3);
  91. FTM_CASE(3,4);
  92. FTM_CASE(3,5);
  93. FTM_CASE(3,6);
  94. FTM_CASE(3,7);
  95. case NOT_ON_TIMER:
  96. default:
  97. return false;
  98. }
  99. SERIAL_ECHOPGM(" ");
  100. }
  101. static void HAL_pwm_details(uint8_t pin) { /* TODO */ }