-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
drivers: pwm: add functions for capturing pwm pulse width and period #26025
drivers: pwm: add functions for capturing pwm pulse width and period #26025
Conversation
5cf6119
to
444b114
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion to make the API extension conditional on a Kconfig enabling it. Example is in 48dc2fd ("drivers: flash: add API to access SFDP region of serial flash devices") of #25851 where CONFIG_FLASH_JESD216_API
enables the special case.
There're actually design considerations on how that should be implemented. In that approach the API functions are only defined if the feature is enabled. An alternative would be to always define them, but have them return -ENOTSUP
if the feature is not enabled (that actually makes more sense at the moment).
444b114
to
122307a
Compare
Thank you. I have added a Kconfig option for enabling this. Example implementation still pending. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is still draft, but since I was looking at it here're the initial comments. Will check again when there's an implementation.
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
2962d5e
to
af63d9b
Compare
49c163c
to
6a2f6c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem quite right to have both a synchronous and an asynchronous API implementation. Seems like that would produce duplication. How about just the async as the implemented API, and have the sync wrapper use a stack signal structure and k_poll()
?
6a2f6c6
to
4378451
Compare
@henrikbrixandersen What is the state of this? Does the API need any more work? Or is the wait because implementations haven't been finished yet? |
I have had to rework the proposed API to meet real-life application needs (support for continuous capture and filtering through a callback mechanism). I have a couple of implementations almost ready. I will update this PR once the final issues have been worked out. |
4378451
to
022fe12
Compare
Comments addressed, at least the essential ones.
9262ffe
to
9d775c6
Compare
@erwango can you take a look? |
No plans on our side for now, @gmarull maybe? |
To demonstrate the PWM capture API on more hardware, I have added another driver implementation in #31165. I will not add it here since it currently has a few dependencies on other PRs to be merged. |
9d775c6
to
687477f
Compare
Ah, I guess I'll have to learn the LL framework and implement the driver myself 😢 😂 In the meantime, if anyone is kind enough to do it, it would be very much appreciated by me! |
687477f
to
7e39c15
Compare
@MaureenHelm Could you please re-approve? @zephyrbot cancelled your approval 👎 |
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 <hebad@vestas.com>
Take ownership of the PWM capture helper functions. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Add myself as collaborator on the PWM code. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Add PWM capture support to the NXP MCUX FlexTimer driver. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Enable FlexTimer 0 (FTM0) as PWM and setup PTC1 as FTM0 channel 0 for use in PWM loopback test. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Add test cases for the PWM capture API using PWM signal loopback. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
7e39c15
to
c673eeb
Compare
@anangl Please re-review. |
Extend the PWM API with optional functions for capturing the PWM pulse width and period time.
Fixes #26026.
Signed-off-by: Henrik Brix Andersen hebad@vestas.com