pub fn flash(firmware: Arc<[u8]>, verify: bool) -> mpsc::Receiver<Progress> {

    let (mut sender, receiver) = mpsc::channel();

    thread::spawn(move || {
        let flipper = match Flipper::attach() {
            Ok(flipper) => flipper,
            Err(e) => {
                let _ = sender.send(Progress::Failed(e.into()));
                return;
            }
        };
        flipper.select_u2_gpio();

        let mut bus = Uart0::new();
        bus.configure(UartBaud::DFU, false);
        let mut gpio = Gpio::new();
        let mut samba = SamBa::new(&mut bus, &mut gpio, &mut sender);

        samba.upload(IFLASH0_ADDR, &firmware);
        if verify { samba.verify(&firmware); }
        samba.reset();
        let _ = samba.sender.send(Progress::Complete);
    });

    receiver
}
/// Flashes the contents of `firmware` onto Flipper. If `verify` is true, also read
/// back each byte in memory from the device and compare it to the original firmware.
///
/// Returns a channel receiver of `Progress`, which reports the status of the flashing
/// process. This is arranged this way so that the console binary can simply display
/// a TUI output based on progress, but any library consumers can programmatically
/// watch progress (and respond accordingly) without their standard output being polluted.
Flashes the contents of `firmware` onto Flipper. If `verify` is true, also read
back each byte in memory from the device and compare it to the original firmware.

Returns a channel receiver of `Progress`, which reports the status of the flashing
process. This is arranged this way so that the console binary can simply display
a TUI output based on progress, but any library consumers can programmatically
watch progress (and respond accordingly) without their standard output being polluted.
Flashes the contents of ` firmware ` onto Flipper . If ` verify ` is true also read back each byte in memory from the device and compare it to the original firmware . Returns a channel receiver of ` Progress ` which reports the status of the flashing process . This is arranged this way so that the console binary can simply display a TUI output based on progress but any library consumers can programmatically watch progress ( and respond accordingly ) without their standard output being polluted .
pub fn flash(firmware: Arc<[u8]>, verify: bool) -> mpsc::Receiver<Progress> {
    let (mut sender, receiver) = mpsc::channel();
    thread::spawn(move || {
        let flipper = match Flipper::attach() {
            Ok(flipper) => flipper,
            Err(e) => {
                let _ = sender.send(Progress::Failed(e.into()));
                return;
            }
        };
        flipper.select_u2_gpio();
        let mut bus = Uart0::new();
        bus.configure(UartBaud::DFU, false);
        let mut gpio = Gpio::new();
        let mut samba = SamBa::new(&mut bus, &mut gpio, &mut sender);
        samba.upload(IFLASH0_ADDR, &firmware);
        if verify { samba.verify(&firmware); }
        samba.reset();
        let _ = samba.sender.send(Progress::Complete);
    });
    receiver
}
pub fn flash ( firmware : Arc < [ u8 ] > , verify : bool ) -> mpsc :: Receiver < Progress > { let ( mut sender , receiver ) = mpsc :: channel ( ) ; thread :: spawn ( move | | { let flipper = match Flipper :: attach ( ) { Ok ( flipper ) => flipper , Err ( e ) => { let _ = sender . send ( Progress :: Failed ( e . into ( ) ) ) ; return ; } } ; flipper . select_u2_gpio ( ) ; let mut bus = Uart0 :: new ( ) ; bus . configure ( UartBaud :: DFU , false ) ; let mut gpio = Gpio :: new ( ) ; let mut samba = SamBa :: new ( & mut bus , & mut gpio , & mut sender ) ; samba . upload ( IFLASH0_ADDR , & firmware ) ; if verify { samba . verify ( & firmware ) ; } samba . reset ( ) ; let _ = samba . sender . send ( Progress :: Complete ) ; } ) ; receiver }
Flashes the contents of `firmware` onto Flipper.
Flashes the contents of ` firmware ` onto Flipper .
firmware
Arc<[u8]>
verify
bool
firmware
Arc<[u8]>
verify
bool