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 unwrapping 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

Returns an instance with zero initialized data.

Returns the underlying bits.

Layout

The returned byte array is layed out in the same way as described here.

Converts the given bytes directly into the bitfield struct.

Returns the value of shutdown.

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.

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.

Sets the value of shutdown to the given value.

#Errors

If the given value is out of bounds for shutdown.

Returns the value of comp_int.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

Sets the value of resolution to the given value.

#Errors

If the given value is out of bounds for resolution.

Returns the value of one_shot.

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.

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.

Sets the value of one_shot to the given value.

#Errors

If the given value is out of bounds for one_shot.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Casts the value.

Should always be Self

Casts the value.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

Casts the value.