[SOLVED] Release-detach input capture from timer

Post here first, or if you can't find a relevant section!
Post Reply
alexandros
Posts: 71
Joined: Mon Oct 02, 2017 6:51 pm

[SOLVED] Release-detach input capture from timer

Post by alexandros » Fri Jan 19, 2018 11:12 pm

I am using timer2 for input capture pin pa0

Code: Select all

Timer2.pause();
  nvic_irq_set_priority (NVIC_TIMER2, 1);  
 Timer2.setPrescaleFactor(1);
 TIMER2->regs.gen->CCMR1 = 0b010000001;  //
 TIMER2->regs.gen->CCMR2 = 0b0;          //
 TIMER2->regs.gen->CCER  = 0b0001;       //
 Timer2.attachCompare1Interrupt(handle_procedure); 
 Timer2.refresh();
 Timer2.resume(); 
 
The question is , how am i gonna end this ? clear the Timer2 and set it to nothing ?

Timer2.pause();
timer_disable_irq(TIMER2 ,1);
Timer2.detachInterrupt(1);
Timer2.refresh();
Timer2.resume();

doesnt work :|

how can i DEttach Compare1Interrupt
Last edited by alexandros on Fri Jan 19, 2018 11:58 pm, edited 1 time in total.

User avatar
mrburnette
Posts: 2190
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Release-detach input capture from timer

Post by mrburnette » Fri Jan 19, 2018 11:25 pm

The specific (original) documenting is here:
http://docs.leaflabs.com/static.leaflab ... timer.html

The Union is defined in timer.h
http://docs.leaflabs.com/static.leaflab ... timer.html


However, I have not personally tested these functions with the current STM32DUINO core. Hopefully some of our members have some examples or input into the detach process.


Ray

alexandros
Posts: 71
Joined: Mon Oct 02, 2017 6:51 pm

Re: Release-detach input capture from timer

Post by alexandros » Fri Jan 19, 2018 11:43 pm

So according to the documentation this Timer2.detachCompare1Interrupt(); coomand should release it ,
i just compiled and seems not to work either :x

alexandros
Posts: 71
Joined: Mon Oct 02, 2017 6:51 pm

Re: Release-detach input capture from timer

Post by alexandros » Fri Jan 19, 2018 11:58 pm

But That

Code: Select all

timer_disable_all();
kill them all , worked like a charm :D

Post Reply