pub struct Register {
pub address: u16,
pub offset: u8,
pub width: u8,
pub read_only: bool,
}Expand description
A register, which is some of the bits of a byte at an address.
Fields§
§address: u16The byte it lives in.
offset: u8Which bit of that byte it starts at.
width: u8How many bits it spans.
read_only: boolWhether the chip refuses to be written here.
Implementations§
Source§impl Register
impl Register
Sourcepub const fn is_whole_byte(&self) -> bool
pub const fn is_whole_byte(&self) -> bool
Whether this register is the whole byte rather than a field inside one.
A whole byte is written directly; anything narrower has to be read first, so the bits beside it survive the write.
§Returns
Whether a write can skip reading the byte first.
§Examples
use pamoja_radios::sx1302::register::{COMMON_VERSION, AGC_MCU_HOST_PROG};
assert!(COMMON_VERSION.is_whole_byte());
assert!(!AGC_MCU_HOST_PROG.is_whole_byte());Trait Implementations§
impl Copy for Register
impl Eq for Register
impl StructuralPartialEq for Register
Auto Trait Implementations§
impl Freeze for Register
impl RefUnwindSafe for Register
impl Send for Register
impl Sync for Register
impl Unpin for Register
impl UnsafeUnpin for Register
impl UnwindSafe for Register
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more