[usb] prevent start of log when usb storage is running

This commit is contained in:
Gautier Hattenberger
2014-02-10 15:34:56 +01:00
parent 591b273a8b
commit c8678c371e
3 changed files with 15 additions and 5 deletions
@@ -92,7 +92,10 @@ static __attribute__((noreturn)) msg_t thd_heartbeat(void *arg)
chRegSetThreadName("pprz heartbeat");
chThdSleepSeconds (SDLOG_START_DELAY);
sdOk = chibios_logInit(true);
if (usbStorageIsItRunning ())
chThdSleepSeconds (20000); // stuck here for hours
else
sdOk = chibios_logInit(true);
while (TRUE) {
palTogglePad (GPIOC, GPIOC_LED3);
@@ -37,6 +37,7 @@ static msg_t thdUsbStorage(void *arg);
static Thread* usbStorageThreadPtr=NULL;
/* USB mass storage driver */
static USBMassStorageDriver UMSD1;
static bool_t isRunning = false;
/* endpoint index */
#define USB_MS_DATA_EP 1
@@ -297,7 +298,7 @@ static msg_t thdUsbStorage(void *arg)
chThdSleepMilliseconds(20);
}
isRunning = true;
chRegSetThreadName("UsbStorage:connected");
chibios_logFinish ();
@@ -331,3 +332,8 @@ static msg_t thdUsbStorage(void *arg)
MCU_RESTART();
return RDY_OK;
}
bool_t usbStorageIsItRunning (void)
{
return isRunning;
}
@@ -25,6 +25,7 @@
*/
#pragma once
void usbStorageStartPolling (void);
void usbStorageStop (void);
void usbStorageWaitForDeconnexion (void);
void usbStorageStartPolling (void);
void usbStorageStop (void);
void usbStorageWaitForDeconnexion (void);
bool_t usbStorageIsItRunning (void);