Skip to content
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

py/modmicropython: Add micropython.kbd_intr() function. #3011

Merged
merged 2 commits into from Apr 18, 2017

Conversation

dpgeorge
Copy link
Member

This function controls the character that's used to (asynchronously) raise a KeyboardInterrupt exception. Passing "-1" allows to disable the interception of the interrupt character (as long as a port allows such a behaviour).

This would fix #2990 and bbcmicrobit/micropython#423, and provide a port-agnostic replacement for stmhal's USB_VCP.set_interrupt().

BUT, there is an alternative, more sophisticated way to do a similar thing: namely to allow to disable (and then restore) the native/built-in REPL stream (eg USB VCP in stmhal, UART0 in esp8266). See #2891 for a PR related to this idea, and also discussion in #2814. It's probably best to go for that solution straight away but it requires some investment to get it to work.

@pfalcon
Copy link
Contributor

pfalcon commented Apr 10, 2017

and provide a port-agnostic replacement for stmhal's USB_VCP.set_interrupt().

That what surprises me - don't we have some "port-agnostic" way to set interrupt char already?

@dpgeorge
Copy link
Member Author

don't we have some "port-agnostic" way to set interrupt char already

Only at the C level via mp_hal_set_interrupt_char. And this PR is exactly to expose that as a Python function.

@pfalcon
Copy link
Contributor

pfalcon commented Apr 15, 2017

Ok, +1 for merging this, I think it's orthogonal to making esp8266's UART object refactor.

It controls the character that's used to (asynchronously) raise a
KeyboardInterrupt exception.  Passing "-1" allows to disable the
interception of the interrupt character (as long as a port allows such a
behaviour).
@dpgeorge dpgeorge merged commit c7c14f1 into micropython:master Apr 18, 2017
@dpgeorge dpgeorge deleted the micropython-kbd-intr branch July 5, 2022 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants