ra4e1/sysc/
sopccr.rs

1#[doc = "Register `SOPCCR` reader"]
2pub struct R(crate::R<SOPCCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SOPCCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SOPCCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SOPCCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SOPCCR` writer"]
17pub struct W(crate::W<SOPCCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SOPCCR_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<SOPCCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SOPCCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SOPCM` reader - Sub Operating Power Control Mode Select"]
38pub type SOPCM_R = crate::BitReader<SOPCM_A>;
39#[doc = "Sub Operating Power Control Mode Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum SOPCM_A {
42    #[doc = "0: Other than Subosc-speed mode"]
43    _0 = 0,
44    #[doc = "1: Subosc-speed mode"]
45    _1 = 1,
46}
47impl From<SOPCM_A> for bool {
48    #[inline(always)]
49    fn from(variant: SOPCM_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl SOPCM_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> SOPCM_A {
57        match self.bits {
58            false => SOPCM_A::_0,
59            true => SOPCM_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == SOPCM_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == SOPCM_A::_1
71    }
72}
73#[doc = "Field `SOPCM` writer - Sub Operating Power Control Mode Select"]
74pub type SOPCM_W<'a, const O: u8> = crate::BitWriter<'a, u8, SOPCCR_SPEC, SOPCM_A, O>;
75impl<'a, const O: u8> SOPCM_W<'a, O> {
76    #[doc = "Other than Subosc-speed mode"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(SOPCM_A::_0)
80    }
81    #[doc = "Subosc-speed mode"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(SOPCM_A::_1)
85    }
86}
87#[doc = "Field `SOPCMTSF` reader - Operating Power Control Mode Transition Status Flag"]
88pub type SOPCMTSF_R = crate::BitReader<SOPCMTSF_A>;
89#[doc = "Operating Power Control Mode Transition Status Flag\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum SOPCMTSF_A {
92    #[doc = "0: Transition completed"]
93    _0 = 0,
94    #[doc = "1: During transition"]
95    _1 = 1,
96}
97impl From<SOPCMTSF_A> for bool {
98    #[inline(always)]
99    fn from(variant: SOPCMTSF_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl SOPCMTSF_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> SOPCMTSF_A {
107        match self.bits {
108            false => SOPCMTSF_A::_0,
109            true => SOPCMTSF_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == SOPCMTSF_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == SOPCMTSF_A::_1
121    }
122}
123impl R {
124    #[doc = "Bit 0 - Sub Operating Power Control Mode Select"]
125    #[inline(always)]
126    pub fn sopcm(&self) -> SOPCM_R {
127        SOPCM_R::new((self.bits & 1) != 0)
128    }
129    #[doc = "Bit 4 - Operating Power Control Mode Transition Status Flag"]
130    #[inline(always)]
131    pub fn sopcmtsf(&self) -> SOPCMTSF_R {
132        SOPCMTSF_R::new(((self.bits >> 4) & 1) != 0)
133    }
134}
135impl W {
136    #[doc = "Bit 0 - Sub Operating Power Control Mode Select"]
137    #[inline(always)]
138    #[must_use]
139    pub fn sopcm(&mut self) -> SOPCM_W<0> {
140        SOPCM_W::new(self)
141    }
142    #[doc = "Writes raw bits to the register."]
143    #[inline(always)]
144    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
145        self.0.bits(bits);
146        self
147    }
148}
149#[doc = "Sub Operating Power Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [sopccr](index.html) module"]
150pub struct SOPCCR_SPEC;
151impl crate::RegisterSpec for SOPCCR_SPEC {
152    type Ux = u8;
153}
154#[doc = "`read()` method returns [sopccr::R](R) reader structure"]
155impl crate::Readable for SOPCCR_SPEC {
156    type Reader = R;
157}
158#[doc = "`write(|w| ..)` method takes [sopccr::W](W) writer structure"]
159impl crate::Writable for SOPCCR_SPEC {
160    type Writer = W;
161    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
162    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
163}
164#[doc = "`reset()` method sets SOPCCR to value 0"]
165impl crate::Resettable for SOPCCR_SPEC {
166    const RESET_VALUE: Self::Ux = 0;
167}