now needs tests
All checks were successful
Rust/va108xx-rs/pipeline/pr-main This commit looks good

This commit is contained in:
2024-09-27 14:52:45 +02:00
parent f7ff74940a
commit 1f4d6f601d
6 changed files with 111 additions and 150 deletions

View File

@ -10,6 +10,7 @@ use va108xx::Uarta;
pub use crate::IrqCfg;
use crate::{
clock::enable_peripheral_clock,
enable_interrupt,
gpio::pin::{
AltFunc1, AltFunc2, AltFunc3, Pin, PA16, PA17, PA18, PA19, PA2, PA26, PA27, PA3, PA30,
@ -744,10 +745,11 @@ impl<Uart: Instance> Rx<Uart> {
pub fn into_rx_with_irq(
self,
irqsel: &pac::Irqsel,
sysconfig: &mut pac::Sysconfig,
irqsel: &mut pac::Irqsel,
interrupt: pac::Interrupt,
) -> RxWithIrq<Uart> {
RxWithIrq::new(self, irqsel, interrupt)
RxWithIrq::new(self, sysconfig, irqsel, interrupt)
}
pub fn release(self) -> Uart {
@ -934,7 +936,13 @@ pub struct RxWithIrq<Uart> {
}
impl<Uart: Instance> RxWithIrq<Uart> {
pub fn new(rx: Rx<Uart>, irqsel: &pac::Irqsel, interrupt: pac::Interrupt) -> Self {
pub fn new(
rx: Rx<Uart>,
syscfg: &mut pac::Sysconfig,
irqsel: &mut pac::Irqsel,
interrupt: pac::Interrupt,
) -> Self {
enable_peripheral_clock(syscfg, PeripheralSelect::Irqsel);
irqsel
.uart0(Uart::IDX as usize)
.write(|w| unsafe { w.bits(interrupt as u32) });