atsamd21j/wdt/
ctrl.rs

1#[doc = "Register `CTRL` reader"]
2pub type R = crate::R<CtrlSpec>;
3#[doc = "Register `CTRL` writer"]
4pub type W = crate::W<CtrlSpec>;
5#[doc = "Field `ENABLE` reader - Enable"]
6pub type EnableR = crate::BitReader;
7#[doc = "Field `ENABLE` writer - Enable"]
8pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `WEN` reader - Watchdog Timer Window Mode Enable"]
10pub type WenR = crate::BitReader;
11#[doc = "Field `WEN` writer - Watchdog Timer Window Mode Enable"]
12pub type WenW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `ALWAYSON` reader - Always-On"]
14pub type AlwaysonR = crate::BitReader;
15#[doc = "Field `ALWAYSON` writer - Always-On"]
16pub type AlwaysonW<'a, REG> = crate::BitWriter<'a, REG>;
17impl R {
18    #[doc = "Bit 1 - Enable"]
19    #[inline(always)]
20    pub fn enable(&self) -> EnableR {
21        EnableR::new(((self.bits >> 1) & 1) != 0)
22    }
23    #[doc = "Bit 2 - Watchdog Timer Window Mode Enable"]
24    #[inline(always)]
25    pub fn wen(&self) -> WenR {
26        WenR::new(((self.bits >> 2) & 1) != 0)
27    }
28    #[doc = "Bit 7 - Always-On"]
29    #[inline(always)]
30    pub fn alwayson(&self) -> AlwaysonR {
31        AlwaysonR::new(((self.bits >> 7) & 1) != 0)
32    }
33}
34impl W {
35    #[doc = "Bit 1 - Enable"]
36    #[inline(always)]
37    #[must_use]
38    pub fn enable(&mut self) -> EnableW<CtrlSpec> {
39        EnableW::new(self, 1)
40    }
41    #[doc = "Bit 2 - Watchdog Timer Window Mode Enable"]
42    #[inline(always)]
43    #[must_use]
44    pub fn wen(&mut self) -> WenW<CtrlSpec> {
45        WenW::new(self, 2)
46    }
47    #[doc = "Bit 7 - Always-On"]
48    #[inline(always)]
49    #[must_use]
50    pub fn alwayson(&mut self) -> AlwaysonW<CtrlSpec> {
51        AlwaysonW::new(self, 7)
52    }
53}
54#[doc = "Control\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
55pub struct CtrlSpec;
56impl crate::RegisterSpec for CtrlSpec {
57    type Ux = u8;
58}
59#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"]
60impl crate::Readable for CtrlSpec {}
61#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"]
62impl crate::Writable for CtrlSpec {
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 CTRL to value 0"]
68impl crate::Resettable for CtrlSpec {
69    const RESET_VALUE: u8 = 0;
70}