Skip to content
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

RFC: drivers: pwm: add functions for capturing pwm pulse width and period #26026

Closed
henrikbrixandersen opened this issue Jun 6, 2020 · 1 comment · Fixed by #26025
Closed
Labels
area: API Changes to public APIs area: PWM Pulse Width Modulation RFC Request For Comments: want input from the community

Comments

@henrikbrixandersen
Copy link
Member

henrikbrixandersen commented Jun 6, 2020

Introduction

Extend the Zephyr RTOS PWM API with functions for capturing PWM pulse width and period time.

Problem description

Many PWM controllers supports capturing PWM pulse width and period time/frequency, but Zephyr currently lacks an API for exposing this functionality.

Proposed change

Add two API functions for capturing the PWM pulse width and period:

  • pwm_pin_capture_cycles()
  • pwm_pin_capture_cycles_async()

Detailed RFC

Proposed change (Detailed)

Please see PR #26025 for proposed API.

Dependencies

None.

Concerns and Unresolved Questions

Not sure if the pwm_pin_capture_cycles_async() function will be useful to anybody. I do not have a use for it, but since this is how other asynchronous Zephyr RTOS APIs are done, I have added it for completeness.

Alternatives

PWM capture could also be implemented as a sensor driver, but seeing that many PWM controllers allow channels/pins to be used for PWM generation while others are used for PWM capture, it would be difficult to share the device between these two functions.

The Linux kernel PWM subsystem allows for PWM controllers to provide a capture function as well.

@henrikbrixandersen henrikbrixandersen added area: PWM Pulse Width Modulation RFC Request For Comments: want input from the community area: API Changes to public APIs labels Jun 6, 2020
@pabigot
Copy link
Collaborator

pabigot commented Jul 7, 2020

API 2020-07-07: Moved from triage to in-progress per discussion.

henrikbrixandersen added a commit to vestas-wind-systems/zephyr that referenced this issue Jan 12, 2021
Extend the PWM API with optional API functions for capturing PWM pulse
width and period cycles.

Fixes zephyrproject-rtos#26026.

Signed-off-by: Henrik Brix Andersen <[email protected]>
carlescufi pushed a commit that referenced this issue Jan 12, 2021
Extend the PWM API with optional API functions for capturing PWM pulse
width and period cycles.

Fixes #26026.

Signed-off-by: Henrik Brix Andersen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: PWM Pulse Width Modulation RFC Request For Comments: want input from the community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants