summaryrefslogtreecommitdiff
path: root/stmhal/usbd_cdc_interface.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-10-26 15:39:22 +0000
committerDamien George <damien.p.george@gmail.com>2014-10-26 15:39:22 +0000
commitbc1488a05f509cd5be8bfab9574babfcb993806f (patch)
treef7e97f9fa2987e3d4a513a91be2bb8dbeff59bb1 /stmhal/usbd_cdc_interface.c
parentb2f19b8d349314baba640e1dd99ea833d0bc4b8f (diff)
stmhal: Improve REPL control codes; improve pyboard.py script.
Improvements are: 2 ctrl-C's are now needed to truly kill running script on pyboard, so make CDC interface allow multiple ctrl-C's through at once (ie sending b'\x03\x03' to pyboard now counts as 2 ctrl-C's). ctrl-C in friendly-repl can now stop multi-line input. In raw-repl mode, use ctrl-D to indicate end of running script, and also end of any error message. Thus, output of raw-repl is always at least 2 ctrl-D's and it's much easier to parse. pyboard.py is now a bit faster, handles exceptions from pyboard better (prints them and exits with exit code 1), prints out the pyboard output while the script is running (instead of waiting till the end), and allows to follow the output of a previous script when run with no arguments.
Diffstat (limited to 'stmhal/usbd_cdc_interface.c')
-rw-r--r--stmhal/usbd_cdc_interface.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/stmhal/usbd_cdc_interface.c b/stmhal/usbd_cdc_interface.c
index 28f06067b..e9b4863f6 100644
--- a/stmhal/usbd_cdc_interface.c
+++ b/stmhal/usbd_cdc_interface.c
@@ -364,6 +364,8 @@ static int8_t CDC_Itf_Receive(uint8_t* Buf, uint32_t *Len) {
for (; src < buf_top; src++) {
if (*src == user_interrupt_char) {
char_found = true;
+ // raise exception when interrupts are finished
+ pendsv_nlr_jump(user_interrupt_data);
} else {
if (char_found) {
*dest = *src;
@@ -372,11 +374,6 @@ static int8_t CDC_Itf_Receive(uint8_t* Buf, uint32_t *Len) {
}
}
- if (char_found) {
- // raise exception when interrupts are finished
- pendsv_nlr_jump(user_interrupt_data);
- }
-
// length of remaining characters
delta_len = dest - Buf;
}