use crate::lib_bitfield;
lib_bitfield! {
/// Represents the `C_SIZE` field of the `CSD` register.
CapacitySize: u16,
mask: 0xfff,
default: 0,
{
/// Represents one of the parameters used to calculate the card's total memory capacity.
c_size: 11, 0;
}
}
impl CapacitySize {
/// Gets the effective capacity size.
///
/// # Note
///
/// The memory capacity is calculated with the algorithm:
///
/// ```no_build,no_run
/// size = C_SIZE + 1
/// ```
pub const fn size(&self) -> usize {
(self.c_size() + 1) as usize
}
}