00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _MULTISERVO_ARCHS_H_
00025 #define _MULTISERVO_ARCHS_H_
00026
00027 #include <aversive.h>
00028
00029
00030 #if defined (__AVR_ATmega128__)
00031
00032 #if MULTISERVO_TIMER == 0
00033 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE0
00034 #define MULTISERVO_TIMSK TIMSK
00035 #define MULTISERVO_OCIE OCIE0
00036 #define MULTISERVO_TCCRnA TCCR0
00037 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM01) | MULTISERVO_TIMER_PRESCALER_CONFIG)
00038 #define MULTISERVO_OCR OCR0
00039
00040 #elif MULTISERVO_TIMER == 1
00041 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE1A
00042 #define MULTISERVO_TIMSK TIMSK
00043 #define MULTISERVO_OCIE OCIE1A
00044 #define MULTISERVO_TCCRnA TCCR1A
00045 #define MULTISERVO_TCCRnA_VALUE 0
00046 #define MULTISERVO_TCCRnB TCCR1B
00047 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM12) | MULTISERVO_TIMER_PRESCALER_CONFIG)
00048 #define MULTISERVO_OCR OCR1A
00049
00050 #elif MULTISERVO_TIMER == 2
00051 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE2
00052 #define MULTISERVO_TIMSK TIMSK
00053 #define MULTISERVO_OCIE OCIE2
00054 #define MULTISERVO_TCCRnA TCCR2
00055 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM21) | MULTISERVO_TIMER_PRESCALER_CONFIG)
00056 #define MULTISERVO_OCR OCR2
00057
00058 #elif MULTISERVO_TIMER == 3
00059 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE3A
00060 #define MULTISERVO_TIMSK ETIMSK
00061 #define MULTISERVO_OCIE OCIE3A
00062 #define MULTISERVO_TCCRnA TCCR3A
00063 #define MULTISERVO_TCCRnA_VALUE 0
00064 #define MULTISERVO_TCCRnB TCCR3B
00065 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM32) | MULTISERVO_TIMER_PRESCALER_CONFIG)
00066 #define MULTISERVO_OCR OCR3A
00067
00068 #else
00069 #error "Bad timer number, check your multiservo_config.h"
00070 #endif
00071
00072
00073
00074
00075
00076 #elif defined (__AVR_ATmega32__)
00077
00078 #if MULTISERVO_TIMER == 0
00079 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE0
00080 #define MULTISERVO_TIMSK TIMSK
00081 #define MULTISERVO_OCIE OCIE0
00082 #define MULTISERVO_TCCRnA TCCR0
00083 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM01) | MULTISERVO_TIMER_PRESCALER_CONFIG)
00084 #define MULTISERVO_OCR OCR0
00085
00086 #elif MULTISERVO_TIMER == 1
00087 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE1A
00088 #define MULTISERVO_TIMSK TIMSK
00089 #define MULTISERVO_OCIE OCIE1A
00090 #define MULTISERVO_TCCRnA TCCR1A
00091 #define MULTISERVO_TCCRnA_VALUE 0
00092 #define MULTISERVO_TCCRnB TCCR1B
00093 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM12) | MULTISERVO_TIMER_PRESCALER_CONFIG)
00094 #define MULTISERVO_OCR OCR1A
00095
00096 #elif MULTISERVO_TIMER == 2
00097 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE2
00098 #define MULTISERVO_TIMSK TIMSK
00099 #define MULTISERVO_OCIE OCIE2
00100 #define MULTISERVO_TCCRnA TCCR2
00101 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM21) | MULTISERVO_TIMER_PRESCALER_CONFIG)
00102 #define MULTISERVO_OCR OCR2
00103
00104 #else
00105 #error "Bad timer number, check your multiservo_config.h"
00106 #endif
00107
00108 #elif defined (__AVR_ATtiny2313__)
00109
00110 #if MULTISERVO_TIMER == 0
00111 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE0
00112 #define MULTISERVO_TIMSK TIMSK
00113 #define MULTISERVO_OCIE OCIE0
00114 #define MULTISERVO_TCCRnA TCCR0A
00115 #define MULTISERVO_TCCRnA_VALUE (1 << WGM01)
00116 #define MULTISERVO_TCCRnA TCCR0B
00117 #define MULTISERVO_TCCRnA_VALUE (MULTISERVO_TIMER_PRESCALER_CONFIG)
00118 #define MULTISERVO_OCR OCR0
00119
00120 #elif MULTISERVO_TIMER == 1
00121 #define MULTISERVO_SIG_OUTPUT_COMPARE SIG_OUTPUT_COMPARE1A
00122 #define MULTISERVO_TIMSK TIMSK
00123 #define MULTISERVO_OCIE OCIE1A
00124 #define MULTISERVO_TCCRnA TCCR1A
00125 #define MULTISERVO_TCCRnA_VALUE 0
00126 #define MULTISERVO_TCCRnB TCCR1B
00127 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM12) | MULTISERVO_TIMER_PRESCALER_CONFIG)
00128 #define MULTISERVO_OCR OCR1A
00129
00130 #else
00131 #error "Bad timer number, check your multiservo_config.h"
00132 #endif
00133
00134
00135
00136
00137
00138
00139
00140 #else
00141
00142 #error "This MCU is not supported, see in multiservo_archs.h"
00143
00144 #endif
00145
00146
00147 #endif