From 41585364a77e8d8491c958525d1f0446fe2772e9 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 20 Feb 2016 18:53:30 +0000 Subject: Updated CDC demos under testhal with new shell. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8916 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/STM32F7xx/USB_CDC/main.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'testhal/STM32/STM32F7xx/USB_CDC/main.c') diff --git a/testhal/STM32/STM32F7xx/USB_CDC/main.c b/testhal/STM32/STM32F7xx/USB_CDC/main.c index d703f52c5..f3a11be5a 100644 --- a/testhal/STM32/STM32F7xx/USB_CDC/main.c +++ b/testhal/STM32/STM32F7xx/USB_CDC/main.c @@ -109,7 +109,6 @@ static THD_FUNCTION(Thread1, arg) { * Application entry point. */ int main(void) { - thread_t *shelltp = NULL; /* * System initializations. @@ -157,13 +156,12 @@ int main(void) { * Normal main() thread activity, spawning shells. */ while (true) { - if (!shelltp && (SDU2.config->usbp->state == USB_ACTIVE)) { - shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE, NORMALPRIO + 1, - shellThread, (void *)&shell_cfg1); - } - else if (chThdTerminatedX(shelltp)) { - chThdFreeToHeap(shelltp); - shelltp = NULL; /* Triggers spawning of a new shell. */ + if (SDU2.config->usbp->state == USB_ACTIVE) { + thread_t *shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE, + NORMALPRIO + 1, shellThread, + (void *)&shell_cfg1); + chThdWait(shelltp); /* Waiting termination. */ + chThdFreeToHeap(shelltp); /* Returning memory to heap. */ } #if 0 if (palReadPad(GPIOI, GPIOI_BUTTON_USER)) { -- cgit v1.2.3