stm32g4 0.16.0

Device support crates for STM32G4 devices
Documentation
///Register `AHB1ENR` reader
pub type R = crate::R<AHB1ENRrs>;
///Register `AHB1ENR` writer
pub type W = crate::W<AHB1ENRrs>;
/**DMA1 clock enable Set and cleared by software.

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMA1EN {
    ///0: The selected clock is disabled
    Disabled = 0,
    ///1: The selected clock is enabled
    Enabled = 1,
}
impl From<DMA1EN> for bool {
    #[inline(always)]
    fn from(variant: DMA1EN) -> Self {
        variant as u8 != 0
    }
}
///Field `DMA1EN` reader - DMA1 clock enable Set and cleared by software.
pub type DMA1EN_R = crate::BitReader<DMA1EN>;
impl DMA1EN_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> DMA1EN {
        match self.bits {
            false => DMA1EN::Disabled,
            true => DMA1EN::Enabled,
        }
    }
    ///The selected clock is disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == DMA1EN::Disabled
    }
    ///The selected clock is enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == DMA1EN::Enabled
    }
}
///Field `DMA1EN` writer - DMA1 clock enable Set and cleared by software.
pub type DMA1EN_W<'a, REG> = crate::BitWriter<'a, REG, DMA1EN>;
impl<'a, REG> DMA1EN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///The selected clock is disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(DMA1EN::Disabled)
    }
    ///The selected clock is enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(DMA1EN::Enabled)
    }
}
///Field `DMA2EN` reader - DMA2 clock enable Set and cleared by software.
pub use DMA1EN_R as DMA2EN_R;
///Field `DMAMUX1EN` reader - DMAMUX1 clock enable Set and reset by software.
pub use DMA1EN_R as DMAMUX1EN_R;
///Field `CORDICEN` reader - CORDIC clock enable Set and reset by software.
pub use DMA1EN_R as CORDICEN_R;
///Field `FMACEN` reader - FMAC enable Set and reset by software.
pub use DMA1EN_R as FMACEN_R;
///Field `FLASHEN` reader - Flash memory interface clock enable Set and cleared by software. This bit can be disabled only when the Flash is in power down mode.
pub use DMA1EN_R as FLASHEN_R;
///Field `CRCEN` reader - CRC clock enable Set and cleared by software.
pub use DMA1EN_R as CRCEN_R;
///Field `DMA2EN` writer - DMA2 clock enable Set and cleared by software.
pub use DMA1EN_W as DMA2EN_W;
///Field `DMAMUX1EN` writer - DMAMUX1 clock enable Set and reset by software.
pub use DMA1EN_W as DMAMUX1EN_W;
///Field `CORDICEN` writer - CORDIC clock enable Set and reset by software.
pub use DMA1EN_W as CORDICEN_W;
///Field `FMACEN` writer - FMAC enable Set and reset by software.
pub use DMA1EN_W as FMACEN_W;
///Field `FLASHEN` writer - Flash memory interface clock enable Set and cleared by software. This bit can be disabled only when the Flash is in power down mode.
pub use DMA1EN_W as FLASHEN_W;
///Field `CRCEN` writer - CRC clock enable Set and cleared by software.
pub use DMA1EN_W as CRCEN_W;
impl R {
    ///Bit 0 - DMA1 clock enable Set and cleared by software.
    #[inline(always)]
    pub fn dma1en(&self) -> DMA1EN_R {
        DMA1EN_R::new((self.bits & 1) != 0)
    }
    ///Bit 1 - DMA2 clock enable Set and cleared by software.
    #[inline(always)]
    pub fn dma2en(&self) -> DMA2EN_R {
        DMA2EN_R::new(((self.bits >> 1) & 1) != 0)
    }
    ///Bit 2 - DMAMUX1 clock enable Set and reset by software.
    #[inline(always)]
    pub fn dmamux1en(&self) -> DMAMUX1EN_R {
        DMAMUX1EN_R::new(((self.bits >> 2) & 1) != 0)
    }
    ///Bit 3 - CORDIC clock enable Set and reset by software.
    #[inline(always)]
    pub fn cordicen(&self) -> CORDICEN_R {
        CORDICEN_R::new(((self.bits >> 3) & 1) != 0)
    }
    ///Bit 4 - FMAC enable Set and reset by software.
    #[inline(always)]
    pub fn fmacen(&self) -> FMACEN_R {
        FMACEN_R::new(((self.bits >> 4) & 1) != 0)
    }
    ///Bit 8 - Flash memory interface clock enable Set and cleared by software. This bit can be disabled only when the Flash is in power down mode.
    #[inline(always)]
    pub fn flashen(&self) -> FLASHEN_R {
        FLASHEN_R::new(((self.bits >> 8) & 1) != 0)
    }
    ///Bit 12 - CRC clock enable Set and cleared by software.
    #[inline(always)]
    pub fn crcen(&self) -> CRCEN_R {
        CRCEN_R::new(((self.bits >> 12) & 1) != 0)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("AHB1ENR")
            .field("dma1en", &self.dma1en())
            .field("dma2en", &self.dma2en())
            .field("dmamux1en", &self.dmamux1en())
            .field("cordicen", &self.cordicen())
            .field("fmacen", &self.fmacen())
            .field("flashen", &self.flashen())
            .field("crcen", &self.crcen())
            .finish()
    }
}
impl W {
    ///Bit 0 - DMA1 clock enable Set and cleared by software.
    #[inline(always)]
    pub fn dma1en(&mut self) -> DMA1EN_W<AHB1ENRrs> {
        DMA1EN_W::new(self, 0)
    }
    ///Bit 1 - DMA2 clock enable Set and cleared by software.
    #[inline(always)]
    pub fn dma2en(&mut self) -> DMA2EN_W<AHB1ENRrs> {
        DMA2EN_W::new(self, 1)
    }
    ///Bit 2 - DMAMUX1 clock enable Set and reset by software.
    #[inline(always)]
    pub fn dmamux1en(&mut self) -> DMAMUX1EN_W<AHB1ENRrs> {
        DMAMUX1EN_W::new(self, 2)
    }
    ///Bit 3 - CORDIC clock enable Set and reset by software.
    #[inline(always)]
    pub fn cordicen(&mut self) -> CORDICEN_W<AHB1ENRrs> {
        CORDICEN_W::new(self, 3)
    }
    ///Bit 4 - FMAC enable Set and reset by software.
    #[inline(always)]
    pub fn fmacen(&mut self) -> FMACEN_W<AHB1ENRrs> {
        FMACEN_W::new(self, 4)
    }
    ///Bit 8 - Flash memory interface clock enable Set and cleared by software. This bit can be disabled only when the Flash is in power down mode.
    #[inline(always)]
    pub fn flashen(&mut self) -> FLASHEN_W<AHB1ENRrs> {
        FLASHEN_W::new(self, 8)
    }
    ///Bit 12 - CRC clock enable Set and cleared by software.
    #[inline(always)]
    pub fn crcen(&mut self) -> CRCEN_W<AHB1ENRrs> {
        CRCEN_W::new(self, 12)
    }
}
/**AHB1 peripheral clock enable register

You can [`read`](crate::Reg::read) this register and get [`ahb1enr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ahb1enr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).

See register [structure](https://stm32-rs.github.io/stm32-rs/STM32G483.html#RCC:AHB1ENR)*/
pub struct AHB1ENRrs;
impl crate::RegisterSpec for AHB1ENRrs {
    type Ux = u32;
}
///`read()` method returns [`ahb1enr::R`](R) reader structure
impl crate::Readable for AHB1ENRrs {}
///`write(|w| ..)` method takes [`ahb1enr::W`](W) writer structure
impl crate::Writable for AHB1ENRrs {
    type Safety = crate::Unsafe;
}
///`reset()` method sets AHB1ENR to value 0x0100
impl crate::Resettable for AHB1ENRrs {
    const RESET_VALUE: u32 = 0x0100;
}