Rev 139 | Rev 143 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 139 | Rev 141 | ||
---|---|---|---|
Line 61... | Line 61... | ||
61 | #include "config.h" |
61 | #include "config.h" |
Line 62... | Line 62... | ||
62 | 62 | ||
63 | #define CR1_OLVL1_MASK 0x0100 |
63 | #define CR1_OLVL1_MASK 0x0100 |
Line 64... | Line 64... | ||
64 | #define CR1_OLVL2_MASK 0x0200 |
64 | #define CR1_OLVL2_MASK 0x0200 |
Line 65... | Line 65... | ||
65 | 65 | ||
66 | ServoParams_t ServoParams; |
66 | volatile ServoParams_t ServoParams; |
67 | 67 | ||
68 | #define TIM2_FREQ 625000 // 625kHz, the same clock like at the FC |
68 | #define TIM2_FREQ 625000 // 625kHz, the same clock like at the FC |
Line 241... | Line 241... | ||
241 | UART1_PutString("ok"); |
241 | UART1_PutString("ok"); |
242 | } |
242 | } |
Line 243... | Line 243... | ||
243 | 243 | ||
244 | void TIMER2_Deinit(void) |
244 | void TIMER2_Deinit(void) |
- | 245 | { |
|
- | 246 | GPIO_InitTypeDef GPIO_InitStructure; |
|
245 | { |
247 | |
246 | VIC_ITCmd(TIM2_ITLine, DISABLE); |
248 | VIC_ITCmd(TIM2_ITLine, DISABLE); |
247 | TIM_CounterCmd(TIM2, TIM_STOP); // stop the timer |
249 | TIM_CounterCmd(TIM2, TIM_STOP); // stop the timer |
248 | TIM_ITConfig(TIM2, TIM_IT_OC1|TIM_IT_OC2, DISABLE); // disable interrupts for the OC 1 & 2 |
250 | TIM_ITConfig(TIM2, TIM_IT_OC1|TIM_IT_OC2, DISABLE); // disable interrupts for the OC 1 & 2 |
- | 251 | TIM_DeInit(TIM2); |
|
- | 252 | SCU_APBPeriphClockConfig(__TIM23, DISABLE); |
|
- | 253 | ||
- | 254 | // configure the servo pins as input |
|
- | 255 | GPIO_StructInit(&GPIO_InitStructure); |
|
- | 256 | GPIO_InitStructure.GPIO_Direction = GPIO_PinInput; |
|
- | 257 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; |
|
- | 258 | GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector; |
|
- | 259 | GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable; |
|
- | 260 | GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1; |
|
- | 261 | GPIO_Init(GPIO6, &GPIO_InitStructure); |
|
- | 262 | ||
- | 263 | GPIO_StructInit(&GPIO_InitStructure); |
|
- | 264 | GPIO_InitStructure.GPIO_Direction = GPIO_PinInput; |
|
- | 265 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; |
|
- | 266 | GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector; |
|
- | 267 | GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable; |
|
- | 268 | GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1; |
|
249 | TIM_DeInit(TIM2); |
269 | GPIO_Init(GPIO6, &GPIO_InitStructure); |