Skip to content

PWM support #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2021
Merged

PWM support #138

merged 1 commit into from
May 25, 2021

Conversation

jonfin
Copy link
Contributor

@jonfin jonfin commented May 24, 2021

Add PWM support based on the stm32f4xx_hal implementation. It is mostly a copy from stm32f4xx_hal with some modification.
Only change to stm32f4xx_hal: it uses the recommended order for setting the register from DM00042534

I did some testing based on a stm32f030c8 chip.

fixes #26

@therealprof
Copy link
Member

Thanks for the PR! I've tested it on a STM32F072 and it works a treat. If you could fix the CI issues and register the example with Cargo.toml I can merge this in.

@jonfin
Copy link
Contributor Author

jonfin commented May 25, 2021

It should now work even on more devices. I missed the possibility that there could be other devices than the stm32f030 or stm32f070.

One thing is missing: the PWM implementation for TIM2 (32-bit). I skip it because I cannot test it after changing the calculation of the prescaler / Auto-reload value.

@therealprof
Copy link
Member

Thanks, it's still missing the example registration in Cargo.toml. And if you could squash your PR a bit that'd be much appreciated.

@jonfin
Copy link
Contributor Author

jonfin commented May 25, 2021

Is the example not automatic registered?

@therealprof
Copy link
Member

Ah sorry, I missed that it's an example that works on all chips; not used to that. 😅

It should work for all devices. Only the implementation for TIM2 is
missing.
@jonfin
Copy link
Contributor Author

jonfin commented May 25, 2021

Me neither ;)
I squashed the commits.

Copy link
Member

@therealprof therealprof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

bors r+

@bors
Copy link
Contributor

bors bot commented May 25, 2021

Build succeeded:

@bors bors bot merged commit 73b0fac into stm32-rs:master May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PWM support
2 participants