pub fn erase_page(device: &DfuDevice, address: u32) -> Result<()> {
    // Device must be in idle state for this operation
    device.abort_request()?;

    // Issue the request
    erase_page_request(device, address)?;

    // First status response must have state dfuDNBUSY
    let status = device.getstatus_request()?;
    if status.bState != states::DeviceStateCode::dfuDNBUSY {
        return Err(Box::new(Error::InvalidDeviceState(status.bState)));
    }

    device.wait_for_status_response(status.bwPollTimeout as u64)?;

    Ok(())
}
/// High-level function to erase a page
High-level function to erase a page
High - level function to erase a page
pub fn erase_page(device: &DfuDevice, address: u32) -> Result<()> {
    // Device must be in idle state for this operation
    device.abort_request()?;
    // Issue the request
    erase_page_request(device, address)?;
    // First status response must have state dfuDNBUSY
    let status = device.getstatus_request()?;
    if status.bState != states::DeviceStateCode::dfuDNBUSY {
        return Err(Box::new(Error::InvalidDeviceState(status.bState)));
    }
    device.wait_for_status_response(status.bwPollTimeout as u64)?;
    Ok(())
}
pub fn erase_page ( device : & DfuDevice , address : u32 ) -> Result < ( ) > { // Device must be in idle state for this operation device . abort_request ( ) ? ; // Issue the request erase_page_request ( device , address ) ? ; // First status response must have state dfuDNBUSY let status = device . getstatus_request ( ) ? ; if status . bState != states :: DeviceStateCode :: dfuDNBUSY { return Err ( Box :: new ( Error :: InvalidDeviceState ( status . bState ) ) ) ; } device . wait_for_status_response ( status . bwPollTimeout as u64 ) ? ; Ok ( ( ) ) }
High-level function to erase a page
High - level function to erase a page
device
&DfuDevice
address
u32