-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Feature/esp pulse cnt #15079
Feature/esp pulse cnt #15079
Conversation
[Experimental Bot, please feedback here] Fill In The Commit Message: This PR contains a Commit with an Empty Commit Message. Please fill in the Commit Message with the PR Summary. Yes, this PR appears to meet the NuttX requirements, although some sections could be more detailed. Here's a breakdown: Strengths:
Weaknesses (and suggestions for improvement):
Example of a more complete Impact section:
By addressing these weaknesses, the PR will be much stronger and easier for reviewers to evaluate. |
@eren-terzioglu I suggest using Pulse Counter in the text because PCNT acronym is not used by all vendors (although at least Espressif and Silicon Labs use it) |
0c7d934
to
3186920
Compare
I see that PCNT can count pulses and edges. The question is wheter |
@raiden00pl I agree! Let's include this driver for now and open an issue to extend capture.c to support pulse counter as well. |
@xiaoxiang781216, Do you have different opinion? |
2b0f708
to
45af5c3
Compare
Thanks @raiden00pl, updated |
45af5c3
to
e688a20
Compare
@xiaoxiang781216, I refactored the code with using capture driver. Fyi |
e688a20
to
46226a6
Compare
Thanks @acassis, updated |
0d7f66e
to
12343a1
Compare
|
||
flags = spin_lock_irqsave(&priv->lock); | ||
|
||
position = priv->position; | ||
count = (int16_t)(pcnt_ll_get_count(priv->dev, | ||
priv->config->pcntid) & 0xffff); | ||
ret = (priv->pcnt->ops->ioctl(priv->pcnt, |
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.
The change seems as total nonsense, please review and correct, @eren-terzioglu, @acassis, @Vajnar
The return value should not be clipped to 16-bits if you compare return to zero at the next line. The logic around counter seems to be totally broken as well. The value has been converted to int16_t in the Martin Vajnar to allow modulo arithmetic. I have open Issue #15319 for more communication and very probable breakages fixup.
Summary
Pulse counter (PCNT) peripheral support added for ESP32, ESP32S2, ESP32S3, ESP32C6, ESP32H2 which is count the number of rising and/or falling edges of input signals. PCNT module can be used in scenarios like:
Commits
Impact
ESP32, ESP32S2, ESP32S3, ESP32C6, ESP32H2
Testing
esp32c6-devkitc:qencoder
and other qencoder configs used to test qencoder devices withqe
example. Also sample pcnt test used to test pcnt peripheral individually for every chip which supports PCNT(only esp32c3 does not have that peripheral support).