-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
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.