Skip to content
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

add set_pull method to pin class #304

Closed
wants to merge 1 commit into from
Closed

add set_pull method to pin class #304

wants to merge 1 commit into from

Conversation

johndela1
Copy link

This change adds a set_pull function to control pull resistors.

see: #288

This change adds a set_pull function to control pull resistors.
@dpgeorge
Copy link
Member

dpgeorge commented Jun 6, 2016

DId you test that this works? I think the DAL will override the setting once you call read_digital.

@johndela1
Copy link
Author

johndela1 commented Jun 11, 2016

This is the behavior:

>>> pin1.set_pull(pin1.PULL_UP)  
>>> pin1.read_digital()        
1
>>> pin1.read_digital()
1
>>> pin1.set_pull(pin1.PULL_DOWN)
>>> pin1.read_digital()          
0
>>> pin1.read_digital()
0

now if you call read_analog then call read_digital it will set it to PULL_DOWN

with this code:


 // Move into a Digital input state if necessary.                                           
    if (!(status & IO_STATUS_DIGITAL_IN)){
        disconnect();
        pin = new DigitalIn(name,PullDown);
        status |= IO_STATUS_DIGITAL_IN;
    }

@markshannon
Copy link
Collaborator

We now have a set_pull method on pins.
@johndela1 thanks for your efforts

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.

3 participants