1#![doc = "Peripheral access API for NRF51 microcontrollers (generated using svd2rust v0.25.1 ( ))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next]
2svd2rust release can be generated by cloning the svd2rust [repository], checking out the above commit, and running `cargo doc --open`.\n\n[here]: https://docs.rs/svd2rust/0.25.1/svd2rust/#peripheral-api\n[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n[repository]: https://github.com/rust-embedded/svd2rust"]
3#![deny(const_err)]
4#![deny(dead_code)]
5#![deny(improper_ctypes)]
6#![deny(missing_docs)]
7#![deny(no_mangle_generic_items)]
8#![deny(non_shorthand_field_patterns)]
9#![deny(overflowing_literals)]
10#![deny(path_statements)]
11#![deny(patterns_in_fns_without_body)]
12#![deny(private_in_public)]
13#![deny(unconditional_recursion)]
14#![deny(unused_allocation)]
15#![deny(unused_comparisons)]
16#![deny(unused_parens)]
17#![deny(while_true)]
18#![allow(non_camel_case_types)]
19#![allow(non_snake_case)]
20#![no_std]
21use core::marker::PhantomData;
22use core::ops::Deref;
23#[doc = r"Number available in the NVIC for configuring priority"]
24pub const NVIC_PRIO_BITS: u8 = 2;
25#[cfg(feature = "rt")]
26pub use self::Interrupt as interrupt;
27pub use cortex_m::peripheral::Peripherals as CorePeripherals;
28pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, ITM, MPU, NVIC, SCB, SYST, TPIU};
29#[cfg(feature = "rt")]
30pub use cortex_m_rt::interrupt;
31#[allow(unused_imports)]
32use generic::*;
33#[doc = r"Common register and bit access and modify traits"]
34pub mod generic;
35#[cfg(feature = "rt")]
36extern "C" {
37 fn POWER_CLOCK();
38 fn RADIO();
39 fn UART0();
40 fn SPI0_TWI0();
41 fn SPI1_TWI1();
42 fn GPIOTE();
43 fn ADC();
44 fn TIMER0();
45 fn TIMER1();
46 fn TIMER2();
47 fn RTC0();
48 fn TEMP();
49 fn RNG();
50 fn ECB();
51 fn CCM_AAR();
52 fn WDT();
53 fn RTC1();
54 fn QDEC();
55 fn LPCOMP();
56 fn SWI0();
57 fn SWI1();
58 fn SWI2();
59 fn SWI3();
60 fn SWI4();
61 fn SWI5();
62}
63#[doc(hidden)]
64pub union Vector {
65 _handler: unsafe extern "C" fn(),
66 _reserved: u32,
67}
68#[cfg(feature = "rt")]
69#[doc(hidden)]
70#[link_section = ".vector_table.interrupts"]
71#[no_mangle]
72pub static __INTERRUPTS: [Vector; 26] = [
73 Vector {
74 _handler: POWER_CLOCK,
75 },
76 Vector { _handler: RADIO },
77 Vector { _handler: UART0 },
78 Vector {
79 _handler: SPI0_TWI0,
80 },
81 Vector {
82 _handler: SPI1_TWI1,
83 },
84 Vector { _reserved: 0 },
85 Vector { _handler: GPIOTE },
86 Vector { _handler: ADC },
87 Vector { _handler: TIMER0 },
88 Vector { _handler: TIMER1 },
89 Vector { _handler: TIMER2 },
90 Vector { _handler: RTC0 },
91 Vector { _handler: TEMP },
92 Vector { _handler: RNG },
93 Vector { _handler: ECB },
94 Vector { _handler: CCM_AAR },
95 Vector { _handler: WDT },
96 Vector { _handler: RTC1 },
97 Vector { _handler: QDEC },
98 Vector { _handler: LPCOMP },
99 Vector { _handler: SWI0 },
100 Vector { _handler: SWI1 },
101 Vector { _handler: SWI2 },
102 Vector { _handler: SWI3 },
103 Vector { _handler: SWI4 },
104 Vector { _handler: SWI5 },
105];
106#[doc = r"Enumeration of all the interrupts."]
107#[derive(Copy, Clone, Debug, PartialEq, Eq)]
108#[repr(u16)]
109pub enum Interrupt {
110 #[doc = "0 - POWER_CLOCK"]
111 POWER_CLOCK = 0,
112 #[doc = "1 - RADIO"]
113 RADIO = 1,
114 #[doc = "2 - UART0"]
115 UART0 = 2,
116 #[doc = "3 - SPI0_TWI0"]
117 SPI0_TWI0 = 3,
118 #[doc = "4 - SPI1_TWI1"]
119 SPI1_TWI1 = 4,
120 #[doc = "6 - GPIOTE"]
121 GPIOTE = 6,
122 #[doc = "7 - ADC"]
123 ADC = 7,
124 #[doc = "8 - TIMER0"]
125 TIMER0 = 8,
126 #[doc = "9 - TIMER1"]
127 TIMER1 = 9,
128 #[doc = "10 - TIMER2"]
129 TIMER2 = 10,
130 #[doc = "11 - RTC0"]
131 RTC0 = 11,
132 #[doc = "12 - TEMP"]
133 TEMP = 12,
134 #[doc = "13 - RNG"]
135 RNG = 13,
136 #[doc = "14 - ECB"]
137 ECB = 14,
138 #[doc = "15 - CCM_AAR"]
139 CCM_AAR = 15,
140 #[doc = "16 - WDT"]
141 WDT = 16,
142 #[doc = "17 - RTC1"]
143 RTC1 = 17,
144 #[doc = "18 - QDEC"]
145 QDEC = 18,
146 #[doc = "19 - LPCOMP"]
147 LPCOMP = 19,
148 #[doc = "20 - SWI0"]
149 SWI0 = 20,
150 #[doc = "21 - SWI1"]
151 SWI1 = 21,
152 #[doc = "22 - SWI2"]
153 SWI2 = 22,
154 #[doc = "23 - SWI3"]
155 SWI3 = 23,
156 #[doc = "24 - SWI4"]
157 SWI4 = 24,
158 #[doc = "25 - SWI5"]
159 SWI5 = 25,
160}
161unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
162 #[inline(always)]
163 fn number(self) -> u16 {
164 self as u16
165 }
166}
167#[doc = "Power Control."]
168pub struct POWER {
169 _marker: PhantomData<*const ()>,
170}
171unsafe impl Send for POWER {}
172impl POWER {
173 #[doc = r"Pointer to the register block"]
174 pub const PTR: *const power::RegisterBlock = 0x4000_0000 as *const _;
175 #[doc = r"Return the pointer to the register block"]
176 #[inline(always)]
177 pub const fn ptr() -> *const power::RegisterBlock {
178 Self::PTR
179 }
180}
181impl Deref for POWER {
182 type Target = power::RegisterBlock;
183 #[inline(always)]
184 fn deref(&self) -> &Self::Target {
185 unsafe { &*Self::PTR }
186 }
187}
188impl core::fmt::Debug for POWER {
189 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
190 f.debug_struct("POWER").finish()
191 }
192}
193#[doc = "Power Control."]
194pub mod power;
195#[doc = "Clock control."]
196pub struct CLOCK {
197 _marker: PhantomData<*const ()>,
198}
199unsafe impl Send for CLOCK {}
200impl CLOCK {
201 #[doc = r"Pointer to the register block"]
202 pub const PTR: *const clock::RegisterBlock = 0x4000_0000 as *const _;
203 #[doc = r"Return the pointer to the register block"]
204 #[inline(always)]
205 pub const fn ptr() -> *const clock::RegisterBlock {
206 Self::PTR
207 }
208}
209impl Deref for CLOCK {
210 type Target = clock::RegisterBlock;
211 #[inline(always)]
212 fn deref(&self) -> &Self::Target {
213 unsafe { &*Self::PTR }
214 }
215}
216impl core::fmt::Debug for CLOCK {
217 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
218 f.debug_struct("CLOCK").finish()
219 }
220}
221#[doc = "Clock control."]
222pub mod clock;
223#[doc = "The radio."]
224pub struct RADIO {
225 _marker: PhantomData<*const ()>,
226}
227unsafe impl Send for RADIO {}
228impl RADIO {
229 #[doc = r"Pointer to the register block"]
230 pub const PTR: *const radio::RegisterBlock = 0x4000_1000 as *const _;
231 #[doc = r"Return the pointer to the register block"]
232 #[inline(always)]
233 pub const fn ptr() -> *const radio::RegisterBlock {
234 Self::PTR
235 }
236}
237impl Deref for RADIO {
238 type Target = radio::RegisterBlock;
239 #[inline(always)]
240 fn deref(&self) -> &Self::Target {
241 unsafe { &*Self::PTR }
242 }
243}
244impl core::fmt::Debug for RADIO {
245 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
246 f.debug_struct("RADIO").finish()
247 }
248}
249#[doc = "The radio."]
250pub mod radio;
251#[doc = "Universal Asynchronous Receiver/Transmitter."]
252pub struct UART0 {
253 _marker: PhantomData<*const ()>,
254}
255unsafe impl Send for UART0 {}
256impl UART0 {
257 #[doc = r"Pointer to the register block"]
258 pub const PTR: *const uart0::RegisterBlock = 0x4000_2000 as *const _;
259 #[doc = r"Return the pointer to the register block"]
260 #[inline(always)]
261 pub const fn ptr() -> *const uart0::RegisterBlock {
262 Self::PTR
263 }
264}
265impl Deref for UART0 {
266 type Target = uart0::RegisterBlock;
267 #[inline(always)]
268 fn deref(&self) -> &Self::Target {
269 unsafe { &*Self::PTR }
270 }
271}
272impl core::fmt::Debug for UART0 {
273 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
274 f.debug_struct("UART0").finish()
275 }
276}
277#[doc = "Universal Asynchronous Receiver/Transmitter."]
278pub mod uart0;
279#[doc = "SPI master 0."]
280pub struct SPI0 {
281 _marker: PhantomData<*const ()>,
282}
283unsafe impl Send for SPI0 {}
284impl SPI0 {
285 #[doc = r"Pointer to the register block"]
286 pub const PTR: *const spi0::RegisterBlock = 0x4000_3000 as *const _;
287 #[doc = r"Return the pointer to the register block"]
288 #[inline(always)]
289 pub const fn ptr() -> *const spi0::RegisterBlock {
290 Self::PTR
291 }
292}
293impl Deref for SPI0 {
294 type Target = spi0::RegisterBlock;
295 #[inline(always)]
296 fn deref(&self) -> &Self::Target {
297 unsafe { &*Self::PTR }
298 }
299}
300impl core::fmt::Debug for SPI0 {
301 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
302 f.debug_struct("SPI0").finish()
303 }
304}
305#[doc = "SPI master 0."]
306pub mod spi0;
307#[doc = "Two-wire interface master 0."]
308pub struct TWI0 {
309 _marker: PhantomData<*const ()>,
310}
311unsafe impl Send for TWI0 {}
312impl TWI0 {
313 #[doc = r"Pointer to the register block"]
314 pub const PTR: *const twi0::RegisterBlock = 0x4000_3000 as *const _;
315 #[doc = r"Return the pointer to the register block"]
316 #[inline(always)]
317 pub const fn ptr() -> *const twi0::RegisterBlock {
318 Self::PTR
319 }
320}
321impl Deref for TWI0 {
322 type Target = twi0::RegisterBlock;
323 #[inline(always)]
324 fn deref(&self) -> &Self::Target {
325 unsafe { &*Self::PTR }
326 }
327}
328impl core::fmt::Debug for TWI0 {
329 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
330 f.debug_struct("TWI0").finish()
331 }
332}
333#[doc = "Two-wire interface master 0."]
334pub mod twi0;
335#[doc = "SPI master 1."]
336pub struct SPI1 {
337 _marker: PhantomData<*const ()>,
338}
339unsafe impl Send for SPI1 {}
340impl SPI1 {
341 #[doc = r"Pointer to the register block"]
342 pub const PTR: *const spi0::RegisterBlock = 0x4000_4000 as *const _;
343 #[doc = r"Return the pointer to the register block"]
344 #[inline(always)]
345 pub const fn ptr() -> *const spi0::RegisterBlock {
346 Self::PTR
347 }
348}
349impl Deref for SPI1 {
350 type Target = spi0::RegisterBlock;
351 #[inline(always)]
352 fn deref(&self) -> &Self::Target {
353 unsafe { &*Self::PTR }
354 }
355}
356impl core::fmt::Debug for SPI1 {
357 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
358 f.debug_struct("SPI1").finish()
359 }
360}
361#[doc = "SPI master 1."]
362pub use spi0 as spi1;
363#[doc = "Two-wire interface master 1."]
364pub struct TWI1 {
365 _marker: PhantomData<*const ()>,
366}
367unsafe impl Send for TWI1 {}
368impl TWI1 {
369 #[doc = r"Pointer to the register block"]
370 pub const PTR: *const twi0::RegisterBlock = 0x4000_4000 as *const _;
371 #[doc = r"Return the pointer to the register block"]
372 #[inline(always)]
373 pub const fn ptr() -> *const twi0::RegisterBlock {
374 Self::PTR
375 }
376}
377impl Deref for TWI1 {
378 type Target = twi0::RegisterBlock;
379 #[inline(always)]
380 fn deref(&self) -> &Self::Target {
381 unsafe { &*Self::PTR }
382 }
383}
384impl core::fmt::Debug for TWI1 {
385 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
386 f.debug_struct("TWI1").finish()
387 }
388}
389#[doc = "Two-wire interface master 1."]
390pub use twi0 as twi1;
391#[doc = "SPI slave 1."]
392pub struct SPIS1 {
393 _marker: PhantomData<*const ()>,
394}
395unsafe impl Send for SPIS1 {}
396impl SPIS1 {
397 #[doc = r"Pointer to the register block"]
398 pub const PTR: *const spis1::RegisterBlock = 0x4000_4000 as *const _;
399 #[doc = r"Return the pointer to the register block"]
400 #[inline(always)]
401 pub const fn ptr() -> *const spis1::RegisterBlock {
402 Self::PTR
403 }
404}
405impl Deref for SPIS1 {
406 type Target = spis1::RegisterBlock;
407 #[inline(always)]
408 fn deref(&self) -> &Self::Target {
409 unsafe { &*Self::PTR }
410 }
411}
412impl core::fmt::Debug for SPIS1 {
413 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
414 f.debug_struct("SPIS1").finish()
415 }
416}
417#[doc = "SPI slave 1."]
418pub mod spis1;
419#[doc = "GPIO tasks and events."]
420pub struct GPIOTE {
421 _marker: PhantomData<*const ()>,
422}
423unsafe impl Send for GPIOTE {}
424impl GPIOTE {
425 #[doc = r"Pointer to the register block"]
426 pub const PTR: *const gpiote::RegisterBlock = 0x4000_6000 as *const _;
427 #[doc = r"Return the pointer to the register block"]
428 #[inline(always)]
429 pub const fn ptr() -> *const gpiote::RegisterBlock {
430 Self::PTR
431 }
432}
433impl Deref for GPIOTE {
434 type Target = gpiote::RegisterBlock;
435 #[inline(always)]
436 fn deref(&self) -> &Self::Target {
437 unsafe { &*Self::PTR }
438 }
439}
440impl core::fmt::Debug for GPIOTE {
441 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
442 f.debug_struct("GPIOTE").finish()
443 }
444}
445#[doc = "GPIO tasks and events."]
446pub mod gpiote;
447#[doc = "Analog to digital converter."]
448pub struct ADC {
449 _marker: PhantomData<*const ()>,
450}
451unsafe impl Send for ADC {}
452impl ADC {
453 #[doc = r"Pointer to the register block"]
454 pub const PTR: *const adc::RegisterBlock = 0x4000_7000 as *const _;
455 #[doc = r"Return the pointer to the register block"]
456 #[inline(always)]
457 pub const fn ptr() -> *const adc::RegisterBlock {
458 Self::PTR
459 }
460}
461impl Deref for ADC {
462 type Target = adc::RegisterBlock;
463 #[inline(always)]
464 fn deref(&self) -> &Self::Target {
465 unsafe { &*Self::PTR }
466 }
467}
468impl core::fmt::Debug for ADC {
469 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
470 f.debug_struct("ADC").finish()
471 }
472}
473#[doc = "Analog to digital converter."]
474pub mod adc;
475#[doc = "Timer 0."]
476pub struct TIMER0 {
477 _marker: PhantomData<*const ()>,
478}
479unsafe impl Send for TIMER0 {}
480impl TIMER0 {
481 #[doc = r"Pointer to the register block"]
482 pub const PTR: *const timer0::RegisterBlock = 0x4000_8000 as *const _;
483 #[doc = r"Return the pointer to the register block"]
484 #[inline(always)]
485 pub const fn ptr() -> *const timer0::RegisterBlock {
486 Self::PTR
487 }
488}
489impl Deref for TIMER0 {
490 type Target = timer0::RegisterBlock;
491 #[inline(always)]
492 fn deref(&self) -> &Self::Target {
493 unsafe { &*Self::PTR }
494 }
495}
496impl core::fmt::Debug for TIMER0 {
497 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
498 f.debug_struct("TIMER0").finish()
499 }
500}
501#[doc = "Timer 0."]
502pub mod timer0;
503#[doc = "Timer 1."]
504pub struct TIMER1 {
505 _marker: PhantomData<*const ()>,
506}
507unsafe impl Send for TIMER1 {}
508impl TIMER1 {
509 #[doc = r"Pointer to the register block"]
510 pub const PTR: *const timer0::RegisterBlock = 0x4000_9000 as *const _;
511 #[doc = r"Return the pointer to the register block"]
512 #[inline(always)]
513 pub const fn ptr() -> *const timer0::RegisterBlock {
514 Self::PTR
515 }
516}
517impl Deref for TIMER1 {
518 type Target = timer0::RegisterBlock;
519 #[inline(always)]
520 fn deref(&self) -> &Self::Target {
521 unsafe { &*Self::PTR }
522 }
523}
524impl core::fmt::Debug for TIMER1 {
525 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
526 f.debug_struct("TIMER1").finish()
527 }
528}
529#[doc = "Timer 1."]
530pub use timer0 as timer1;
531#[doc = "Timer 2."]
532pub struct TIMER2 {
533 _marker: PhantomData<*const ()>,
534}
535unsafe impl Send for TIMER2 {}
536impl TIMER2 {
537 #[doc = r"Pointer to the register block"]
538 pub const PTR: *const timer0::RegisterBlock = 0x4000_a000 as *const _;
539 #[doc = r"Return the pointer to the register block"]
540 #[inline(always)]
541 pub const fn ptr() -> *const timer0::RegisterBlock {
542 Self::PTR
543 }
544}
545impl Deref for TIMER2 {
546 type Target = timer0::RegisterBlock;
547 #[inline(always)]
548 fn deref(&self) -> &Self::Target {
549 unsafe { &*Self::PTR }
550 }
551}
552impl core::fmt::Debug for TIMER2 {
553 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
554 f.debug_struct("TIMER2").finish()
555 }
556}
557#[doc = "Timer 2."]
558pub use timer0 as timer2;
559#[doc = "Real time counter 0."]
560pub struct RTC0 {
561 _marker: PhantomData<*const ()>,
562}
563unsafe impl Send for RTC0 {}
564impl RTC0 {
565 #[doc = r"Pointer to the register block"]
566 pub const PTR: *const rtc0::RegisterBlock = 0x4000_b000 as *const _;
567 #[doc = r"Return the pointer to the register block"]
568 #[inline(always)]
569 pub const fn ptr() -> *const rtc0::RegisterBlock {
570 Self::PTR
571 }
572}
573impl Deref for RTC0 {
574 type Target = rtc0::RegisterBlock;
575 #[inline(always)]
576 fn deref(&self) -> &Self::Target {
577 unsafe { &*Self::PTR }
578 }
579}
580impl core::fmt::Debug for RTC0 {
581 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
582 f.debug_struct("RTC0").finish()
583 }
584}
585#[doc = "Real time counter 0."]
586pub mod rtc0;
587#[doc = "Temperature Sensor."]
588pub struct TEMP {
589 _marker: PhantomData<*const ()>,
590}
591unsafe impl Send for TEMP {}
592impl TEMP {
593 #[doc = r"Pointer to the register block"]
594 pub const PTR: *const temp::RegisterBlock = 0x4000_c000 as *const _;
595 #[doc = r"Return the pointer to the register block"]
596 #[inline(always)]
597 pub const fn ptr() -> *const temp::RegisterBlock {
598 Self::PTR
599 }
600}
601impl Deref for TEMP {
602 type Target = temp::RegisterBlock;
603 #[inline(always)]
604 fn deref(&self) -> &Self::Target {
605 unsafe { &*Self::PTR }
606 }
607}
608impl core::fmt::Debug for TEMP {
609 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
610 f.debug_struct("TEMP").finish()
611 }
612}
613#[doc = "Temperature Sensor."]
614pub mod temp;
615#[doc = "Random Number Generator."]
616pub struct RNG {
617 _marker: PhantomData<*const ()>,
618}
619unsafe impl Send for RNG {}
620impl RNG {
621 #[doc = r"Pointer to the register block"]
622 pub const PTR: *const rng::RegisterBlock = 0x4000_d000 as *const _;
623 #[doc = r"Return the pointer to the register block"]
624 #[inline(always)]
625 pub const fn ptr() -> *const rng::RegisterBlock {
626 Self::PTR
627 }
628}
629impl Deref for RNG {
630 type Target = rng::RegisterBlock;
631 #[inline(always)]
632 fn deref(&self) -> &Self::Target {
633 unsafe { &*Self::PTR }
634 }
635}
636impl core::fmt::Debug for RNG {
637 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
638 f.debug_struct("RNG").finish()
639 }
640}
641#[doc = "Random Number Generator."]
642pub mod rng;
643#[doc = "AES ECB Mode Encryption."]
644pub struct ECB {
645 _marker: PhantomData<*const ()>,
646}
647unsafe impl Send for ECB {}
648impl ECB {
649 #[doc = r"Pointer to the register block"]
650 pub const PTR: *const ecb::RegisterBlock = 0x4000_e000 as *const _;
651 #[doc = r"Return the pointer to the register block"]
652 #[inline(always)]
653 pub const fn ptr() -> *const ecb::RegisterBlock {
654 Self::PTR
655 }
656}
657impl Deref for ECB {
658 type Target = ecb::RegisterBlock;
659 #[inline(always)]
660 fn deref(&self) -> &Self::Target {
661 unsafe { &*Self::PTR }
662 }
663}
664impl core::fmt::Debug for ECB {
665 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
666 f.debug_struct("ECB").finish()
667 }
668}
669#[doc = "AES ECB Mode Encryption."]
670pub mod ecb;
671#[doc = "Accelerated Address Resolver."]
672pub struct AAR {
673 _marker: PhantomData<*const ()>,
674}
675unsafe impl Send for AAR {}
676impl AAR {
677 #[doc = r"Pointer to the register block"]
678 pub const PTR: *const aar::RegisterBlock = 0x4000_f000 as *const _;
679 #[doc = r"Return the pointer to the register block"]
680 #[inline(always)]
681 pub const fn ptr() -> *const aar::RegisterBlock {
682 Self::PTR
683 }
684}
685impl Deref for AAR {
686 type Target = aar::RegisterBlock;
687 #[inline(always)]
688 fn deref(&self) -> &Self::Target {
689 unsafe { &*Self::PTR }
690 }
691}
692impl core::fmt::Debug for AAR {
693 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
694 f.debug_struct("AAR").finish()
695 }
696}
697#[doc = "Accelerated Address Resolver."]
698pub mod aar;
699#[doc = "AES CCM Mode Encryption."]
700pub struct CCM {
701 _marker: PhantomData<*const ()>,
702}
703unsafe impl Send for CCM {}
704impl CCM {
705 #[doc = r"Pointer to the register block"]
706 pub const PTR: *const ccm::RegisterBlock = 0x4000_f000 as *const _;
707 #[doc = r"Return the pointer to the register block"]
708 #[inline(always)]
709 pub const fn ptr() -> *const ccm::RegisterBlock {
710 Self::PTR
711 }
712}
713impl Deref for CCM {
714 type Target = ccm::RegisterBlock;
715 #[inline(always)]
716 fn deref(&self) -> &Self::Target {
717 unsafe { &*Self::PTR }
718 }
719}
720impl core::fmt::Debug for CCM {
721 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
722 f.debug_struct("CCM").finish()
723 }
724}
725#[doc = "AES CCM Mode Encryption."]
726pub mod ccm;
727#[doc = "Watchdog Timer."]
728pub struct WDT {
729 _marker: PhantomData<*const ()>,
730}
731unsafe impl Send for WDT {}
732impl WDT {
733 #[doc = r"Pointer to the register block"]
734 pub const PTR: *const wdt::RegisterBlock = 0x4001_0000 as *const _;
735 #[doc = r"Return the pointer to the register block"]
736 #[inline(always)]
737 pub const fn ptr() -> *const wdt::RegisterBlock {
738 Self::PTR
739 }
740}
741impl Deref for WDT {
742 type Target = wdt::RegisterBlock;
743 #[inline(always)]
744 fn deref(&self) -> &Self::Target {
745 unsafe { &*Self::PTR }
746 }
747}
748impl core::fmt::Debug for WDT {
749 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
750 f.debug_struct("WDT").finish()
751 }
752}
753#[doc = "Watchdog Timer."]
754pub mod wdt;
755#[doc = "Real time counter 1."]
756pub struct RTC1 {
757 _marker: PhantomData<*const ()>,
758}
759unsafe impl Send for RTC1 {}
760impl RTC1 {
761 #[doc = r"Pointer to the register block"]
762 pub const PTR: *const rtc0::RegisterBlock = 0x4001_1000 as *const _;
763 #[doc = r"Return the pointer to the register block"]
764 #[inline(always)]
765 pub const fn ptr() -> *const rtc0::RegisterBlock {
766 Self::PTR
767 }
768}
769impl Deref for RTC1 {
770 type Target = rtc0::RegisterBlock;
771 #[inline(always)]
772 fn deref(&self) -> &Self::Target {
773 unsafe { &*Self::PTR }
774 }
775}
776impl core::fmt::Debug for RTC1 {
777 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
778 f.debug_struct("RTC1").finish()
779 }
780}
781#[doc = "Real time counter 1."]
782pub use rtc0 as rtc1;
783#[doc = "Rotary decoder."]
784pub struct QDEC {
785 _marker: PhantomData<*const ()>,
786}
787unsafe impl Send for QDEC {}
788impl QDEC {
789 #[doc = r"Pointer to the register block"]
790 pub const PTR: *const qdec::RegisterBlock = 0x4001_2000 as *const _;
791 #[doc = r"Return the pointer to the register block"]
792 #[inline(always)]
793 pub const fn ptr() -> *const qdec::RegisterBlock {
794 Self::PTR
795 }
796}
797impl Deref for QDEC {
798 type Target = qdec::RegisterBlock;
799 #[inline(always)]
800 fn deref(&self) -> &Self::Target {
801 unsafe { &*Self::PTR }
802 }
803}
804impl core::fmt::Debug for QDEC {
805 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
806 f.debug_struct("QDEC").finish()
807 }
808}
809#[doc = "Rotary decoder."]
810pub mod qdec;
811#[doc = "Low power comparator."]
812pub struct LPCOMP {
813 _marker: PhantomData<*const ()>,
814}
815unsafe impl Send for LPCOMP {}
816impl LPCOMP {
817 #[doc = r"Pointer to the register block"]
818 pub const PTR: *const lpcomp::RegisterBlock = 0x4001_3000 as *const _;
819 #[doc = r"Return the pointer to the register block"]
820 #[inline(always)]
821 pub const fn ptr() -> *const lpcomp::RegisterBlock {
822 Self::PTR
823 }
824}
825impl Deref for LPCOMP {
826 type Target = lpcomp::RegisterBlock;
827 #[inline(always)]
828 fn deref(&self) -> &Self::Target {
829 unsafe { &*Self::PTR }
830 }
831}
832impl core::fmt::Debug for LPCOMP {
833 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
834 f.debug_struct("LPCOMP").finish()
835 }
836}
837#[doc = "Low power comparator."]
838pub mod lpcomp;
839#[doc = "SW Interrupts."]
840pub struct SWI {
841 _marker: PhantomData<*const ()>,
842}
843unsafe impl Send for SWI {}
844impl SWI {
845 #[doc = r"Pointer to the register block"]
846 pub const PTR: *const swi::RegisterBlock = 0x4001_4000 as *const _;
847 #[doc = r"Return the pointer to the register block"]
848 #[inline(always)]
849 pub const fn ptr() -> *const swi::RegisterBlock {
850 Self::PTR
851 }
852}
853impl Deref for SWI {
854 type Target = swi::RegisterBlock;
855 #[inline(always)]
856 fn deref(&self) -> &Self::Target {
857 unsafe { &*Self::PTR }
858 }
859}
860impl core::fmt::Debug for SWI {
861 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
862 f.debug_struct("SWI").finish()
863 }
864}
865#[doc = "SW Interrupts."]
866pub mod swi;
867#[doc = "Non Volatile Memory Controller."]
868pub struct NVMC {
869 _marker: PhantomData<*const ()>,
870}
871unsafe impl Send for NVMC {}
872impl NVMC {
873 #[doc = r"Pointer to the register block"]
874 pub const PTR: *const nvmc::RegisterBlock = 0x4001_e000 as *const _;
875 #[doc = r"Return the pointer to the register block"]
876 #[inline(always)]
877 pub const fn ptr() -> *const nvmc::RegisterBlock {
878 Self::PTR
879 }
880}
881impl Deref for NVMC {
882 type Target = nvmc::RegisterBlock;
883 #[inline(always)]
884 fn deref(&self) -> &Self::Target {
885 unsafe { &*Self::PTR }
886 }
887}
888impl core::fmt::Debug for NVMC {
889 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
890 f.debug_struct("NVMC").finish()
891 }
892}
893#[doc = "Non Volatile Memory Controller."]
894pub mod nvmc;
895#[doc = "PPI controller."]
896pub struct PPI {
897 _marker: PhantomData<*const ()>,
898}
899unsafe impl Send for PPI {}
900impl PPI {
901 #[doc = r"Pointer to the register block"]
902 pub const PTR: *const ppi::RegisterBlock = 0x4001_f000 as *const _;
903 #[doc = r"Return the pointer to the register block"]
904 #[inline(always)]
905 pub const fn ptr() -> *const ppi::RegisterBlock {
906 Self::PTR
907 }
908}
909impl Deref for PPI {
910 type Target = ppi::RegisterBlock;
911 #[inline(always)]
912 fn deref(&self) -> &Self::Target {
913 unsafe { &*Self::PTR }
914 }
915}
916impl core::fmt::Debug for PPI {
917 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
918 f.debug_struct("PPI").finish()
919 }
920}
921#[doc = "PPI controller."]
922pub mod ppi;
923#[doc = "Factory Information Configuration."]
924pub struct FICR {
925 _marker: PhantomData<*const ()>,
926}
927unsafe impl Send for FICR {}
928impl FICR {
929 #[doc = r"Pointer to the register block"]
930 pub const PTR: *const ficr::RegisterBlock = 0x1000_0000 as *const _;
931 #[doc = r"Return the pointer to the register block"]
932 #[inline(always)]
933 pub const fn ptr() -> *const ficr::RegisterBlock {
934 Self::PTR
935 }
936}
937impl Deref for FICR {
938 type Target = ficr::RegisterBlock;
939 #[inline(always)]
940 fn deref(&self) -> &Self::Target {
941 unsafe { &*Self::PTR }
942 }
943}
944impl core::fmt::Debug for FICR {
945 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
946 f.debug_struct("FICR").finish()
947 }
948}
949#[doc = "Factory Information Configuration."]
950pub mod ficr;
951#[doc = "User Information Configuration."]
952pub struct UICR {
953 _marker: PhantomData<*const ()>,
954}
955unsafe impl Send for UICR {}
956impl UICR {
957 #[doc = r"Pointer to the register block"]
958 pub const PTR: *const uicr::RegisterBlock = 0x1000_1000 as *const _;
959 #[doc = r"Return the pointer to the register block"]
960 #[inline(always)]
961 pub const fn ptr() -> *const uicr::RegisterBlock {
962 Self::PTR
963 }
964}
965impl Deref for UICR {
966 type Target = uicr::RegisterBlock;
967 #[inline(always)]
968 fn deref(&self) -> &Self::Target {
969 unsafe { &*Self::PTR }
970 }
971}
972impl core::fmt::Debug for UICR {
973 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
974 f.debug_struct("UICR").finish()
975 }
976}
977#[doc = "User Information Configuration."]
978pub mod uicr;
979#[doc = "General purpose input and output."]
980pub struct GPIO {
981 _marker: PhantomData<*const ()>,
982}
983unsafe impl Send for GPIO {}
984impl GPIO {
985 #[doc = r"Pointer to the register block"]
986 pub const PTR: *const gpio::RegisterBlock = 0x5000_0000 as *const _;
987 #[doc = r"Return the pointer to the register block"]
988 #[inline(always)]
989 pub const fn ptr() -> *const gpio::RegisterBlock {
990 Self::PTR
991 }
992}
993impl Deref for GPIO {
994 type Target = gpio::RegisterBlock;
995 #[inline(always)]
996 fn deref(&self) -> &Self::Target {
997 unsafe { &*Self::PTR }
998 }
999}
1000impl core::fmt::Debug for GPIO {
1001 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1002 f.debug_struct("GPIO").finish()
1003 }
1004}
1005#[doc = "General purpose input and output."]
1006pub mod gpio;
1007#[no_mangle]
1008static mut DEVICE_PERIPHERALS: bool = false;
1009#[doc = r"All the peripherals"]
1010#[allow(non_snake_case)]
1011pub struct Peripherals {
1012 #[doc = "POWER"]
1013 pub POWER: POWER,
1014 #[doc = "CLOCK"]
1015 pub CLOCK: CLOCK,
1016 #[doc = "RADIO"]
1017 pub RADIO: RADIO,
1018 #[doc = "UART0"]
1019 pub UART0: UART0,
1020 #[doc = "SPI0"]
1021 pub SPI0: SPI0,
1022 #[doc = "TWI0"]
1023 pub TWI0: TWI0,
1024 #[doc = "SPI1"]
1025 pub SPI1: SPI1,
1026 #[doc = "TWI1"]
1027 pub TWI1: TWI1,
1028 #[doc = "SPIS1"]
1029 pub SPIS1: SPIS1,
1030 #[doc = "GPIOTE"]
1031 pub GPIOTE: GPIOTE,
1032 #[doc = "ADC"]
1033 pub ADC: ADC,
1034 #[doc = "TIMER0"]
1035 pub TIMER0: TIMER0,
1036 #[doc = "TIMER1"]
1037 pub TIMER1: TIMER1,
1038 #[doc = "TIMER2"]
1039 pub TIMER2: TIMER2,
1040 #[doc = "RTC0"]
1041 pub RTC0: RTC0,
1042 #[doc = "TEMP"]
1043 pub TEMP: TEMP,
1044 #[doc = "RNG"]
1045 pub RNG: RNG,
1046 #[doc = "ECB"]
1047 pub ECB: ECB,
1048 #[doc = "AAR"]
1049 pub AAR: AAR,
1050 #[doc = "CCM"]
1051 pub CCM: CCM,
1052 #[doc = "WDT"]
1053 pub WDT: WDT,
1054 #[doc = "RTC1"]
1055 pub RTC1: RTC1,
1056 #[doc = "QDEC"]
1057 pub QDEC: QDEC,
1058 #[doc = "LPCOMP"]
1059 pub LPCOMP: LPCOMP,
1060 #[doc = "SWI"]
1061 pub SWI: SWI,
1062 #[doc = "NVMC"]
1063 pub NVMC: NVMC,
1064 #[doc = "PPI"]
1065 pub PPI: PPI,
1066 #[doc = "FICR"]
1067 pub FICR: FICR,
1068 #[doc = "UICR"]
1069 pub UICR: UICR,
1070 #[doc = "GPIO"]
1071 pub GPIO: GPIO,
1072}
1073impl Peripherals {
1074 #[doc = r"Returns all the peripherals *once*"]
1075 #[inline]
1076 pub fn take() -> Option<Self> {
1077 cortex_m::interrupt::free(|_| {
1078 if unsafe { DEVICE_PERIPHERALS } {
1079 None
1080 } else {
1081 Some(unsafe { Peripherals::steal() })
1082 }
1083 })
1084 }
1085 #[doc = r"Unchecked version of `Peripherals::take`"]
1086 #[inline]
1087 pub unsafe fn steal() -> Self {
1088 DEVICE_PERIPHERALS = true;
1089 Peripherals {
1090 POWER: POWER {
1091 _marker: PhantomData,
1092 },
1093 CLOCK: CLOCK {
1094 _marker: PhantomData,
1095 },
1096 RADIO: RADIO {
1097 _marker: PhantomData,
1098 },
1099 UART0: UART0 {
1100 _marker: PhantomData,
1101 },
1102 SPI0: SPI0 {
1103 _marker: PhantomData,
1104 },
1105 TWI0: TWI0 {
1106 _marker: PhantomData,
1107 },
1108 SPI1: SPI1 {
1109 _marker: PhantomData,
1110 },
1111 TWI1: TWI1 {
1112 _marker: PhantomData,
1113 },
1114 SPIS1: SPIS1 {
1115 _marker: PhantomData,
1116 },
1117 GPIOTE: GPIOTE {
1118 _marker: PhantomData,
1119 },
1120 ADC: ADC {
1121 _marker: PhantomData,
1122 },
1123 TIMER0: TIMER0 {
1124 _marker: PhantomData,
1125 },
1126 TIMER1: TIMER1 {
1127 _marker: PhantomData,
1128 },
1129 TIMER2: TIMER2 {
1130 _marker: PhantomData,
1131 },
1132 RTC0: RTC0 {
1133 _marker: PhantomData,
1134 },
1135 TEMP: TEMP {
1136 _marker: PhantomData,
1137 },
1138 RNG: RNG {
1139 _marker: PhantomData,
1140 },
1141 ECB: ECB {
1142 _marker: PhantomData,
1143 },
1144 AAR: AAR {
1145 _marker: PhantomData,
1146 },
1147 CCM: CCM {
1148 _marker: PhantomData,
1149 },
1150 WDT: WDT {
1151 _marker: PhantomData,
1152 },
1153 RTC1: RTC1 {
1154 _marker: PhantomData,
1155 },
1156 QDEC: QDEC {
1157 _marker: PhantomData,
1158 },
1159 LPCOMP: LPCOMP {
1160 _marker: PhantomData,
1161 },
1162 SWI: SWI {
1163 _marker: PhantomData,
1164 },
1165 NVMC: NVMC {
1166 _marker: PhantomData,
1167 },
1168 PPI: PPI {
1169 _marker: PhantomData,
1170 },
1171 FICR: FICR {
1172 _marker: PhantomData,
1173 },
1174 UICR: UICR {
1175 _marker: PhantomData,
1176 },
1177 GPIO: GPIO {
1178 _marker: PhantomData,
1179 },
1180 }
1181 }
1182}