-
Notifications
You must be signed in to change notification settings - Fork 96
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
Allow any gpio pin to be used (not just the first 32) #117
base: sdk-2.0.0
Are you sure you want to change the base?
Conversation
Just used gpio number to decode register locations
@@ -93,9 +97,9 @@ static void set_gpio_value(const struct adapter_gpio_config *gpio_config, int va | |||
switch (gpio_config->drive) { | |||
case ADAPTER_GPIO_DRIVE_MODE_PUSH_PULL: | |||
if (value) | |||
GPIO_SET = 1 << gpio_config->gpio_num; | |||
GPIO_SET(gpio_config->gpio_num) = 1 << (gpio_config->gpio_num & 0x1f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO it looks a bit weird seeing gpio_config->gpio_num
repeated on both sides of the =
sign? But perhaps "fixing" that would be too much of a departure from the way the existing code was working? 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree - could rewrite entirely if you'd like and make set an entire macro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really my call to make. What does @P33M think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@P33M any thoughts?
Is the motivation for this PR to be able to use this with the additional GPIO pins that are exposed on the Compute Modules? |
I've just noticed that this PR introduces a mix of tabs vs. spaces for indentation. IMHO it's best to be consistent (so stick to tabs, as that's what the original code was using). |
Yes, I have a board which is pin constrained and I needed to be able to use GPIO 44 as the reset pin... it wasn't initially clear that the request to do so was silently ignored. In theory any pin should be usable... hence the PR |
Thanks, fixed. I usually have my editor set up to auto convert, missed that in the diff. |
this should now be fixed |
Previous implementation disallowed using higher pin numbers for srst etc, this removes that restriction
replaces #113