Skip to content

Commit

Permalink
fix(can): add support for ch32l1, w/o canfd
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Dec 29, 2024
1 parent e6b7d67 commit f26fb37
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/can/can.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ pin_trait!(TxPin, Instance);
foreach_peripheral!(
(can, $inst:ident) => {
impl SealedInstance for peripherals::$inst {
// FIXME: CH32L1 supports CANFD, and is compatible with the CAN peripheral.
fn regs() -> crate::pac::can::Can {
crate::pac::$inst
#[cfg(ch32l1)]
return unsafe { crate::pac::can::Can::from_ptr(crate::pac::$inst.as_ptr()) };
#[cfg(not(ch32l1))]
return crate::pac::$inst;
}
}

Expand Down

0 comments on commit f26fb37

Please sign in to comment.