[del] tock-registers: Implement mask() accessor for Field
This commit is contained in:
parent
b2c99f52c7
commit
0cf8a88f12
|
@ -514,6 +514,11 @@ pub struct Field<T: IntLike, R: RegisterLongName> {
|
|||
}
|
||||
|
||||
impl<T: IntLike, R: RegisterLongName> Field<T, R> {
|
||||
/// Get the raw bitmask used by this Field.
|
||||
pub fn mask(&self) -> T {
|
||||
(self.mask as T) << self.shift
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn read(self, val: T) -> T {
|
||||
(val & (self.mask << self.shift)) >> self.shift
|
||||
|
|
Loading…
Reference in New Issue