atsam3n00a 0.1.0

Peripheral access API for ATSAM3N00A microcontrollers (generated using svd2rust)
Documentation
#[doc = "Register `CR` writer"]
pub type W = crate::W<CrSpec>;
#[doc = "Voltage Regulator Off"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Vroff {
    #[doc = "0: no effect."]
    NoEffect = 0,
    #[doc = "1: if KEY is correct, asserts vddcore_nreset and stops the voltage regulator."]
    StopVreg = 1,
}
impl From<Vroff> for bool {
    #[inline(always)]
    fn from(variant: Vroff) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `VROFF` writer - Voltage Regulator Off"]
pub type VroffW<'a, REG> = crate::BitWriter<'a, REG, Vroff>;
impl<'a, REG> VroffW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "no effect."]
    #[inline(always)]
    pub fn no_effect(self) -> &'a mut crate::W<REG> {
        self.variant(Vroff::NoEffect)
    }
    #[doc = "if KEY is correct, asserts vddcore_nreset and stops the voltage regulator."]
    #[inline(always)]
    pub fn stop_vreg(self) -> &'a mut crate::W<REG> {
        self.variant(Vroff::StopVreg)
    }
}
#[doc = "Crystal Oscillator Select"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Xtalsel {
    #[doc = "0: no effect."]
    NoEffect = 0,
    #[doc = "1: if KEY is correct, switches the slow clock on the crystal oscillator output."]
    CrystalSel = 1,
}
impl From<Xtalsel> for bool {
    #[inline(always)]
    fn from(variant: Xtalsel) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `XTALSEL` writer - Crystal Oscillator Select"]
pub type XtalselW<'a, REG> = crate::BitWriter<'a, REG, Xtalsel>;
impl<'a, REG> XtalselW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "no effect."]
    #[inline(always)]
    pub fn no_effect(self) -> &'a mut crate::W<REG> {
        self.variant(Xtalsel::NoEffect)
    }
    #[doc = "if KEY is correct, switches the slow clock on the crystal oscillator output."]
    #[inline(always)]
    pub fn crystal_sel(self) -> &'a mut crate::W<REG> {
        self.variant(Xtalsel::CrystalSel)
    }
}
#[doc = "Field `KEY` writer - Password"]
pub type KeyW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
impl W {
    #[doc = "Bit 2 - Voltage Regulator Off"]
    #[inline(always)]
    #[must_use]
    pub fn vroff(&mut self) -> VroffW<CrSpec> {
        VroffW::new(self, 2)
    }
    #[doc = "Bit 3 - Crystal Oscillator Select"]
    #[inline(always)]
    #[must_use]
    pub fn xtalsel(&mut self) -> XtalselW<CrSpec> {
        XtalselW::new(self, 3)
    }
    #[doc = "Bits 24:31 - Password"]
    #[inline(always)]
    #[must_use]
    pub fn key(&mut self) -> KeyW<CrSpec> {
        KeyW::new(self, 24)
    }
}
#[doc = "Supply Controller Control Register\n\nYou can [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`cr::W`](W). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct CrSpec;
impl crate::RegisterSpec for CrSpec {
    type Ux = u32;
}
#[doc = "`write(|w| ..)` method takes [`cr::W`](W) writer structure"]
impl crate::Writable for CrSpec {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}