ra6t2/adc_b/
adsycr.rs

1#[doc = "Register `ADSYCR` reader"]
2pub struct R(crate::R<ADSYCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ADSYCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ADSYCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ADSYCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ADSYCR` writer"]
17pub struct W(crate::W<ADSYCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ADSYCR_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<ADSYCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ADSYCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `ADSYCYC` reader - Synchronous Operation Period Cycle"]
38pub type ADSYCYC_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `ADSYCYC` writer - Synchronous Operation Period Cycle"]
40pub type ADSYCYC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, ADSYCR_SPEC, u16, u16, 11, O>;
41#[doc = "Field `ADSYDIS0` reader - ADC0 Synchronous Operation Select"]
42pub type ADSYDIS0_R = crate::BitReader<ADSYDIS0_A>;
43#[doc = "ADC0 Synchronous Operation Select\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum ADSYDIS0_A {
46    #[doc = "0: Enable ADC0 synchronous operation"]
47    _0 = 0,
48    #[doc = "1: Disable ADC0 synchronous operation"]
49    _1 = 1,
50}
51impl From<ADSYDIS0_A> for bool {
52    #[inline(always)]
53    fn from(variant: ADSYDIS0_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl ADSYDIS0_R {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> ADSYDIS0_A {
61        match self.bits {
62            false => ADSYDIS0_A::_0,
63            true => ADSYDIS0_A::_1,
64        }
65    }
66    #[doc = "Checks if the value of the field is `_0`"]
67    #[inline(always)]
68    pub fn is_0(&self) -> bool {
69        *self == ADSYDIS0_A::_0
70    }
71    #[doc = "Checks if the value of the field is `_1`"]
72    #[inline(always)]
73    pub fn is_1(&self) -> bool {
74        *self == ADSYDIS0_A::_1
75    }
76}
77#[doc = "Field `ADSYDIS0` writer - ADC0 Synchronous Operation Select"]
78pub type ADSYDIS0_W<'a, const O: u8> = crate::BitWriter<'a, u32, ADSYCR_SPEC, ADSYDIS0_A, O>;
79impl<'a, const O: u8> ADSYDIS0_W<'a, O> {
80    #[doc = "Enable ADC0 synchronous operation"]
81    #[inline(always)]
82    pub fn _0(self) -> &'a mut W {
83        self.variant(ADSYDIS0_A::_0)
84    }
85    #[doc = "Disable ADC0 synchronous operation"]
86    #[inline(always)]
87    pub fn _1(self) -> &'a mut W {
88        self.variant(ADSYDIS0_A::_1)
89    }
90}
91#[doc = "Field `ADSYDIS1` reader - ADC1 Synchronous Operation Select"]
92pub type ADSYDIS1_R = crate::BitReader<ADSYDIS1_A>;
93#[doc = "ADC1 Synchronous Operation Select\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum ADSYDIS1_A {
96    #[doc = "0: Enable ADC1 synchronous operation"]
97    _0 = 0,
98    #[doc = "1: Disable ADC1 synchronous operation"]
99    _1 = 1,
100}
101impl From<ADSYDIS1_A> for bool {
102    #[inline(always)]
103    fn from(variant: ADSYDIS1_A) -> Self {
104        variant as u8 != 0
105    }
106}
107impl ADSYDIS1_R {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub fn variant(&self) -> ADSYDIS1_A {
111        match self.bits {
112            false => ADSYDIS1_A::_0,
113            true => ADSYDIS1_A::_1,
114        }
115    }
116    #[doc = "Checks if the value of the field is `_0`"]
117    #[inline(always)]
118    pub fn is_0(&self) -> bool {
119        *self == ADSYDIS1_A::_0
120    }
121    #[doc = "Checks if the value of the field is `_1`"]
122    #[inline(always)]
123    pub fn is_1(&self) -> bool {
124        *self == ADSYDIS1_A::_1
125    }
126}
127#[doc = "Field `ADSYDIS1` writer - ADC1 Synchronous Operation Select"]
128pub type ADSYDIS1_W<'a, const O: u8> = crate::BitWriter<'a, u32, ADSYCR_SPEC, ADSYDIS1_A, O>;
129impl<'a, const O: u8> ADSYDIS1_W<'a, O> {
130    #[doc = "Enable ADC1 synchronous operation"]
131    #[inline(always)]
132    pub fn _0(self) -> &'a mut W {
133        self.variant(ADSYDIS1_A::_0)
134    }
135    #[doc = "Disable ADC1 synchronous operation"]
136    #[inline(always)]
137    pub fn _1(self) -> &'a mut W {
138        self.variant(ADSYDIS1_A::_1)
139    }
140}
141impl R {
142    #[doc = "Bits 0:10 - Synchronous Operation Period Cycle"]
143    #[inline(always)]
144    pub fn adsycyc(&self) -> ADSYCYC_R {
145        ADSYCYC_R::new((self.bits & 0x07ff) as u16)
146    }
147    #[doc = "Bit 16 - ADC0 Synchronous Operation Select"]
148    #[inline(always)]
149    pub fn adsydis0(&self) -> ADSYDIS0_R {
150        ADSYDIS0_R::new(((self.bits >> 16) & 1) != 0)
151    }
152    #[doc = "Bit 17 - ADC1 Synchronous Operation Select"]
153    #[inline(always)]
154    pub fn adsydis1(&self) -> ADSYDIS1_R {
155        ADSYDIS1_R::new(((self.bits >> 17) & 1) != 0)
156    }
157}
158impl W {
159    #[doc = "Bits 0:10 - Synchronous Operation Period Cycle"]
160    #[inline(always)]
161    #[must_use]
162    pub fn adsycyc(&mut self) -> ADSYCYC_W<0> {
163        ADSYCYC_W::new(self)
164    }
165    #[doc = "Bit 16 - ADC0 Synchronous Operation Select"]
166    #[inline(always)]
167    #[must_use]
168    pub fn adsydis0(&mut self) -> ADSYDIS0_W<16> {
169        ADSYDIS0_W::new(self)
170    }
171    #[doc = "Bit 17 - ADC1 Synchronous Operation Select"]
172    #[inline(always)]
173    #[must_use]
174    pub fn adsydis1(&mut self) -> ADSYDIS1_W<17> {
175        ADSYDIS1_W::new(self)
176    }
177    #[doc = "Writes raw bits to the register."]
178    #[inline(always)]
179    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
180        self.0.bits(bits);
181        self
182    }
183}
184#[doc = "A/D Converter Synchronous Operation 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 [adsycr](index.html) module"]
185pub struct ADSYCR_SPEC;
186impl crate::RegisterSpec for ADSYCR_SPEC {
187    type Ux = u32;
188}
189#[doc = "`read()` method returns [adsycr::R](R) reader structure"]
190impl crate::Readable for ADSYCR_SPEC {
191    type Reader = R;
192}
193#[doc = "`write(|w| ..)` method takes [adsycr::W](W) writer structure"]
194impl crate::Writable for ADSYCR_SPEC {
195    type Writer = W;
196    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
197    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
198}
199#[doc = "`reset()` method sets ADSYCR to value 0x05"]
200impl crate::Resettable for ADSYCR_SPEC {
201    const RESET_VALUE: Self::Ux = 0x05;
202}