-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Allow Unix variant to override MICROPY_EVENT_POLL_HOOK #8278
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
Conversation
15a4349
to
b749687
Compare
https://github.com/micropython/micropython/runs/5112540065?check_suite_focus=true#step:6:15 There seems to be a bug in uncrustify, so we can either have proper syntax with bad formatting: #define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[50]; \
void *mmap_region_head; \
MICROPY_BLUETOOTH_ROOT_POINTERS \
MICROPY_VARIANT_ROOT_POINTERS \ Or an extra semicolon with proper formatting: #define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[50]; \
void *mmap_region_head; \
MICROPY_BLUETOOTH_ROOT_POINTERS; \
MICROPY_VARIANT_ROOT_POINTERS \ |
Related #8144 i.e. it's going to take many more PRs like this before all options are wrapped and everyone is satisfied :) |
b749687
to
1e0cecf
Compare
@dlech @stinos I think I'd prefer to make this work in a similar fashion to MP_REGISTER_MODULE (i.e. also add MP_REGISTER_ROOT_POINTER). See #8566 for the first step in deprecating MICROPY_PORT_BUILTIN_MODULES That doesn't address MICROPY_EVENT_POLL_HOOK (although perhaps it could?) but also the broader issue raised in #8144 needs more thought. |
That sounds good |
This could be quite tricky to get right. As an example, here is our most complicated implementation currently: https://github.com/pybricks/pybricks-micropython/blob/f69bd694ba481563c980e09fae41b60c0ecea4fc/bricks/virtualhub/mp_port.c#L143-L185 Just allowing to override |
1e0cecf
to
c6e5ec3
Compare
I have dropped the commits for registering extra modules and root pointers since those have been solved another way. The remaining commit for overriding |
This allows variants to supply their own `MICROPY_EVENT_POLL_HOOK`. Signed-off-by: David Lechner <david@pybricks.com>
c6e5ec3
to
6af100e
Compare
Allowing to override MICROPY_EVENT_POLL_HOOK seems reasonable. Merged in 03fb671 |
Now, try_lock (SPI & I2C) & begin_transaction (display bus core) will check that the related objects are still valid first; if they are not, the lock/begin transaction will fail by returning false, rather than "other things" such as raising a Python exception where it is not permitted, accessing invalid memory, etc. Closes micropython#8278 and Closes micropython#9426
This allows unix variants to extend or replace more config options: