diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-06-07 03:21:09 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-06-07 03:21:37 +0200 |
| commit | 3be49d3e794d5819574fe33ffbfda9da1ddbe216 (patch) | |
| tree | 30ac3b89de123efd2e6a6d9cc250783f9df6f699 | |
| parent | ef1ebefec0c682553213406b3e59a30a79520291 (diff) | |
fmt: Add dunmy use to avoid "unused variable" errors when no log is enabled.
| -rw-r--r-- | .vscode/settings.json | 4 | ||||
| -rw-r--r-- | embassy-extras/src/fmt.rs | 42 | ||||
| -rw-r--r-- | embassy-net/src/fmt.rs | 42 | ||||
| -rw-r--r-- | embassy-nrf/src/fmt.rs | 42 | ||||
| -rw-r--r-- | embassy-rp/src/fmt.rs | 42 | ||||
| -rw-r--r-- | embassy-stm32/src/fmt.rs | 42 | ||||
| -rw-r--r-- | embassy/src/fmt.rs | 42 | ||||
| -rw-r--r-- | stm32-metapac/Cargo.toml | 4 |
8 files changed, 161 insertions, 99 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index 4c6c3bece..ca242662b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | "editor.formatOnSave": true, | 3 | "editor.formatOnSave": true, |
| 4 | "rust-analyzer.checkOnSave.allFeatures": false, | 4 | "rust-analyzer.checkOnSave.allFeatures": false, |
| 5 | "rust-analyzer.checkOnSave.allTargets": false, | 5 | "rust-analyzer.checkOnSave.allTargets": false, |
| 6 | //"rust-analyzer.cargo.target": "thumbv7em-none-eabi", | 6 | "rust-analyzer.cargo.target": "thumbv7em-none-eabi", |
| 7 | //"rust-analyzer.checkOnSave.target": "thumbv7em-none-eabi", | 7 | "rust-analyzer.checkOnSave.target": "thumbv7em-none-eabi", |
| 8 | "rust-analyzer.procMacro.enable": true, | 8 | "rust-analyzer.procMacro.enable": true, |
| 9 | "rust-analyzer.cargo.loadOutDirsFromCheck": true, | 9 | "rust-analyzer.cargo.loadOutDirsFromCheck": true, |
| 10 | "files.watcherExclude": { | 10 | "files.watcherExclude": { |
diff --git a/embassy-extras/src/fmt.rs b/embassy-extras/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy-extras/src/fmt.rs +++ b/embassy-extras/src/fmt.rs | |||
| @@ -104,56 +104,66 @@ macro_rules! panic { | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | macro_rules! trace { | 106 | macro_rules! trace { |
| 107 | ($($x:tt)*) => { | 107 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 108 | { | 108 | { |
| 109 | #[cfg(feature = "log")] | 109 | #[cfg(feature = "log")] |
| 110 | ::log::trace!($($x)*); | 110 | ::log::trace!($s $(, $x)*); |
| 111 | #[cfg(feature = "defmt")] | 111 | #[cfg(feature = "defmt")] |
| 112 | ::defmt::trace!($($x)*); | 112 | ::defmt::trace!($s $(, $x)*); |
| 113 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 114 | let _ = ($( & $x ),*); | ||
| 113 | } | 115 | } |
| 114 | }; | 116 | }; |
| 115 | } | 117 | } |
| 116 | 118 | ||
| 117 | macro_rules! debug { | 119 | macro_rules! debug { |
| 118 | ($($x:tt)*) => { | 120 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 119 | { | 121 | { |
| 120 | #[cfg(fevature = "log")] | 122 | #[cfg(feature = "log")] |
| 121 | ::log::debug!($($x)*); | 123 | ::log::debug!($s $(, $x)*); |
| 122 | #[cfg(feature = "defmt")] | 124 | #[cfg(feature = "defmt")] |
| 123 | ::defmt::debug!($($x)*); | 125 | ::defmt::debug!($s $(, $x)*); |
| 126 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 127 | let _ = ($( & $x ),*); | ||
| 124 | } | 128 | } |
| 125 | }; | 129 | }; |
| 126 | } | 130 | } |
| 127 | 131 | ||
| 128 | macro_rules! info { | 132 | macro_rules! info { |
| 129 | ($($x:tt)*) => { | 133 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 130 | { | 134 | { |
| 131 | #[cfg(feature = "log")] | 135 | #[cfg(feature = "log")] |
| 132 | ::log::info!($($x)*); | 136 | ::log::info!($s $(, $x)*); |
| 133 | #[cfg(feature = "defmt")] | 137 | #[cfg(feature = "defmt")] |
| 134 | ::defmt::info!($($x)*); | 138 | ::defmt::info!($s $(, $x)*); |
| 139 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 140 | let _ = ($( & $x ),*); | ||
| 135 | } | 141 | } |
| 136 | }; | 142 | }; |
| 137 | } | 143 | } |
| 138 | 144 | ||
| 139 | macro_rules! warn { | 145 | macro_rules! warn { |
| 140 | ($($x:tt)*) => { | 146 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 141 | { | 147 | { |
| 142 | #[cfg(feature = "log")] | 148 | #[cfg(feature = "log")] |
| 143 | ::log::warn!($($x)*); | 149 | ::log::warn!($s $(, $x)*); |
| 144 | #[cfg(feature = "defmt")] | 150 | #[cfg(feature = "defmt")] |
| 145 | ::defmt::warn!($($x)*); | 151 | ::defmt::warn!($s $(, $x)*); |
| 152 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 153 | let _ = ($( & $x ),*); | ||
| 146 | } | 154 | } |
| 147 | }; | 155 | }; |
| 148 | } | 156 | } |
| 149 | 157 | ||
| 150 | macro_rules! error { | 158 | macro_rules! error { |
| 151 | ($($x:tt)*) => { | 159 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 152 | { | 160 | { |
| 153 | #[cfg(feature = "log")] | 161 | #[cfg(feature = "log")] |
| 154 | ::log::error!($($x)*); | 162 | ::log::error!($s $(, $x)*); |
| 155 | #[cfg(feature = "defmt")] | 163 | #[cfg(feature = "defmt")] |
| 156 | ::defmt::error!($($x)*); | 164 | ::defmt::error!($s $(, $x)*); |
| 165 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 166 | let _ = ($( & $x ),*); | ||
| 157 | } | 167 | } |
| 158 | }; | 168 | }; |
| 159 | } | 169 | } |
diff --git a/embassy-net/src/fmt.rs b/embassy-net/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy-net/src/fmt.rs +++ b/embassy-net/src/fmt.rs | |||
| @@ -104,56 +104,66 @@ macro_rules! panic { | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | macro_rules! trace { | 106 | macro_rules! trace { |
| 107 | ($($x:tt)*) => { | 107 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 108 | { | 108 | { |
| 109 | #[cfg(feature = "log")] | 109 | #[cfg(feature = "log")] |
| 110 | ::log::trace!($($x)*); | 110 | ::log::trace!($s $(, $x)*); |
| 111 | #[cfg(feature = "defmt")] | 111 | #[cfg(feature = "defmt")] |
| 112 | ::defmt::trace!($($x)*); | 112 | ::defmt::trace!($s $(, $x)*); |
| 113 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 114 | let _ = ($( & $x ),*); | ||
| 113 | } | 115 | } |
| 114 | }; | 116 | }; |
| 115 | } | 117 | } |
| 116 | 118 | ||
| 117 | macro_rules! debug { | 119 | macro_rules! debug { |
| 118 | ($($x:tt)*) => { | 120 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 119 | { | 121 | { |
| 120 | #[cfg(fevature = "log")] | 122 | #[cfg(feature = "log")] |
| 121 | ::log::debug!($($x)*); | 123 | ::log::debug!($s $(, $x)*); |
| 122 | #[cfg(feature = "defmt")] | 124 | #[cfg(feature = "defmt")] |
| 123 | ::defmt::debug!($($x)*); | 125 | ::defmt::debug!($s $(, $x)*); |
| 126 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 127 | let _ = ($( & $x ),*); | ||
| 124 | } | 128 | } |
| 125 | }; | 129 | }; |
| 126 | } | 130 | } |
| 127 | 131 | ||
| 128 | macro_rules! info { | 132 | macro_rules! info { |
| 129 | ($($x:tt)*) => { | 133 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 130 | { | 134 | { |
| 131 | #[cfg(feature = "log")] | 135 | #[cfg(feature = "log")] |
| 132 | ::log::info!($($x)*); | 136 | ::log::info!($s $(, $x)*); |
| 133 | #[cfg(feature = "defmt")] | 137 | #[cfg(feature = "defmt")] |
| 134 | ::defmt::info!($($x)*); | 138 | ::defmt::info!($s $(, $x)*); |
| 139 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 140 | let _ = ($( & $x ),*); | ||
| 135 | } | 141 | } |
| 136 | }; | 142 | }; |
| 137 | } | 143 | } |
| 138 | 144 | ||
| 139 | macro_rules! warn { | 145 | macro_rules! warn { |
| 140 | ($($x:tt)*) => { | 146 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 141 | { | 147 | { |
| 142 | #[cfg(feature = "log")] | 148 | #[cfg(feature = "log")] |
| 143 | ::log::warn!($($x)*); | 149 | ::log::warn!($s $(, $x)*); |
| 144 | #[cfg(feature = "defmt")] | 150 | #[cfg(feature = "defmt")] |
| 145 | ::defmt::warn!($($x)*); | 151 | ::defmt::warn!($s $(, $x)*); |
| 152 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 153 | let _ = ($( & $x ),*); | ||
| 146 | } | 154 | } |
| 147 | }; | 155 | }; |
| 148 | } | 156 | } |
| 149 | 157 | ||
| 150 | macro_rules! error { | 158 | macro_rules! error { |
| 151 | ($($x:tt)*) => { | 159 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 152 | { | 160 | { |
| 153 | #[cfg(feature = "log")] | 161 | #[cfg(feature = "log")] |
| 154 | ::log::error!($($x)*); | 162 | ::log::error!($s $(, $x)*); |
| 155 | #[cfg(feature = "defmt")] | 163 | #[cfg(feature = "defmt")] |
| 156 | ::defmt::error!($($x)*); | 164 | ::defmt::error!($s $(, $x)*); |
| 165 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 166 | let _ = ($( & $x ),*); | ||
| 157 | } | 167 | } |
| 158 | }; | 168 | }; |
| 159 | } | 169 | } |
diff --git a/embassy-nrf/src/fmt.rs b/embassy-nrf/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy-nrf/src/fmt.rs +++ b/embassy-nrf/src/fmt.rs | |||
| @@ -104,56 +104,66 @@ macro_rules! panic { | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | macro_rules! trace { | 106 | macro_rules! trace { |
| 107 | ($($x:tt)*) => { | 107 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 108 | { | 108 | { |
| 109 | #[cfg(feature = "log")] | 109 | #[cfg(feature = "log")] |
| 110 | ::log::trace!($($x)*); | 110 | ::log::trace!($s $(, $x)*); |
| 111 | #[cfg(feature = "defmt")] | 111 | #[cfg(feature = "defmt")] |
| 112 | ::defmt::trace!($($x)*); | 112 | ::defmt::trace!($s $(, $x)*); |
| 113 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 114 | let _ = ($( & $x ),*); | ||
| 113 | } | 115 | } |
| 114 | }; | 116 | }; |
| 115 | } | 117 | } |
| 116 | 118 | ||
| 117 | macro_rules! debug { | 119 | macro_rules! debug { |
| 118 | ($($x:tt)*) => { | 120 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 119 | { | 121 | { |
| 120 | #[cfg(fevature = "log")] | 122 | #[cfg(feature = "log")] |
| 121 | ::log::debug!($($x)*); | 123 | ::log::debug!($s $(, $x)*); |
| 122 | #[cfg(feature = "defmt")] | 124 | #[cfg(feature = "defmt")] |
| 123 | ::defmt::debug!($($x)*); | 125 | ::defmt::debug!($s $(, $x)*); |
| 126 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 127 | let _ = ($( & $x ),*); | ||
| 124 | } | 128 | } |
| 125 | }; | 129 | }; |
| 126 | } | 130 | } |
| 127 | 131 | ||
| 128 | macro_rules! info { | 132 | macro_rules! info { |
| 129 | ($($x:tt)*) => { | 133 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 130 | { | 134 | { |
| 131 | #[cfg(feature = "log")] | 135 | #[cfg(feature = "log")] |
| 132 | ::log::info!($($x)*); | 136 | ::log::info!($s $(, $x)*); |
| 133 | #[cfg(feature = "defmt")] | 137 | #[cfg(feature = "defmt")] |
| 134 | ::defmt::info!($($x)*); | 138 | ::defmt::info!($s $(, $x)*); |
| 139 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 140 | let _ = ($( & $x ),*); | ||
| 135 | } | 141 | } |
| 136 | }; | 142 | }; |
| 137 | } | 143 | } |
| 138 | 144 | ||
| 139 | macro_rules! warn { | 145 | macro_rules! warn { |
| 140 | ($($x:tt)*) => { | 146 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 141 | { | 147 | { |
| 142 | #[cfg(feature = "log")] | 148 | #[cfg(feature = "log")] |
| 143 | ::log::warn!($($x)*); | 149 | ::log::warn!($s $(, $x)*); |
| 144 | #[cfg(feature = "defmt")] | 150 | #[cfg(feature = "defmt")] |
| 145 | ::defmt::warn!($($x)*); | 151 | ::defmt::warn!($s $(, $x)*); |
| 152 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 153 | let _ = ($( & $x ),*); | ||
| 146 | } | 154 | } |
| 147 | }; | 155 | }; |
| 148 | } | 156 | } |
| 149 | 157 | ||
| 150 | macro_rules! error { | 158 | macro_rules! error { |
| 151 | ($($x:tt)*) => { | 159 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 152 | { | 160 | { |
| 153 | #[cfg(feature = "log")] | 161 | #[cfg(feature = "log")] |
| 154 | ::log::error!($($x)*); | 162 | ::log::error!($s $(, $x)*); |
| 155 | #[cfg(feature = "defmt")] | 163 | #[cfg(feature = "defmt")] |
| 156 | ::defmt::error!($($x)*); | 164 | ::defmt::error!($s $(, $x)*); |
| 165 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 166 | let _ = ($( & $x ),*); | ||
| 157 | } | 167 | } |
| 158 | }; | 168 | }; |
| 159 | } | 169 | } |
diff --git a/embassy-rp/src/fmt.rs b/embassy-rp/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy-rp/src/fmt.rs +++ b/embassy-rp/src/fmt.rs | |||
| @@ -104,56 +104,66 @@ macro_rules! panic { | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | macro_rules! trace { | 106 | macro_rules! trace { |
| 107 | ($($x:tt)*) => { | 107 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 108 | { | 108 | { |
| 109 | #[cfg(feature = "log")] | 109 | #[cfg(feature = "log")] |
| 110 | ::log::trace!($($x)*); | 110 | ::log::trace!($s $(, $x)*); |
| 111 | #[cfg(feature = "defmt")] | 111 | #[cfg(feature = "defmt")] |
| 112 | ::defmt::trace!($($x)*); | 112 | ::defmt::trace!($s $(, $x)*); |
| 113 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 114 | let _ = ($( & $x ),*); | ||
| 113 | } | 115 | } |
| 114 | }; | 116 | }; |
| 115 | } | 117 | } |
| 116 | 118 | ||
| 117 | macro_rules! debug { | 119 | macro_rules! debug { |
| 118 | ($($x:tt)*) => { | 120 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 119 | { | 121 | { |
| 120 | #[cfg(fevature = "log")] | 122 | #[cfg(feature = "log")] |
| 121 | ::log::debug!($($x)*); | 123 | ::log::debug!($s $(, $x)*); |
| 122 | #[cfg(feature = "defmt")] | 124 | #[cfg(feature = "defmt")] |
| 123 | ::defmt::debug!($($x)*); | 125 | ::defmt::debug!($s $(, $x)*); |
| 126 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 127 | let _ = ($( & $x ),*); | ||
| 124 | } | 128 | } |
| 125 | }; | 129 | }; |
| 126 | } | 130 | } |
| 127 | 131 | ||
| 128 | macro_rules! info { | 132 | macro_rules! info { |
| 129 | ($($x:tt)*) => { | 133 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 130 | { | 134 | { |
| 131 | #[cfg(feature = "log")] | 135 | #[cfg(feature = "log")] |
| 132 | ::log::info!($($x)*); | 136 | ::log::info!($s $(, $x)*); |
| 133 | #[cfg(feature = "defmt")] | 137 | #[cfg(feature = "defmt")] |
| 134 | ::defmt::info!($($x)*); | 138 | ::defmt::info!($s $(, $x)*); |
| 139 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 140 | let _ = ($( & $x ),*); | ||
| 135 | } | 141 | } |
| 136 | }; | 142 | }; |
| 137 | } | 143 | } |
| 138 | 144 | ||
| 139 | macro_rules! warn { | 145 | macro_rules! warn { |
| 140 | ($($x:tt)*) => { | 146 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 141 | { | 147 | { |
| 142 | #[cfg(feature = "log")] | 148 | #[cfg(feature = "log")] |
| 143 | ::log::warn!($($x)*); | 149 | ::log::warn!($s $(, $x)*); |
| 144 | #[cfg(feature = "defmt")] | 150 | #[cfg(feature = "defmt")] |
| 145 | ::defmt::warn!($($x)*); | 151 | ::defmt::warn!($s $(, $x)*); |
| 152 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 153 | let _ = ($( & $x ),*); | ||
| 146 | } | 154 | } |
| 147 | }; | 155 | }; |
| 148 | } | 156 | } |
| 149 | 157 | ||
| 150 | macro_rules! error { | 158 | macro_rules! error { |
| 151 | ($($x:tt)*) => { | 159 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 152 | { | 160 | { |
| 153 | #[cfg(feature = "log")] | 161 | #[cfg(feature = "log")] |
| 154 | ::log::error!($($x)*); | 162 | ::log::error!($s $(, $x)*); |
| 155 | #[cfg(feature = "defmt")] | 163 | #[cfg(feature = "defmt")] |
| 156 | ::defmt::error!($($x)*); | 164 | ::defmt::error!($s $(, $x)*); |
| 165 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 166 | let _ = ($( & $x ),*); | ||
| 157 | } | 167 | } |
| 158 | }; | 168 | }; |
| 159 | } | 169 | } |
diff --git a/embassy-stm32/src/fmt.rs b/embassy-stm32/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy-stm32/src/fmt.rs +++ b/embassy-stm32/src/fmt.rs | |||
| @@ -104,56 +104,66 @@ macro_rules! panic { | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | macro_rules! trace { | 106 | macro_rules! trace { |
| 107 | ($($x:tt)*) => { | 107 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 108 | { | 108 | { |
| 109 | #[cfg(feature = "log")] | 109 | #[cfg(feature = "log")] |
| 110 | ::log::trace!($($x)*); | 110 | ::log::trace!($s $(, $x)*); |
| 111 | #[cfg(feature = "defmt")] | 111 | #[cfg(feature = "defmt")] |
| 112 | ::defmt::trace!($($x)*); | 112 | ::defmt::trace!($s $(, $x)*); |
| 113 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 114 | let _ = ($( & $x ),*); | ||
| 113 | } | 115 | } |
| 114 | }; | 116 | }; |
| 115 | } | 117 | } |
| 116 | 118 | ||
| 117 | macro_rules! debug { | 119 | macro_rules! debug { |
| 118 | ($($x:tt)*) => { | 120 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 119 | { | 121 | { |
| 120 | #[cfg(fevature = "log")] | 122 | #[cfg(feature = "log")] |
| 121 | ::log::debug!($($x)*); | 123 | ::log::debug!($s $(, $x)*); |
| 122 | #[cfg(feature = "defmt")] | 124 | #[cfg(feature = "defmt")] |
| 123 | ::defmt::debug!($($x)*); | 125 | ::defmt::debug!($s $(, $x)*); |
| 126 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 127 | let _ = ($( & $x ),*); | ||
| 124 | } | 128 | } |
| 125 | }; | 129 | }; |
| 126 | } | 130 | } |
| 127 | 131 | ||
| 128 | macro_rules! info { | 132 | macro_rules! info { |
| 129 | ($($x:tt)*) => { | 133 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 130 | { | 134 | { |
| 131 | #[cfg(feature = "log")] | 135 | #[cfg(feature = "log")] |
| 132 | ::log::info!($($x)*); | 136 | ::log::info!($s $(, $x)*); |
| 133 | #[cfg(feature = "defmt")] | 137 | #[cfg(feature = "defmt")] |
| 134 | ::defmt::info!($($x)*); | 138 | ::defmt::info!($s $(, $x)*); |
| 139 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 140 | let _ = ($( & $x ),*); | ||
| 135 | } | 141 | } |
| 136 | }; | 142 | }; |
| 137 | } | 143 | } |
| 138 | 144 | ||
| 139 | macro_rules! warn { | 145 | macro_rules! warn { |
| 140 | ($($x:tt)*) => { | 146 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 141 | { | 147 | { |
| 142 | #[cfg(feature = "log")] | 148 | #[cfg(feature = "log")] |
| 143 | ::log::warn!($($x)*); | 149 | ::log::warn!($s $(, $x)*); |
| 144 | #[cfg(feature = "defmt")] | 150 | #[cfg(feature = "defmt")] |
| 145 | ::defmt::warn!($($x)*); | 151 | ::defmt::warn!($s $(, $x)*); |
| 152 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 153 | let _ = ($( & $x ),*); | ||
| 146 | } | 154 | } |
| 147 | }; | 155 | }; |
| 148 | } | 156 | } |
| 149 | 157 | ||
| 150 | macro_rules! error { | 158 | macro_rules! error { |
| 151 | ($($x:tt)*) => { | 159 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 152 | { | 160 | { |
| 153 | #[cfg(feature = "log")] | 161 | #[cfg(feature = "log")] |
| 154 | ::log::error!($($x)*); | 162 | ::log::error!($s $(, $x)*); |
| 155 | #[cfg(feature = "defmt")] | 163 | #[cfg(feature = "defmt")] |
| 156 | ::defmt::error!($($x)*); | 164 | ::defmt::error!($s $(, $x)*); |
| 165 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 166 | let _ = ($( & $x ),*); | ||
| 157 | } | 167 | } |
| 158 | }; | 168 | }; |
| 159 | } | 169 | } |
diff --git a/embassy/src/fmt.rs b/embassy/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy/src/fmt.rs +++ b/embassy/src/fmt.rs | |||
| @@ -104,56 +104,66 @@ macro_rules! panic { | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | macro_rules! trace { | 106 | macro_rules! trace { |
| 107 | ($($x:tt)*) => { | 107 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 108 | { | 108 | { |
| 109 | #[cfg(feature = "log")] | 109 | #[cfg(feature = "log")] |
| 110 | ::log::trace!($($x)*); | 110 | ::log::trace!($s $(, $x)*); |
| 111 | #[cfg(feature = "defmt")] | 111 | #[cfg(feature = "defmt")] |
| 112 | ::defmt::trace!($($x)*); | 112 | ::defmt::trace!($s $(, $x)*); |
| 113 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 114 | let _ = ($( & $x ),*); | ||
| 113 | } | 115 | } |
| 114 | }; | 116 | }; |
| 115 | } | 117 | } |
| 116 | 118 | ||
| 117 | macro_rules! debug { | 119 | macro_rules! debug { |
| 118 | ($($x:tt)*) => { | 120 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 119 | { | 121 | { |
| 120 | #[cfg(fevature = "log")] | 122 | #[cfg(feature = "log")] |
| 121 | ::log::debug!($($x)*); | 123 | ::log::debug!($s $(, $x)*); |
| 122 | #[cfg(feature = "defmt")] | 124 | #[cfg(feature = "defmt")] |
| 123 | ::defmt::debug!($($x)*); | 125 | ::defmt::debug!($s $(, $x)*); |
| 126 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 127 | let _ = ($( & $x ),*); | ||
| 124 | } | 128 | } |
| 125 | }; | 129 | }; |
| 126 | } | 130 | } |
| 127 | 131 | ||
| 128 | macro_rules! info { | 132 | macro_rules! info { |
| 129 | ($($x:tt)*) => { | 133 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 130 | { | 134 | { |
| 131 | #[cfg(feature = "log")] | 135 | #[cfg(feature = "log")] |
| 132 | ::log::info!($($x)*); | 136 | ::log::info!($s $(, $x)*); |
| 133 | #[cfg(feature = "defmt")] | 137 | #[cfg(feature = "defmt")] |
| 134 | ::defmt::info!($($x)*); | 138 | ::defmt::info!($s $(, $x)*); |
| 139 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 140 | let _ = ($( & $x ),*); | ||
| 135 | } | 141 | } |
| 136 | }; | 142 | }; |
| 137 | } | 143 | } |
| 138 | 144 | ||
| 139 | macro_rules! warn { | 145 | macro_rules! warn { |
| 140 | ($($x:tt)*) => { | 146 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 141 | { | 147 | { |
| 142 | #[cfg(feature = "log")] | 148 | #[cfg(feature = "log")] |
| 143 | ::log::warn!($($x)*); | 149 | ::log::warn!($s $(, $x)*); |
| 144 | #[cfg(feature = "defmt")] | 150 | #[cfg(feature = "defmt")] |
| 145 | ::defmt::warn!($($x)*); | 151 | ::defmt::warn!($s $(, $x)*); |
| 152 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 153 | let _ = ($( & $x ),*); | ||
| 146 | } | 154 | } |
| 147 | }; | 155 | }; |
| 148 | } | 156 | } |
| 149 | 157 | ||
| 150 | macro_rules! error { | 158 | macro_rules! error { |
| 151 | ($($x:tt)*) => { | 159 | ($s:literal $(, $x:expr)* $(,)?) => { |
| 152 | { | 160 | { |
| 153 | #[cfg(feature = "log")] | 161 | #[cfg(feature = "log")] |
| 154 | ::log::error!($($x)*); | 162 | ::log::error!($s $(, $x)*); |
| 155 | #[cfg(feature = "defmt")] | 163 | #[cfg(feature = "defmt")] |
| 156 | ::defmt::error!($($x)*); | 164 | ::defmt::error!($s $(, $x)*); |
| 165 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 166 | let _ = ($( & $x ),*); | ||
| 157 | } | 167 | } |
| 158 | }; | 168 | }; |
| 159 | } | 169 | } |
diff --git a/stm32-metapac/Cargo.toml b/stm32-metapac/Cargo.toml index c92c5f003..971d76956 100644 --- a/stm32-metapac/Cargo.toml +++ b/stm32-metapac/Cargo.toml | |||
| @@ -9,16 +9,18 @@ resolver = "2" | |||
| 9 | cortex-m = "0.7.2" | 9 | cortex-m = "0.7.2" |
| 10 | cortex-m-rt = { version = "0.6.8", optional = true } | 10 | cortex-m-rt = { version = "0.6.8", optional = true } |
| 11 | 11 | ||
| 12 | # BEGIN BUILD DEPENDENCIES | ||
| 13 | # These are removed when generating the pre-generated crate using the tool at gen/. | ||
| 12 | [build-dependencies] | 14 | [build-dependencies] |
| 13 | regex = "1.4.6" | 15 | regex = "1.4.6" |
| 14 | chiptool = { git = "https://github.com/embassy-rs/chiptool", rev = "86b77165078065058098e981d49d2dd213b2feba" } | 16 | chiptool = { git = "https://github.com/embassy-rs/chiptool", rev = "86b77165078065058098e981d49d2dd213b2feba" } |
| 15 | serde = { version = "1.0.123", features = [ "derive" ]} | 17 | serde = { version = "1.0.123", features = [ "derive" ]} |
| 16 | serde_yaml = "0.8.15" | 18 | serde_yaml = "0.8.15" |
| 19 | # END BUILD DEPENDENCIES | ||
| 17 | 20 | ||
| 18 | [features] | 21 | [features] |
| 19 | rt = ["cortex-m-rt/device"] | 22 | rt = ["cortex-m-rt/device"] |
| 20 | 23 | ||
| 21 | |||
| 22 | # BEGIN GENERATED FEATURES | 24 | # BEGIN GENERATED FEATURES |
| 23 | # Generated by gen_features.py. DO NOT EDIT. | 25 | # Generated by gen_features.py. DO NOT EDIT. |
| 24 | stm32f030c6 = [] | 26 | stm32f030c6 = [] |
