Struct tcn75a::ConfigReg [−][src]
pub struct ConfigReg { /* fields omitted */ }
Expand description
Representation of the Sensor Configuration Register.
The Sensor Configuration Register of the TCN75A is eight bits wide and consists of
6 separate fields. Fields are accessed using getters and set_*
methods provided by the
modular_bitfield
crate. See the datasheet for information on field meanings.
Examples
Each field has a power-of-two number of valid options. Therefore the set_*
methods should never
panic:
let mut cfg = ConfigReg::new(); assert_eq!(cfg.resolution(), Resolution::Bits9); cfg.set_resolution(Resolution::Bits12); assert_eq!(cfg.resolution(), Resolution::Bits12);
Using set_*_checked
methods and unwrap
ping the Result
should also be zero-cost:
let mut cfg = ConfigReg::new(); assert_eq!(cfg.resolution(), Resolution::Bits9); cfg.set_resolution_checked(Resolution::Bits12).unwrap(); assert_eq!(cfg.resolution(), Resolution::Bits12);
Implementations
pub fn shutdown_or_err(
&self
) -> Result<<Shutdown as Specifier>::InOut, InvalidBitPattern<<Shutdown as Specifier>::Bytes>>
pub fn shutdown_or_err(
&self
) -> Result<<Shutdown as Specifier>::InOut, InvalidBitPattern<<Shutdown as Specifier>::Bytes>>
Returns the value of shutdown.
#Errors
If the returned value contains an invalid bit pattern for shutdown.
Returns a copy of the bitfield with the value of shutdown set to the given value.
#Panics
If the given value is out of bounds for shutdown.
pub fn with_shutdown_checked(
self,
new_val: <Shutdown as Specifier>::InOut
) -> Result<Self, OutOfBounds>
pub fn with_shutdown_checked(
self,
new_val: <Shutdown as Specifier>::InOut
) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of shutdown set to the given value.
#Errors
If the given value is out of bounds for shutdown.
Sets the value of shutdown to the given value.
#Panics
If the given value is out of bounds for shutdown.
pub fn set_shutdown_checked(
&mut self,
new_val: <Shutdown as Specifier>::InOut
) -> Result<(), OutOfBounds>
pub fn set_shutdown_checked(
&mut self,
new_val: <Shutdown as Specifier>::InOut
) -> Result<(), OutOfBounds>
Sets the value of shutdown to the given value.
#Errors
If the given value is out of bounds for shutdown.
pub fn comp_int_or_err(
&self
) -> Result<<CompInt as Specifier>::InOut, InvalidBitPattern<<CompInt as Specifier>::Bytes>>
pub fn comp_int_or_err(
&self
) -> Result<<CompInt as Specifier>::InOut, InvalidBitPattern<<CompInt as Specifier>::Bytes>>
Returns the value of comp_int.
#Errors
If the returned value contains an invalid bit pattern for comp_int.
Returns a copy of the bitfield with the value of comp_int set to the given value.
#Panics
If the given value is out of bounds for comp_int.
pub fn with_comp_int_checked(
self,
new_val: <CompInt as Specifier>::InOut
) -> Result<Self, OutOfBounds>
pub fn with_comp_int_checked(
self,
new_val: <CompInt as Specifier>::InOut
) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of comp_int set to the given value.
#Errors
If the given value is out of bounds for comp_int.
Sets the value of comp_int to the given value.
#Panics
If the given value is out of bounds for comp_int.
pub fn set_comp_int_checked(
&mut self,
new_val: <CompInt as Specifier>::InOut
) -> Result<(), OutOfBounds>
pub fn set_comp_int_checked(
&mut self,
new_val: <CompInt as Specifier>::InOut
) -> Result<(), OutOfBounds>
Sets the value of comp_int to the given value.
#Errors
If the given value is out of bounds for comp_int.
Returns the value of alert_polarity.
pub fn alert_polarity_or_err(
&self
) -> Result<<AlertPolarity as Specifier>::InOut, InvalidBitPattern<<AlertPolarity as Specifier>::Bytes>>
pub fn alert_polarity_or_err(
&self
) -> Result<<AlertPolarity as Specifier>::InOut, InvalidBitPattern<<AlertPolarity as Specifier>::Bytes>>
Returns the value of alert_polarity.
#Errors
If the returned value contains an invalid bit pattern for alert_polarity.
Returns a copy of the bitfield with the value of alert_polarity set to the given value.
#Panics
If the given value is out of bounds for alert_polarity.
pub fn with_alert_polarity_checked(
self,
new_val: <AlertPolarity as Specifier>::InOut
) -> Result<Self, OutOfBounds>
pub fn with_alert_polarity_checked(
self,
new_val: <AlertPolarity as Specifier>::InOut
) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of alert_polarity set to the given value.
#Errors
If the given value is out of bounds for alert_polarity.
Sets the value of alert_polarity to the given value.
#Panics
If the given value is out of bounds for alert_polarity.
pub fn set_alert_polarity_checked(
&mut self,
new_val: <AlertPolarity as Specifier>::InOut
) -> Result<(), OutOfBounds>
pub fn set_alert_polarity_checked(
&mut self,
new_val: <AlertPolarity as Specifier>::InOut
) -> Result<(), OutOfBounds>
Sets the value of alert_polarity to the given value.
#Errors
If the given value is out of bounds for alert_polarity.
Returns the value of fault_queue.
pub fn fault_queue_or_err(
&self
) -> Result<<FaultQueue as Specifier>::InOut, InvalidBitPattern<<FaultQueue as Specifier>::Bytes>>
pub fn fault_queue_or_err(
&self
) -> Result<<FaultQueue as Specifier>::InOut, InvalidBitPattern<<FaultQueue as Specifier>::Bytes>>
Returns the value of fault_queue.
#Errors
If the returned value contains an invalid bit pattern for fault_queue.
Returns a copy of the bitfield with the value of fault_queue set to the given value.
#Panics
If the given value is out of bounds for fault_queue.
pub fn with_fault_queue_checked(
self,
new_val: <FaultQueue as Specifier>::InOut
) -> Result<Self, OutOfBounds>
pub fn with_fault_queue_checked(
self,
new_val: <FaultQueue as Specifier>::InOut
) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of fault_queue set to the given value.
#Errors
If the given value is out of bounds for fault_queue.
Sets the value of fault_queue to the given value.
#Panics
If the given value is out of bounds for fault_queue.
pub fn set_fault_queue_checked(
&mut self,
new_val: <FaultQueue as Specifier>::InOut
) -> Result<(), OutOfBounds>
pub fn set_fault_queue_checked(
&mut self,
new_val: <FaultQueue as Specifier>::InOut
) -> Result<(), OutOfBounds>
Sets the value of fault_queue to the given value.
#Errors
If the given value is out of bounds for fault_queue.
Returns the value of resolution.
pub fn resolution_or_err(
&self
) -> Result<<Resolution as Specifier>::InOut, InvalidBitPattern<<Resolution as Specifier>::Bytes>>
pub fn resolution_or_err(
&self
) -> Result<<Resolution as Specifier>::InOut, InvalidBitPattern<<Resolution as Specifier>::Bytes>>
Returns the value of resolution.
#Errors
If the returned value contains an invalid bit pattern for resolution.
Returns a copy of the bitfield with the value of resolution set to the given value.
#Panics
If the given value is out of bounds for resolution.
pub fn with_resolution_checked(
self,
new_val: <Resolution as Specifier>::InOut
) -> Result<Self, OutOfBounds>
pub fn with_resolution_checked(
self,
new_val: <Resolution as Specifier>::InOut
) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of resolution set to the given value.
#Errors
If the given value is out of bounds for resolution.
Sets the value of resolution to the given value.
#Panics
If the given value is out of bounds for resolution.
pub fn set_resolution_checked(
&mut self,
new_val: <Resolution as Specifier>::InOut
) -> Result<(), OutOfBounds>
pub fn set_resolution_checked(
&mut self,
new_val: <Resolution as Specifier>::InOut
) -> Result<(), OutOfBounds>
Sets the value of resolution to the given value.
#Errors
If the given value is out of bounds for resolution.
pub fn one_shot_or_err(
&self
) -> Result<<OneShot as Specifier>::InOut, InvalidBitPattern<<OneShot as Specifier>::Bytes>>
pub fn one_shot_or_err(
&self
) -> Result<<OneShot as Specifier>::InOut, InvalidBitPattern<<OneShot as Specifier>::Bytes>>
Returns the value of one_shot.
#Errors
If the returned value contains an invalid bit pattern for one_shot.
Returns a copy of the bitfield with the value of one_shot set to the given value.
#Panics
If the given value is out of bounds for one_shot.
pub fn with_one_shot_checked(
self,
new_val: <OneShot as Specifier>::InOut
) -> Result<Self, OutOfBounds>
pub fn with_one_shot_checked(
self,
new_val: <OneShot as Specifier>::InOut
) -> Result<Self, OutOfBounds>
Returns a copy of the bitfield with the value of one_shot set to the given value.
#Errors
If the given value is out of bounds for one_shot.
Sets the value of one_shot to the given value.
#Panics
If the given value is out of bounds for one_shot.
pub fn set_one_shot_checked(
&mut self,
new_val: <OneShot as Specifier>::InOut
) -> Result<(), OutOfBounds>
pub fn set_one_shot_checked(
&mut self,
new_val: <OneShot as Specifier>::InOut
) -> Result<(), OutOfBounds>
Sets the value of one_shot to the given value.
#Errors
If the given value is out of bounds for one_shot.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ConfigReg
impl UnwindSafe for ConfigReg
Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Performs the conversion.
Performs the conversion.
Casts the value.
type Output = T
type Output = T
Should always be Self
Casts the value.
Casts the value.
Casts the value.