Skip to content

Commit

Permalink
Add high seed arg
Browse files Browse the repository at this point in the history
  • Loading branch information
fangpenlin committed Jan 6, 2025
1 parent c8baa1c commit cf39dcf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
13 changes: 9 additions & 4 deletions src/usb/msc_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<EspWlPartition<EspPartition>>,
}

Expand All @@ -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()
}
}
Expand Down Expand Up @@ -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")?;

Expand Down

0 comments on commit cf39dcf

Please sign in to comment.