Struct mcp9808::reg::Register

source ·
pub struct Register { /* private fields */ }

Implementations§

source§

impl Register

source

pub fn new(ptr: u8, len: u8) -> Self

source

pub fn get_buf(&self) -> &[u8]

source

pub fn set_buf(&mut self, val: [u8; 2])

source

pub fn get_ptr(&self) -> u8

source

pub fn get_len(&self) -> u8

source

pub fn get_lsb(&self) -> Option<u8>

lower byte, bits 0-7, availability depends on register type

source

pub fn set_lsb(&mut self, val: u8)

source

pub fn get_msb(&self) -> u8

upper byte, bits 8-15, always available

source

pub fn set_msb(&mut self, val: u8)

source

pub fn get_bit(&self, offset: usize) -> bool

source

pub fn set_bit(&mut self, offset: usize, val: bool)

datasheet numbers bits from lsb-0, we store them as msb

source

pub fn as_u16(&self) -> u16

Trait Implementations§

source§

impl Clone for Register

source§

fn clone(&self) -> Register

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Configuration for Register

Sensor configuration register.

source§

impl Debug for Register

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DeviceId for Register

source§

fn is_valid_device(&self) -> bool

are we talking to the right device?

source§

fn get_device_id(&self) -> u8

get device id

source§

fn get_device_rev(&self) -> u8

get device revision

source§

impl ManufacturerId for Register

source§

fn is_valid_manufacturer(&self) -> bool

are we talking to the right device?

source§

fn get_manufacturer_id(&self) -> u16

source§

impl ReadableTempRegister for Register

source§

fn get_celsius(&self, res: ResolutionVal) -> f32

degree celsius as float
source§

fn get_milli_celsius(&self, res: ResolutionVal) -> i32

avoids floats, but only works up to 0.125 resolution
source§

fn get_raw_value(&self) -> u16

raw register value
source§

impl Resolution for Register

source§

impl Temperature for Register

source§

impl WritableTempRegister for Register

source§

fn set_celsius(&mut self, val: f32)

source§

fn set_milli_celsius(&mut self, val: i32)

source§

impl Copy for Register

source§

impl CriticalTemperatureAlert for Register

source§

impl LowerTemperatureAlert for Register

source§

impl UpperTemperatureAlert for Register

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.