Open
Conversation
Closed
derekstavis
reviewed
Jun 3, 2019
| EDGES = (RISING, FALLING, BOTH) | ||
| ACTIVE_LOW_MODES = (ACTIVE_LOW_ON, ACTIVE_LOW_OFF) | ||
|
|
||
| def GetGpioDirFromPin(number): |
Owner
There was a problem hiding this comment.
Project is following snake case. Rename the function to _sysfs_gpio_pin_path (see more below).
| if len(nd) > 0: | ||
| return nd[0] | ||
| else: | ||
| return "DONOT" |
Owner
There was a problem hiding this comment.
I'd not return a bogus string. Raising an exception would work much better.
| @return: the path to sysfs value file | ||
| """ | ||
| return SYSFS_GPIO_VALUE_PATH % self.number | ||
| return SYSFS_BASE_PATH + "/" + GetGpioDirFromPin(self.number) + SYSFS_GPIO_VALUE_PATH |
Owner
There was a problem hiding this comment.
I'd prefer a function _sysfs_gpio_pin_path that returns the absolute GPIO path, which would avoid repeating SYSFS_BASE_PATH everywhere.
|
|
||
| def GetGpioDirFromPin(number): | ||
| ds = listdir(SYSFS_BASE_PATH) | ||
| nd = filter(lambda a: a.startswith("gpio" + str(number)),ds) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
i modify some place to add support for cubieboard