Rev 461 | Rev 480 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 461 | Rev 475 | ||
---|---|---|---|
Line 79... | Line 79... | ||
79 | #define SERVORANGE (MAXSERVOPULSE - MINSERVOPULSE) |
79 | #define SERVORANGE (MAXSERVOPULSE - MINSERVOPULSE) |
Line 80... | Line 80... | ||
80 | 80 | ||
81 | //---------------------------------------------------------------------------------------------------- |
81 | //---------------------------------------------------------------------------------------------------- |
82 | void TIM2_IRQHandler(void) |
82 | void TIM2_IRQHandler(void) |
- | 83 | { |
|
83 | { |
84 | /* |
84 | #define MULTIPLYER 4 |
85 | #define MULTIPLYER 4 |
85 | static s16 ServoNickOffset = (255 / 2) * MULTIPLYER; // initial value near center position |
86 | static s16 ServoNickOffset = (255 / 2) * MULTIPLYER; // initial value near center position |
Line 86... | Line 87... | ||
86 | static s16 ServoRollOffset = (255 / 2) * MULTIPLYER; // initial value near center position |
87 | static s16 ServoRollOffset = (255 / 2) * MULTIPLYER; // initial value near center position |
Line 173... | Line 174... | ||
173 | TIM2->CR1 |= CR1_OLVL2_MASK; // make next a high pulse |
174 | TIM2->CR1 |= CR1_OLVL2_MASK; // make next a high pulse |
174 | } |
175 | } |
175 | TIM2->OC2R += pulselen; |
176 | TIM2->OC2R += pulselen; |
176 | } |
177 | } |
177 | IDISABLE; |
178 | IDISABLE; |
- | 179 | */ |
|
178 | VIC0->VAR = 0xFF; // write any value to VIC0 Vector address register |
180 | VIC0->VAR = 0xFF; // write any value to VIC0 Vector address register |
179 | } |
181 | } |
Line 180... | Line 182... | ||
180 | 182 | ||
181 | //---------------------------------------------------------------------------------------------------- |
183 | //---------------------------------------------------------------------------------------------------- |
182 | // Servo Timer |
184 | // Servo Timer |
183 | //---------------------------------------------------------------------------------------------------- |
185 | //---------------------------------------------------------------------------------------------------- |
184 | void TIMER2_Init(void) |
186 | void TIMER2_Init(void) |
185 | { |
187 | { |
186 | 188 | /* |
|
187 | GPIO_InitTypeDef GPIO_InitStructure; |
189 | GPIO_InitTypeDef GPIO_InitStructure; |
Line 188... | Line 190... | ||
188 | TIM_InitTypeDef TIM_InitStructure; |
190 | TIM_InitTypeDef TIM_InitStructure; |
Line 244... | Line 246... | ||
244 | 246 | |
|
245 | TIM_CounterCmd(TIM2, TIM_CLEAR); // reset timer |
247 | TIM_CounterCmd(TIM2, TIM_CLEAR); // reset timer |
Line 246... | Line 248... | ||
246 | TIM_CounterCmd(TIM2, TIM_START); // start the timer |
248 | TIM_CounterCmd(TIM2, TIM_START); // start the timer |
- | 249 | |
|
247 | 250 | UART1_PutString("ok\r\n"); |
|
Line 248... | Line 251... | ||
248 | UART1_PutString("ok\r\n"); |
251 | */ |
249 | } |
252 | } |
- | 253 | ||
- | 254 | void TIMER2_Deinit(void) |
|
250 | 255 | { |
|
Line 251... | Line 256... | ||
251 | void TIMER2_Deinit(void) |
256 | } |
Line 252... | Line 257... | ||
252 | { |
257 | /* |
Line 276... | Line 281... | ||
276 | GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector; |
281 | GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector; |
277 | GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable; |
282 | GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable; |
278 | GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1; |
283 | GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1; |
279 | GPIO_Init(GPIO6, &GPIO_InitStructure); |
284 | GPIO_Init(GPIO6, &GPIO_InitStructure); |
280 | } |
285 | } |
- | 286 | */ |
|
281 | 287 |