diff --git a/src/main.rs b/src/main.rs index 2a97dc2..30af756 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,7 +44,7 @@ async fn run_async(spawner: LocalSpawner) -> Result<(), anyhow::Error> { let _sntp = EspSntp::new_default()?; log::info!("SNTP initialized"); - let mut msc_device = MSCDevice::new(partition_label, mount_path); + let mut msc_device = MSCDevice::new(partition_label, mount_path, true); msc_device.install()?; let mut button = PinDriver::input(peripherals.pins.gpio14)?; diff --git a/src/usb/msc_device.rs b/src/usb/msc_device.rs index 42e24c5..342dd77 100644 --- a/src/usb/msc_device.rs +++ b/src/usb/msc_device.rs @@ -11,9 +11,10 @@ use std::ffi::CString; #[derive(Default)] pub struct MSCDevice { - pub partition_label: String, - pub mount_path: String, + partition_label: String, + mount_path: String, mount_path_c_str: CString, + high_speed: bool, wl_partition: Option>, } @@ -34,10 +35,11 @@ unsafe extern "C" fn storage_mount_changed_cb(event: *mut tinyusb_msc_event_t) { } impl MSCDevice { - pub fn new(partition_label: &str, base_path: &str) -> Self { + pub fn new(partition_label: &str, base_path: &str, high_speed: bool) -> Self { Self { mount_path: base_path.to_string(), partition_label: partition_label.to_string(), + high_speed, ..Default::default() } } @@ -82,7 +84,10 @@ impl MSCDevice { esp!(unsafe { tinyusb_msc_storage_mount(base_path_c_str.as_ptr()) }) .with_context(|| format!("Failed to mount storage at {}", self.mount_path))?; - let tusb_cfg = tinyusb_config_t::default(); + let mut tusb_cfg = tinyusb_config_t::default(); + if self.high_speed { + // TODO: + } esp!(unsafe { tinyusb_driver_install(&tusb_cfg) }) .with_context(|| "Failed to install TinyUSB driver")?;