remove CVS
[aversive.git] / modules / devices / servo / multiservo / multiservo_archs.h
1 /*  
2  *  Copyright Droids Corporation, Microb Technology, Eirbot (2006)
3  * 
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program 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
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  *  Revision : $Id: multiservo_archs.h,v 1.3.4.4 2008-03-02 17:18:16 zer0 Exp $
19  *
20  */
21
22 /* set in CTC mode */
23
24 #ifndef _MULTISERVO_ARCHS_H_
25 #define _MULTISERVO_ARCHS_H_
26
27 #include <aversive.h>
28
29 /* will be in aversive_timers */
30 #if defined (__AVR_ATmega128__) 
31
32 #if MULTISERVO_TIMER == 0
33 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE0
34 #define MULTISERVO_TIMSK TIMSK
35 #define MULTISERVO_OCIE  OCIE0
36 #define MULTISERVO_TCCRnA TCCR0
37 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM01) | MULTISERVO_TIMER_PRESCALER_CONFIG)
38 #define MULTISERVO_OCR OCR0
39
40 #elif MULTISERVO_TIMER == 1
41 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE1A
42 #define MULTISERVO_TIMSK TIMSK
43 #define MULTISERVO_OCIE  OCIE1A
44 #define MULTISERVO_TCCRnA TCCR1A
45 #define MULTISERVO_TCCRnA_VALUE 0
46 #define MULTISERVO_TCCRnB TCCR1B
47 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM12) | MULTISERVO_TIMER_PRESCALER_CONFIG)
48 #define MULTISERVO_OCR OCR1A
49
50 #elif MULTISERVO_TIMER == 2
51 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE2
52 #define MULTISERVO_TIMSK TIMSK
53 #define MULTISERVO_OCIE  OCIE2
54 #define MULTISERVO_TCCRnA TCCR2
55 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM21) | MULTISERVO_TIMER_PRESCALER_CONFIG)
56 #define MULTISERVO_OCR OCR2
57
58 #elif MULTISERVO_TIMER == 3
59 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE3A
60 #define MULTISERVO_TIMSK ETIMSK
61 #define MULTISERVO_OCIE  OCIE3A
62 #define MULTISERVO_TCCRnA TCCR3A
63 #define MULTISERVO_TCCRnA_VALUE 0
64 #define MULTISERVO_TCCRnB TCCR3B
65 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM32) | MULTISERVO_TIMER_PRESCALER_CONFIG)
66 #define MULTISERVO_OCR OCR3A
67
68 #else
69 #error "Bad timer number, check your multiservo_config.h"
70 #endif
71
72
73
74
75
76 #elif defined (__AVR_ATmega32__) 
77
78 #if MULTISERVO_TIMER == 0
79 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE0
80 #define MULTISERVO_TIMSK TIMSK
81 #define MULTISERVO_OCIE  OCIE0
82 #define MULTISERVO_TCCRnA TCCR0
83 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM01) | MULTISERVO_TIMER_PRESCALER_CONFIG)
84 #define MULTISERVO_OCR OCR0
85
86 #elif MULTISERVO_TIMER == 1
87 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE1A
88 #define MULTISERVO_TIMSK TIMSK
89 #define MULTISERVO_OCIE  OCIE1A
90 #define MULTISERVO_TCCRnA TCCR1A
91 #define MULTISERVO_TCCRnA_VALUE 0
92 #define MULTISERVO_TCCRnB TCCR1B
93 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM12) | MULTISERVO_TIMER_PRESCALER_CONFIG)
94 #define MULTISERVO_OCR OCR1A
95
96 #elif MULTISERVO_TIMER == 2
97 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE2
98 #define MULTISERVO_TIMSK TIMSK
99 #define MULTISERVO_OCIE  OCIE2
100 #define MULTISERVO_TCCRnA TCCR2
101 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM21) | MULTISERVO_TIMER_PRESCALER_CONFIG)
102 #define MULTISERVO_OCR OCR2
103
104 #else
105 #error "Bad timer number, check your multiservo_config.h"
106 #endif
107
108 #elif defined (__AVR_ATtiny2313__) 
109
110 #if MULTISERVO_TIMER == 0
111 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE0
112 #define MULTISERVO_TIMSK TIMSK
113 #define MULTISERVO_OCIE  OCIE0
114 #define MULTISERVO_TCCRnA TCCR0A
115 #define MULTISERVO_TCCRnA_VALUE (1 << WGM01)
116 #define MULTISERVO_TCCRnA TCCR0B
117 #define MULTISERVO_TCCRnA_VALUE (MULTISERVO_TIMER_PRESCALER_CONFIG)
118 #define MULTISERVO_OCR OCR0
119
120 #elif MULTISERVO_TIMER == 1
121 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE1A
122 #define MULTISERVO_TIMSK TIMSK
123 #define MULTISERVO_OCIE  OCIE1A
124 #define MULTISERVO_TCCRnA TCCR1A
125 #define MULTISERVO_TCCRnA_VALUE 0
126 #define MULTISERVO_TCCRnB TCCR1B
127 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM12) | MULTISERVO_TIMER_PRESCALER_CONFIG)
128 #define MULTISERVO_OCR OCR1A
129
130 #else
131 #error "Bad timer number, check your multiservo_config.h"
132 #endif
133
134
135
136 /* #elif XYZ */
137
138 /* Add other archs here */
139
140 #else
141
142 #error "This MCU is not supported, see in multiservo_archs.h"
143
144 #endif /* MCU CHOICE */
145
146
147 #endif /* _MULTISERVO_ARCHS_H_ */