atsamd_hal/
lib.rs
1#![no_std]
2
3use embedded_hal_02 as ehal_02;
4pub use embedded_hal_1 as ehal;
5pub use embedded_hal_nb as ehal_nb;
6pub use embedded_io;
7pub use fugit;
8pub use nb;
9pub use paste;
10
11#[cfg(feature = "async")]
12pub use embedded_hal_async as ehal_async;
13
14#[cfg(feature = "async")]
15pub use embedded_io_async;
16
17#[cfg(feature = "rtic")]
18pub use rtic_time;
19
20pub mod typelevel;
21mod util;
22
23macro_rules! define_pac {
24 ( $( ($pac:ident, $feat:literal)),+ ) => {
25 $(
26 #[cfg(feature = $feat)]
27 pub use $pac as pac;
28 )+
29 };
30}
31
32define_pac!(
33 (atsamd11c, "samd11c"),
34 (atsamd11d, "samd11d"),
35 (atsamd21e, "samd21e"),
36 (atsamd21g, "samd21g"),
37 (atsamd21j, "samd21j"),
38 (atsamd21e, "samd21el"),
39 (atsamd21g, "samd21gl"),
40 (atsamd51g, "samd51g"),
41 (atsamd51j, "samd51j"),
42 (atsamd51n, "samd51n"),
43 (atsamd51p, "samd51p"),
44 (atsame51g, "same51g"),
45 (atsame51j, "same51j"),
46 (atsame51n, "same51n"),
47 (atsame53j, "same53j"),
48 (atsame53n, "same53n"),
49 (atsame54n, "same54n"),
50 (atsame54p, "same54p")
51);
52
53#[cfg(feature = "use_rtt")]
54pub use jlink_rtt;
55
56#[cfg(feature = "use_rtt")]
57#[macro_export]
58macro_rules! dbgprint {
59 ($($arg:tt)*) => {
60 {
61 use core::fmt::Write;
62 let mut out = $crate::jlink_rtt::NonBlockingOutput::new();
63 writeln!(out, $($arg)*).ok();
64 }
65 };
66}
67
68#[cfg(not(feature = "use_rtt"))]
69#[macro_export]
70macro_rules! dbgprint {
71 ($($arg:tt)*) => {{}};
72}
73
74#[cfg(feature = "async")]
75pub mod async_hal;
76
77#[cfg(feature = "device")]
78pub mod delay;
79#[cfg(feature = "device")]
80pub mod gpio;
81#[cfg(feature = "device")]
82pub mod interrupt;
83#[cfg(feature = "device")]
84pub mod prelude;
85#[cfg(feature = "device")]
86pub mod rtc;
87#[cfg(feature = "device")]
88pub mod sercom;
89pub mod sleeping_delay;
90pub mod time;
91pub mod timer_params;
92pub mod timer_traits;
93
94#[cfg(feature = "dma")]
95pub mod dmac;
96
97#[doc(hidden)]
98mod peripherals;
99#[doc(inline)]
100#[allow(unused_imports)]
101pub use crate::peripherals::*;
102
103#[macro_use]
104mod bsp_peripherals_macro;