
#include <cmsis_os.h>                                           // CMSIS RTOS header file

/*----------------------------------------------------------------------------
 *      Thread 1 'Thread_Name': Sample thread
 *---------------------------------------------------------------------------*/
 
void Thread (void const *argument);                             // thread function
osThreadId tid_Thread;                                          // thread id
osThreadDef (Thread, osPriorityNormal, 1, 0);                   // thread object

int Init_Thread (void) {

  tid_Thread = osThreadCreate (osThread(Thread), NULL);
  if(!tid_Thread) return(-1);
  
  return(0);
}

#include "USBH_MSC.h"
char fbuf[2009] = { 0 };

void Thread (void const *argument ) {
	static unsigned int result;
	static FILE *f;
	
	USBH_Initialize (0);
	
	while (1) {
		result = USBH_MSC_DriveMount ("U0:");
		if (result == USBH_MSC_OK) {
			f = fopen ("Test.txt", "r");
			if (f) {
				fread (fbuf, sizeof (fbuf), 1 ,f);
				fclose (f);
			}
		}
		osDelay (1000);
	}
}


