Skip to content

Commit ea60249

Browse files
Update mod.rs
remove const def of base registers
1 parent 14d4b49 commit ea60249

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

imxrt-hal/src/can/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ pub struct CAN<M> {
117117
_mailbox_reader_index: u8,
118118
}
119119

120-
const CAN1_ADDR: u32 = 0x401d0000;
121-
const CAN2_ADDR: u32 = 0x401d4000;
122-
123120
#[derive(Debug)]
124121
pub struct MailboxData {
125122
pub frame: Frame,
@@ -245,10 +242,8 @@ where
245242
}
246243

247244
pub fn base_address(&self) -> u32 {
248-
match self.is_can1() {
249-
true => CAN1_ADDR,
250-
false => CAN2_ADDR,
251-
}
245+
let addr: *const ral::can::RegisterBlock = &*self.reg;
246+
addr as u32
252247
}
253248

254249
pub fn free(self) -> ral::can::Instance {

0 commit comments

Comments
 (0)