tinyboot-ch32-hal 0.3.0

Hardware abstraction layer for tinyboot on CH32 microcontrollers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[inline(always)]
pub fn set_usart_remap(n: u8, remap: u8) {
    if remap == 0 {
        return;
    }
    match n {
        1 => ch32_metapac::AFIO
            .pcfr1()
            .modify(|w| w.set_usart1_rm(remap & 1 != 0)),
        2 => ch32_metapac::AFIO
            .pcfr1()
            .modify(|w| w.set_usart2_rm(remap & 1 != 0)),
        3 => ch32_metapac::AFIO
            .pcfr1()
            .modify(|w| w.set_usart3_rm(remap)),
        _ => {}
    }
}