Skip to content
Discussion options

You must be logged in to vote

my_callback will need to be reachable by the GC somehow to avoid releasing the memory too early. This could be done by creating a new root pointer (MP_REGISTER_ROOT_POINTER()) or by attaching it to some other Python object whose lifetime is synchronized with the rtos task.

All of the ISR handling rules apply here. So instead of mp_obj_new_int(), you could use MP_OBJ_NEW_SMALL_INT() (as long as you don't need all 32 bits) and for bytes, you would need to use a pre-allocated bytearray.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@moefear85
Comment options

Answer selected by moefear85
Comment options

You must be logged in to vote
2 replies
@moefear85
Comment options

@jimmo
Comment options

jimmo Oct 9, 2023
Maintainer

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants