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