atsam3s8c/adc/
cwr.rs

1#[doc = "Register `CWR` reader"]
2pub type R = crate::R<CwrSpec>;
3#[doc = "Register `CWR` writer"]
4pub type W = crate::W<CwrSpec>;
5#[doc = "Field `LOWTHRES` reader - Low Threshold"]
6pub type LowthresR = crate::FieldReader<u16>;
7#[doc = "Field `LOWTHRES` writer - Low Threshold"]
8pub type LowthresW<'a, REG> = crate::FieldWriter<'a, REG, 12, u16>;
9#[doc = "Field `HIGHTHRES` reader - High Threshold"]
10pub type HighthresR = crate::FieldReader<u16>;
11#[doc = "Field `HIGHTHRES` writer - High Threshold"]
12pub type HighthresW<'a, REG> = crate::FieldWriter<'a, REG, 12, u16>;
13impl R {
14    #[doc = "Bits 0:11 - Low Threshold"]
15    #[inline(always)]
16    pub fn lowthres(&self) -> LowthresR {
17        LowthresR::new((self.bits & 0x0fff) as u16)
18    }
19    #[doc = "Bits 16:27 - High Threshold"]
20    #[inline(always)]
21    pub fn highthres(&self) -> HighthresR {
22        HighthresR::new(((self.bits >> 16) & 0x0fff) as u16)
23    }
24}
25impl W {
26    #[doc = "Bits 0:11 - Low Threshold"]
27    #[inline(always)]
28    #[must_use]
29    pub fn lowthres(&mut self) -> LowthresW<CwrSpec> {
30        LowthresW::new(self, 0)
31    }
32    #[doc = "Bits 16:27 - High Threshold"]
33    #[inline(always)]
34    #[must_use]
35    pub fn highthres(&mut self) -> HighthresW<CwrSpec> {
36        HighthresW::new(self, 16)
37    }
38}
39#[doc = "Compare Window Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`cwr::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 [`cwr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
40pub struct CwrSpec;
41impl crate::RegisterSpec for CwrSpec {
42    type Ux = u32;
43}
44#[doc = "`read()` method returns [`cwr::R`](R) reader structure"]
45impl crate::Readable for CwrSpec {}
46#[doc = "`write(|w| ..)` method takes [`cwr::W`](W) writer structure"]
47impl crate::Writable for CwrSpec {
48    type Safety = crate::Unsafe;
49    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
50    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
51}
52#[doc = "`reset()` method sets CWR to value 0"]
53impl crate::Resettable for CwrSpec {
54    const RESET_VALUE: u32 = 0;
55}