1#[macro_export]
2macro_rules! config_matrix_pins_rp {
3 (peripherals: $p:ident, input: [$($in_pin:ident), *], output: [$($out_pin:ident), +]) => {
4 {
5 let mut output_pins = [$(Output::new(AnyPin::from($p.$out_pin), embassy_rp::gpio::Level::High)), +];
6 let input_pins = [$(Input::new(AnyPin::from($p.$in_pin), embassy_rp::gpio::Pull::Up)), +];
7 output_pins.iter_mut().for_each(|p| {
8 p.set_high();
9 });
10 (input_pins, output_pins)
11 }
12 };
13}
14
15#[allow(unused)]
16#[cfg(all(not(test), not(feature = "defmt")))]
17mod no_defmt {
18 #[macro_export]
19 macro_rules! fixme {
20 ($a:expr) => {{
21 let _ = $a;
22 }};
23 }
24
25 #[macro_export]
26 macro_rules! info {
27 ($($arg:expr),*) => {{let _ = ($($arg),*);}};
28}
29
30 #[macro_export]
31 macro_rules! debug {
32 ($($arg:expr),*) => {{let _ = ($($arg),*);}};
33}
34
35 #[macro_export]
36 macro_rules! warn {
37 ($($arg:expr),*) => {{let _ = ($($arg),*);}};
38}
39
40 #[macro_export]
41 macro_rules! error {
42 ($($arg:expr),*) => {{let _ = ($($arg),*);}};
43}
44}
45
46#[cfg(all(not(test), feature = "defmt"))]
47mod defmt {
48 #[macro_export]
49 macro_rules! fixme {
50 ($a:expr) => {
51 defmt::debug!(
52 "FIXME: at {}:{}:{}\n{:?}",
54 file!(),
55 line!(),
56 column!(),
57 $a,
58 )
59 };
60 }
61
62 #[macro_export]
63 macro_rules! debug {
64 ($($arg:expr),*) => {
65 defmt::debug!($($arg,)*)
66 };
67 }
68
69 #[macro_export]
70 macro_rules! info {
71 ($($arg:expr),*) => {
72 defmt::info!($($arg,)*)
73 };
74 }
75
76 #[macro_export]
77 macro_rules! warn {
78 ($($arg:expr),*) => {
79 defmt::warn!($($arg,)*)
80 };
81 }
82
83 #[macro_export]
84 macro_rules! error {
85 ($($arg:expr),*) => {
86 defmt::info!($($arg,)*)
87 };
88 }
89}
90
91#[cfg(test)]
92mod test {
93 #[macro_export]
94 macro_rules! kc {
95 ($a:expr) => {
96 match rpk_config::keycodes::key_code($a) {
97 Some(kc) => kc,
98 None => panic!("Unknown key mnemonic: {:?}", $a),
99 }
100 };
101 }
102
103 #[macro_export]
104 macro_rules! fixme {
105 ($a:expr) => {{
106 extern crate std;
107 std::eprintln!(
108 "FIXME\
110 ! at ./{}:{}:{}\n{:?}",
111 file!(),
112 line!(),
113 column!(),
114 $a,
115 )
116 }};
117 }
118
119 #[macro_export]
120 macro_rules! debug {
121 ($($arg:expr),*) => {{
122 extern crate std;
123 std::eprintln!("DEBUG: {}", format_args!($($arg,)*))
124 }};
125}
126
127 #[macro_export]
128 macro_rules! info {
129 ($($arg:expr),*) => {{
130 extern crate std;
131 std::eprintln!("INFO: {}", std::format!($($arg,)*))
132 }};
133}
134
135 #[macro_export]
136 macro_rules! warn {
137 ($($arg:expr),*) => {{
138 extern crate std;
139 std::eprintln!("WARN: {}", std::format!($($arg,)*))
140 }};
141}
142
143 #[macro_export]
144 macro_rules! error {
145 ($($arg:expr),*) => {{
146 extern crate std;
147 std::eprintln!("\nERROR: at ./{}:{}:{}:\n{}", file!(), line!(), column!(),
148 std::format!($($arg,)*))
149 }};
150}
151}