aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVadim Kaushan <admin@disasm.info>2021-09-22 08:28:03 +0300
committerVadim Kaushan <admin@disasm.info>2021-09-23 07:59:55 +0300
commite65acf5ccf64563b4fc91320dd1075c520ef931a (patch)
tree67690bbff6c2d8a1a05f651e0096fa384141022a /src
parent55168100e1fe885587e2a4f7ad555139a396a720 (diff)
Prevent masking value variables with imports
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 6122f01..52401d6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -280,7 +280,11 @@ macro_rules! write_reg {
use $periph::{*};
#[allow(unused_imports)]
(*$instance).$reg.write(
- $({ use $periph::{$reg::$field::{mask, offset, W::*, RW::*}}; ($value << offset) & mask }) | *
+ $({
+ use $periph::{$reg::$field::{W::*, RW::*}};
+ ($value << { use $periph::{$reg::$field::offset}; offset })
+ & { use $periph::{$reg::$field::mask}; mask }
+ }) | *
);
}};
( $periph:path, $instance:expr, $reg:ident, $value:expr ) => {{
@@ -410,7 +414,12 @@ macro_rules! modify_reg {
#[allow(unused_imports)]
(*$instance).$reg.write(
((*$instance).$reg.read() & !( $({ use $periph::{$reg::$field::mask}; mask }) | * ))
- | $({ use $periph::{$reg::$field::{mask, offset, W::*, RW::*}}; ($value << offset) & mask }) | *);
+ | $({
+ use $periph::{$reg::$field::{W::*, RW::*}};
+ ($value << { use $periph::{$reg::$field::offset}; offset })
+ & { use $periph::{$reg::$field::mask}; mask }
+ }) | *
+ );
}};
( $periph:path, $instance:expr, $reg:ident, $fn:expr ) => {{
#[allow(unused_imports)]