-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Check for parameter underflow when PIO_USE_GPIO_BASE is in use #2618
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
base: develop
Are you sure you want to change the base?
Conversation
| check_pio_param(pio); | ||
| check_sm_param(sm); | ||
| #if PICO_PIO_USE_GPIO_BASE | ||
| invalid_params_if(HARDWARE_PIO, in_base < pio_get_gpio_base(pio)); |
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.
note all of these tests (well the ones i looked at) are unnecessary since the value being subtracted from is unsigned, so the following < 32 check will fail (as a negative result will be a large positive result)
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.
Ah neat - that's a subtlety that I hadn't realised. Being more of a Python programmer, I keep forgetting about the tricks that you can do with unsigned ints in C 😉
abe69a6 to
96f5b94
Compare
|
PR updated and force-pushed. |
|
@armandomontanez Bazel CI checks are failing because |
|
I'll look into that today, sorry about the friction! |
Inspired by comments on #2616
I wasn't sure which parts of this PR are necessary, so I split it into 3 commits to make it easier to chop & change 🙂