sdmmc-core 0.5.0

SD/MMC core data structures and algorithms
Documentation
use super::{ExtCsd, ExtCsdIndex};

impl ExtCsd {
    /// Gets the `BKOPS_START` field of the [ExtCsd] register.
    pub const fn bkops_start(&self) -> u8 {
        self.0[ExtCsdIndex::BkopsStart.into_inner()]
    }

    /// Sets the `BKOPS_START` field of the [ExtCsd] register.
    pub fn set_bkops_start(&mut self, val: u8) {
        self.0[ExtCsdIndex::BkopsStart.into_inner()] = val;
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_bkops_start() {
        let mut ext_csd = ExtCsd::new();

        assert_eq!(ext_csd.bkops_start(), 0);

        (0..=u8::MAX).for_each(|val| {
            ext_csd.set_bkops_start(val);
            assert_eq!(ext_csd.bkops_start(), val);
        });
    }
}