atsamd51j/adc0/
sampctrl.rs

1#[doc = "Register `SAMPCTRL` reader"]
2pub type R = crate::R<SampctrlSpec>;
3#[doc = "Register `SAMPCTRL` writer"]
4pub type W = crate::W<SampctrlSpec>;
5#[doc = "Field `SAMPLEN` reader - Sampling Time Length"]
6pub type SamplenR = crate::FieldReader;
7#[doc = "Field `SAMPLEN` writer - Sampling Time Length"]
8pub type SamplenW<'a, REG> = crate::FieldWriter<'a, REG, 6>;
9#[doc = "Field `OFFCOMP` reader - Comparator Offset Compensation Enable"]
10pub type OffcompR = crate::BitReader;
11#[doc = "Field `OFFCOMP` writer - Comparator Offset Compensation Enable"]
12pub type OffcompW<'a, REG> = crate::BitWriter<'a, REG>;
13impl R {
14    #[doc = "Bits 0:5 - Sampling Time Length"]
15    #[inline(always)]
16    pub fn samplen(&self) -> SamplenR {
17        SamplenR::new(self.bits & 0x3f)
18    }
19    #[doc = "Bit 7 - Comparator Offset Compensation Enable"]
20    #[inline(always)]
21    pub fn offcomp(&self) -> OffcompR {
22        OffcompR::new(((self.bits >> 7) & 1) != 0)
23    }
24}
25impl W {
26    #[doc = "Bits 0:5 - Sampling Time Length"]
27    #[inline(always)]
28    #[must_use]
29    pub fn samplen(&mut self) -> SamplenW<SampctrlSpec> {
30        SamplenW::new(self, 0)
31    }
32    #[doc = "Bit 7 - Comparator Offset Compensation Enable"]
33    #[inline(always)]
34    #[must_use]
35    pub fn offcomp(&mut self) -> OffcompW<SampctrlSpec> {
36        OffcompW::new(self, 7)
37    }
38}
39#[doc = "Sample Time Control\n\nYou can [`read`](crate::Reg::read) this register and get [`sampctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sampctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
40pub struct SampctrlSpec;
41impl crate::RegisterSpec for SampctrlSpec {
42    type Ux = u8;
43}
44#[doc = "`read()` method returns [`sampctrl::R`](R) reader structure"]
45impl crate::Readable for SampctrlSpec {}
46#[doc = "`write(|w| ..)` method takes [`sampctrl::W`](W) writer structure"]
47impl crate::Writable for SampctrlSpec {
48    type Safety = crate::Unsafe;
49    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
50    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
51}
52#[doc = "`reset()` method sets SAMPCTRL to value 0"]
53impl crate::Resettable for SampctrlSpec {
54    const RESET_VALUE: u8 = 0;
55}