fivdi / onoff

GPIO access and interrupt detection with Node.js
MIT License
1.24k stars 120 forks source link

Support pull-up and pull-down naively as other libs do... #38

Closed born2net closed 8 years ago

born2net commented 8 years ago

Support pull-up and pull-down naively as other libs do... no real info how to use the tree and really it should be transparent to user, just set flag

tx

Sean

fivdi commented 8 years ago

Are you aware of a technique for performing this in a platform independent way?

There's info about how to use the tree on the Raspberry Pi here although it is far from transparent.

born2net commented 8 years ago

yes but it would be great if we could control through the lib, just like Python does it...

fivdi commented 8 years ago

Can the Python lib do it without sudo?

born2net commented 8 years ago

I believe it does need sudo, but for me and many others that's just fine as I run as root, or use helper exec such as utlity runuser to for added privileges.

I think onoff is the PERFECT lib, and it's the last thing it's missing to be the BEST!

fivdi commented 8 years ago

Thank you for your kind words, but I don't know if I want to add a C++ addon to onoff for achieving this.

If this is the last thing missing to make onoff the BEST, then what, in your opinion, is the BEST today?

born2net commented 8 years ago

I can tell you that the most popular hardware today for the raspberry pi are the adafruit hats, servo, lcd, motors, and they all use i2c. no one had translated their api to node, and that would be very awesome...after u add the pull up down resistor option ;) On Oct 2, 2015 4:29 PM, "Brian Cooke" notifications@github.com wrote:

Thank you for your kind words, but I don't know if I want to add a C++ addon to onoff for achieving this.

If this is the last thing missing to make onoff the BEST, then what, in your opinion, is the BEST today?

— Reply to this email directly or view it on GitHub https://github.com/fivdi/onoff/issues/38#issuecomment-145182863.

fivdi commented 8 years ago

onoff doesn't support I2C (but https://github.com/fivdi/i2c-bus does). I'm not sure I fully understand now. Is the pullup/pulldown support you need related to I2C?

born2net commented 8 years ago

No I just needed to have the ability to change the pull up and pull down on projects that I'm using the library for On Oct 3, 2015 1:23 AM, "Brian Cooke" notifications@github.com wrote:

onoff doesn't support I2C (but https://github.com/fivdi/i2c-bus does). I'm not sure I fully understand now. Is the pullup/pulldown support you need related to I2C?

— Reply to this email directly or view it on GitHub https://github.com/fivdi/onoff/issues/38#issuecomment-145215212.

fivdi commented 8 years ago

It looks like it should be possible to achieve this on the Raspberry Pi without requiring the use of sudo.

born2net commented 8 years ago

You could add that that would be awesome On Oct 3, 2015 9:22 AM, "Brian Cooke" notifications@github.com wrote:

It looks like it should be possible to achieve this on the Raspberry Pi without requiring the use of sudo.

— Reply to this email directly or view it on GitHub https://github.com/fivdi/onoff/issues/38#issuecomment-145262231.

fivdi commented 8 years ago

@born2net and anyone else interested in GPIO on the Raspberry Pi.

onoff is actually a platform independent package that functions on multiple systems like the Raspberry Pi and the BeagleBone. Rather than extending onoff with Raspberry Pi specific code, I decided to implement a new package called pigpio that is specifically tailored to the Raspberry Pi. pigpio already supports the following features:

Features

So @born2net, I'd suggest taking a look at pigpio and recommend using it on the Raspberry Pi when onoff doesn't fit the requirements.

born2net commented 8 years ago

sure, will check it out tx!!!

fivdi commented 8 years ago

@born2net I'm going to close this issue.

If Linux is ever extended to provide a platform independent mechanism for configuring pull-up and pull-down resistors, onoff will also be extended to make use of such a mechanism. onoff is very unlikely to be extended to make use of platform specific mechanisms.

The alternative in this case is to use platform specific libraries such as pigpio.