Skip to main content

probe_rp_usb/
lib.rs

1//! Library interface for `probe-rp-usb`.
2//!
3//! Exposes the core USB, serial, flash, and UF2 operations so they can be
4//! embedded in other tools without going through the command-line interface.
5//!
6//! Firmware targeted by `probe-rp-usb` should use the 
7//! [`rp-usb-reset`](https://crates.io/crates/rp-usb-reset) crate to
8//! expose the expected USB reset interface. This keeps reset behavior
9//! compatible with `probe-rp-usb` and, in normal Windows setups, removes the
10//! need for a manual Zadig driver install.
11//!
12//! # Quick example
13//!
14//! ```no_run
15//! use probe_rp_usb::{bootsel, flash, usb};
16//! use probe_rp_usb::Family;
17//! use std::path::Path;
18//!
19//! // Reset into BOOTSEL and flash a firmware ELF in one call.
20//! flash::flash(
21//!     Path::new("firmware.elf"),
22//!     Family::RP2350_ARM_S,
23//!     0x1000_0000,
24//!     None,  // VID: use default 0x2E8A
25//!     None,  // PID: use default 0x0009
26//!     10,    // BOOTSEL drive timeout (seconds)
27//!     false, // no_wait: wait for device reboot
28//!     None,  // event callback
29//! ).unwrap();
30//!
31//! // Optional: suppress default terminal output when embedding as a library.
32//! probe_rp_usb::event::set_silent_output(true);
33//! ```
34
35pub mod attach;
36pub mod bootsel;
37pub mod elf;
38pub mod event;
39pub mod flash;
40pub mod picoboot;
41pub(crate) mod progress;
42pub mod uf2;
43pub mod ui;
44pub mod usb;
45pub mod write;
46
47/// Re-export the UF2 family enum used by the flash and write APIs.
48pub use crate::uf2::Family;