hk32f005-pac 0.1.0

HK32F005 PAC, Generate by Chiptool
Documentation
#[doc = "APB_FZ"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ApbFz(pub u32);
impl ApbFz {
    #[doc = "Debug TIMC5 stopped when core is halted"]
    #[must_use]
    #[inline(always)]
    pub const fn dbg_timc5_stop(&self) -> bool {
        let val = (self.0 >> 0usize) & 0x01;
        val != 0
    }
    #[doc = "Debug TIMC5 stopped when core is halted"]
    #[inline(always)]
    pub const fn set_dbg_timc5_stop(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
    }
    #[doc = "Debug TIM6 stopped when core is halted"]
    #[must_use]
    #[inline(always)]
    pub const fn dbg_tim6_stop(&self) -> bool {
        let val = (self.0 >> 4usize) & 0x01;
        val != 0
    }
    #[doc = "Debug TIM6 stopped when core is halted"]
    #[inline(always)]
    pub const fn set_dbg_tim6_stop(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
    }
    #[doc = "Debug TIMC11 stopped when core is halted"]
    #[must_use]
    #[inline(always)]
    pub const fn dbg_timc11_stop(&self) -> bool {
        let val = (self.0 >> 5usize) & 0x01;
        val != 0
    }
    #[doc = "Debug TIMC11 stopped when core is halted"]
    #[inline(always)]
    pub const fn set_dbg_timc11_stop(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
    }
    #[doc = "Debug window watchdog stopped when core is halted"]
    #[must_use]
    #[inline(always)]
    pub const fn dbg_wwdg_stop(&self) -> bool {
        let val = (self.0 >> 11usize) & 0x01;
        val != 0
    }
    #[doc = "Debug window watchdog stopped when core is halted"]
    #[inline(always)]
    pub const fn set_dbg_wwdg_stop(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
    }
    #[doc = "Debug independent watchdog stopped when core is halted"]
    #[must_use]
    #[inline(always)]
    pub const fn dbg_iwdg_stop(&self) -> bool {
        let val = (self.0 >> 12usize) & 0x01;
        val != 0
    }
    #[doc = "Debug independent watchdog stopped when core is halted"]
    #[inline(always)]
    pub const fn set_dbg_iwdg_stop(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
    }
    #[doc = "I2C1 SMBUS timeout mode stopped when core is halted"]
    #[must_use]
    #[inline(always)]
    pub const fn dbg_i2c1_smbus_timeout(&self) -> bool {
        let val = (self.0 >> 21usize) & 0x01;
        val != 0
    }
    #[doc = "I2C1 SMBUS timeout mode stopped when core is halted"]
    #[inline(always)]
    pub const fn set_dbg_i2c1_smbus_timeout(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
    }
    #[doc = "LPTIM1 counter stopped when core is halted"]
    #[must_use]
    #[inline(always)]
    pub const fn dbg_lptim1_stop(&self) -> bool {
        let val = (self.0 >> 31usize) & 0x01;
        val != 0
    }
    #[doc = "LPTIM1 counter stopped when core is halted"]
    #[inline(always)]
    pub const fn set_dbg_lptim1_stop(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
    }
}
impl Default for ApbFz {
    #[inline(always)]
    fn default() -> ApbFz {
        ApbFz(0)
    }
}
impl core::fmt::Debug for ApbFz {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("ApbFz")
            .field("dbg_timc5_stop", &self.dbg_timc5_stop())
            .field("dbg_tim6_stop", &self.dbg_tim6_stop())
            .field("dbg_timc11_stop", &self.dbg_timc11_stop())
            .field("dbg_wwdg_stop", &self.dbg_wwdg_stop())
            .field("dbg_iwdg_stop", &self.dbg_iwdg_stop())
            .field("dbg_i2c1_smbus_timeout", &self.dbg_i2c1_smbus_timeout())
            .field("dbg_lptim1_stop", &self.dbg_lptim1_stop())
            .finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for ApbFz {
    fn format(&self, f: defmt::Formatter) {
        defmt :: write ! (f , "ApbFz {{ dbg_timc5_stop: {=bool:?}, dbg_tim6_stop: {=bool:?}, dbg_timc11_stop: {=bool:?}, dbg_wwdg_stop: {=bool:?}, dbg_iwdg_stop: {=bool:?}, dbg_i2c1_smbus_timeout: {=bool:?}, dbg_lptim1_stop: {=bool:?} }}" , self . dbg_timc5_stop () , self . dbg_tim6_stop () , self . dbg_timc11_stop () , self . dbg_wwdg_stop () , self . dbg_iwdg_stop () , self . dbg_i2c1_smbus_timeout () , self . dbg_lptim1_stop ())
    }
}
#[doc = "CR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr(pub u32);
impl Cr {
    #[doc = "Debug Sleep mode"]
    #[must_use]
    #[inline(always)]
    pub const fn dbg_sleep(&self) -> bool {
        let val = (self.0 >> 0usize) & 0x01;
        val != 0
    }
    #[doc = "Debug Sleep mode"]
    #[inline(always)]
    pub const fn set_dbg_sleep(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
    }
    #[doc = "Debug Stop mode"]
    #[must_use]
    #[inline(always)]
    pub const fn dbg_stop(&self) -> bool {
        let val = (self.0 >> 1usize) & 0x01;
        val != 0
    }
    #[doc = "Debug Stop mode"]
    #[inline(always)]
    pub const fn set_dbg_stop(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
    }
}
impl Default for Cr {
    #[inline(always)]
    fn default() -> Cr {
        Cr(0)
    }
}
impl core::fmt::Debug for Cr {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Cr")
            .field("dbg_sleep", &self.dbg_sleep())
            .field("dbg_stop", &self.dbg_stop())
            .finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr {
    fn format(&self, f: defmt::Formatter) {
        defmt::write!(
            f,
            "Cr {{ dbg_sleep: {=bool:?}, dbg_stop: {=bool:?} }}",
            self.dbg_sleep(),
            self.dbg_stop()
        )
    }
}
#[doc = "IDCODE"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Idcode(pub u32);
impl Idcode {
    #[doc = "Device identifier"]
    #[must_use]
    #[inline(always)]
    pub const fn dev_id(&self) -> u16 {
        let val = (self.0 >> 0usize) & 0x0fff;
        val as u16
    }
    #[doc = "Device identifier"]
    #[inline(always)]
    pub const fn set_dev_id(&mut self, val: u16) {
        self.0 = (self.0 & !(0x0fff << 0usize)) | (((val as u32) & 0x0fff) << 0usize);
    }
    #[doc = "Revision identifier"]
    #[must_use]
    #[inline(always)]
    pub const fn rev_id(&self) -> u16 {
        let val = (self.0 >> 16usize) & 0xffff;
        val as u16
    }
    #[doc = "Revision identifier"]
    #[inline(always)]
    pub const fn set_rev_id(&mut self, val: u16) {
        self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize);
    }
}
impl Default for Idcode {
    #[inline(always)]
    fn default() -> Idcode {
        Idcode(0)
    }
}
impl core::fmt::Debug for Idcode {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Idcode")
            .field("dev_id", &self.dev_id())
            .field("rev_id", &self.rev_id())
            .finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Idcode {
    fn format(&self, f: defmt::Formatter) {
        defmt::write!(
            f,
            "Idcode {{ dev_id: {=u16:?}, rev_id: {=u16:?} }}",
            self.dev_id(),
            self.rev_id()
        )
    }
}