d1_pac/timer/
wdog_soft_rst.rs

1#[doc = "Register `wdog_soft_rst` reader"]
2pub type R = crate::R<WDOG_SOFT_RST_SPEC>;
3#[doc = "Register `wdog_soft_rst` writer"]
4pub type W = crate::W<WDOG_SOFT_RST_SPEC>;
5#[doc = "Field `soft_rst_en` reader - Soft Reset Enable"]
6pub type SOFT_RST_EN_R = crate::BitReader<SOFT_RST_EN_A>;
7#[doc = "Soft Reset Enable\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum SOFT_RST_EN_A {
10    #[doc = "0: `0`"]
11    DEASSERT = 0,
12    #[doc = "1: `1`"]
13    RESET = 1,
14}
15impl From<SOFT_RST_EN_A> for bool {
16    #[inline(always)]
17    fn from(variant: SOFT_RST_EN_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl SOFT_RST_EN_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> SOFT_RST_EN_A {
25        match self.bits {
26            false => SOFT_RST_EN_A::DEASSERT,
27            true => SOFT_RST_EN_A::RESET,
28        }
29    }
30    #[doc = "`0`"]
31    #[inline(always)]
32    pub fn is_deassert(&self) -> bool {
33        *self == SOFT_RST_EN_A::DEASSERT
34    }
35    #[doc = "`1`"]
36    #[inline(always)]
37    pub fn is_reset(&self) -> bool {
38        *self == SOFT_RST_EN_A::RESET
39    }
40}
41#[doc = "Field `soft_rst_en` writer - Soft Reset Enable"]
42pub type SOFT_RST_EN_W<'a, REG> = crate::BitWriter<'a, REG, SOFT_RST_EN_A>;
43impl<'a, REG> SOFT_RST_EN_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "`0`"]
48    #[inline(always)]
49    pub fn deassert(self) -> &'a mut crate::W<REG> {
50        self.variant(SOFT_RST_EN_A::DEASSERT)
51    }
52    #[doc = "`1`"]
53    #[inline(always)]
54    pub fn reset(self) -> &'a mut crate::W<REG> {
55        self.variant(SOFT_RST_EN_A::RESET)
56    }
57}
58#[doc = "Field `key_field` writer - Key Field"]
59pub type KEY_FIELD_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
60impl R {
61    #[doc = "Bit 0 - Soft Reset Enable"]
62    #[inline(always)]
63    pub fn soft_rst_en(&self) -> SOFT_RST_EN_R {
64        SOFT_RST_EN_R::new((self.bits & 1) != 0)
65    }
66}
67impl W {
68    #[doc = "Bit 0 - Soft Reset Enable"]
69    #[inline(always)]
70    #[must_use]
71    pub fn soft_rst_en(&mut self) -> SOFT_RST_EN_W<WDOG_SOFT_RST_SPEC> {
72        SOFT_RST_EN_W::new(self, 0)
73    }
74    #[doc = "Bits 16:31 - Key Field"]
75    #[inline(always)]
76    #[must_use]
77    pub fn key_field(&mut self) -> KEY_FIELD_W<WDOG_SOFT_RST_SPEC> {
78        KEY_FIELD_W::new(self, 16)
79    }
80    #[doc = r" Writes raw bits to the register."]
81    #[doc = r""]
82    #[doc = r" # Safety"]
83    #[doc = r""]
84    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
85    #[inline(always)]
86    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
87        self.bits = bits;
88        self
89    }
90}
91#[doc = "Watchdog Software Reset Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`wdog_soft_rst::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 [`wdog_soft_rst::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
92pub struct WDOG_SOFT_RST_SPEC;
93impl crate::RegisterSpec for WDOG_SOFT_RST_SPEC {
94    type Ux = u32;
95}
96#[doc = "`read()` method returns [`wdog_soft_rst::R`](R) reader structure"]
97impl crate::Readable for WDOG_SOFT_RST_SPEC {}
98#[doc = "`write(|w| ..)` method takes [`wdog_soft_rst::W`](W) writer structure"]
99impl crate::Writable for WDOG_SOFT_RST_SPEC {
100    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
101    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
102}
103#[doc = "`reset()` method sets wdog_soft_rst to value 0"]
104impl crate::Resettable for WDOG_SOFT_RST_SPEC {
105    const RESET_VALUE: Self::Ux = 0;
106}