Skip to content

Commit

Permalink
Try out new approach
Browse files Browse the repository at this point in the history
  • Loading branch information
fangpenlin committed Jan 2, 2025
1 parent 5ba5323 commit 0018f96
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@ esp_idf_version = "v5.2.2"

[[package.metadata.esp-idf-sys.extra_components]]
remote_component = { name = "espressif/esp_tinyusb", version = "1.5.0" }
bindings_header = "src/include/tinyusb_bindings.h"
bindings_module = "esp_tinyusb"

[patch.crates-io]
embuild = { git = "https://github.com/esp-rs/embuild" }
esp-idf-svc = { git = "https://github.com/esp-rs/esp-idf-svc" }
esp-idf-hal = { git = "https://github.com/esp-rs/esp-idf-hal" }
esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys", rev = "ecf45d1b7f8c9acc8c55dbdd9b105c7ac51d8525" }
3 changes: 0 additions & 3 deletions src/include/tinyusb_bindings.h

This file was deleted.

13 changes: 10 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
use esp_idf_sys::esp_tinyusb::{tinyusb_config_t, tinyusb_driver_install};

use esp_idf_sys::esp_tinyusb::{
tinyusb_config_t, tinyusb_driver_install, tinyusb_msc_storage_mount,
};
use std::ffi::CString;

fn main() {
let tusb_cfg = tinyusb_config_t::default();
unsafe { tinyusb_driver_install(&tusb_cfg); }
unsafe {
tinyusb_driver_install(&tusb_cfg);
}

let s = CString::new("");
unsafe { tinyusb_msc_storage_mount(s.unwrap().as_ptr()) };
}

0 comments on commit 0018f96

Please sign in to comment.