From 5118eccf4d5fe17f3aa8211c39c5d6d02773711f Mon Sep 17 00:00:00 2001 From: "michael.blandford@mypostoffice.co.uk" Date: Sun, 14 Apr 2013 19:07:39 +0000 Subject: [PATCH] Add stop_trainer_capture() --- src/taranis/board_taranis.h | 1 + src/taranis/trainer_driver.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/taranis/board_taranis.h b/src/taranis/board_taranis.h index 173b582ff..f2cf36bb6 100644 --- a/src/taranis/board_taranis.h +++ b/src/taranis/board_taranis.h @@ -123,6 +123,7 @@ void disable_pxx( uint32_t module_index ); void init_trainer_ppm(); void stop_trainer_ppm(); void init_trainer_capture(); +void stop_trainer_ppm() ; // Keys driver void keysInit(); diff --git a/src/taranis/trainer_driver.cpp b/src/taranis/trainer_driver.cpp index adc8c451c..885d34849 100644 --- a/src/taranis/trainer_driver.cpp +++ b/src/taranis/trainer_driver.cpp @@ -109,8 +109,10 @@ void init_trainer_ppm() // TODO - testing void stop_trainer_ppm() { - configure_pins( PIN_TR_PPM_OUT, PIN_INPUT | PIN_PORTC ) ; + configure_pins( PIN_TR_PPM_OUT, PIN_INPUT | PIN_PORTC ) ; // Pin as input TIM3->CR1 &= ~TIM_CR1_CEN ; // Stop counter + TIM3->DIER &= ~TIM_DIER_CC2IE ; // Stop Interrupt + TIM3->DIER &= ~TIM_DIER_UIE ; // Stop Interrupt NVIC_DisableIRQ(TIM3_IRQn) ; // Stop Interrupt } @@ -132,6 +134,12 @@ void init_trainer_capture() NVIC_EnableIRQ(TIM3_IRQn) ; } +void stop_trainer_capture() +{ + TIM3->CR1 &= ~TIM_CR1_CEN ; // Stop counter + TIM3->DIER &= ~TIM_DIER_CC3IE ; // Stop Interrupt + NVIC_DisableIRQ(TIM3_IRQn) ; // Stop Interrupt +} extern "C" void TIM3_IRQHandler() {