Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
d3a4d396
Commit
d3a4d396
authored
Dec 20, 2015
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
esp8266: Support raising KeyboardInterrupt on Ctrl+C.
parent
07744832
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
esp8266/esp_mphal.c
+5
-1
5 additions, 1 deletion
esp8266/esp_mphal.c
esp8266/main.c
+5
-0
5 additions, 0 deletions
esp8266/main.c
esp8266/mpconfigport.h
+1
-0
1 addition, 0 deletions
esp8266/mpconfigport.h
esp8266/uart.c
+5
-0
5 additions, 0 deletions
esp8266/uart.c
with
16 additions
and
1 deletion
esp8266/esp_mphal.c
+
5
−
1
View file @
d3a4d396
...
...
@@ -98,7 +98,11 @@ void mp_hal_delay_ms(uint32_t delay) {
}
void
mp_hal_set_interrupt_char
(
int
c
)
{
// TODO
if
(
c
!=
-
1
)
{
mp_obj_exception_clear_traceback
(
MP_STATE_PORT
(
mp_kbd_exception
));
}
extern
int
interrupt_char
;
interrupt_char
=
c
;
}
void
__assert_func
(
const
char
*
file
,
int
line
,
const
char
*
func
,
const
char
*
expr
)
{
...
...
This diff is collapsed.
Click to expand it.
esp8266/main.c
+
5
−
0
View file @
d3a4d396
...
...
@@ -47,6 +47,7 @@ STATIC void mp_reset(void) {
mp_init
();
mp_obj_list_init
(
mp_sys_path
,
0
);
mp_obj_list_init
(
mp_sys_argv
,
0
);
MP_STATE_PORT
(
mp_kbd_exception
)
=
mp_obj_new_exception
(
&
mp_type_KeyboardInterrupt
);
#if MICROPY_MODULE_FROZEN
pyexec_frozen_module
(
"main"
);
#endif
...
...
@@ -83,6 +84,10 @@ mp_obj_t mp_builtin_open(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) {
}
MP_DEFINE_CONST_FUN_OBJ_KW
(
mp_builtin_open_obj
,
1
,
mp_builtin_open
);
void
mp_keyboard_interrupt
(
void
)
{
MP_STATE_VM
(
mp_pending_exception
)
=
MP_STATE_PORT
(
mp_kbd_exception
);
}
void
nlr_jump_fail
(
void
*
val
)
{
printf
(
"NLR jump failed
\n
"
);
for
(;;)
{
...
...
This diff is collapsed.
Click to expand it.
esp8266/mpconfigport.h
+
1
−
0
View file @
d3a4d396
...
...
@@ -99,6 +99,7 @@ extern const struct _mp_obj_module_t mp_module_machine;
#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[8]; \
mp_obj_t mp_kbd_exception; \
\
/* Singleton instance of scan callback, meaning that there can
be only one concurrent AP scan. */
\
...
...
This diff is collapsed.
Click to expand it.
esp8266/uart.c
+
5
−
0
View file @
d3a4d396
...
...
@@ -210,10 +210,15 @@ void ICACHE_FLASH_ATTR uart_reattach() {
#include
"lib/utils/pyexec.h"
void
soft_reset
(
void
);
void
mp_keyboard_interrupt
(
void
);
int
interrupt_char
;
void
uart_task_handler
(
os_event_t
*
evt
)
{
int
c
,
ret
=
0
;
while
((
c
=
uart_rx_one_char
(
UART_REPL
))
>=
0
)
{
if
(
c
==
interrupt_char
)
{
mp_keyboard_interrupt
();
}
ret
=
pyexec_event_repl_process_char
(
c
);
if
(
ret
&
PYEXEC_FORCED_EXIT
)
{
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment