luni64 / TeensyTimerTool

Generic Interface to Teensy Timers
MIT License
82 stars 18 forks source link

setPrescaler() not working #32

Open vindar opened 1 month ago

vindar commented 1 month ago

Hi Luni64,

It looks the implementation of the setPrescaler() method is broken. I am trying to use use specifically with TMR timers.

  1. Making a call to the method yields a linker error because BaseTimer::setPrescaler() is defined as inline but implemented in the compilation unit BaseTimer.cpp c.f. also this pull request.
  2. Also it looks like the current implementation of BaseTimer::setPrescaler() just set this->prescaler = psc but I suppose it should also call timerChannel->setPrescaler() no ?
  3. In order to do so, TMRChannel::setPrescaler() must override the method in the base class ITimerChannel but, as it currently stands, TMRChannel::setPrescaler() and ITimerChannel::setPrescaler() have different signature...

I realize there are many more caveats which I do not see but do you think it is possible to get the setPrescaler() method working, at least for TMR ? I know I can change the psc it the config file but I would like to be able to adjust it at runtime. Thanks !