alt_sam3x8e/rstc/cr/
mod.rs1#[doc = "Writer for register CR"]
2pub type W = crate::W<u32, super::CR>;
3#[doc = "Write proxy for field `PROCRST`"]
4pub struct PROCRST_W<'a> {
5 w: &'a mut W,
6}
7impl<'a> PROCRST_W<'a> {
8 #[doc = r"Sets the field bit"]
9 #[inline(always)]
10 pub fn set_bit(self) -> &'a mut W {
11 self.bit(true)
12 }
13 #[doc = r"Clears the field bit"]
14 #[inline(always)]
15 pub fn clear_bit(self) -> &'a mut W {
16 self.bit(false)
17 }
18 #[doc = r"Writes raw bits to the field"]
19 #[inline(always)]
20 pub fn bit(self, value: bool) -> &'a mut W {
21 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
22 self.w
23 }
24}
25#[doc = "Write proxy for field `PERRST`"]
26pub struct PERRST_W<'a> {
27 w: &'a mut W,
28}
29impl<'a> PERRST_W<'a> {
30 #[doc = r"Sets the field bit"]
31 #[inline(always)]
32 pub fn set_bit(self) -> &'a mut W {
33 self.bit(true)
34 }
35 #[doc = r"Clears the field bit"]
36 #[inline(always)]
37 pub fn clear_bit(self) -> &'a mut W {
38 self.bit(false)
39 }
40 #[doc = r"Writes raw bits to the field"]
41 #[inline(always)]
42 pub fn bit(self, value: bool) -> &'a mut W {
43 self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
44 self.w
45 }
46}
47#[doc = "Write proxy for field `EXTRST`"]
48pub struct EXTRST_W<'a> {
49 w: &'a mut W,
50}
51impl<'a> EXTRST_W<'a> {
52 #[doc = r"Sets the field bit"]
53 #[inline(always)]
54 pub fn set_bit(self) -> &'a mut W {
55 self.bit(true)
56 }
57 #[doc = r"Clears the field bit"]
58 #[inline(always)]
59 pub fn clear_bit(self) -> &'a mut W {
60 self.bit(false)
61 }
62 #[doc = r"Writes raw bits to the field"]
63 #[inline(always)]
64 pub fn bit(self, value: bool) -> &'a mut W {
65 self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
66 self.w
67 }
68}
69#[doc = "Possible values of the field `KEY`"]
70#[derive(Clone, Copy, Debug, PartialEq)]
71pub enum KEY_AW {
72 #[doc = "Writing any other value in this field aborts the write operation."]
73 PASSWD,
74}
75impl crate::ToBits<u8> for KEY_AW {
76 #[inline(always)]
77 fn _bits(&self) -> u8 {
78 match *self {
79 KEY_AW::PASSWD => 165,
80 }
81 }
82}
83#[doc = "Write proxy for field `KEY`"]
84pub struct KEY_W<'a> {
85 w: &'a mut W,
86}
87impl<'a> KEY_W<'a> {
88 #[doc = r"Writes `variant` to the field"]
89 #[inline(always)]
90 pub fn variant(self, variant: KEY_AW) -> &'a mut W {
91 use crate::ToBits;
92 unsafe { self.bits(variant._bits()) }
93 }
94 #[doc = "Writing any other value in this field aborts the write operation."]
95 #[inline(always)]
96 pub fn passwd(self) -> &'a mut W {
97 self.variant(KEY_AW::PASSWD)
98 }
99 #[doc = r"Writes raw bits to the field"]
100 #[inline(always)]
101 pub unsafe fn bits(self, value: u8) -> &'a mut W {
102 self.w.bits = (self.w.bits & !(0xff << 24)) | (((value as u32) & 0xff) << 24);
103 self.w
104 }
105}
106impl W {
107 #[doc = "Bit 0 - Processor Reset"]
108 #[inline(always)]
109 pub fn procrst(&mut self) -> PROCRST_W {
110 PROCRST_W { w: self }
111 }
112 #[doc = "Bit 2 - Peripheral Reset"]
113 #[inline(always)]
114 pub fn perrst(&mut self) -> PERRST_W {
115 PERRST_W { w: self }
116 }
117 #[doc = "Bit 3 - External Reset"]
118 #[inline(always)]
119 pub fn extrst(&mut self) -> EXTRST_W {
120 EXTRST_W { w: self }
121 }
122 #[doc = "Bits 24:31 - System Reset Key"]
123 #[inline(always)]
124 pub fn key(&mut self) -> KEY_W {
125 KEY_W { w: self }
126 }
127}