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.0KB

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