adafruit / Adafruit_Python_GPIO

DEPRECATED! Please use Adafruit Blinka instead (was: Library to provide a cross-platform GPIO interface on the Raspberry Pi and Beaglebone Black using the RPi.GPIO and Adafruit_BBIO libraries.)
MIT License
402 stars 312 forks source link

Check raspberry pi version for require_repeated_start #74

Closed misko closed 6 years ago

misko commented 7 years ago

For require_repeated_start check that platform is not only raspberrypi but also the correct version, otherwise code currently using this breaks on new raspberry pi because of hardcoded path

Thank you for creating a pull request to contribute to Adafruit's GitHub code! Before you open the request please review the following guidelines and tips to help it be more easily integrated:

Thank you again for contributing! We will try to test and integrate the change as soon as we can, but be aware we have many GitHub repositories to manage and can't immediately respond to every request. There is no need to bump or check in on a pull request (it will clutter the discussion of the request).

Also don't be worried if the request is closed or not integrated--sometimes the priorities of Adafruit's GitHub code (education, ease of use) might not match the priorities of the pull request. Don't fret, the open source community thrives on forks and GitHub makes it easy to keep your changes in a forked repo.

After reviewing the guidelines above you can delete this text from the pull request.

tdicola commented 6 years ago

I'm going to close this because it doesn't look like it's working the way you might have intended. If you notice the pi_version() function actually returns a number like 1, 2, or 3 to indicate the Raspberry Pi version (see https://github.com/adafruit/Adafruit_Python_GPIO/blob/master/Adafruit_GPIO/Platform.py#L99-L107 ). The check in this pull is comparing against a BCM name like BCM2708 though and won't ever be true for any Pi version. What I'll do is instead add a check to see if the path exists (i.e you're using the older BCM2708 kernel driver) and then try to set it. For reference this thread has good context on the switch from BCM2708 to BCM2835 driver functionality and the loss of the explicit combined mode setting: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=184377