sdmmc-core 0.5.0

SD/MMC core data structures and algorithms
Documentation
use crate::lib_enum;
use crate::result::{Error, Result};

use super::{ExtCsd, ExtCsdIndex};

lib_enum! {
    /// Represents the `FFU_STATUS` field of the [ExtCsd] register.
    ///
    /// Reports the status of the FFU (`Field Firmware Update`) process.
    FfuStatus: u8 {
        default: Success,
        error: Error,
        Success = 0x00,
        GeneralError = 0x10,
        FirmwareInstallError = 0x11,
        FirmwareDownloadError = 0x12,
    }
}

impl ExtCsd {
    /// Gets the `FFU_STATUS` field of the [ExtCsd].
    pub const fn ffu_status(&self) -> Result<FfuStatus> {
        FfuStatus::from_raw(self.0[ExtCsdIndex::FfuStatus.into_inner()])
    }
}