source: trunk/Arduino/libraries/Servo/src/sam/ServoTimers.h @ 29

Last change on this file since 29 was 3, checked in by markus, 7 years ago

Setup project structure

File size: 2.6 KB
RevLine 
[3]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/*
20 * Defines for 16 bit timers used with  Servo library
21 *
22 * If _useTimerX is defined then TimerX is a 16 bit timer on the current board
23 * timer16_Sequence_t enumerates the sequence that the timers should be allocated
24 * _Nbr_16timers indicates how many 16 bit timers are available.
25 */
26
27/**
28 * SAM Only definitions
29 * --------------------
30 */
31
32// For SAM3X:
33#define _useTimer1
34#define _useTimer2
35#define _useTimer3
36#define _useTimer4
37#define _useTimer5
38
39/*
40  TC0, chan 0 => TC0_Handler
41  TC0, chan 1 => TC1_Handler
42  TC0, chan 2 => TC2_Handler
43  TC1, chan 0 => TC3_Handler
44  TC1, chan 1 => TC4_Handler
45  TC1, chan 2 => TC5_Handler
46  TC2, chan 0 => TC6_Handler
47  TC2, chan 1 => TC7_Handler
48  TC2, chan 2 => TC8_Handler
49 */
50
51#if defined (_useTimer1)
52#define TC_FOR_TIMER1       TC1
53#define CHANNEL_FOR_TIMER1  0
54#define ID_TC_FOR_TIMER1    ID_TC3
55#define IRQn_FOR_TIMER1     TC3_IRQn
56#define HANDLER_FOR_TIMER1  TC3_Handler
57#endif
58#if defined (_useTimer2)
59#define TC_FOR_TIMER2       TC1
60#define CHANNEL_FOR_TIMER2  1
61#define ID_TC_FOR_TIMER2    ID_TC4
62#define IRQn_FOR_TIMER2     TC4_IRQn
63#define HANDLER_FOR_TIMER2  TC4_Handler
64#endif
65#if defined (_useTimer3)
66#define TC_FOR_TIMER3       TC1
67#define CHANNEL_FOR_TIMER3  2
68#define ID_TC_FOR_TIMER3    ID_TC5
69#define IRQn_FOR_TIMER3     TC5_IRQn
70#define HANDLER_FOR_TIMER3  TC5_Handler
71#endif
72#if defined (_useTimer4)
73#define TC_FOR_TIMER4       TC0
74#define CHANNEL_FOR_TIMER4  2
75#define ID_TC_FOR_TIMER4    ID_TC2
76#define IRQn_FOR_TIMER4     TC2_IRQn
77#define HANDLER_FOR_TIMER4  TC2_Handler
78#endif
79#if defined (_useTimer5)
80#define TC_FOR_TIMER5       TC0
81#define CHANNEL_FOR_TIMER5  0
82#define ID_TC_FOR_TIMER5    ID_TC0
83#define IRQn_FOR_TIMER5     TC0_IRQn
84#define HANDLER_FOR_TIMER5  TC0_Handler
85#endif
86
87typedef enum { _timer1, _timer2, _timer3, _timer4, _timer5, _Nbr_16timers } timer16_Sequence_t ;
88
Note: See TracBrowser for help on using the repository browser.