Merge pull request #62 from glennrub/raw_repl_support
nrf5: Updating main.c to support RAW REPL.
This commit is contained in:
commit
e619b837c0
@ -43,6 +43,8 @@ const char * nrf5_help_text =
|
||||
HELP_TEXT_SD
|
||||
#endif
|
||||
"Control commands:\n"
|
||||
" CTRL-A -- on a blank line, enter raw REPL mode\n"
|
||||
" CTRL-B -- on a blank line, enter normal REPL mode\n"
|
||||
" CTRL-D -- on a blank line, do a soft reset of the board\n"
|
||||
" CTRL-E -- on a blank line, enter paste mode\n"
|
||||
"\n"
|
||||
|
@ -83,6 +83,7 @@ extern uint32_t _heap_end;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
soft_reset:
|
||||
mp_stack_set_top(&_ram_end);
|
||||
|
||||
// Stack limit should be less than real stack size, so we have a chance
|
||||
@ -197,16 +198,24 @@ pin_init0();
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
|
||||
if (pyexec_raw_repl() != 0) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ret_code = pyexec_friendly_repl();
|
||||
if (ret_code != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mp_deinit();
|
||||
|
||||
if (ret_code == PYEXEC_FORCED_EXIT) {
|
||||
NVIC_SystemReset();
|
||||
} else {
|
||||
goto soft_reset;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user