Skip to content

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

Merged
merged 5 commits into from
Nov 6, 2020
Merged

ESP32S2: Support for CountIO #3615

merged 5 commits into from
Nov 6, 2020

Conversation

microdev1
Copy link
Collaborator

No description provided.

@tannewt tannewt self-requested a review October 30, 2020 19:10
Copy link
Member

@tannewt tannewt left a 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.

@microdev1 microdev1 requested a review from tannewt November 1, 2020 12:35
@microdev1 microdev1 marked this pull request as ready for review November 1, 2020 12:35
Copy link
Member

@tannewt tannewt left a 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.

Copy link
Collaborator

@hierophect hierophect left a 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?

@microdev1
Copy link
Collaborator Author

@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)

Copy link
Collaborator

@hierophect hierophect left a 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.

@microdev1
Copy link
Collaborator Author

@hierophect A file named pcnt.c already exists in the esp-idf.

@jepler
Copy link

jepler commented Nov 4, 2020

Does this cause a problem? In CircuitPython, for instance, there are many files named __init__.c and it's okay.

@microdev1
Copy link
Collaborator Author

No problem as such. My aim is to avoid confusion.

@hierophect
Copy link
Collaborator

My first impression would be to avoid giving peripherals files a prefix so that the naming is in line with the other ports, but the ESP-IDF is somewhat unique among HALs in that it doesn't have a prefix on its own source files (as compared to hdl_adc.h, nrfx_adc.c, stm32fxxxxxx_adc.c). Either way is fine with me as long as we're consistent.

@hierophect
Copy link
Collaborator

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.

@microdev1 microdev1 requested a review from hierophect November 5, 2020 04:42
hierophect
hierophect previously approved these changes Nov 5, 2020
Copy link
Collaborator

@hierophect hierophect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Member

@tannewt tannewt left a 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.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt
Copy link
Member

tannewt commented Nov 6, 2020

One failing check due to network issues. All is good.

@tannewt tannewt merged commit 01c7a06 into adafruit:main Nov 6, 2020
@microdev1 microdev1 deleted the CountIO-S2 branch November 7, 2020 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants