2017-06-18 01:36:10 +02:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 15:00:57 +01:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2017-06-18 01:36:10 +02:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 06:57:50 +02:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2017-06-18 01:36:10 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-07-23 05:20:14 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2017-06-18 01:36:10 +02:00
|
|
|
*
|
|
|
|
*/
|
2018-11-04 09:25:55 +01:00
|
|
|
#pragma once
|
2017-06-18 01:36:10 +02:00
|
|
|
|
2017-11-18 09:08:03 +01:00
|
|
|
/**
|
|
|
|
* ServoTimers.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
|
|
|
|
* Copyright (c) 2009 Michael Margolis. All right reserved.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2017-06-18 01:36:10 +02:00
|
|
|
|
2017-10-15 02:05:10 +02:00
|
|
|
/**
|
2017-06-18 01:36:10 +02:00
|
|
|
* Defines for 16 bit timers used with Servo library
|
|
|
|
*
|
|
|
|
* If _useTimerX is defined then TimerX is a 16 bit timer on the current board
|
|
|
|
* timer16_Sequence_t enumerates the sequence that the timers should be allocated
|
|
|
|
* _Nbr_16timers indicates how many 16 bit timers are available.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* AVR Only definitions
|
|
|
|
* --------------------
|
|
|
|
*/
|
|
|
|
|
2019-08-02 14:37:41 +02:00
|
|
|
#define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays
|
|
|
|
#define SERVO_TIMER_PRESCALER 8 // timer prescaler
|
2017-06-18 01:36:10 +02:00
|
|
|
|
|
|
|
// Say which 16 bit timers can be used and in what order
|
|
|
|
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
|
|
|
//#define _useTimer1
|
|
|
|
#define _useTimer3
|
2020-08-14 15:41:44 +02:00
|
|
|
#if NUM_SERVOS > SERVOS_PER_TIMER
|
|
|
|
#define _useTimer4
|
|
|
|
#if !HAS_MOTOR_CURRENT_PWM && SERVOS > 2 * SERVOS_PER_TIMER
|
|
|
|
#define _useTimer5 // Timer 5 is used for motor current PWM and can't be used for servos.
|
|
|
|
#endif
|
2017-06-18 01:36:10 +02:00
|
|
|
#endif
|
|
|
|
#elif defined(__AVR_ATmega32U4__)
|
|
|
|
#define _useTimer3
|
|
|
|
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
|
|
|
|
#define _useTimer3
|
|
|
|
#elif defined(__AVR_ATmega128__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega2561__)
|
|
|
|
#define _useTimer3
|
|
|
|
#else
|
|
|
|
// everything else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef enum {
|
2019-05-26 05:39:00 +02:00
|
|
|
#ifdef _useTimer1
|
2017-06-18 01:36:10 +02:00
|
|
|
_timer1,
|
|
|
|
#endif
|
2019-05-26 05:39:00 +02:00
|
|
|
#ifdef _useTimer3
|
2017-06-18 01:36:10 +02:00
|
|
|
_timer3,
|
|
|
|
#endif
|
2019-05-26 05:39:00 +02:00
|
|
|
#ifdef _useTimer4
|
2017-06-18 01:36:10 +02:00
|
|
|
_timer4,
|
|
|
|
#endif
|
2019-05-26 05:39:00 +02:00
|
|
|
#ifdef _useTimer5
|
2017-06-18 01:36:10 +02:00
|
|
|
_timer5,
|
|
|
|
#endif
|
|
|
|
_Nbr_16timers
|
|
|
|
} timer16_Sequence_t;
|