1#[doc = "Register `MODE` reader"]
2pub struct R(crate::R<MODE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<MODE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<MODE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<MODE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `MODE` writer"]
17pub struct W(crate::W<MODE_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<MODE_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<MODE_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<MODE_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `MODE` reader - The mode of operation to be used"]
38pub type MODE_R = crate::BitReader<MODE_A>;
39#[doc = "The mode of operation to be used\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum MODE_A {
42 #[doc = "0: AES CCM packet encryption mode"]
43 ENCRYPTION = 0,
44 #[doc = "1: AES CCM packet decryption mode"]
45 DECRYPTION = 1,
46}
47impl From<MODE_A> for bool {
48 #[inline(always)]
49 fn from(variant: MODE_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl MODE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> MODE_A {
57 match self.bits {
58 false => MODE_A::ENCRYPTION,
59 true => MODE_A::DECRYPTION,
60 }
61 }
62 #[doc = "Checks if the value of the field is `ENCRYPTION`"]
63 #[inline(always)]
64 pub fn is_encryption(&self) -> bool {
65 *self == MODE_A::ENCRYPTION
66 }
67 #[doc = "Checks if the value of the field is `DECRYPTION`"]
68 #[inline(always)]
69 pub fn is_decryption(&self) -> bool {
70 *self == MODE_A::DECRYPTION
71 }
72}
73#[doc = "Field `MODE` writer - The mode of operation to be used"]
74pub type MODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, MODE_SPEC, MODE_A, O>;
75impl<'a, const O: u8> MODE_W<'a, O> {
76 #[doc = "AES CCM packet encryption mode"]
77 #[inline(always)]
78 pub fn encryption(self) -> &'a mut W {
79 self.variant(MODE_A::ENCRYPTION)
80 }
81 #[doc = "AES CCM packet decryption mode"]
82 #[inline(always)]
83 pub fn decryption(self) -> &'a mut W {
84 self.variant(MODE_A::DECRYPTION)
85 }
86}
87#[doc = "Field `DATARATE` reader - Data rate that the CCM shall run in synch with"]
88pub type DATARATE_R = crate::BitReader<DATARATE_A>;
89#[doc = "Data rate that the CCM shall run in synch with\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum DATARATE_A {
92 #[doc = "0: In synch with 1 Mbit data rate"]
93 _1MBIT = 0,
94 #[doc = "1: In synch with 2 Mbit data rate"]
95 _2MBIT = 1,
96}
97impl From<DATARATE_A> for bool {
98 #[inline(always)]
99 fn from(variant: DATARATE_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl DATARATE_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> DATARATE_A {
107 match self.bits {
108 false => DATARATE_A::_1MBIT,
109 true => DATARATE_A::_2MBIT,
110 }
111 }
112 #[doc = "Checks if the value of the field is `_1MBIT`"]
113 #[inline(always)]
114 pub fn is_1mbit(&self) -> bool {
115 *self == DATARATE_A::_1MBIT
116 }
117 #[doc = "Checks if the value of the field is `_2MBIT`"]
118 #[inline(always)]
119 pub fn is_2mbit(&self) -> bool {
120 *self == DATARATE_A::_2MBIT
121 }
122}
123#[doc = "Field `DATARATE` writer - Data rate that the CCM shall run in synch with"]
124pub type DATARATE_W<'a, const O: u8> = crate::BitWriter<'a, u32, MODE_SPEC, DATARATE_A, O>;
125impl<'a, const O: u8> DATARATE_W<'a, O> {
126 #[doc = "In synch with 1 Mbit data rate"]
127 #[inline(always)]
128 pub fn _1mbit(self) -> &'a mut W {
129 self.variant(DATARATE_A::_1MBIT)
130 }
131 #[doc = "In synch with 2 Mbit data rate"]
132 #[inline(always)]
133 pub fn _2mbit(self) -> &'a mut W {
134 self.variant(DATARATE_A::_2MBIT)
135 }
136}
137#[doc = "Field `LENGTH` reader - Packet length configuration"]
138pub type LENGTH_R = crate::BitReader<LENGTH_A>;
139#[doc = "Packet length configuration\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum LENGTH_A {
142 #[doc = "0: Default length. Effective length of LENGTH field is 5-bit"]
143 DEFAULT = 0,
144 #[doc = "1: Extended length. Effective length of LENGTH field is 8-bit"]
145 EXTENDED = 1,
146}
147impl From<LENGTH_A> for bool {
148 #[inline(always)]
149 fn from(variant: LENGTH_A) -> Self {
150 variant as u8 != 0
151 }
152}
153impl LENGTH_R {
154 #[doc = "Get enumerated values variant"]
155 #[inline(always)]
156 pub fn variant(&self) -> LENGTH_A {
157 match self.bits {
158 false => LENGTH_A::DEFAULT,
159 true => LENGTH_A::EXTENDED,
160 }
161 }
162 #[doc = "Checks if the value of the field is `DEFAULT`"]
163 #[inline(always)]
164 pub fn is_default(&self) -> bool {
165 *self == LENGTH_A::DEFAULT
166 }
167 #[doc = "Checks if the value of the field is `EXTENDED`"]
168 #[inline(always)]
169 pub fn is_extended(&self) -> bool {
170 *self == LENGTH_A::EXTENDED
171 }
172}
173#[doc = "Field `LENGTH` writer - Packet length configuration"]
174pub type LENGTH_W<'a, const O: u8> = crate::BitWriter<'a, u32, MODE_SPEC, LENGTH_A, O>;
175impl<'a, const O: u8> LENGTH_W<'a, O> {
176 #[doc = "Default length. Effective length of LENGTH field is 5-bit"]
177 #[inline(always)]
178 pub fn default(self) -> &'a mut W {
179 self.variant(LENGTH_A::DEFAULT)
180 }
181 #[doc = "Extended length. Effective length of LENGTH field is 8-bit"]
182 #[inline(always)]
183 pub fn extended(self) -> &'a mut W {
184 self.variant(LENGTH_A::EXTENDED)
185 }
186}
187impl R {
188 #[doc = "Bit 0 - The mode of operation to be used"]
189 #[inline(always)]
190 pub fn mode(&self) -> MODE_R {
191 MODE_R::new((self.bits & 1) != 0)
192 }
193 #[doc = "Bit 16 - Data rate that the CCM shall run in synch with"]
194 #[inline(always)]
195 pub fn datarate(&self) -> DATARATE_R {
196 DATARATE_R::new(((self.bits >> 16) & 1) != 0)
197 }
198 #[doc = "Bit 24 - Packet length configuration"]
199 #[inline(always)]
200 pub fn length(&self) -> LENGTH_R {
201 LENGTH_R::new(((self.bits >> 24) & 1) != 0)
202 }
203}
204impl W {
205 #[doc = "Bit 0 - The mode of operation to be used"]
206 #[inline(always)]
207 pub fn mode(&mut self) -> MODE_W<0> {
208 MODE_W::new(self)
209 }
210 #[doc = "Bit 16 - Data rate that the CCM shall run in synch with"]
211 #[inline(always)]
212 pub fn datarate(&mut self) -> DATARATE_W<16> {
213 DATARATE_W::new(self)
214 }
215 #[doc = "Bit 24 - Packet length configuration"]
216 #[inline(always)]
217 pub fn length(&mut self) -> LENGTH_W<24> {
218 LENGTH_W::new(self)
219 }
220 #[doc = "Writes raw bits to the register."]
221 #[inline(always)]
222 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
223 self.0.bits(bits);
224 self
225 }
226}
227#[doc = "Operation mode\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [mode](index.html) module"]
228pub struct MODE_SPEC;
229impl crate::RegisterSpec for MODE_SPEC {
230 type Ux = u32;
231}
232#[doc = "`read()` method returns [mode::R](R) reader structure"]
233impl crate::Readable for MODE_SPEC {
234 type Reader = R;
235}
236#[doc = "`write(|w| ..)` method takes [mode::W](W) writer structure"]
237impl crate::Writable for MODE_SPEC {
238 type Writer = W;
239}
240#[doc = "`reset()` method sets MODE to value 0x01"]
241impl crate::Resettable for MODE_SPEC {
242 #[inline(always)]
243 fn reset_value() -> Self::Ux {
244 0x01
245 }
246}