d1_pac/csic/csic_top/
csic_top_en.rs

1#[doc = "Register `csic_top_en` reader"]
2pub type R = crate::R<CSIC_TOP_EN_SPEC>;
3#[doc = "Register `csic_top_en` writer"]
4pub type W = crate::W<CSIC_TOP_EN_SPEC>;
5#[doc = "Field `csic_top_en` reader - "]
6pub type CSIC_TOP_EN_R = crate::BitReader<CSIC_TOP_EN_A>;
7#[doc = "\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum CSIC_TOP_EN_A {
10    #[doc = "0: Reset and disable the CSIC module"]
11    RESET_DISABLE = 0,
12    #[doc = "1: Enable the CSIC module"]
13    ENABLE = 1,
14}
15impl From<CSIC_TOP_EN_A> for bool {
16    #[inline(always)]
17    fn from(variant: CSIC_TOP_EN_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl CSIC_TOP_EN_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> CSIC_TOP_EN_A {
25        match self.bits {
26            false => CSIC_TOP_EN_A::RESET_DISABLE,
27            true => CSIC_TOP_EN_A::ENABLE,
28        }
29    }
30    #[doc = "Reset and disable the CSIC module"]
31    #[inline(always)]
32    pub fn is_reset_disable(&self) -> bool {
33        *self == CSIC_TOP_EN_A::RESET_DISABLE
34    }
35    #[doc = "Enable the CSIC module"]
36    #[inline(always)]
37    pub fn is_enable(&self) -> bool {
38        *self == CSIC_TOP_EN_A::ENABLE
39    }
40}
41#[doc = "Field `csic_top_en` writer - "]
42pub type CSIC_TOP_EN_W<'a, REG> = crate::BitWriter<'a, REG, CSIC_TOP_EN_A>;
43impl<'a, REG> CSIC_TOP_EN_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "Reset and disable the CSIC module"]
48    #[inline(always)]
49    pub fn reset_disable(self) -> &'a mut crate::W<REG> {
50        self.variant(CSIC_TOP_EN_A::RESET_DISABLE)
51    }
52    #[doc = "Enable the CSIC module"]
53    #[inline(always)]
54    pub fn enable(self) -> &'a mut crate::W<REG> {
55        self.variant(CSIC_TOP_EN_A::ENABLE)
56    }
57}
58#[doc = "Field `bist_mode_en` reader - "]
59pub type BIST_MODE_EN_R = crate::BitReader<BIST_MODE_EN_A>;
60#[doc = "\n\nValue on reset: 0"]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum BIST_MODE_EN_A {
63    #[doc = "0: Closed"]
64    C_LOSED = 0,
65    #[doc = "1: EN BIST TEST"]
66    EN = 1,
67}
68impl From<BIST_MODE_EN_A> for bool {
69    #[inline(always)]
70    fn from(variant: BIST_MODE_EN_A) -> Self {
71        variant as u8 != 0
72    }
73}
74impl BIST_MODE_EN_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> BIST_MODE_EN_A {
78        match self.bits {
79            false => BIST_MODE_EN_A::C_LOSED,
80            true => BIST_MODE_EN_A::EN,
81        }
82    }
83    #[doc = "Closed"]
84    #[inline(always)]
85    pub fn is_c_losed(&self) -> bool {
86        *self == BIST_MODE_EN_A::C_LOSED
87    }
88    #[doc = "EN BIST TEST"]
89    #[inline(always)]
90    pub fn is_en(&self) -> bool {
91        *self == BIST_MODE_EN_A::EN
92    }
93}
94#[doc = "Field `bist_mode_en` writer - "]
95pub type BIST_MODE_EN_W<'a, REG> = crate::BitWriter<'a, REG, BIST_MODE_EN_A>;
96impl<'a, REG> BIST_MODE_EN_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "Closed"]
101    #[inline(always)]
102    pub fn c_losed(self) -> &'a mut crate::W<REG> {
103        self.variant(BIST_MODE_EN_A::C_LOSED)
104    }
105    #[doc = "EN BIST TEST"]
106    #[inline(always)]
107    pub fn en(self) -> &'a mut crate::W<REG> {
108        self.variant(BIST_MODE_EN_A::EN)
109    }
110}
111impl R {
112    #[doc = "Bit 0"]
113    #[inline(always)]
114    pub fn csic_top_en(&self) -> CSIC_TOP_EN_R {
115        CSIC_TOP_EN_R::new((self.bits & 1) != 0)
116    }
117    #[doc = "Bit 2"]
118    #[inline(always)]
119    pub fn bist_mode_en(&self) -> BIST_MODE_EN_R {
120        BIST_MODE_EN_R::new(((self.bits >> 2) & 1) != 0)
121    }
122}
123impl W {
124    #[doc = "Bit 0"]
125    #[inline(always)]
126    #[must_use]
127    pub fn csic_top_en(&mut self) -> CSIC_TOP_EN_W<CSIC_TOP_EN_SPEC> {
128        CSIC_TOP_EN_W::new(self, 0)
129    }
130    #[doc = "Bit 2"]
131    #[inline(always)]
132    #[must_use]
133    pub fn bist_mode_en(&mut self) -> BIST_MODE_EN_W<CSIC_TOP_EN_SPEC> {
134        BIST_MODE_EN_W::new(self, 2)
135    }
136    #[doc = r" Writes raw bits to the register."]
137    #[doc = r""]
138    #[doc = r" # Safety"]
139    #[doc = r""]
140    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
141    #[inline(always)]
142    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
143        self.bits = bits;
144        self
145    }
146}
147#[doc = "CSIC TOP Enable Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`csic_top_en::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`csic_top_en::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
148pub struct CSIC_TOP_EN_SPEC;
149impl crate::RegisterSpec for CSIC_TOP_EN_SPEC {
150    type Ux = u32;
151}
152#[doc = "`read()` method returns [`csic_top_en::R`](R) reader structure"]
153impl crate::Readable for CSIC_TOP_EN_SPEC {}
154#[doc = "`write(|w| ..)` method takes [`csic_top_en::W`](W) writer structure"]
155impl crate::Writable for CSIC_TOP_EN_SPEC {
156    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
157    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
158}
159#[doc = "`reset()` method sets csic_top_en to value 0"]
160impl crate::Resettable for CSIC_TOP_EN_SPEC {
161    const RESET_VALUE: Self::Ux = 0;
162}