aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F7xx/USB_CDC
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-02-20 18:53:30 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-02-20 18:53:30 +0000
commit41585364a77e8d8491c958525d1f0446fe2772e9 (patch)
treeb9cdb86310678f066c78732a527885a611eb5bd9 /testhal/STM32/STM32F7xx/USB_CDC
parent54b63fd3bb931702581eca0ffb1d470923046c81 (diff)
downloadChibiOS-41585364a77e8d8491c958525d1f0446fe2772e9.tar.gz
ChibiOS-41585364a77e8d8491c958525d1f0446fe2772e9.tar.bz2
ChibiOS-41585364a77e8d8491c958525d1f0446fe2772e9.zip
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
Diffstat (limited to 'testhal/STM32/STM32F7xx/USB_CDC')
-rw-r--r--testhal/STM32/STM32F7xx/USB_CDC/main.c14
1 files changed, 6 insertions, 8 deletions
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)) {