mqtt-io icon indicating copy to clipboard operation
mqtt-io copied to clipboard

Is ist possible to change gpio.BCM to gpi.BOARD for Raspberry module

Open Rohrleitner opened this issue 6 years ago • 6 comments

Hi! Your script seems nearly perfect! Thank you. But is ist possible to change gpio.BCM to gpi.BOARD for Raspberry module. I found it hardcoded in line 54 from "raspberrypi.py" " gpio.setmode(gpio.BCM)"

Greetings from austria Charly

Rohrleitner avatar Dec 11 '18 11:12 Rohrleitner

Schön abend, Charly!

I believe its possible, yes. I'll take a look at the code later, but from memory I expect it to be a simple change.

Ich werde versuchen es machen bald.

flyte avatar Dec 11 '18 13:12 flyte

Perfect! Is there an information about, how to use the "timeoput" output with the "ms" value

Am Di., 11. Dez. 2018 um 14:25 Uhr schrieb Ellis Percival < [email protected]>:

Schön abend, Charly!

I believe its possible, yes. I'll take a look at the code later, but from memory I expect it to be a simple change.

Ich werde versuchen es machen bald.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/flyte/pi-mqtt-gpio/issues/47#issuecomment-446201048, or mute the thread https://github.com/notifications/unsubscribe-auth/AlMLs1uIXW-NVTERcedbDkzWa5KdzfWJks5u37I3gaJpZM4ZNNab .

Rohrleitner avatar Dec 12 '18 08:12 Rohrleitner

What would be the default mode? GPIO.BCM? Should we check for errors, if another python module changed the numbering and we could get a inconsistancy?

To detect which pin numbering system has been set (for example, by another Python module): mode = GPIO.getmode() The mode will be GPIO.BOARD, GPIO.BCM or None

BenjiU avatar Feb 19 '19 13:02 BenjiU

Good questions, @BenjiU

I'd say use what we're using now for numbering as default, if only to be more backwards compatible. Is one more of a defacto standard than the other?

When would you suggest checking the mode? If we're setting the mode explicitly, then that should suffice during the setup phase, but do you suggest checking the mode before each read/write operation too? Perhaps this should be configurable, since it may add a performance penalty.

flyte avatar May 26 '19 14:05 flyte

Hi, I'm always using gpio.BCM, keep it for backward compatibility. Good idea.

I just googled a little bit and I'm not sure, if we need a check. Does someone know, how it works, when linux program uses a library, is it copied and exclusive or shared with different executed programs? Maybe we don't need a check. I'll try next week on a raspberry with different programs.

BenjiU avatar May 27 '19 13:05 BenjiU

@BenjiU Did you had a chance to check? I have implemented that for Orange Pi in Orange Pi pull request.

yozik04 avatar Jan 23 '20 14:01 yozik04