1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#![no_std]

use embedded_hal_02 as ehal_02;
pub use embedded_hal_1 as ehal;
pub use embedded_hal_nb as ehal_nb;
pub use embedded_io;
pub use fugit;
pub use nb;
pub use paste;
pub mod typelevel;

macro_rules! define_pac {
    ( $( ($pac:ident, $feat:literal)),+ ) => {
        $(
            #[cfg(feature = $feat)]
            pub use $pac as pac;
        )+
    };
}

define_pac!(
    (atsamd11c, "samd11c"),
    (atsamd11d, "samd11d"),
    (atsamd21e, "samd21e"),
    (atsamd21g, "samd21g"),
    (atsamd21j, "samd21j"),
    (atsamd21e, "samd21el"),
    (atsamd21g, "samd21gl"),
    (atsamd51g, "samd51g"),
    (atsamd51j, "samd51j"),
    (atsamd51n, "samd51n"),
    (atsamd51p, "samd51p"),
    (atsame51g, "same51g"),
    (atsame51j, "same51j"),
    (atsame51n, "same51n"),
    (atsame53j, "same53j"),
    (atsame53n, "same53n"),
    (atsame54n, "same54n"),
    (atsame54p, "same54p")
);

#[cfg(feature = "use_rtt")]
pub use jlink_rtt;

#[cfg(feature = "use_rtt")]
#[macro_export]
macro_rules! dbgprint {
    ($($arg:tt)*) => {
        {
            use core::fmt::Write;
            let mut out = $crate::jlink_rtt::NonBlockingOutput::new();
            writeln!(out, $($arg)*).ok();
        }
    };
}

#[cfg(not(feature = "use_rtt"))]
#[macro_export]
macro_rules! dbgprint {
    ($($arg:tt)*) => {{}};
}

#[cfg(feature = "device")]
pub mod delay;
#[cfg(feature = "device")]
pub mod gpio;
#[cfg(feature = "device")]
pub mod prelude;
#[cfg(feature = "device")]
pub mod rtc;
#[cfg(feature = "device")]
pub mod sercom;
pub mod sleeping_delay;
pub mod time;
pub mod timer_params;
pub mod timer_traits;

#[cfg(feature = "dma")]
pub mod dmac;

#[doc(hidden)]
mod peripherals;
#[doc(inline)]
#[allow(unused_imports)]
pub use crate::peripherals::*;

#[macro_use]
mod bsp_peripherals_macro;