stm32wlxx-hal icon indicating copy to clipboard operation
stm32wlxx-hal copied to clipboard

How to Establish a Continuous LPTIM Peripheral

Open justacec opened this issue 3 years ago • 3 comments

I would like to use an LPTIM peripheral to track time. To do so I would like it to be in continuous mode so it just fires off the event and then reloads and keeps going. Unfortunately, the start function implementation for the LPTIM peripherals seems to set the mode to Single. How would I go about setting this up for continuous?

justacec avatar May 28 '22 06:05 justacec

Continuous timers are part of the PwmPin traits: https://github.com/stm32-rs/stm32wlxx-hal/blob/a9d4b5a77d7d4fc6d5da3402328196d980d4b680/hal/src/lptim/mod.rs#L767

There's an example here: https://docs.rs/stm32wlxx-hal/latest/stm32wlxx_hal/lptim/trait.LpTim.html#example-5

The new_output_pin method is optional, that's just for PWM.

newAM avatar May 28 '22 16:05 newAM

Ahh. Got it. I should have seen that. I will take a look there and see if I can get everything to work.

Thanks for being so helpful and responsive. :)

justacec avatar May 28 '22 18:05 justacec

No problem! It is misleading being called PwmPin when the pin isn't even required :sweat_smile:

newAM avatar May 28 '22 18:05 newAM