1 | /*
|
---|
2 | Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
|
---|
3 | Copyright (c) 2009 Michael Margolis. All right reserved.
|
---|
4 |
|
---|
5 | This library is free software; you can redistribute it and/or
|
---|
6 | modify it under the terms of the GNU Lesser General Public
|
---|
7 | License as published by the Free Software Foundation; either
|
---|
8 | version 2.1 of the License, or (at your option) any later version.
|
---|
9 |
|
---|
10 | This library 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 GNU
|
---|
13 | Lesser General Public License for more details.
|
---|
14 |
|
---|
15 | You should have received a copy of the GNU Lesser General Public
|
---|
16 | License along with this library; if not, write to the Free Software
|
---|
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
18 | */
|
---|
19 |
|
---|
20 | /*
|
---|
21 | * Defines for 16 bit timers used with Servo library
|
---|
22 | *
|
---|
23 | * If _useTimerX is defined then TimerX is a 16 bit timer on the current board
|
---|
24 | * timer16_Sequence_t enumerates the sequence that the timers should be allocated
|
---|
25 | * _Nbr_16timers indicates how many 16 bit timers are available.
|
---|
26 | */
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * AVR Only definitions
|
---|
30 | * --------------------
|
---|
31 | */
|
---|
32 |
|
---|
33 | // Say which 16 bit timers can be used and in what order
|
---|
34 | #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
---|
35 | #define _useTimer5
|
---|
36 | #define _useTimer1
|
---|
37 | #define _useTimer3
|
---|
38 | #define _useTimer4
|
---|
39 | typedef enum { _timer5, _timer1, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t;
|
---|
40 |
|
---|
41 | #elif defined(__AVR_ATmega32U4__)
|
---|
42 | #define _useTimer1
|
---|
43 | typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t;
|
---|
44 |
|
---|
45 | #elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
|
---|
46 | #define _useTimer3
|
---|
47 | #define _useTimer1
|
---|
48 | typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t;
|
---|
49 |
|
---|
50 | #elif defined(__AVR_ATmega128__) ||defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
|
---|
51 | #define _useTimer3
|
---|
52 | #define _useTimer1
|
---|
53 | typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t;
|
---|
54 |
|
---|
55 | #else // everything else
|
---|
56 | #define _useTimer1
|
---|
57 | typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t;
|
---|
58 | #endif
|
---|
59 |
|
---|