atsamd21g/rtc/mode0/
freqcorr.rs

1#[doc = "Register `FREQCORR` reader"]
2pub type R = crate::R<FreqcorrSpec>;
3#[doc = "Register `FREQCORR` writer"]
4pub type W = crate::W<FreqcorrSpec>;
5#[doc = "Field `VALUE` reader - Correction Value"]
6pub type ValueR = crate::FieldReader;
7#[doc = "Field `VALUE` writer - Correction Value"]
8pub type ValueW<'a, REG> = crate::FieldWriter<'a, REG, 7>;
9#[doc = "Field `SIGN` reader - Correction Sign"]
10pub type SignR = crate::BitReader;
11#[doc = "Field `SIGN` writer - Correction Sign"]
12pub type SignW<'a, REG> = crate::BitWriter<'a, REG>;
13impl R {
14    #[doc = "Bits 0:6 - Correction Value"]
15    #[inline(always)]
16    pub fn value(&self) -> ValueR {
17        ValueR::new(self.bits & 0x7f)
18    }
19    #[doc = "Bit 7 - Correction Sign"]
20    #[inline(always)]
21    pub fn sign(&self) -> SignR {
22        SignR::new(((self.bits >> 7) & 1) != 0)
23    }
24}
25impl W {
26    #[doc = "Bits 0:6 - Correction Value"]
27    #[inline(always)]
28    #[must_use]
29    pub fn value(&mut self) -> ValueW<FreqcorrSpec> {
30        ValueW::new(self, 0)
31    }
32    #[doc = "Bit 7 - Correction Sign"]
33    #[inline(always)]
34    #[must_use]
35    pub fn sign(&mut self) -> SignW<FreqcorrSpec> {
36        SignW::new(self, 7)
37    }
38}
39#[doc = "Frequency Correction\n\nYou can [`read`](crate::Reg::read) this register and get [`freqcorr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`freqcorr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
40pub struct FreqcorrSpec;
41impl crate::RegisterSpec for FreqcorrSpec {
42    type Ux = u8;
43}
44#[doc = "`read()` method returns [`freqcorr::R`](R) reader structure"]
45impl crate::Readable for FreqcorrSpec {}
46#[doc = "`write(|w| ..)` method takes [`freqcorr::W`](W) writer structure"]
47impl crate::Writable for FreqcorrSpec {
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 FREQCORR to value 0"]
53impl crate::Resettable for FreqcorrSpec {
54    const RESET_VALUE: u8 = 0;
55}