Skip to content

__init__ arguments are not Pins #121

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

Closed
dhalbert opened this issue Dec 28, 2020 · 7 comments
Closed

__init__ arguments are not Pins #121

dhalbert opened this issue Dec 28, 2020 · 7 comments

Comments

@dhalbert
Copy link
Contributor

The arg names here are suffixed as _pin, but they should actually be DigitalInOut objects. The arg names could be clearer, maybe _dio or just drop the suffix. At least one user might have been confused by this: https://forums.adafruit.com/viewtopic.php?f=60&t=173353.

def __init__(
self, spi, cs_pin, ready_pin, reset_pin, gpio0_pin=None, *, debug=False
):

@brentru
Copy link
Member

brentru commented Dec 28, 2020

@dhalbert I think dropping the suffix would be clearer compared to substituting _pin for _dio

@tekktrik
Copy link
Member

tekktrik commented Nov 1, 2021

Is this something we want to do? I'm happy to submit a PR for this :) Was also planning to add type annotations, if that helps at all.

@FoamyGuy
Copy link
Contributor

resolved by #146

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Jan 24, 2022

@tekktrik all of the other instances of similar *_pin named arguments are linked above here in this issue now.

These ones do have Learn Guide code using the named keyword arguments as well, so we will need to make sure to update all usages at the same time as the library changes are made.

@tannewt
Copy link
Member

tannewt commented Jan 24, 2022

I agree with @brentru that dropping the suffix is clearer than changing it to _dio. Adding the suffix is redundant with the type info.

@tekktrik
Copy link
Member

I can submit another PR to drop it if that's the case

@tannewt
Copy link
Member

tannewt commented Jan 25, 2022

I think it's important to point out that by taking DigitalInOut its usually meant to work with GPIO expander provided objects as well. Pin should be only used when a native pin object is expected.

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

No branches or pull requests

5 participants