-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/msp430fxyz: Fixed input sanitizing in GPIO_PIN #9367
Conversation
@haukepetersen: As you are the author of |
Sadly this issue is blocking another pull request, which I'm really interested to get it merged. Maybe @cladmi also has a an msp430 bases board and is able to review and test this one-line PR? |
@maribu I can give it a look this evening. Can you add a short description how to test this PR in order to see that it fixes the bug? |
@PeterKietzmann: Thank you very much. The bug is that the compilation with specific invalid values for So, I already know that this PR fixes the compilation Bug. I only don't know if it has any regressions, as I don't have the correct hardware to test. So basically, does the |
@maribu I'm fine with the |
You're totally right about the |
@maribu no worries, we all know that. |
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.
ACK. I wasn't able to completely test this PR as the driver seems (partly) broken. However, the change (i) is correct by the description and (ii) does not break the Z1/MSP430 GPIO pins that work on current master. Furthermore, this PR blocks progress in other PRs so I decide for merging it know.
In
cpu/msp430fxyz/include/periph_cpu.h
the typegpio_t
is defined as:The old version of the macro is:
Both
x
andy
are sanitized by using bit-wise and. But they
sanitizing is not correct:1 can be shifted at most 15 times to the left in an
uint16_t
. But the upper 8 bits are determined by the portx
, so only the lower 8 bit should be determined byy
. Thus, the correct bitmask is0x07
to sanitizey
.Update: My original patch and statement was strictly wrong. It should be fixed now.