atsamd51j20a/wdt/
clear.rs

1#[doc = "Writer for register CLEAR"]
2pub type W = crate::W<u8, super::CLEAR>;
3#[doc = "Register CLEAR `reset()`'s with value 0"]
4impl crate::ResetValue for super::CLEAR {
5    type Type = u8;
6    #[inline(always)]
7    fn reset_value() -> Self::Type {
8        0
9    }
10}
11#[doc = "Watchdog Clear\n\nValue on reset: 0"]
12#[derive(Clone, Copy, Debug, PartialEq)]
13#[repr(u8)]
14pub enum CLEAR_AW {
15    #[doc = "165: Clear Key"]
16    KEY = 165,
17}
18impl From<CLEAR_AW> for u8 {
19    #[inline(always)]
20    fn from(variant: CLEAR_AW) -> Self {
21        variant as _
22    }
23}
24#[doc = "Write proxy for field `CLEAR`"]
25pub struct CLEAR_W<'a> {
26    w: &'a mut W,
27}
28impl<'a> CLEAR_W<'a> {
29    #[doc = r"Writes `variant` to the field"]
30    #[inline(always)]
31    pub fn variant(self, variant: CLEAR_AW) -> &'a mut W {
32        unsafe { self.bits(variant.into()) }
33    }
34    #[doc = "Clear Key"]
35    #[inline(always)]
36    pub fn key(self) -> &'a mut W {
37        self.variant(CLEAR_AW::KEY)
38    }
39    #[doc = r"Writes raw bits to the field"]
40    #[inline(always)]
41    pub unsafe fn bits(self, value: u8) -> &'a mut W {
42        self.w.bits = (self.w.bits & !0xff) | ((value as u8) & 0xff);
43        self.w
44    }
45}
46impl W {
47    #[doc = "Bits 0:7 - Watchdog Clear"]
48    #[inline(always)]
49    pub fn clear(&mut self) -> CLEAR_W {
50        CLEAR_W { w: self }
51    }
52}