My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pinsDebug.h 3.1KB

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