![](/media/cache/profiles/f0fcf351df4eb6786e9bb6fc4e2dee02.jpg.50x50_q85.jpg)
Several examples run on only mbed-os5.13.0 (not 5.14.0)
Dependencies: BD_SD_DISCO_F769NI BSP_DISCO_F769NI LCD_DISCO_F769NI TS_DISCO_F769NI USBHost_F769NI
Diff: z_example/7_porting.cpp
- Revision:
- 3:35ac9ee7d2d6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/z_example/7_porting.cpp Wed Aug 07 05:39:01 2019 +0000 @@ -0,0 +1,80 @@ +#if 0 +#if USB_NOT_USE==0 +void tsk_write_usb(void const *args) +{ + FATFileSystem fsu("usb"); + FILE *fp; + + while(!msd.connect()) { + DBG("Step(%u)\r\n", __LINE__); + wait_ms(20); + } + if (msd.connected() == true){ + if (fsu.mount(&msd) == 0) { + usb_memory_run = true; + DBG("Step(%u)\r\n", __LINE__); + fp = fopen(name_usb_txt, "a"); + if (fp != 0) { + pc.printf("USBdisk:open %s\r\n", name_usb_txt); + usb_memory_run = true; + } else { + pc.printf("Cannot use USB memory\r\n"); + usb_memory_run = false; + } + fclose(fp); + } + } else { + pc.printf("Cannot use USB Memory\r\n"); + usb_memory_run = false; + } + while (true) { + osEvent evt = mail_box1.get(); + if(file_write_enabale == true){ + while(msd.connected() == false) { + while(!msd.connect()) { + DBG("Step(%u)\r\n", __LINE__); + wait_ms(20); + } + pc.printf("Step(%u)\r\n", __LINE__); + } + if (msd.connected() == true){ + DBG("Step(%u)\r\n", __LINE__); + usb_memory_run = true; + if (fsu.mount(&msd) == 0) { + DBG("Step(%u)\r\n", __LINE__); + } + } else { + pc.printf("Cannot use USB Memory\r\n"); + usb_memory_run = false; + } + fp = fopen(name_usb_txt, "a"); + wait_ms(5); + if(fp == NULL) { + pc.printf("Cannot use USB Memory\r\n"); + usb_memory_run = false; + } else { + usb_memory_run = true; + } + if (evt.status == osEventMail) { + mail_t *mail = (mail_t*)evt.value.p; + DBG(mail->all_data); + if (usb_memory_run == true){ + fprintf(fp, mail->all_data); + } + wait_ms(5); + mail_box1.free(mail); + } else { + pc.printf("ERROR-Mail1\r\n"); + } + wait_ms(5); + fclose(fp); + } else { + if (evt.status == osEventMail) { + mail_t *mail = (mail_t*)evt.value.p; + mail_box0.free(mail); + } + } + } +} +#endif +#endif \ No newline at end of file