1use stm32f4::{Readable, Reg, RegisterSpec, Resettable, Writable, R, W};
2
3pub mod uart;
4
5macro_rules! wrap_r {
6 (pub trait $TrR:ident {
7 $(fn $f:ident(&self $(, $n:ident: u8)?) -> $fr:path;)*
8 }) => {
9 pub trait $TrR {
10 $(fn $f(&self $(, $n: u8)?) -> $fr;)*
11 }
12 impl<REG: reg::$TrR> $TrR for R<REG> {
13 $(
14 #[inline(always)]
15 fn $f(&self $(, $n: u8)?) -> $fr {
16 REG::$f(self $(, $n)?)
17 }
18 )*
19 }
20 };
21}
22pub(crate) use wrap_r;
23
24macro_rules! wrap_w {
25 (pub trait $TrR:ident {
26 $(fn $f:ident(&mut self $(, $n:ident: u8)?) -> $fr:path;)*
27 }) => {
28 pub trait $TrR<REG: reg::$TrR> {
29 $(fn $f(&mut self $(, $n: u8)?) -> $fr;)*
30 }
31
32 impl<REG: reg::$TrR> $TrR<REG> for W<REG> {
33 $(
34 #[inline(always)]
35 fn $f(&mut self $(, $n: u8)?) -> $fr {
36 REG::$f(self $(, $n)?)
37 }
38 )*
39 }
40 };
41}
42pub(crate) use wrap_w;
43
44macro_rules! impl_reg {
45 ($($r:ident $(: $n:ident)? -> &$rty:path;)*) => {
46 $(
47 #[inline(always)]
48 fn $r(&self $(, $n: usize)?) -> &$rty {
49 self.$r($($n)?)
50 }
51 )*
52 };
53}
54pub(crate) use impl_reg;
55
56macro_rules! impl_read {
57 ($($f:ident $(: $n:ident)? -> $fty:path;)*) => {
58 $(
59 #[inline(always)]
60 fn $f(r: &R<Self> $(, $n: u8)?) -> $fty {
61 r.$f($($n)?)
62 }
63 )*
64 };
65}
66pub(crate) use impl_read;
67
68macro_rules! impl_write {
69 ($($f:ident $(: $n:ident)? -> $fty:path;)*) => {
70 $(
71 #[inline(always)]
72 fn $f(w: &mut W<Self> $(, $n: u8)?) -> $fty {
73 w.$f($($n)?)
74 }
75 )*
76 };
77}
78pub(crate) use impl_write;