cc430f5137 0.1.0

Peripheral access API for CC430F5137 microcontroller
#[doc = "Register `PMMCTL0` reader"]
pub type R = crate::R<Pmmctl0Spec>;
#[doc = "Register `PMMCTL0` writer"]
pub type W = crate::W<Pmmctl0Spec>;
#[doc = "PMM Core Voltage Bit: 0\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Pmmcorev {
    #[doc = "0: PMM Core Voltage 0 (1.35V)"]
    Pmmcorev0 = 0,
    #[doc = "1: PMM Core Voltage 1 (1.55V)"]
    Pmmcorev1 = 1,
    #[doc = "2: PMM Core Voltage 2 (1.75V)"]
    Pmmcorev2 = 2,
    #[doc = "3: PMM Core Voltage 3 (1.85V)"]
    Pmmcorev3 = 3,
}
impl From<Pmmcorev> for u8 {
    #[inline(always)]
    fn from(variant: Pmmcorev) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Pmmcorev {
    type Ux = u8;
}
impl crate::IsEnum for Pmmcorev {}
#[doc = "Field `PMMCOREV` reader - PMM Core Voltage Bit: 0"]
pub type PmmcorevR = crate::FieldReader<Pmmcorev>;
impl PmmcorevR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Pmmcorev {
        match self.bits {
            0 => Pmmcorev::Pmmcorev0,
            1 => Pmmcorev::Pmmcorev1,
            2 => Pmmcorev::Pmmcorev2,
            3 => Pmmcorev::Pmmcorev3,
            _ => unreachable!(),
        }
    }
    #[doc = "PMM Core Voltage 0 (1.35V)"]
    #[inline(always)]
    pub fn is_pmmcorev_0(&self) -> bool {
        *self == Pmmcorev::Pmmcorev0
    }
    #[doc = "PMM Core Voltage 1 (1.55V)"]
    #[inline(always)]
    pub fn is_pmmcorev_1(&self) -> bool {
        *self == Pmmcorev::Pmmcorev1
    }
    #[doc = "PMM Core Voltage 2 (1.75V)"]
    #[inline(always)]
    pub fn is_pmmcorev_2(&self) -> bool {
        *self == Pmmcorev::Pmmcorev2
    }
    #[doc = "PMM Core Voltage 3 (1.85V)"]
    #[inline(always)]
    pub fn is_pmmcorev_3(&self) -> bool {
        *self == Pmmcorev::Pmmcorev3
    }
}
#[doc = "Field `PMMCOREV` writer - PMM Core Voltage Bit: 0"]
pub type PmmcorevW<'a, REG> = crate::FieldWriter<'a, REG, 2, Pmmcorev, crate::Safe>;
impl<'a, REG> PmmcorevW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "PMM Core Voltage 0 (1.35V)"]
    #[inline(always)]
    pub fn pmmcorev_0(self) -> &'a mut crate::W<REG> {
        self.variant(Pmmcorev::Pmmcorev0)
    }
    #[doc = "PMM Core Voltage 1 (1.55V)"]
    #[inline(always)]
    pub fn pmmcorev_1(self) -> &'a mut crate::W<REG> {
        self.variant(Pmmcorev::Pmmcorev1)
    }
    #[doc = "PMM Core Voltage 2 (1.75V)"]
    #[inline(always)]
    pub fn pmmcorev_2(self) -> &'a mut crate::W<REG> {
        self.variant(Pmmcorev::Pmmcorev2)
    }
    #[doc = "PMM Core Voltage 3 (1.85V)"]
    #[inline(always)]
    pub fn pmmcorev_3(self) -> &'a mut crate::W<REG> {
        self.variant(Pmmcorev::Pmmcorev3)
    }
}
#[doc = "Field `PMMSWBOR` reader - PMM Software BOR"]
pub type PmmswborR = crate::BitReader;
#[doc = "Field `PMMSWBOR` writer - PMM Software BOR"]
pub type PmmswborW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `PMMSWPOR` reader - PMM Software POR"]
pub type PmmswporR = crate::BitReader;
#[doc = "Field `PMMSWPOR` writer - PMM Software POR"]
pub type PmmswporW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `PMMREGOFF` reader - PMM Turn Regulator off"]
pub type PmmregoffR = crate::BitReader;
#[doc = "Field `PMMREGOFF` writer - PMM Turn Regulator off"]
pub type PmmregoffW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `PMMHPMRE` reader - PMM Global High Power Module Request Enable"]
pub type PmmhpmreR = crate::BitReader;
#[doc = "Field `PMMHPMRE` writer - PMM Global High Power Module Request Enable"]
pub type PmmhpmreW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
    #[doc = "Bits 0:1 - PMM Core Voltage Bit: 0"]
    #[inline(always)]
    pub fn pmmcorev(&self) -> PmmcorevR {
        PmmcorevR::new((self.bits & 3) as u8)
    }
    #[doc = "Bit 2 - PMM Software BOR"]
    #[inline(always)]
    pub fn pmmswbor(&self) -> PmmswborR {
        PmmswborR::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - PMM Software POR"]
    #[inline(always)]
    pub fn pmmswpor(&self) -> PmmswporR {
        PmmswporR::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bit 4 - PMM Turn Regulator off"]
    #[inline(always)]
    pub fn pmmregoff(&self) -> PmmregoffR {
        PmmregoffR::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 7 - PMM Global High Power Module Request Enable"]
    #[inline(always)]
    pub fn pmmhpmre(&self) -> PmmhpmreR {
        PmmhpmreR::new(((self.bits >> 7) & 1) != 0)
    }
}
impl W {
    #[doc = "Bits 0:1 - PMM Core Voltage Bit: 0"]
    #[inline(always)]
    pub fn pmmcorev(&mut self) -> PmmcorevW<'_, Pmmctl0Spec> {
        PmmcorevW::new(self, 0)
    }
    #[doc = "Bit 2 - PMM Software BOR"]
    #[inline(always)]
    pub fn pmmswbor(&mut self) -> PmmswborW<'_, Pmmctl0Spec> {
        PmmswborW::new(self, 2)
    }
    #[doc = "Bit 3 - PMM Software POR"]
    #[inline(always)]
    pub fn pmmswpor(&mut self) -> PmmswporW<'_, Pmmctl0Spec> {
        PmmswporW::new(self, 3)
    }
    #[doc = "Bit 4 - PMM Turn Regulator off"]
    #[inline(always)]
    pub fn pmmregoff(&mut self) -> PmmregoffW<'_, Pmmctl0Spec> {
        PmmregoffW::new(self, 4)
    }
    #[doc = "Bit 7 - PMM Global High Power Module Request Enable"]
    #[inline(always)]
    pub fn pmmhpmre(&mut self) -> PmmhpmreW<'_, Pmmctl0Spec> {
        PmmhpmreW::new(self, 7)
    }
}
#[doc = "PMM Control 0\n\nYou can [`read`](crate::Reg::read) this register and get [`pmmctl0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pmmctl0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Pmmctl0Spec;
impl crate::RegisterSpec for Pmmctl0Spec {
    type Ux = u16;
}
#[doc = "`read()` method returns [`pmmctl0::R`](R) reader structure"]
impl crate::Readable for Pmmctl0Spec {}
#[doc = "`write(|w| ..)` method takes [`pmmctl0::W`](W) writer structure"]
impl crate::Writable for Pmmctl0Spec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets PMMCTL0 to value 0"]
impl crate::Resettable for Pmmctl0Spec {}