r528_pac/ccu/
tpadc_bgr.rs

1#[doc = "Register `TPADC_BGR` reader"]
2pub struct R(crate::R<TPADC_BGR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TPADC_BGR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TPADC_BGR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TPADC_BGR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TPADC_BGR` writer"]
17pub struct W(crate::W<TPADC_BGR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TPADC_BGR_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<TPADC_BGR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TPADC_BGR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Reset\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum RST_A {
40    #[doc = "0: `0`"]
41    ASSERT = 0,
42    #[doc = "1: `1`"]
43    DEASSERT = 1,
44}
45impl From<RST_A> for bool {
46    #[inline(always)]
47    fn from(variant: RST_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `RST` reader - Reset"]
52pub type RST_R = crate::BitReader<RST_A>;
53impl RST_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> RST_A {
57        match self.bits {
58            false => RST_A::ASSERT,
59            true => RST_A::DEASSERT,
60        }
61    }
62    #[doc = "Checks if the value of the field is `ASSERT`"]
63    #[inline(always)]
64    pub fn is_assert(&self) -> bool {
65        *self == RST_A::ASSERT
66    }
67    #[doc = "Checks if the value of the field is `DEASSERT`"]
68    #[inline(always)]
69    pub fn is_deassert(&self) -> bool {
70        *self == RST_A::DEASSERT
71    }
72}
73#[doc = "Field `RST` writer - Reset"]
74pub type RST_W<'a> = crate::BitWriter<'a, u32, TPADC_BGR_SPEC, RST_A, 16>;
75impl<'a> RST_W<'a> {
76    #[doc = "`0`"]
77    #[inline(always)]
78    pub fn assert(self) -> &'a mut W {
79        self.variant(RST_A::ASSERT)
80    }
81    #[doc = "`1`"]
82    #[inline(always)]
83    pub fn deassert(self) -> &'a mut W {
84        self.variant(RST_A::DEASSERT)
85    }
86}
87#[doc = "Gating Clock\n\nValue on reset: 0"]
88#[derive(Clone, Copy, Debug, PartialEq)]
89pub enum GATING_A {
90    #[doc = "0: `0`"]
91    MASK = 0,
92    #[doc = "1: `1`"]
93    PASS = 1,
94}
95impl From<GATING_A> for bool {
96    #[inline(always)]
97    fn from(variant: GATING_A) -> Self {
98        variant as u8 != 0
99    }
100}
101#[doc = "Field `GATING` reader - Gating Clock"]
102pub type GATING_R = crate::BitReader<GATING_A>;
103impl GATING_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> GATING_A {
107        match self.bits {
108            false => GATING_A::MASK,
109            true => GATING_A::PASS,
110        }
111    }
112    #[doc = "Checks if the value of the field is `MASK`"]
113    #[inline(always)]
114    pub fn is_mask(&self) -> bool {
115        *self == GATING_A::MASK
116    }
117    #[doc = "Checks if the value of the field is `PASS`"]
118    #[inline(always)]
119    pub fn is_pass(&self) -> bool {
120        *self == GATING_A::PASS
121    }
122}
123#[doc = "Field `GATING` writer - Gating Clock"]
124pub type GATING_W<'a> = crate::BitWriter<'a, u32, TPADC_BGR_SPEC, GATING_A, 0>;
125impl<'a> GATING_W<'a> {
126    #[doc = "`0`"]
127    #[inline(always)]
128    pub fn mask(self) -> &'a mut W {
129        self.variant(GATING_A::MASK)
130    }
131    #[doc = "`1`"]
132    #[inline(always)]
133    pub fn pass(self) -> &'a mut W {
134        self.variant(GATING_A::PASS)
135    }
136}
137impl R {
138    #[doc = "Bit 16 - Reset"]
139    #[inline(always)]
140    pub fn rst(&self) -> RST_R {
141        RST_R::new(((self.bits >> 16) & 1) != 0)
142    }
143    #[doc = "Bit 0 - Gating Clock"]
144    #[inline(always)]
145    pub fn gating(&self) -> GATING_R {
146        GATING_R::new((self.bits & 1) != 0)
147    }
148}
149impl W {
150    #[doc = "Bit 16 - Reset"]
151    #[inline(always)]
152    pub fn rst(&mut self) -> RST_W {
153        RST_W::new(self)
154    }
155    #[doc = "Bit 0 - Gating Clock"]
156    #[inline(always)]
157    pub fn gating(&mut self) -> GATING_W {
158        GATING_W::new(self)
159    }
160    #[doc = "Writes raw bits to the register."]
161    #[inline(always)]
162    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
163        self.0.bits(bits);
164        self
165    }
166}
167#[doc = "TPADC Bus Gating Reset 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 [tpadc_bgr](index.html) module"]
168pub struct TPADC_BGR_SPEC;
169impl crate::RegisterSpec for TPADC_BGR_SPEC {
170    type Ux = u32;
171}
172#[doc = "`read()` method returns [tpadc_bgr::R](R) reader structure"]
173impl crate::Readable for TPADC_BGR_SPEC {
174    type Reader = R;
175}
176#[doc = "`write(|w| ..)` method takes [tpadc_bgr::W](W) writer structure"]
177impl crate::Writable for TPADC_BGR_SPEC {
178    type Writer = W;
179}
180#[doc = "`reset()` method sets TPADC_BGR to value 0"]
181impl crate::Resettable for TPADC_BGR_SPEC {
182    #[inline(always)]
183    fn reset_value() -> Self::Ux {
184        0
185    }
186}