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 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /**
  2. * Copyright (c) 2013 Arduino LLC. All right reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. /**
  19. * Defines for 16 bit timers used with Servo library
  20. *
  21. * If _useTimerX is defined then TimerX is a 32 bit timer on the current board
  22. * timer16_Sequence_t enumerates the sequence that the timers should be allocated
  23. * _Nbr_16timers indicates how many timers are available.
  24. */
  25. /**
  26. * SAM Only definitions
  27. * --------------------
  28. */
  29. // For SAM3X:
  30. //!#define _useTimer1
  31. //!#define _useTimer2
  32. #define _useTimer3
  33. //!#define _useTimer4
  34. #define _useTimer5
  35. #define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays
  36. #define SERVO_TIMER_PRESCALER 32 // timer prescaler
  37. /*
  38. TC0, chan 0 => TC0_Handler
  39. TC0, chan 1 => TC1_Handler
  40. TC0, chan 2 => TC2_Handler
  41. TC1, chan 0 => TC3_Handler
  42. TC1, chan 1 => TC4_Handler
  43. TC1, chan 2 => TC5_Handler
  44. TC2, chan 0 => TC6_Handler
  45. TC2, chan 1 => TC7_Handler
  46. TC2, chan 2 => TC8_Handler
  47. */
  48. #ifdef _useTimer1
  49. #define TC_FOR_TIMER1 TC1
  50. #define CHANNEL_FOR_TIMER1 0
  51. #define ID_TC_FOR_TIMER1 ID_TC3
  52. #define IRQn_FOR_TIMER1 TC3_IRQn
  53. #define HANDLER_FOR_TIMER1 TC3_Handler
  54. #endif
  55. #ifdef _useTimer2
  56. #define TC_FOR_TIMER2 TC1
  57. #define CHANNEL_FOR_TIMER2 1
  58. #define ID_TC_FOR_TIMER2 ID_TC4
  59. #define IRQn_FOR_TIMER2 TC4_IRQn
  60. #define HANDLER_FOR_TIMER2 TC4_Handler
  61. #endif
  62. #ifdef _useTimer3
  63. #define TC_FOR_TIMER3 TC1
  64. #define CHANNEL_FOR_TIMER3 2
  65. #define ID_TC_FOR_TIMER3 ID_TC5
  66. #define IRQn_FOR_TIMER3 TC5_IRQn
  67. #define HANDLER_FOR_TIMER3 TC5_Handler
  68. #endif
  69. #ifdef _useTimer4
  70. #define TC_FOR_TIMER4 TC0
  71. #define CHANNEL_FOR_TIMER4 2
  72. #define ID_TC_FOR_TIMER4 ID_TC2
  73. #define IRQn_FOR_TIMER4 TC2_IRQn
  74. #define HANDLER_FOR_TIMER4 TC2_Handler
  75. #endif
  76. #ifdef _useTimer5
  77. #define TC_FOR_TIMER5 TC0
  78. #define CHANNEL_FOR_TIMER5 0
  79. #define ID_TC_FOR_TIMER5 ID_TC0
  80. #define IRQn_FOR_TIMER5 TC0_IRQn
  81. #define HANDLER_FOR_TIMER5 TC0_Handler
  82. #endif
  83. typedef enum : unsigned char {
  84. #ifdef _useTimer1
  85. _timer1,
  86. #endif
  87. #ifdef _useTimer2
  88. _timer2,
  89. #endif
  90. #ifdef _useTimer3
  91. _timer3,
  92. #endif
  93. #ifdef _useTimer4
  94. _timer4,
  95. #endif
  96. #ifdef _useTimer5
  97. _timer5,
  98. #endif
  99. _Nbr_16timers
  100. } timer16_Sequence_t;