Skip to content

Commit

Permalink
fix: v0 usart1 remap
Browse files Browse the repository at this point in the history
Close #12
  • Loading branch information
andelf committed May 5, 2024
1 parent c0cf76b commit 9405001
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/patches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ mod usart1 {
impl crate::peripheral::RemapPeripheral for crate::peripherals::USART1 {}
}

#[cfg(all(any(ch32v0), peri_usart1))]
mod usart1 {
impl crate::peripheral::sealed::RemapPeripheral for crate::peripherals::USART1 {
fn set_remap(remap: u8) {
let afio = &crate::pac::AFIO;
afio.pcfr1().modify(|w| w.set_usart1_rm(remap & 0b1 != 0));
afio.pcfr1().modify(|w| w.set_usart1_rm1(remap & 0b10 != 0));
}
}
impl crate::peripheral::RemapPeripheral for crate::peripherals::USART1 {}
}

#[cfg(all(peri_i2c1, ch32v0))]
mod i2c1 {
impl crate::peripheral::sealed::RemapPeripheral for crate::peripherals::I2C1 {
Expand Down

0 comments on commit 9405001

Please sign in to comment.