1#![doc = "Peripheral access API for LPC82X microcontrollers (generated using svd2rust v0.19.0 ( ))\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.19.0/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 SPI0();
38 fn SPI1();
39 fn USART0();
40 fn USART1();
41 fn USART2();
42 fn I2C1();
43 fn I2C0();
44 fn SCT0();
45 fn MRT0();
46 fn CMP();
47 fn WDT();
48 fn BOD();
49 fn FLASH();
50 fn WKT();
51 fn ADC0_SEQA();
52 fn ADC0_SEQB();
53 fn ADC0_THCMP();
54 fn ADC0_OVR();
55 fn DMA0();
56 fn I2C2();
57 fn I2C3();
58 fn PIN_INT0();
59 fn PIN_INT1();
60 fn PIN_INT2();
61 fn PIN_INT3();
62 fn PIN_INT4();
63 fn PIN_INT5();
64 fn PIN_INT6();
65 fn PIN_INT7();
66}
67#[doc(hidden)]
68pub union Vector {
69 _handler: unsafe extern "C" fn(),
70 _reserved: u32,
71}
72#[cfg(feature = "rt")]
73#[doc(hidden)]
74#[link_section = ".vector_table.interrupts"]
75#[no_mangle]
76pub static __INTERRUPTS: [Vector; 32] = [
77 Vector { _handler: SPI0 },
78 Vector { _handler: SPI1 },
79 Vector { _reserved: 0 },
80 Vector { _handler: USART0 },
81 Vector { _handler: USART1 },
82 Vector { _handler: USART2 },
83 Vector { _reserved: 0 },
84 Vector { _handler: I2C1 },
85 Vector { _handler: I2C0 },
86 Vector { _handler: SCT0 },
87 Vector { _handler: MRT0 },
88 Vector { _handler: CMP },
89 Vector { _handler: WDT },
90 Vector { _handler: BOD },
91 Vector { _handler: FLASH },
92 Vector { _handler: WKT },
93 Vector {
94 _handler: ADC0_SEQA,
95 },
96 Vector {
97 _handler: ADC0_SEQB,
98 },
99 Vector {
100 _handler: ADC0_THCMP,
101 },
102 Vector { _handler: ADC0_OVR },
103 Vector { _handler: DMA0 },
104 Vector { _handler: I2C2 },
105 Vector { _handler: I2C3 },
106 Vector { _reserved: 0 },
107 Vector { _handler: PIN_INT0 },
108 Vector { _handler: PIN_INT1 },
109 Vector { _handler: PIN_INT2 },
110 Vector { _handler: PIN_INT3 },
111 Vector { _handler: PIN_INT4 },
112 Vector { _handler: PIN_INT5 },
113 Vector { _handler: PIN_INT6 },
114 Vector { _handler: PIN_INT7 },
115];
116#[doc = r"Enumeration of all the interrupts."]
117#[derive(Copy, Clone, Debug, PartialEq, Eq)]
118#[repr(u16)]
119pub enum Interrupt {
120 #[doc = "0 - SPI0"]
121 SPI0 = 0,
122 #[doc = "1 - SPI1"]
123 SPI1 = 1,
124 #[doc = "3 - USART0"]
125 USART0 = 3,
126 #[doc = "4 - USART1"]
127 USART1 = 4,
128 #[doc = "5 - USART2"]
129 USART2 = 5,
130 #[doc = "7 - I2C1"]
131 I2C1 = 7,
132 #[doc = "8 - I2C0"]
133 I2C0 = 8,
134 #[doc = "9 - SCT0"]
135 SCT0 = 9,
136 #[doc = "10 - MRT0"]
137 MRT0 = 10,
138 #[doc = "11 - CMP"]
139 CMP = 11,
140 #[doc = "12 - WDT"]
141 WDT = 12,
142 #[doc = "13 - BOD"]
143 BOD = 13,
144 #[doc = "14 - FLASH"]
145 FLASH = 14,
146 #[doc = "15 - WKT"]
147 WKT = 15,
148 #[doc = "16 - ADC0_SEQA"]
149 ADC0_SEQA = 16,
150 #[doc = "17 - ADC0_SEQB"]
151 ADC0_SEQB = 17,
152 #[doc = "18 - ADC0_THCMP"]
153 ADC0_THCMP = 18,
154 #[doc = "19 - ADC0_OVR"]
155 ADC0_OVR = 19,
156 #[doc = "20 - DMA0"]
157 DMA0 = 20,
158 #[doc = "21 - I2C2"]
159 I2C2 = 21,
160 #[doc = "22 - I2C3"]
161 I2C3 = 22,
162 #[doc = "24 - PIN_INT0"]
163 PIN_INT0 = 24,
164 #[doc = "25 - PIN_INT1"]
165 PIN_INT1 = 25,
166 #[doc = "26 - PIN_INT2"]
167 PIN_INT2 = 26,
168 #[doc = "27 - PIN_INT3"]
169 PIN_INT3 = 27,
170 #[doc = "28 - PIN_INT4"]
171 PIN_INT4 = 28,
172 #[doc = "29 - PIN_INT5"]
173 PIN_INT5 = 29,
174 #[doc = "30 - PIN_INT6"]
175 PIN_INT6 = 30,
176 #[doc = "31 - PIN_INT7"]
177 PIN_INT7 = 31,
178}
179unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
180 #[inline(always)]
181 fn number(self) -> u16 {
182 self as u16
183 }
184}
185#[doc = "LPC82x Micro Trace Buffer"]
186pub struct MTB_SFR {
187 _marker: PhantomData<*const ()>,
188}
189unsafe impl Send for MTB_SFR {}
190impl MTB_SFR {
191 #[doc = r"Pointer to the register block"]
192 pub const PTR: *const mtb_sfr::RegisterBlock = 0x1400_0000 as *const _;
193 #[doc = r"Return the pointer to the register block"]
194 #[inline(always)]
195 pub const fn ptr() -> *const mtb_sfr::RegisterBlock {
196 Self::PTR
197 }
198}
199impl Deref for MTB_SFR {
200 type Target = mtb_sfr::RegisterBlock;
201 #[inline(always)]
202 fn deref(&self) -> &Self::Target {
203 unsafe { &*Self::PTR }
204 }
205}
206impl core::fmt::Debug for MTB_SFR {
207 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
208 f.debug_struct("MTB_SFR").finish()
209 }
210}
211#[doc = "LPC82x Micro Trace Buffer"]
212pub mod mtb_sfr;
213#[doc = "LPC82x Windowed Watchdog Timer (WWDT)"]
214pub struct WWDT {
215 _marker: PhantomData<*const ()>,
216}
217unsafe impl Send for WWDT {}
218impl WWDT {
219 #[doc = r"Pointer to the register block"]
220 pub const PTR: *const wwdt::RegisterBlock = 0x4000_0000 as *const _;
221 #[doc = r"Return the pointer to the register block"]
222 #[inline(always)]
223 pub const fn ptr() -> *const wwdt::RegisterBlock {
224 Self::PTR
225 }
226}
227impl Deref for WWDT {
228 type Target = wwdt::RegisterBlock;
229 #[inline(always)]
230 fn deref(&self) -> &Self::Target {
231 unsafe { &*Self::PTR }
232 }
233}
234impl core::fmt::Debug for WWDT {
235 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
236 f.debug_struct("WWDT").finish()
237 }
238}
239#[doc = "LPC82x Windowed Watchdog Timer (WWDT)"]
240pub mod wwdt;
241#[doc = "LPC82x Multi-Rate Timer (MRT)"]
242pub struct MRT0 {
243 _marker: PhantomData<*const ()>,
244}
245unsafe impl Send for MRT0 {}
246impl MRT0 {
247 #[doc = r"Pointer to the register block"]
248 pub const PTR: *const mrt0::RegisterBlock = 0x4000_4000 as *const _;
249 #[doc = r"Return the pointer to the register block"]
250 #[inline(always)]
251 pub const fn ptr() -> *const mrt0::RegisterBlock {
252 Self::PTR
253 }
254}
255impl Deref for MRT0 {
256 type Target = mrt0::RegisterBlock;
257 #[inline(always)]
258 fn deref(&self) -> &Self::Target {
259 unsafe { &*Self::PTR }
260 }
261}
262impl core::fmt::Debug for MRT0 {
263 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
264 f.debug_struct("MRT0").finish()
265 }
266}
267#[doc = "LPC82x Multi-Rate Timer (MRT)"]
268pub mod mrt0;
269#[doc = "LPC82x Wake Up Timer(WKT)"]
270pub struct WKT {
271 _marker: PhantomData<*const ()>,
272}
273unsafe impl Send for WKT {}
274impl WKT {
275 #[doc = r"Pointer to the register block"]
276 pub const PTR: *const wkt::RegisterBlock = 0x4000_8000 as *const _;
277 #[doc = r"Return the pointer to the register block"]
278 #[inline(always)]
279 pub const fn ptr() -> *const wkt::RegisterBlock {
280 Self::PTR
281 }
282}
283impl Deref for WKT {
284 type Target = wkt::RegisterBlock;
285 #[inline(always)]
286 fn deref(&self) -> &Self::Target {
287 unsafe { &*Self::PTR }
288 }
289}
290impl core::fmt::Debug for WKT {
291 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
292 f.debug_struct("WKT").finish()
293 }
294}
295#[doc = "LPC82x Wake Up Timer(WKT)"]
296pub mod wkt;
297#[doc = "LPC82x SWM"]
298pub struct SWM0 {
299 _marker: PhantomData<*const ()>,
300}
301unsafe impl Send for SWM0 {}
302impl SWM0 {
303 #[doc = r"Pointer to the register block"]
304 pub const PTR: *const swm0::RegisterBlock = 0x4000_c000 as *const _;
305 #[doc = r"Return the pointer to the register block"]
306 #[inline(always)]
307 pub const fn ptr() -> *const swm0::RegisterBlock {
308 Self::PTR
309 }
310}
311impl Deref for SWM0 {
312 type Target = swm0::RegisterBlock;
313 #[inline(always)]
314 fn deref(&self) -> &Self::Target {
315 unsafe { &*Self::PTR }
316 }
317}
318impl core::fmt::Debug for SWM0 {
319 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
320 f.debug_struct("SWM0").finish()
321 }
322}
323#[doc = "LPC82x SWM"]
324pub mod swm0;
325#[doc = "LPC82x 12-bit ADC controller (ADC)"]
326pub struct ADC0 {
327 _marker: PhantomData<*const ()>,
328}
329unsafe impl Send for ADC0 {}
330impl ADC0 {
331 #[doc = r"Pointer to the register block"]
332 pub const PTR: *const adc0::RegisterBlock = 0x4001_c000 as *const _;
333 #[doc = r"Return the pointer to the register block"]
334 #[inline(always)]
335 pub const fn ptr() -> *const adc0::RegisterBlock {
336 Self::PTR
337 }
338}
339impl Deref for ADC0 {
340 type Target = adc0::RegisterBlock;
341 #[inline(always)]
342 fn deref(&self) -> &Self::Target {
343 unsafe { &*Self::PTR }
344 }
345}
346impl core::fmt::Debug for ADC0 {
347 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
348 f.debug_struct("ADC0").finish()
349 }
350}
351#[doc = "LPC82x 12-bit ADC controller (ADC)"]
352pub mod adc0;
353#[doc = "LPC82x PMU"]
354pub struct PMU {
355 _marker: PhantomData<*const ()>,
356}
357unsafe impl Send for PMU {}
358impl PMU {
359 #[doc = r"Pointer to the register block"]
360 pub const PTR: *const pmu::RegisterBlock = 0x4002_0000 as *const _;
361 #[doc = r"Return the pointer to the register block"]
362 #[inline(always)]
363 pub const fn ptr() -> *const pmu::RegisterBlock {
364 Self::PTR
365 }
366}
367impl Deref for PMU {
368 type Target = pmu::RegisterBlock;
369 #[inline(always)]
370 fn deref(&self) -> &Self::Target {
371 unsafe { &*Self::PTR }
372 }
373}
374impl core::fmt::Debug for PMU {
375 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
376 f.debug_struct("PMU").finish()
377 }
378}
379#[doc = "LPC82x PMU"]
380pub mod pmu;
381#[doc = "LPC82x analog comparator"]
382pub struct ACOMP {
383 _marker: PhantomData<*const ()>,
384}
385unsafe impl Send for ACOMP {}
386impl ACOMP {
387 #[doc = r"Pointer to the register block"]
388 pub const PTR: *const acomp::RegisterBlock = 0x4002_4000 as *const _;
389 #[doc = r"Return the pointer to the register block"]
390 #[inline(always)]
391 pub const fn ptr() -> *const acomp::RegisterBlock {
392 Self::PTR
393 }
394}
395impl Deref for ACOMP {
396 type Target = acomp::RegisterBlock;
397 #[inline(always)]
398 fn deref(&self) -> &Self::Target {
399 unsafe { &*Self::PTR }
400 }
401}
402impl core::fmt::Debug for ACOMP {
403 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
404 f.debug_struct("ACOMP").finish()
405 }
406}
407#[doc = "LPC82x analog comparator"]
408pub mod acomp;
409#[doc = "LPC82x Input multiplexing (INPUT MUX)"]
410pub struct INPUTMUX {
411 _marker: PhantomData<*const ()>,
412}
413unsafe impl Send for INPUTMUX {}
414impl INPUTMUX {
415 #[doc = r"Pointer to the register block"]
416 pub const PTR: *const inputmux::RegisterBlock = 0x4002_8000 as *const _;
417 #[doc = r"Return the pointer to the register block"]
418 #[inline(always)]
419 pub const fn ptr() -> *const inputmux::RegisterBlock {
420 Self::PTR
421 }
422}
423impl Deref for INPUTMUX {
424 type Target = inputmux::RegisterBlock;
425 #[inline(always)]
426 fn deref(&self) -> &Self::Target {
427 unsafe { &*Self::PTR }
428 }
429}
430impl core::fmt::Debug for INPUTMUX {
431 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
432 f.debug_struct("INPUTMUX").finish()
433 }
434}
435#[doc = "LPC82x Input multiplexing (INPUT MUX)"]
436pub mod inputmux;
437#[doc = "LPC82x NVMC flash controller"]
438pub struct FLASH_CTRL {
439 _marker: PhantomData<*const ()>,
440}
441unsafe impl Send for FLASH_CTRL {}
442impl FLASH_CTRL {
443 #[doc = r"Pointer to the register block"]
444 pub const PTR: *const flash_ctrl::RegisterBlock = 0x4004_0000 as *const _;
445 #[doc = r"Return the pointer to the register block"]
446 #[inline(always)]
447 pub const fn ptr() -> *const flash_ctrl::RegisterBlock {
448 Self::PTR
449 }
450}
451impl Deref for FLASH_CTRL {
452 type Target = flash_ctrl::RegisterBlock;
453 #[inline(always)]
454 fn deref(&self) -> &Self::Target {
455 unsafe { &*Self::PTR }
456 }
457}
458impl core::fmt::Debug for FLASH_CTRL {
459 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
460 f.debug_struct("FLASH_CTRL").finish()
461 }
462}
463#[doc = "LPC82x NVMC flash controller"]
464pub mod flash_ctrl;
465#[doc = "LPC82x I/O pin configuration (IOCON)"]
466pub struct IOCON {
467 _marker: PhantomData<*const ()>,
468}
469unsafe impl Send for IOCON {}
470impl IOCON {
471 #[doc = r"Pointer to the register block"]
472 pub const PTR: *const iocon::RegisterBlock = 0x4004_4000 as *const _;
473 #[doc = r"Return the pointer to the register block"]
474 #[inline(always)]
475 pub const fn ptr() -> *const iocon::RegisterBlock {
476 Self::PTR
477 }
478}
479impl Deref for IOCON {
480 type Target = iocon::RegisterBlock;
481 #[inline(always)]
482 fn deref(&self) -> &Self::Target {
483 unsafe { &*Self::PTR }
484 }
485}
486impl core::fmt::Debug for IOCON {
487 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
488 f.debug_struct("IOCON").finish()
489 }
490}
491#[doc = "LPC82x I/O pin configuration (IOCON)"]
492pub mod iocon;
493#[doc = "LPC82x System configuration (SYSCON)"]
494pub struct SYSCON {
495 _marker: PhantomData<*const ()>,
496}
497unsafe impl Send for SYSCON {}
498impl SYSCON {
499 #[doc = r"Pointer to the register block"]
500 pub const PTR: *const syscon::RegisterBlock = 0x4004_8000 as *const _;
501 #[doc = r"Return the pointer to the register block"]
502 #[inline(always)]
503 pub const fn ptr() -> *const syscon::RegisterBlock {
504 Self::PTR
505 }
506}
507impl Deref for SYSCON {
508 type Target = syscon::RegisterBlock;
509 #[inline(always)]
510 fn deref(&self) -> &Self::Target {
511 unsafe { &*Self::PTR }
512 }
513}
514impl core::fmt::Debug for SYSCON {
515 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
516 f.debug_struct("SYSCON").finish()
517 }
518}
519#[doc = "LPC82x System configuration (SYSCON)"]
520pub mod syscon;
521#[doc = "LPC82x I2C-bus interfaces"]
522pub struct I2C0 {
523 _marker: PhantomData<*const ()>,
524}
525unsafe impl Send for I2C0 {}
526impl I2C0 {
527 #[doc = r"Pointer to the register block"]
528 pub const PTR: *const i2c0::RegisterBlock = 0x4005_0000 as *const _;
529 #[doc = r"Return the pointer to the register block"]
530 #[inline(always)]
531 pub const fn ptr() -> *const i2c0::RegisterBlock {
532 Self::PTR
533 }
534}
535impl Deref for I2C0 {
536 type Target = i2c0::RegisterBlock;
537 #[inline(always)]
538 fn deref(&self) -> &Self::Target {
539 unsafe { &*Self::PTR }
540 }
541}
542impl core::fmt::Debug for I2C0 {
543 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
544 f.debug_struct("I2C0").finish()
545 }
546}
547#[doc = "LPC82x I2C-bus interfaces"]
548pub mod i2c0;
549#[doc = "LPC82x I2C-bus interfaces"]
550pub struct I2C1 {
551 _marker: PhantomData<*const ()>,
552}
553unsafe impl Send for I2C1 {}
554impl I2C1 {
555 #[doc = r"Pointer to the register block"]
556 pub const PTR: *const i2c0::RegisterBlock = 0x4005_4000 as *const _;
557 #[doc = r"Return the pointer to the register block"]
558 #[inline(always)]
559 pub const fn ptr() -> *const i2c0::RegisterBlock {
560 Self::PTR
561 }
562}
563impl Deref for I2C1 {
564 type Target = i2c0::RegisterBlock;
565 #[inline(always)]
566 fn deref(&self) -> &Self::Target {
567 unsafe { &*Self::PTR }
568 }
569}
570impl core::fmt::Debug for I2C1 {
571 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
572 f.debug_struct("I2C1").finish()
573 }
574}
575#[doc = "LPC82x I2C-bus interfaces"]
576pub struct I2C2 {
577 _marker: PhantomData<*const ()>,
578}
579unsafe impl Send for I2C2 {}
580impl I2C2 {
581 #[doc = r"Pointer to the register block"]
582 pub const PTR: *const i2c0::RegisterBlock = 0x4007_0000 as *const _;
583 #[doc = r"Return the pointer to the register block"]
584 #[inline(always)]
585 pub const fn ptr() -> *const i2c0::RegisterBlock {
586 Self::PTR
587 }
588}
589impl Deref for I2C2 {
590 type Target = i2c0::RegisterBlock;
591 #[inline(always)]
592 fn deref(&self) -> &Self::Target {
593 unsafe { &*Self::PTR }
594 }
595}
596impl core::fmt::Debug for I2C2 {
597 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
598 f.debug_struct("I2C2").finish()
599 }
600}
601#[doc = "LPC82x I2C-bus interfaces"]
602pub struct I2C3 {
603 _marker: PhantomData<*const ()>,
604}
605unsafe impl Send for I2C3 {}
606impl I2C3 {
607 #[doc = r"Pointer to the register block"]
608 pub const PTR: *const i2c0::RegisterBlock = 0x4007_4000 as *const _;
609 #[doc = r"Return the pointer to the register block"]
610 #[inline(always)]
611 pub const fn ptr() -> *const i2c0::RegisterBlock {
612 Self::PTR
613 }
614}
615impl Deref for I2C3 {
616 type Target = i2c0::RegisterBlock;
617 #[inline(always)]
618 fn deref(&self) -> &Self::Target {
619 unsafe { &*Self::PTR }
620 }
621}
622impl core::fmt::Debug for I2C3 {
623 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
624 f.debug_struct("I2C3").finish()
625 }
626}
627#[doc = "LPC82x Serial Peripheral Interfaces (SPI)"]
628pub struct SPI0 {
629 _marker: PhantomData<*const ()>,
630}
631unsafe impl Send for SPI0 {}
632impl SPI0 {
633 #[doc = r"Pointer to the register block"]
634 pub const PTR: *const spi0::RegisterBlock = 0x4005_8000 as *const _;
635 #[doc = r"Return the pointer to the register block"]
636 #[inline(always)]
637 pub const fn ptr() -> *const spi0::RegisterBlock {
638 Self::PTR
639 }
640}
641impl Deref for SPI0 {
642 type Target = spi0::RegisterBlock;
643 #[inline(always)]
644 fn deref(&self) -> &Self::Target {
645 unsafe { &*Self::PTR }
646 }
647}
648impl core::fmt::Debug for SPI0 {
649 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
650 f.debug_struct("SPI0").finish()
651 }
652}
653#[doc = "LPC82x Serial Peripheral Interfaces (SPI)"]
654pub mod spi0;
655#[doc = "LPC82x Serial Peripheral Interfaces (SPI)"]
656pub struct SPI1 {
657 _marker: PhantomData<*const ()>,
658}
659unsafe impl Send for SPI1 {}
660impl SPI1 {
661 #[doc = r"Pointer to the register block"]
662 pub const PTR: *const spi0::RegisterBlock = 0x4005_c000 as *const _;
663 #[doc = r"Return the pointer to the register block"]
664 #[inline(always)]
665 pub const fn ptr() -> *const spi0::RegisterBlock {
666 Self::PTR
667 }
668}
669impl Deref for SPI1 {
670 type Target = spi0::RegisterBlock;
671 #[inline(always)]
672 fn deref(&self) -> &Self::Target {
673 unsafe { &*Self::PTR }
674 }
675}
676impl core::fmt::Debug for SPI1 {
677 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
678 f.debug_struct("SPI1").finish()
679 }
680}
681#[doc = "LPC82x USARTs"]
682pub struct USART0 {
683 _marker: PhantomData<*const ()>,
684}
685unsafe impl Send for USART0 {}
686impl USART0 {
687 #[doc = r"Pointer to the register block"]
688 pub const PTR: *const usart0::RegisterBlock = 0x4006_4000 as *const _;
689 #[doc = r"Return the pointer to the register block"]
690 #[inline(always)]
691 pub const fn ptr() -> *const usart0::RegisterBlock {
692 Self::PTR
693 }
694}
695impl Deref for USART0 {
696 type Target = usart0::RegisterBlock;
697 #[inline(always)]
698 fn deref(&self) -> &Self::Target {
699 unsafe { &*Self::PTR }
700 }
701}
702impl core::fmt::Debug for USART0 {
703 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
704 f.debug_struct("USART0").finish()
705 }
706}
707#[doc = "LPC82x USARTs"]
708pub mod usart0;
709#[doc = "LPC82x USARTs"]
710pub struct USART1 {
711 _marker: PhantomData<*const ()>,
712}
713unsafe impl Send for USART1 {}
714impl USART1 {
715 #[doc = r"Pointer to the register block"]
716 pub const PTR: *const usart0::RegisterBlock = 0x4006_8000 as *const _;
717 #[doc = r"Return the pointer to the register block"]
718 #[inline(always)]
719 pub const fn ptr() -> *const usart0::RegisterBlock {
720 Self::PTR
721 }
722}
723impl Deref for USART1 {
724 type Target = usart0::RegisterBlock;
725 #[inline(always)]
726 fn deref(&self) -> &Self::Target {
727 unsafe { &*Self::PTR }
728 }
729}
730impl core::fmt::Debug for USART1 {
731 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
732 f.debug_struct("USART1").finish()
733 }
734}
735#[doc = "LPC82x USARTs"]
736pub struct USART2 {
737 _marker: PhantomData<*const ()>,
738}
739unsafe impl Send for USART2 {}
740impl USART2 {
741 #[doc = r"Pointer to the register block"]
742 pub const PTR: *const usart0::RegisterBlock = 0x4006_c000 as *const _;
743 #[doc = r"Return the pointer to the register block"]
744 #[inline(always)]
745 pub const fn ptr() -> *const usart0::RegisterBlock {
746 Self::PTR
747 }
748}
749impl Deref for USART2 {
750 type Target = usart0::RegisterBlock;
751 #[inline(always)]
752 fn deref(&self) -> &Self::Target {
753 unsafe { &*Self::PTR }
754 }
755}
756impl core::fmt::Debug for USART2 {
757 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
758 f.debug_struct("USART2").finish()
759 }
760}
761#[doc = "LPC5411x CRC engine"]
762pub struct CRC {
763 _marker: PhantomData<*const ()>,
764}
765unsafe impl Send for CRC {}
766impl CRC {
767 #[doc = r"Pointer to the register block"]
768 pub const PTR: *const crc::RegisterBlock = 0x5000_0000 as *const _;
769 #[doc = r"Return the pointer to the register block"]
770 #[inline(always)]
771 pub const fn ptr() -> *const crc::RegisterBlock {
772 Self::PTR
773 }
774}
775impl Deref for CRC {
776 type Target = crc::RegisterBlock;
777 #[inline(always)]
778 fn deref(&self) -> &Self::Target {
779 unsafe { &*Self::PTR }
780 }
781}
782impl core::fmt::Debug for CRC {
783 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
784 f.debug_struct("CRC").finish()
785 }
786}
787#[doc = "LPC5411x CRC engine"]
788pub mod crc;
789#[doc = "LPC82x SCTimer/PWM (SCT)"]
790pub struct SCT0 {
791 _marker: PhantomData<*const ()>,
792}
793unsafe impl Send for SCT0 {}
794impl SCT0 {
795 #[doc = r"Pointer to the register block"]
796 pub const PTR: *const sct0::RegisterBlock = 0x5000_4000 as *const _;
797 #[doc = r"Return the pointer to the register block"]
798 #[inline(always)]
799 pub const fn ptr() -> *const sct0::RegisterBlock {
800 Self::PTR
801 }
802}
803impl Deref for SCT0 {
804 type Target = sct0::RegisterBlock;
805 #[inline(always)]
806 fn deref(&self) -> &Self::Target {
807 unsafe { &*Self::PTR }
808 }
809}
810impl core::fmt::Debug for SCT0 {
811 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
812 f.debug_struct("SCT0").finish()
813 }
814}
815#[doc = "LPC82x SCTimer/PWM (SCT)"]
816pub mod sct0;
817#[doc = "LPC82x DMA controller"]
818pub struct DMA0 {
819 _marker: PhantomData<*const ()>,
820}
821unsafe impl Send for DMA0 {}
822impl DMA0 {
823 #[doc = r"Pointer to the register block"]
824 pub const PTR: *const dma0::RegisterBlock = 0x5000_8000 as *const _;
825 #[doc = r"Return the pointer to the register block"]
826 #[inline(always)]
827 pub const fn ptr() -> *const dma0::RegisterBlock {
828 Self::PTR
829 }
830}
831impl Deref for DMA0 {
832 type Target = dma0::RegisterBlock;
833 #[inline(always)]
834 fn deref(&self) -> &Self::Target {
835 unsafe { &*Self::PTR }
836 }
837}
838impl core::fmt::Debug for DMA0 {
839 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
840 f.debug_struct("DMA0").finish()
841 }
842}
843#[doc = "LPC82x DMA controller"]
844pub mod dma0;
845#[doc = "LPC82x General Purpose I/O (GPIO)"]
846pub struct GPIO {
847 _marker: PhantomData<*const ()>,
848}
849unsafe impl Send for GPIO {}
850impl GPIO {
851 #[doc = r"Pointer to the register block"]
852 pub const PTR: *const gpio::RegisterBlock = 0xa000_0000 as *const _;
853 #[doc = r"Return the pointer to the register block"]
854 #[inline(always)]
855 pub const fn ptr() -> *const gpio::RegisterBlock {
856 Self::PTR
857 }
858}
859impl Deref for GPIO {
860 type Target = gpio::RegisterBlock;
861 #[inline(always)]
862 fn deref(&self) -> &Self::Target {
863 unsafe { &*Self::PTR }
864 }
865}
866impl core::fmt::Debug for GPIO {
867 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
868 f.debug_struct("GPIO").finish()
869 }
870}
871#[doc = "LPC82x General Purpose I/O (GPIO)"]
872pub mod gpio;
873#[doc = "LPC82x Pin interrupt and pattern match (PINT)"]
874pub struct PINT {
875 _marker: PhantomData<*const ()>,
876}
877unsafe impl Send for PINT {}
878impl PINT {
879 #[doc = r"Pointer to the register block"]
880 pub const PTR: *const pint::RegisterBlock = 0xa000_4000 as *const _;
881 #[doc = r"Return the pointer to the register block"]
882 #[inline(always)]
883 pub const fn ptr() -> *const pint::RegisterBlock {
884 Self::PTR
885 }
886}
887impl Deref for PINT {
888 type Target = pint::RegisterBlock;
889 #[inline(always)]
890 fn deref(&self) -> &Self::Target {
891 unsafe { &*Self::PTR }
892 }
893}
894impl core::fmt::Debug for PINT {
895 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
896 f.debug_struct("PINT").finish()
897 }
898}
899#[doc = "LPC82x Pin interrupt and pattern match (PINT)"]
900pub mod pint;
901#[no_mangle]
902static mut DEVICE_PERIPHERALS: bool = false;
903#[doc = r"All the peripherals"]
904#[allow(non_snake_case)]
905pub struct Peripherals {
906 #[doc = "MTB_SFR"]
907 pub MTB_SFR: MTB_SFR,
908 #[doc = "WWDT"]
909 pub WWDT: WWDT,
910 #[doc = "MRT0"]
911 pub MRT0: MRT0,
912 #[doc = "WKT"]
913 pub WKT: WKT,
914 #[doc = "SWM0"]
915 pub SWM0: SWM0,
916 #[doc = "ADC0"]
917 pub ADC0: ADC0,
918 #[doc = "PMU"]
919 pub PMU: PMU,
920 #[doc = "ACOMP"]
921 pub ACOMP: ACOMP,
922 #[doc = "INPUTMUX"]
923 pub INPUTMUX: INPUTMUX,
924 #[doc = "FLASH_CTRL"]
925 pub FLASH_CTRL: FLASH_CTRL,
926 #[doc = "IOCON"]
927 pub IOCON: IOCON,
928 #[doc = "SYSCON"]
929 pub SYSCON: SYSCON,
930 #[doc = "I2C0"]
931 pub I2C0: I2C0,
932 #[doc = "I2C1"]
933 pub I2C1: I2C1,
934 #[doc = "I2C2"]
935 pub I2C2: I2C2,
936 #[doc = "I2C3"]
937 pub I2C3: I2C3,
938 #[doc = "SPI0"]
939 pub SPI0: SPI0,
940 #[doc = "SPI1"]
941 pub SPI1: SPI1,
942 #[doc = "USART0"]
943 pub USART0: USART0,
944 #[doc = "USART1"]
945 pub USART1: USART1,
946 #[doc = "USART2"]
947 pub USART2: USART2,
948 #[doc = "CRC"]
949 pub CRC: CRC,
950 #[doc = "SCT0"]
951 pub SCT0: SCT0,
952 #[doc = "DMA0"]
953 pub DMA0: DMA0,
954 #[doc = "GPIO"]
955 pub GPIO: GPIO,
956 #[doc = "PINT"]
957 pub PINT: PINT,
958}
959impl Peripherals {
960 #[doc = r"Returns all the peripherals *once*"]
961 #[inline]
962 pub fn take() -> Option<Self> {
963 cortex_m::interrupt::free(|_| {
964 if unsafe { DEVICE_PERIPHERALS } {
965 None
966 } else {
967 Some(unsafe { Peripherals::steal() })
968 }
969 })
970 }
971 #[doc = r"Unchecked version of `Peripherals::take`"]
972 #[inline]
973 pub unsafe fn steal() -> Self {
974 DEVICE_PERIPHERALS = true;
975 Peripherals {
976 MTB_SFR: MTB_SFR {
977 _marker: PhantomData,
978 },
979 WWDT: WWDT {
980 _marker: PhantomData,
981 },
982 MRT0: MRT0 {
983 _marker: PhantomData,
984 },
985 WKT: WKT {
986 _marker: PhantomData,
987 },
988 SWM0: SWM0 {
989 _marker: PhantomData,
990 },
991 ADC0: ADC0 {
992 _marker: PhantomData,
993 },
994 PMU: PMU {
995 _marker: PhantomData,
996 },
997 ACOMP: ACOMP {
998 _marker: PhantomData,
999 },
1000 INPUTMUX: INPUTMUX {
1001 _marker: PhantomData,
1002 },
1003 FLASH_CTRL: FLASH_CTRL {
1004 _marker: PhantomData,
1005 },
1006 IOCON: IOCON {
1007 _marker: PhantomData,
1008 },
1009 SYSCON: SYSCON {
1010 _marker: PhantomData,
1011 },
1012 I2C0: I2C0 {
1013 _marker: PhantomData,
1014 },
1015 I2C1: I2C1 {
1016 _marker: PhantomData,
1017 },
1018 I2C2: I2C2 {
1019 _marker: PhantomData,
1020 },
1021 I2C3: I2C3 {
1022 _marker: PhantomData,
1023 },
1024 SPI0: SPI0 {
1025 _marker: PhantomData,
1026 },
1027 SPI1: SPI1 {
1028 _marker: PhantomData,
1029 },
1030 USART0: USART0 {
1031 _marker: PhantomData,
1032 },
1033 USART1: USART1 {
1034 _marker: PhantomData,
1035 },
1036 USART2: USART2 {
1037 _marker: PhantomData,
1038 },
1039 CRC: CRC {
1040 _marker: PhantomData,
1041 },
1042 SCT0: SCT0 {
1043 _marker: PhantomData,
1044 },
1045 DMA0: DMA0 {
1046 _marker: PhantomData,
1047 },
1048 GPIO: GPIO {
1049 _marker: PhantomData,
1050 },
1051 PINT: PINT {
1052 _marker: PhantomData,
1053 },
1054 }
1055 }
1056}