stm32f7 0.8.0

Device support crates for STM32F7 devices
Documentation
#[doc = r"Value read from the register"]
pub struct R {
    bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
    bits: u32,
}
impl super::OAR1 {
    #[doc = r"Modifies the contents of the register"]
    #[inline(always)]
    pub fn modify<F>(&self, f: F)
    where
        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
    {
        let bits = self.register.get();
        self.register.set(f(&R { bits }, &mut W { bits }).bits);
    }
    #[doc = r"Reads the contents of the register"]
    #[inline(always)]
    pub fn read(&self) -> R {
        R {
            bits: self.register.get(),
        }
    }
    #[doc = r"Writes to the register"]
    #[inline(always)]
    pub fn write<F>(&self, f: F)
    where
        F: FnOnce(&mut W) -> &mut W,
    {
        self.register.set(
            f(&mut W {
                bits: Self::reset_value(),
            })
            .bits,
        );
    }
    #[doc = r"Reset value of the register"]
    #[inline(always)]
    pub const fn reset_value() -> u32 {
        0
    }
    #[doc = r"Writes the reset value to the register"]
    #[inline(always)]
    pub fn reset(&self) {
        self.register.set(Self::reset_value())
    }
}
#[doc = r"Value of the field"]
pub struct OA1R {
    bits: u16,
}
impl OA1R {
    #[doc = r"Value of the field as raw bits"]
    #[inline(always)]
    pub fn bits(&self) -> u16 {
        self.bits
    }
}
#[doc = r"Proxy"]
pub struct _OA1W<'a> {
    w: &'a mut W,
}
impl<'a> _OA1W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u16) -> &'a mut W {
        self.w.bits &= !(0x03ff << 0);
        self.w.bits |= ((value as u32) & 0x03ff) << 0;
        self.w
    }
}
#[doc = "Possible values of the field `OA1MODE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OA1MODER {
    #[doc = "Own address 1 is a 7-bit address"]
    BIT7,
    #[doc = "Own address 1 is a 10-bit address"]
    BIT10,
}
impl OA1MODER {
    #[doc = r"Returns `true` if the bit is clear (0)"]
    #[inline(always)]
    pub fn bit_is_clear(&self) -> bool {
        !self.bit()
    }
    #[doc = r"Returns `true` if the bit is set (1)"]
    #[inline(always)]
    pub fn bit_is_set(&self) -> bool {
        self.bit()
    }
    #[doc = r"Value of the field as raw bits"]
    #[inline(always)]
    pub fn bit(&self) -> bool {
        match *self {
            OA1MODER::BIT7 => false,
            OA1MODER::BIT10 => true,
        }
    }
    #[allow(missing_docs)]
    #[doc(hidden)]
    #[inline(always)]
    pub fn _from(value: bool) -> OA1MODER {
        match value {
            false => OA1MODER::BIT7,
            true => OA1MODER::BIT10,
        }
    }
    #[doc = "Checks if the value of the field is `BIT7`"]
    #[inline(always)]
    pub fn is_bit7(&self) -> bool {
        *self == OA1MODER::BIT7
    }
    #[doc = "Checks if the value of the field is `BIT10`"]
    #[inline(always)]
    pub fn is_bit10(&self) -> bool {
        *self == OA1MODER::BIT10
    }
}
#[doc = "Values that can be written to the field `OA1MODE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OA1MODEW {
    #[doc = "Own address 1 is a 7-bit address"]
    BIT7,
    #[doc = "Own address 1 is a 10-bit address"]
    BIT10,
}
impl OA1MODEW {
    #[allow(missing_docs)]
    #[doc(hidden)]
    #[inline(always)]
    pub fn _bits(&self) -> bool {
        match *self {
            OA1MODEW::BIT7 => false,
            OA1MODEW::BIT10 => true,
        }
    }
}
#[doc = r"Proxy"]
pub struct _OA1MODEW<'a> {
    w: &'a mut W,
}
impl<'a> _OA1MODEW<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: OA1MODEW) -> &'a mut W {
        {
            self.bit(variant._bits())
        }
    }
    #[doc = "Own address 1 is a 7-bit address"]
    #[inline(always)]
    pub fn bit7(self) -> &'a mut W {
        self.variant(OA1MODEW::BIT7)
    }
    #[doc = "Own address 1 is a 10-bit address"]
    #[inline(always)]
    pub fn bit10(self) -> &'a mut W {
        self.variant(OA1MODEW::BIT10)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits &= !(0x01 << 10);
        self.w.bits |= ((value as u32) & 0x01) << 10;
        self.w
    }
}
#[doc = "Possible values of the field `OA1EN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OA1ENR {
    #[doc = "Own address 1 disabled. The received slave address OA1 is NACKed"]
    DIASBLED,
    #[doc = "Own address 1 enabled. The received slave address OA1 is ACKed"]
    ENABLED,
}
impl OA1ENR {
    #[doc = r"Returns `true` if the bit is clear (0)"]
    #[inline(always)]
    pub fn bit_is_clear(&self) -> bool {
        !self.bit()
    }
    #[doc = r"Returns `true` if the bit is set (1)"]
    #[inline(always)]
    pub fn bit_is_set(&self) -> bool {
        self.bit()
    }
    #[doc = r"Value of the field as raw bits"]
    #[inline(always)]
    pub fn bit(&self) -> bool {
        match *self {
            OA1ENR::DIASBLED => false,
            OA1ENR::ENABLED => true,
        }
    }
    #[allow(missing_docs)]
    #[doc(hidden)]
    #[inline(always)]
    pub fn _from(value: bool) -> OA1ENR {
        match value {
            false => OA1ENR::DIASBLED,
            true => OA1ENR::ENABLED,
        }
    }
    #[doc = "Checks if the value of the field is `DIASBLED`"]
    #[inline(always)]
    pub fn is_diasbled(&self) -> bool {
        *self == OA1ENR::DIASBLED
    }
    #[doc = "Checks if the value of the field is `ENABLED`"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == OA1ENR::ENABLED
    }
}
#[doc = "Values that can be written to the field `OA1EN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OA1ENW {
    #[doc = "Own address 1 disabled. The received slave address OA1 is NACKed"]
    DIASBLED,
    #[doc = "Own address 1 enabled. The received slave address OA1 is ACKed"]
    ENABLED,
}
impl OA1ENW {
    #[allow(missing_docs)]
    #[doc(hidden)]
    #[inline(always)]
    pub fn _bits(&self) -> bool {
        match *self {
            OA1ENW::DIASBLED => false,
            OA1ENW::ENABLED => true,
        }
    }
}
#[doc = r"Proxy"]
pub struct _OA1ENW<'a> {
    w: &'a mut W,
}
impl<'a> _OA1ENW<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: OA1ENW) -> &'a mut W {
        {
            self.bit(variant._bits())
        }
    }
    #[doc = "Own address 1 disabled. The received slave address OA1 is NACKed"]
    #[inline(always)]
    pub fn diasbled(self) -> &'a mut W {
        self.variant(OA1ENW::DIASBLED)
    }
    #[doc = "Own address 1 enabled. The received slave address OA1 is ACKed"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut W {
        self.variant(OA1ENW::ENABLED)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits &= !(0x01 << 15);
        self.w.bits |= ((value as u32) & 0x01) << 15;
        self.w
    }
}
impl R {
    #[doc = r"Value of the register as raw bits"]
    #[inline(always)]
    pub fn bits(&self) -> u32 {
        self.bits
    }
    #[doc = "Bits 0:9 - Interface address"]
    #[inline(always)]
    pub fn oa1(&self) -> OA1R {
        let bits = ((self.bits >> 0) & 0x03ff) as u16;
        OA1R { bits }
    }
    #[doc = "Bit 10 - Own Address 1 10-bit mode"]
    #[inline(always)]
    pub fn oa1mode(&self) -> OA1MODER {
        OA1MODER::_from(((self.bits >> 10) & 0x01) != 0)
    }
    #[doc = "Bit 15 - Own Address 1 enable"]
    #[inline(always)]
    pub fn oa1en(&self) -> OA1ENR {
        OA1ENR::_from(((self.bits >> 15) & 0x01) != 0)
    }
}
impl W {
    #[doc = r"Writes raw bits to the register"]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.bits = bits;
        self
    }
    #[doc = "Bits 0:9 - Interface address"]
    #[inline(always)]
    pub fn oa1(&mut self) -> _OA1W {
        _OA1W { w: self }
    }
    #[doc = "Bit 10 - Own Address 1 10-bit mode"]
    #[inline(always)]
    pub fn oa1mode(&mut self) -> _OA1MODEW {
        _OA1MODEW { w: self }
    }
    #[doc = "Bit 15 - Own Address 1 enable"]
    #[inline(always)]
    pub fn oa1en(&mut self) -> _OA1ENW {
        _OA1ENW { w: self }
    }
}