use crate::lib_bool_enum;
use crate::result::Result;
use super::{ExtCsd, ExtCsdIndex};
lib_bool_enum! {
/// Represents the `BARRIER_CTRL` field of the [ExtCsd] register.
BarrierCtrl {
/// Barrier feature is off.
Off = false,
/// Barrier feature is on.
On = true,
}
}
impl ExtCsd {
/// Gets the `BARRIER_CTRL` field of the [ExtCsd] register.
pub const fn barrier_ctrl(&self) -> BarrierCtrl {
BarrierCtrl::from_bool((self.0[ExtCsdIndex::BarrierCtrl.into_inner()] & 0b1) != 0)
}
/// Sets the `BARRIER_CTRL` field of the [ExtCsd] register.
pub fn set_barrier_ctrl(&mut self, val: BarrierCtrl) {
self.0[ExtCsdIndex::BarrierCtrl.into_inner()] = val.into_u8();
}
}