I'm working with a chip that needs to read a byte of the form 0b0100AAAW, where the upper bits must always be 0100. What's the best route for me to ensure that those bits will always be set to that?
Right now, I'm setting them via the default as the docs say
Default values are used as-is, even if they affect bits that aren't defined within the bitfield.
However, someone could call new_with_raw_value(0) and set those upper bits to an invalid value.
I was originally looking for something vaguely of this shape:
#[bits(4..=7, fixed = 0b0100)]
_: (),
This would let me specify that a range of bits should always be a given value and wouldn't generate setters or getters.
I'm working with a chip that needs to read a byte of the form
0b0100AAAW, where the upper bits must always be0100. What's the best route for me to ensure that those bits will always be set to that?Right now, I'm setting them via the
defaultas the docs sayHowever, someone could call
new_with_raw_value(0)and set those upper bits to an invalid value.I was originally looking for something vaguely of this shape:
This would let me specify that a range of bits should always be a given value and wouldn't generate setters or getters.