Skip to content

Conversation

@de-vri-es
Copy link
Contributor

@de-vri-es de-vri-es commented Oct 15, 2025

This PR:

  • Derives more traits for public structs in the PWM module.

  • Allows you to set the idle state of pins for when the PWM is stopped.

    From the nRF9160 manual:
    image

  • Allows you to configure the pins in the constructor of SimplePwm to avoid glitches on the output levels during initialization (in fact, you can now configure the whole PWM peripherals, same as with the Sequencer struct).

  • Exposes bit 16 of the duty cycle value in SimplePwm in a DutyCycle struct so you can use inverted polarity.

  • Adds a function to set all channels of a SimplePwm at once, to avoid doing four DMA transfers when one would have been enough.

Tested with an nRF9160.

@de-vri-es de-vri-es force-pushed the nrf-simplepwm-config branch from 2824a16 to 3250345 Compare October 15, 2025 12:42
@de-vri-es
Copy link
Contributor Author

Is this a good way forward? It's a breaking change as it is now. I think it's nicer this way since it will be a more consistent API. But if desired I can avoid breaking the API by adding new functions instead of modifying existing ones.

Copy link
Member

@lulf lulf left a comment

Choose a reason for hiding this comment

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

I like the API, nice work! 🚀 It'll make my nrf54 PR harder to merge 🥲 but i'll rebase once this is merge :)

@lulf lulf added this pull request to the merge queue Oct 28, 2025
@de-vri-es
Copy link
Contributor Author

Haha, thanks :)

Merged via the queue into embassy-rs:main with commit 5f0085f Oct 28, 2025
8 checks passed
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.

2 participants