swm341_pac/sfc/
cfg.rs

1#[doc = "Register `CFG` reader"]
2pub struct R(crate::R<CFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CFG` writer"]
17pub struct W(crate::W<CFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CFG_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<CFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CMDTYPE` reader - CMDTYPE field"]
38pub type CMDTYPE_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `CMDTYPE` writer - CMDTYPE field"]
40pub type CMDTYPE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG_SPEC, u8, u8, 4, O>;
41#[doc = "Field `CMDWREN` reader - CMDWREN field"]
42pub type CMDWREN_R = crate::BitReader<bool>;
43#[doc = "Field `CMDWREN` writer - CMDWREN field"]
44pub type CMDWREN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, bool, O>;
45#[doc = "Field `CLKDIV` reader - CLKDIV field"]
46pub type CLKDIV_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `CLKDIV` writer - CLKDIV field"]
48pub type CLKDIV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG_SPEC, u8, u8, 2, O>;
49#[doc = "Field `ADDR4L` reader - ADDR4L field"]
50pub type ADDR4L_R = crate::BitReader<bool>;
51#[doc = "Field `ADDR4L` writer - ADDR4L field"]
52pub type ADDR4L_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, bool, O>;
53#[doc = "Field `DATA4L_PP` reader - DATA4L_PP field"]
54pub type DATA4L_PP_R = crate::BitReader<bool>;
55#[doc = "Field `DATA4L_PP` writer - DATA4L_PP field"]
56pub type DATA4L_PP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, bool, O>;
57#[doc = "Field `DATA4L_RD` reader - DATA4L_RD field"]
58pub type DATA4L_RD_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `DATA4L_RD` writer - DATA4L_RD field"]
60pub type DATA4L_RD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG_SPEC, u8, u8, 2, O>;
61#[doc = "Field `WREN` reader - WREN field"]
62pub type WREN_R = crate::BitReader<bool>;
63#[doc = "Field `WREN` writer - WREN field"]
64pub type WREN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, bool, O>;
65impl R {
66    #[doc = "Bits 0:3 - CMDTYPE field"]
67    #[inline(always)]
68    pub fn cmdtype(&self) -> CMDTYPE_R {
69        CMDTYPE_R::new((self.bits & 0x0f) as u8)
70    }
71    #[doc = "Bit 5 - CMDWREN field"]
72    #[inline(always)]
73    pub fn cmdwren(&self) -> CMDWREN_R {
74        CMDWREN_R::new(((self.bits >> 5) & 1) != 0)
75    }
76    #[doc = "Bits 6:7 - CLKDIV field"]
77    #[inline(always)]
78    pub fn clkdiv(&self) -> CLKDIV_R {
79        CLKDIV_R::new(((self.bits >> 6) & 3) as u8)
80    }
81    #[doc = "Bit 8 - ADDR4L field"]
82    #[inline(always)]
83    pub fn addr4l(&self) -> ADDR4L_R {
84        ADDR4L_R::new(((self.bits >> 8) & 1) != 0)
85    }
86    #[doc = "Bit 9 - DATA4L_PP field"]
87    #[inline(always)]
88    pub fn data4l_pp(&self) -> DATA4L_PP_R {
89        DATA4L_PP_R::new(((self.bits >> 9) & 1) != 0)
90    }
91    #[doc = "Bits 10:11 - DATA4L_RD field"]
92    #[inline(always)]
93    pub fn data4l_rd(&self) -> DATA4L_RD_R {
94        DATA4L_RD_R::new(((self.bits >> 10) & 3) as u8)
95    }
96    #[doc = "Bit 12 - WREN field"]
97    #[inline(always)]
98    pub fn wren(&self) -> WREN_R {
99        WREN_R::new(((self.bits >> 12) & 1) != 0)
100    }
101}
102impl W {
103    #[doc = "Bits 0:3 - CMDTYPE field"]
104    #[inline(always)]
105    pub fn cmdtype(&mut self) -> CMDTYPE_W<0> {
106        CMDTYPE_W::new(self)
107    }
108    #[doc = "Bit 5 - CMDWREN field"]
109    #[inline(always)]
110    pub fn cmdwren(&mut self) -> CMDWREN_W<5> {
111        CMDWREN_W::new(self)
112    }
113    #[doc = "Bits 6:7 - CLKDIV field"]
114    #[inline(always)]
115    pub fn clkdiv(&mut self) -> CLKDIV_W<6> {
116        CLKDIV_W::new(self)
117    }
118    #[doc = "Bit 8 - ADDR4L field"]
119    #[inline(always)]
120    pub fn addr4l(&mut self) -> ADDR4L_W<8> {
121        ADDR4L_W::new(self)
122    }
123    #[doc = "Bit 9 - DATA4L_PP field"]
124    #[inline(always)]
125    pub fn data4l_pp(&mut self) -> DATA4L_PP_W<9> {
126        DATA4L_PP_W::new(self)
127    }
128    #[doc = "Bits 10:11 - DATA4L_RD field"]
129    #[inline(always)]
130    pub fn data4l_rd(&mut self) -> DATA4L_RD_W<10> {
131        DATA4L_RD_W::new(self)
132    }
133    #[doc = "Bit 12 - WREN field"]
134    #[inline(always)]
135    pub fn wren(&mut self) -> WREN_W<12> {
136        WREN_W::new(self)
137    }
138    #[doc = "Writes raw bits to the register."]
139    #[inline(always)]
140    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
141        self.0.bits(bits);
142        self
143    }
144}
145#[doc = "CFG 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)."]
146pub struct CFG_SPEC;
147impl crate::RegisterSpec for CFG_SPEC {
148    type Ux = u32;
149}
150#[doc = "`read()` method returns [cfg::R](R) reader structure"]
151impl crate::Readable for CFG_SPEC {
152    type Reader = R;
153}
154#[doc = "`write(|w| ..)` method takes [cfg::W](W) writer structure"]
155impl crate::Writable for CFG_SPEC {
156    type Writer = W;
157}
158#[doc = "`reset()` method sets CFG to value 0"]
159impl crate::Resettable for CFG_SPEC {
160    #[inline(always)]
161    fn reset_value() -> Self::Ux {
162        0
163    }
164}