1#[doc = "Register `SR` reader"]
2pub struct R(crate::R<SR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `SR` writer"]
17pub struct W(crate::W<SR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<SR_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<SR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<SR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `ADIF` reader - ADC interrupt flag"]
38pub type ADIF_R = crate::BitReader<bool>;
39#[doc = "Field `ADIF` writer - ADC interrupt flag"]
40pub type ADIF_W<'a, const O: u8> = crate::BitWriter1C<'a, u32, SR_SPEC, bool, O>;
41#[doc = "Field `ADWIF` reader - ADC window comparator interrupt flag"]
42pub type ADWIF_R = crate::BitReader<bool>;
43#[doc = "Field `ADWIF` writer - ADC window comparator interrupt flag"]
44pub type ADWIF_W<'a, const O: u8> = crate::BitWriter1C<'a, u32, SR_SPEC, bool, O>;
45#[doc = "Field `BUSY` reader - Busy"]
46pub type BUSY_R = crate::BitReader<bool>;
47#[doc = "Field `CHANNEL` reader - Current conversion channel"]
48pub type CHANNEL_R = crate::FieldReader<u8, u8>;
49#[doc = "Field `VALID` reader - Valid flag"]
50pub type VALID_R = crate::FieldReader<u16, u16>;
51#[doc = "Field `OVERRUN` reader - Overrun flag"]
52pub type OVERRUN_R = crate::FieldReader<u16, u16>;
53impl R {
54 #[doc = "Bit 0 - ADC interrupt flag"]
55 #[inline(always)]
56 pub fn adif(&self) -> ADIF_R {
57 ADIF_R::new((self.bits & 1) != 0)
58 }
59 #[doc = "Bit 1 - ADC window comparator interrupt flag"]
60 #[inline(always)]
61 pub fn adwif(&self) -> ADWIF_R {
62 ADWIF_R::new(((self.bits >> 1) & 1) != 0)
63 }
64 #[doc = "Bit 2 - Busy"]
65 #[inline(always)]
66 pub fn busy(&self) -> BUSY_R {
67 BUSY_R::new(((self.bits >> 2) & 1) != 0)
68 }
69 #[doc = "Bits 4:7 - Current conversion channel"]
70 #[inline(always)]
71 pub fn channel(&self) -> CHANNEL_R {
72 CHANNEL_R::new(((self.bits >> 4) & 0x0f) as u8)
73 }
74 #[doc = "Bits 8:19 - Valid flag"]
75 #[inline(always)]
76 pub fn valid(&self) -> VALID_R {
77 VALID_R::new(((self.bits >> 8) & 0x0fff) as u16)
78 }
79 #[doc = "Bits 20:31 - Overrun flag"]
80 #[inline(always)]
81 pub fn overrun(&self) -> OVERRUN_R {
82 OVERRUN_R::new(((self.bits >> 20) & 0x0fff) as u16)
83 }
84}
85impl W {
86 #[doc = "Bit 0 - ADC interrupt flag"]
87 #[inline(always)]
88 #[must_use]
89 pub fn adif(&mut self) -> ADIF_W<0> {
90 ADIF_W::new(self)
91 }
92 #[doc = "Bit 1 - ADC window comparator interrupt flag"]
93 #[inline(always)]
94 #[must_use]
95 pub fn adwif(&mut self) -> ADWIF_W<1> {
96 ADWIF_W::new(self)
97 }
98 #[doc = "Writes raw bits to the register."]
99 #[inline(always)]
100 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
101 self.0.bits(bits);
102 self
103 }
104}
105#[doc = "Status 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 [sr](index.html) module"]
106pub struct SR_SPEC;
107impl crate::RegisterSpec for SR_SPEC {
108 type Ux = u32;
109}
110#[doc = "`read()` method returns [sr::R](R) reader structure"]
111impl crate::Readable for SR_SPEC {
112 type Reader = R;
113}
114#[doc = "`write(|w| ..)` method takes [sr::W](W) writer structure"]
115impl crate::Writable for SR_SPEC {
116 type Writer = W;
117 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
118 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0x03;
119}
120#[doc = "`reset()` method sets SR to value 0"]
121impl crate::Resettable for SR_SPEC {
122 const RESET_VALUE: Self::Ux = 0;
123}