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.

ServoTimers.h 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. * ServoTimers.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
  25. * Copyright (c) 2009 Michael Margolis. All right reserved.
  26. *
  27. * This library is free software; you can redistribute it and/or
  28. * modify it under the terms of the GNU Lesser General Public
  29. * License as published by the Free Software Foundation; either
  30. * version 2.1 of the License, or (at your option) any later version.
  31. *
  32. * This library is distributed in the hope that it will be useful,
  33. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  34. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  35. * Lesser General Public License for more details.
  36. *
  37. * You should have received a copy of the GNU Lesser General Public
  38. * License along with this library; if not, write to the Free Software
  39. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  40. */
  41. /**
  42. * Defines for 16 bit timers used with Servo library
  43. *
  44. * If _useTimerX is defined then TimerX is a 16 bit timer on the current board
  45. * timer16_Sequence_t enumerates the sequence that the timers should be allocated
  46. * _Nbr_16timers indicates how many 16 bit timers are available.
  47. */
  48. /**
  49. * AVR Only definitions
  50. * --------------------
  51. */
  52. #define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays
  53. #define SERVO_TIMER_PRESCALER 8 // timer prescaler
  54. // Say which 16 bit timers can be used and in what order
  55. #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  56. //#define _useTimer1
  57. #define _useTimer3
  58. #define _useTimer4
  59. #if !HAS_MOTOR_CURRENT_PWM
  60. #define _useTimer5 // Timer 5 is used for motor current PWM and can't be used for servos.
  61. #endif
  62. #elif defined(__AVR_ATmega32U4__)
  63. #define _useTimer3
  64. #elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
  65. #define _useTimer3
  66. #elif defined(__AVR_ATmega128__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega2561__)
  67. #define _useTimer3
  68. #else
  69. // everything else
  70. #endif
  71. typedef enum {
  72. #ifdef _useTimer1
  73. _timer1,
  74. #endif
  75. #ifdef _useTimer3
  76. _timer3,
  77. #endif
  78. #ifdef _useTimer4
  79. _timer4,
  80. #endif
  81. #ifdef _useTimer5
  82. _timer5,
  83. #endif
  84. _Nbr_16timers
  85. } timer16_Sequence_t;