eos_s3/aip/
apc_ctrl_2.rs

1#[doc = "Register `APC_CTRL_2` reader"]
2pub struct R(crate::R<APC_CTRL_2_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<APC_CTRL_2_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<APC_CTRL_2_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<APC_CTRL_2_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `APC_CTRL_2` writer"]
17pub struct W(crate::W<APC_CTRL_2_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<APC_CTRL_2_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<APC_CTRL_2_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<APC_CTRL_2_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `it` reader - Please refer to the Technical Reference Manual for others (No SYNC Needed)"]
38pub struct IT_R(crate::FieldReader<u8, u8>);
39impl IT_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u8) -> Self {
42        IT_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for IT_R {
46    type Target = crate::FieldReader<u8, u8>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `it` writer - Please refer to the Technical Reference Manual for others (No SYNC Needed)"]
53pub struct IT_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> IT_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u8) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
61        self.w
62    }
63}
64#[doc = "Field `test` reader - Please refer to the Technical Reference Manual for others (No SYNC Needed)"]
65pub struct TEST_R(crate::FieldReader<u8, u8>);
66impl TEST_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: u8) -> Self {
69        TEST_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for TEST_R {
73    type Target = crate::FieldReader<u8, u8>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `test` writer - Please refer to the Technical Reference Manual for others (No SYNC Needed)"]
80pub struct TEST_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> TEST_W<'a> {
84    #[doc = r"Writes raw bits to the field"]
85    #[inline(always)]
86    pub unsafe fn bits(self, value: u8) -> &'a mut W {
87        self.w.bits =
88            (self.w.bits & !(0x0f << 3)) | ((value as u32 & 0x0f) << 3);
89        self.w
90    }
91}
92impl R {
93    #[doc = "Bits 0:2 - Please refer to the Technical Reference Manual for others (No SYNC Needed)"]
94    #[inline(always)]
95    pub fn it(&self) -> IT_R {
96        IT_R::new((self.bits & 0x07) as u8)
97    }
98    #[doc = "Bits 3:6 - Please refer to the Technical Reference Manual for others (No SYNC Needed)"]
99    #[inline(always)]
100    pub fn test(&self) -> TEST_R {
101        TEST_R::new(((self.bits >> 3) & 0x0f) as u8)
102    }
103}
104impl W {
105    #[doc = "Bits 0:2 - Please refer to the Technical Reference Manual for others (No SYNC Needed)"]
106    #[inline(always)]
107    pub fn it(&mut self) -> IT_W {
108        IT_W { w: self }
109    }
110    #[doc = "Bits 3:6 - Please refer to the Technical Reference Manual for others (No SYNC Needed)"]
111    #[inline(always)]
112    pub fn test(&mut self) -> TEST_W {
113        TEST_W { w: self }
114    }
115    #[doc = "Writes raw bits to the register."]
116    #[inline(always)]
117    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
118        self.0.bits(bits);
119        self
120    }
121}
122#[doc = "APC control register 2\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 [apc_ctrl_2](index.html) module"]
123pub struct APC_CTRL_2_SPEC;
124impl crate::RegisterSpec for APC_CTRL_2_SPEC {
125    type Ux = u32;
126}
127#[doc = "`read()` method returns [apc_ctrl_2::R](R) reader structure"]
128impl crate::Readable for APC_CTRL_2_SPEC {
129    type Reader = R;
130}
131#[doc = "`write(|w| ..)` method takes [apc_ctrl_2::W](W) writer structure"]
132impl crate::Writable for APC_CTRL_2_SPEC {
133    type Writer = W;
134}
135#[doc = "`reset()` method sets APC_CTRL_2 to value 0"]
136impl crate::Resettable for APC_CTRL_2_SPEC {
137    #[inline(always)]
138    fn reset_value() -> Self::Ux {
139        0
140    }
141}