-
Notifications
You must be signed in to change notification settings - Fork 1.3k
ESP32S2: Support for CountIO #3615
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
Conversation
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.
Code looks great! The PCNT looks really useful. I think you'll want to sort out sharing it's units.
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.
Just a couple minor things! Looks good overall.
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.
This looks great! Just a couple minor port organization comments, if we could get this all moved into a peripherals/pcnt.c
file instead of the port root that'd be good. Do you have a good test sketch I can run with this to try it out?
@hierophect Thanks for the review. I am using the following test sketch. import countio
import time
import digitalio
from board import *
#Connect IO21 to IO14
led = digitalio.DigitalInOut(IO21)
led.direction = digitalio.Direction.OUTPUT
pin_counter = countio.Counter(IO14)
while True:
led.value = True
time.sleep(0.25)
led.value = False
time.sleep(0.25)
print(pin_counter.count) |
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.
Close! It's a minor change, but please change pcnt_handler to pcnt.c to match the naming conventions we use for peripherals/ source files.
@hierophect A file named |
Does this cause a problem? In CircuitPython, for instance, there are many files named |
No problem as such. My aim is to avoid confusion. |
My first impression would be to avoid giving |
Chatted with @tannewt briefly on discord, let's keep the "pcnt.c" style for simplicity and consistency. The makefile enforces more extended include paths to avoid this kind of confusion anyway. |
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.
Looks good!
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'd prefer a return instead of filling out a field in an input struct.
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.
Thank you!
One failing check due to network issues. All is good. |
No description provided.