atsamd51p/osc32kctrl/
cfdctrl.rs
1#[doc = "Register `CFDCTRL` reader"]
2pub type R = crate::R<CfdctrlSpec>;
3#[doc = "Register `CFDCTRL` writer"]
4pub type W = crate::W<CfdctrlSpec>;
5#[doc = "Field `CFDEN` reader - Clock Failure Detector Enable"]
6pub type CfdenR = crate::BitReader;
7#[doc = "Field `CFDEN` writer - Clock Failure Detector Enable"]
8pub type CfdenW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `SWBACK` reader - Clock Switch Back"]
10pub type SwbackR = crate::BitReader;
11#[doc = "Field `SWBACK` writer - Clock Switch Back"]
12pub type SwbackW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `CFDPRESC` reader - Clock Failure Detector Prescaler"]
14pub type CfdprescR = crate::BitReader;
15#[doc = "Field `CFDPRESC` writer - Clock Failure Detector Prescaler"]
16pub type CfdprescW<'a, REG> = crate::BitWriter<'a, REG>;
17impl R {
18 #[doc = "Bit 0 - Clock Failure Detector Enable"]
19 #[inline(always)]
20 pub fn cfden(&self) -> CfdenR {
21 CfdenR::new((self.bits & 1) != 0)
22 }
23 #[doc = "Bit 1 - Clock Switch Back"]
24 #[inline(always)]
25 pub fn swback(&self) -> SwbackR {
26 SwbackR::new(((self.bits >> 1) & 1) != 0)
27 }
28 #[doc = "Bit 2 - Clock Failure Detector Prescaler"]
29 #[inline(always)]
30 pub fn cfdpresc(&self) -> CfdprescR {
31 CfdprescR::new(((self.bits >> 2) & 1) != 0)
32 }
33}
34impl W {
35 #[doc = "Bit 0 - Clock Failure Detector Enable"]
36 #[inline(always)]
37 #[must_use]
38 pub fn cfden(&mut self) -> CfdenW<CfdctrlSpec> {
39 CfdenW::new(self, 0)
40 }
41 #[doc = "Bit 1 - Clock Switch Back"]
42 #[inline(always)]
43 #[must_use]
44 pub fn swback(&mut self) -> SwbackW<CfdctrlSpec> {
45 SwbackW::new(self, 1)
46 }
47 #[doc = "Bit 2 - Clock Failure Detector Prescaler"]
48 #[inline(always)]
49 #[must_use]
50 pub fn cfdpresc(&mut self) -> CfdprescW<CfdctrlSpec> {
51 CfdprescW::new(self, 2)
52 }
53}
54#[doc = "Clock Failure Detector Control\n\nYou can [`read`](crate::Reg::read) this register and get [`cfdctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cfdctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
55pub struct CfdctrlSpec;
56impl crate::RegisterSpec for CfdctrlSpec {
57 type Ux = u8;
58}
59#[doc = "`read()` method returns [`cfdctrl::R`](R) reader structure"]
60impl crate::Readable for CfdctrlSpec {}
61#[doc = "`write(|w| ..)` method takes [`cfdctrl::W`](W) writer structure"]
62impl crate::Writable for CfdctrlSpec {
63 type Safety = crate::Unsafe;
64 const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
65 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
66}
67#[doc = "`reset()` method sets CFDCTRL to value 0"]
68impl crate::Resettable for CfdctrlSpec {
69 const RESET_VALUE: u8 = 0;
70}