efm32pg12_pac/crypto0/
cmd.rs

1#[doc = "Reader of register CMD"]
2pub type R = crate::R<u32, super::CMD>;
3#[doc = "Writer for register CMD"]
4pub type W = crate::W<u32, super::CMD>;
5#[doc = "Register CMD `reset()`'s with value 0"]
6impl crate::ResetValue for super::CMD {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `INSTR`"]
14pub type INSTR_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `INSTR`"]
16pub struct INSTR_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> INSTR_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0xff) | ((value as u32) & 0xff);
24        self.w
25    }
26}
27#[doc = "Write proxy for field `SEQSTART`"]
28pub struct SEQSTART_W<'a> {
29    w: &'a mut W,
30}
31impl<'a> SEQSTART_W<'a> {
32    #[doc = r"Sets the field bit"]
33    #[inline(always)]
34    pub fn set_bit(self) -> &'a mut W {
35        self.bit(true)
36    }
37    #[doc = r"Clears the field bit"]
38    #[inline(always)]
39    pub fn clear_bit(self) -> &'a mut W {
40        self.bit(false)
41    }
42    #[doc = r"Writes raw bits to the field"]
43    #[inline(always)]
44    pub fn bit(self, value: bool) -> &'a mut W {
45        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
46        self.w
47    }
48}
49#[doc = "Write proxy for field `SEQSTOP`"]
50pub struct SEQSTOP_W<'a> {
51    w: &'a mut W,
52}
53impl<'a> SEQSTOP_W<'a> {
54    #[doc = r"Sets the field bit"]
55    #[inline(always)]
56    pub fn set_bit(self) -> &'a mut W {
57        self.bit(true)
58    }
59    #[doc = r"Clears the field bit"]
60    #[inline(always)]
61    pub fn clear_bit(self) -> &'a mut W {
62        self.bit(false)
63    }
64    #[doc = r"Writes raw bits to the field"]
65    #[inline(always)]
66    pub fn bit(self, value: bool) -> &'a mut W {
67        self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
68        self.w
69    }
70}
71#[doc = "Write proxy for field `SEQSTEP`"]
72pub struct SEQSTEP_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> SEQSTEP_W<'a> {
76    #[doc = r"Sets the field bit"]
77    #[inline(always)]
78    pub fn set_bit(self) -> &'a mut W {
79        self.bit(true)
80    }
81    #[doc = r"Clears the field bit"]
82    #[inline(always)]
83    pub fn clear_bit(self) -> &'a mut W {
84        self.bit(false)
85    }
86    #[doc = r"Writes raw bits to the field"]
87    #[inline(always)]
88    pub fn bit(self, value: bool) -> &'a mut W {
89        self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
90        self.w
91    }
92}
93impl R {
94    #[doc = "Bits 0:7 - Execute Instruction"]
95    #[inline(always)]
96    pub fn instr(&self) -> INSTR_R {
97        INSTR_R::new((self.bits & 0xff) as u8)
98    }
99}
100impl W {
101    #[doc = "Bits 0:7 - Execute Instruction"]
102    #[inline(always)]
103    pub fn instr(&mut self) -> INSTR_W {
104        INSTR_W { w: self }
105    }
106    #[doc = "Bit 9 - Encryption/Decryption SEQUENCE Start"]
107    #[inline(always)]
108    pub fn seqstart(&mut self) -> SEQSTART_W {
109        SEQSTART_W { w: self }
110    }
111    #[doc = "Bit 10 - Sequence Stop"]
112    #[inline(always)]
113    pub fn seqstop(&mut self) -> SEQSTOP_W {
114        SEQSTOP_W { w: self }
115    }
116    #[doc = "Bit 11 - Sequence Step"]
117    #[inline(always)]
118    pub fn seqstep(&mut self) -> SEQSTEP_W {
119        SEQSTEP_W { w: self }
120    }
121}