今日头条
这里同时使能:Mass Storage Device 与 winusb device
开启 USB的BSP驱动
#include
#include
#include
#include
#include
/* defined the LED0 pin: PI8 */
#define LED0_PIN GET_PIN(I, 8)
#ifdef RT_USING_WIFI
extern void wlan_autoconnect_init(void);
#endif
#define FS_PARTITION_NAME "filesystem"
extern int ulog_file_backend_init(void);
void mount_to_usb(void)
{
char *fullpath = NULL;
fullpath = dfs_normalize_path(NULL, "/");
if (dfs_unmount(fullpath) == 0)
{
rt_kprintf("mount_to_usb ok!\n");
}
else
{
rt_kprintf("mount_to_usb fail!\n");
}
}
MSH_CMD_EXPORT(mount_to_usb, mount_to_usb);
void mount_to_flash(void)
{
rt_device_t dev;
dev = rt_device_find(FS_PARTITION_NAME);
if (dev != RT_NULL && dev->open_flag != 0)
{
rt_device_close(dev);
rt_kprintf("close usb device ok!\n");
}
if (dfs_mount(FS_PARTITION_NAME, "/", "elm", 0, 0) == 0)
{
rt_kprintf("mount_to_flash ok!\n");
}
else
{
rt_kprintf("mount_to_flash error!!\n");
}
}
MSH_CMD_EXPORT(mount_to_flash, mount_to_flash);
mount_to_usb
,开机后,输入命令,电脑过一会,就会出现U盘mount_to_flash
,也可以直接重启,拔掉USB OTG的线即可全部0条评论
快来发表一下你的评论吧 !