1#[doc = "Register `SCTRL` reader"]
2pub type R = crate::R<SctrlSpec>;
3#[doc = "Register `SCTRL` writer"]
4pub type W = crate::W<SctrlSpec>;
5#[doc = "Event\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Event {
10 #[doc = "0: NORMAL_MODE"]
11 NormalMode = 0,
12 #[doc = "1: IBI"]
13 Ibi = 1,
14 #[doc = "2: CONTROLLER_REQUEST"]
15 MasterRequest = 2,
16 #[doc = "3: HOT_JOIN_REQUEST"]
17 HotJoinRequest = 3,
18}
19impl From<Event> for u8 {
20 #[inline(always)]
21 fn from(variant: Event) -> Self {
22 variant as _
23 }
24}
25impl crate::FieldSpec for Event {
26 type Ux = u8;
27}
28impl crate::IsEnum for Event {}
29#[doc = "Field `EVENT` reader - Event"]
30pub type EventR = crate::FieldReader<Event>;
31impl EventR {
32 #[doc = "Get enumerated values variant"]
33 #[inline(always)]
34 pub const fn variant(&self) -> Event {
35 match self.bits {
36 0 => Event::NormalMode,
37 1 => Event::Ibi,
38 2 => Event::MasterRequest,
39 3 => Event::HotJoinRequest,
40 _ => unreachable!(),
41 }
42 }
43 #[doc = "NORMAL_MODE"]
44 #[inline(always)]
45 pub fn is_normal_mode(&self) -> bool {
46 *self == Event::NormalMode
47 }
48 #[doc = "IBI"]
49 #[inline(always)]
50 pub fn is_ibi(&self) -> bool {
51 *self == Event::Ibi
52 }
53 #[doc = "CONTROLLER_REQUEST"]
54 #[inline(always)]
55 pub fn is_master_request(&self) -> bool {
56 *self == Event::MasterRequest
57 }
58 #[doc = "HOT_JOIN_REQUEST"]
59 #[inline(always)]
60 pub fn is_hot_join_request(&self) -> bool {
61 *self == Event::HotJoinRequest
62 }
63}
64#[doc = "Field `EVENT` writer - Event"]
65pub type EventW<'a, REG> = crate::FieldWriter<'a, REG, 2, Event, crate::Safe>;
66impl<'a, REG> EventW<'a, REG>
67where
68 REG: crate::Writable + crate::RegisterSpec,
69 REG::Ux: From<u8>,
70{
71 #[doc = "NORMAL_MODE"]
72 #[inline(always)]
73 pub fn normal_mode(self) -> &'a mut crate::W<REG> {
74 self.variant(Event::NormalMode)
75 }
76 #[doc = "IBI"]
77 #[inline(always)]
78 pub fn ibi(self) -> &'a mut crate::W<REG> {
79 self.variant(Event::Ibi)
80 }
81 #[doc = "CONTROLLER_REQUEST"]
82 #[inline(always)]
83 pub fn master_request(self) -> &'a mut crate::W<REG> {
84 self.variant(Event::MasterRequest)
85 }
86 #[doc = "HOT_JOIN_REQUEST"]
87 #[inline(always)]
88 pub fn hot_join_request(self) -> &'a mut crate::W<REG> {
89 self.variant(Event::HotJoinRequest)
90 }
91}
92#[doc = "Extended Data\n\nValue on reset: 0"]
93#[cfg_attr(feature = "defmt", derive(defmt::Format))]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum Extdata {
96 #[doc = "0: Disable"]
97 Disable = 0,
98 #[doc = "1: Enable"]
99 Enable = 1,
100}
101impl From<Extdata> for bool {
102 #[inline(always)]
103 fn from(variant: Extdata) -> Self {
104 variant as u8 != 0
105 }
106}
107#[doc = "Field `EXTDATA` reader - Extended Data"]
108pub type ExtdataR = crate::BitReader<Extdata>;
109impl ExtdataR {
110 #[doc = "Get enumerated values variant"]
111 #[inline(always)]
112 pub const fn variant(&self) -> Extdata {
113 match self.bits {
114 false => Extdata::Disable,
115 true => Extdata::Enable,
116 }
117 }
118 #[doc = "Disable"]
119 #[inline(always)]
120 pub fn is_disable(&self) -> bool {
121 *self == Extdata::Disable
122 }
123 #[doc = "Enable"]
124 #[inline(always)]
125 pub fn is_enable(&self) -> bool {
126 *self == Extdata::Enable
127 }
128}
129#[doc = "Field `EXTDATA` writer - Extended Data"]
130pub type ExtdataW<'a, REG> = crate::BitWriter<'a, REG, Extdata>;
131impl<'a, REG> ExtdataW<'a, REG>
132where
133 REG: crate::Writable + crate::RegisterSpec,
134{
135 #[doc = "Disable"]
136 #[inline(always)]
137 pub fn disable(self) -> &'a mut crate::W<REG> {
138 self.variant(Extdata::Disable)
139 }
140 #[doc = "Enable"]
141 #[inline(always)]
142 pub fn enable(self) -> &'a mut crate::W<REG> {
143 self.variant(Extdata::Enable)
144 }
145}
146#[doc = "Field `IBIDATA` reader - In-Band Interrupt Data"]
147pub type IbidataR = crate::FieldReader;
148#[doc = "Field `IBIDATA` writer - In-Band Interrupt Data"]
149pub type IbidataW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
150#[doc = "Field `PENDINT` reader - Pending Interrupt"]
151pub type PendintR = crate::FieldReader;
152#[doc = "Field `PENDINT` writer - Pending Interrupt"]
153pub type PendintW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
154#[doc = "Field `ACTSTATE` reader - Activity State of Target"]
155pub type ActstateR = crate::FieldReader;
156#[doc = "Field `ACTSTATE` writer - Activity State of Target"]
157pub type ActstateW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
158#[doc = "Field `VENDINFO` reader - Vendor Information"]
159pub type VendinfoR = crate::FieldReader;
160#[doc = "Field `VENDINFO` writer - Vendor Information"]
161pub type VendinfoW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
162impl R {
163 #[doc = "Bits 0:1 - Event"]
164 #[inline(always)]
165 pub fn event(&self) -> EventR {
166 EventR::new((self.bits & 3) as u8)
167 }
168 #[doc = "Bit 3 - Extended Data"]
169 #[inline(always)]
170 pub fn extdata(&self) -> ExtdataR {
171 ExtdataR::new(((self.bits >> 3) & 1) != 0)
172 }
173 #[doc = "Bits 8:15 - In-Band Interrupt Data"]
174 #[inline(always)]
175 pub fn ibidata(&self) -> IbidataR {
176 IbidataR::new(((self.bits >> 8) & 0xff) as u8)
177 }
178 #[doc = "Bits 16:19 - Pending Interrupt"]
179 #[inline(always)]
180 pub fn pendint(&self) -> PendintR {
181 PendintR::new(((self.bits >> 16) & 0x0f) as u8)
182 }
183 #[doc = "Bits 20:21 - Activity State of Target"]
184 #[inline(always)]
185 pub fn actstate(&self) -> ActstateR {
186 ActstateR::new(((self.bits >> 20) & 3) as u8)
187 }
188 #[doc = "Bits 24:31 - Vendor Information"]
189 #[inline(always)]
190 pub fn vendinfo(&self) -> VendinfoR {
191 VendinfoR::new(((self.bits >> 24) & 0xff) as u8)
192 }
193}
194#[cfg(feature = "debug")]
195impl core::fmt::Debug for R {
196 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
197 f.debug_struct("SCTRL")
198 .field("event", &self.event())
199 .field("extdata", &self.extdata())
200 .field("ibidata", &self.ibidata())
201 .field("pendint", &self.pendint())
202 .field("actstate", &self.actstate())
203 .field("vendinfo", &self.vendinfo())
204 .finish()
205 }
206}
207impl W {
208 #[doc = "Bits 0:1 - Event"]
209 #[inline(always)]
210 pub fn event(&mut self) -> EventW<'_, SctrlSpec> {
211 EventW::new(self, 0)
212 }
213 #[doc = "Bit 3 - Extended Data"]
214 #[inline(always)]
215 pub fn extdata(&mut self) -> ExtdataW<'_, SctrlSpec> {
216 ExtdataW::new(self, 3)
217 }
218 #[doc = "Bits 8:15 - In-Band Interrupt Data"]
219 #[inline(always)]
220 pub fn ibidata(&mut self) -> IbidataW<'_, SctrlSpec> {
221 IbidataW::new(self, 8)
222 }
223 #[doc = "Bits 16:19 - Pending Interrupt"]
224 #[inline(always)]
225 pub fn pendint(&mut self) -> PendintW<'_, SctrlSpec> {
226 PendintW::new(self, 16)
227 }
228 #[doc = "Bits 20:21 - Activity State of Target"]
229 #[inline(always)]
230 pub fn actstate(&mut self) -> ActstateW<'_, SctrlSpec> {
231 ActstateW::new(self, 20)
232 }
233 #[doc = "Bits 24:31 - Vendor Information"]
234 #[inline(always)]
235 pub fn vendinfo(&mut self) -> VendinfoW<'_, SctrlSpec> {
236 VendinfoW::new(self, 24)
237 }
238}
239#[doc = "Target Control\n\nYou can [`read`](crate::Reg::read) this register and get [`sctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
240pub struct SctrlSpec;
241impl crate::RegisterSpec for SctrlSpec {
242 type Ux = u32;
243}
244#[doc = "`read()` method returns [`sctrl::R`](R) reader structure"]
245impl crate::Readable for SctrlSpec {}
246#[doc = "`write(|w| ..)` method takes [`sctrl::W`](W) writer structure"]
247impl crate::Writable for SctrlSpec {
248 type Safety = crate::Unsafe;
249}
250#[doc = "`reset()` method sets SCTRL to value 0"]
251impl crate::Resettable for SctrlSpec {}