| [3] | 1 | /* |
|---|
| 2 | Copyright (c) 2015 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 | #ifndef __SERVO_TIMERS_H__ |
|---|
| 28 | #define __SERVO_TIMERS_H__ |
|---|
| 29 | |
|---|
| 30 | /** |
|---|
| 31 | * SAMD Only definitions |
|---|
| 32 | * --------------------- |
|---|
| 33 | */ |
|---|
| 34 | |
|---|
| 35 | // For SAMD: |
|---|
| 36 | #define _useTimer1 |
|---|
| 37 | //#define _useTimer2 // <- TODO do not activate until the code in Servo.cpp has been changed in order |
|---|
| 38 | // to manage more than one channel per timer on the SAMD architecture |
|---|
| 39 | |
|---|
| 40 | #if defined (_useTimer1) |
|---|
| 41 | #define TC_FOR_TIMER1 TC4 |
|---|
| 42 | #define CHANNEL_FOR_TIMER1 0 |
|---|
| 43 | #define INTENSET_BIT_FOR_TIMER_1 TC_INTENSET_MC0 |
|---|
| 44 | #define INTENCLR_BIT_FOR_TIMER_1 TC_INTENCLR_MC0 |
|---|
| 45 | #define INTFLAG_BIT_FOR_TIMER_1 TC_INTFLAG_MC0 |
|---|
| 46 | #define ID_TC_FOR_TIMER1 ID_TC4 |
|---|
| 47 | #define IRQn_FOR_TIMER1 TC4_IRQn |
|---|
| 48 | #define HANDLER_FOR_TIMER1 TC4_Handler |
|---|
| 49 | #define GCM_FOR_TIMER_1 GCM_TC4_TC5 |
|---|
| 50 | #endif |
|---|
| 51 | #if defined (_useTimer2) |
|---|
| 52 | #define TC_FOR_TIMER2 TC4 |
|---|
| 53 | #define CHANNEL_FOR_TIMER2 1 |
|---|
| 54 | #define INTENSET_BIT_FOR_TIMER_2 TC_INTENSET_MC1 |
|---|
| 55 | #define INTENCLR_BIT_FOR_TIMER_2 TC_INTENCLR_MC1 |
|---|
| 56 | #define ID_TC_FOR_TIMER2 ID_TC4 |
|---|
| 57 | #define IRQn_FOR_TIMER2 TC4_IRQn |
|---|
| 58 | #define HANDLER_FOR_TIMER2 TC4_Handler |
|---|
| 59 | #define GCM_FOR_TIMER_2 GCM_TC4_TC5 |
|---|
| 60 | #endif |
|---|
| 61 | |
|---|
| 62 | typedef enum { |
|---|
| 63 | #if defined (_useTimer1) |
|---|
| 64 | _timer1, |
|---|
| 65 | #endif |
|---|
| 66 | #if defined (_useTimer2) |
|---|
| 67 | _timer2, |
|---|
| 68 | #endif |
|---|
| 69 | _Nbr_16timers } timer16_Sequence_t; |
|---|
| 70 | |
|---|
| 71 | #endif // __SERVO_TIMERS_H__ |
|---|