stm32g4 0.8.0

Device support crates for STM32G4 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::TR1 {
    #[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 {
        0x0fff_0000
    }
    #[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 HT1R {
    bits: u16,
}
impl HT1R {
    #[doc = r"Value of the field as raw bits"]
    #[inline(always)]
    pub fn bits(&self) -> u16 {
        self.bits
    }
}
#[doc = r"Proxy"]
pub struct _HT1W<'a> {
    w: &'a mut W,
}
impl<'a> _HT1W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u16) -> &'a mut W {
        self.w.bits &= !(0x0fff << 16);
        self.w.bits |= ((value as u32) & 0x0fff) << 16;
        self.w
    }
}
#[doc = r"Value of the field"]
pub struct AWDFILTR {
    bits: u8,
}
impl AWDFILTR {
    #[doc = r"Value of the field as raw bits"]
    #[inline(always)]
    pub fn bits(&self) -> u8 {
        self.bits
    }
}
#[doc = r"Proxy"]
pub struct _AWDFILTW<'a> {
    w: &'a mut W,
}
impl<'a> _AWDFILTW<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits &= !(0x07 << 12);
        self.w.bits |= ((value as u32) & 0x07) << 12;
        self.w
    }
}
#[doc = r"Value of the field"]
pub struct LT1R {
    bits: u16,
}
impl LT1R {
    #[doc = r"Value of the field as raw bits"]
    #[inline(always)]
    pub fn bits(&self) -> u16 {
        self.bits
    }
}
#[doc = r"Proxy"]
pub struct _LT1W<'a> {
    w: &'a mut W,
}
impl<'a> _LT1W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u16) -> &'a mut W {
        self.w.bits &= !(0x0fff << 0);
        self.w.bits |= ((value as u32) & 0x0fff) << 0;
        self.w
    }
}
impl R {
    #[doc = r"Value of the register as raw bits"]
    #[inline(always)]
    pub fn bits(&self) -> u32 {
        self.bits
    }
    #[doc = "Bits 16:27 - HT1"]
    #[inline(always)]
    pub fn ht1(&self) -> HT1R {
        let bits = ((self.bits >> 16) & 0x0fff) as u16;
        HT1R { bits }
    }
    #[doc = "Bits 12:14 - AWDFILT"]
    #[inline(always)]
    pub fn awdfilt(&self) -> AWDFILTR {
        let bits = ((self.bits >> 12) & 0x07) as u8;
        AWDFILTR { bits }
    }
    #[doc = "Bits 0:11 - LT1"]
    #[inline(always)]
    pub fn lt1(&self) -> LT1R {
        let bits = ((self.bits >> 0) & 0x0fff) as u16;
        LT1R { bits }
    }
}
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 16:27 - HT1"]
    #[inline(always)]
    pub fn ht1(&mut self) -> _HT1W {
        _HT1W { w: self }
    }
    #[doc = "Bits 12:14 - AWDFILT"]
    #[inline(always)]
    pub fn awdfilt(&mut self) -> _AWDFILTW {
        _AWDFILTW { w: self }
    }
    #[doc = "Bits 0:11 - LT1"]
    #[inline(always)]
    pub fn lt1(&mut self) -> _LT1W {
        _LT1W { w: self }
    }
}