diff --git a/examples/rtic/Cargo.toml b/examples/rtic/Cargo.toml index 31425db..bcbdff2 100644 --- a/examples/rtic/Cargo.toml +++ b/examples/rtic/Cargo.toml @@ -35,6 +35,8 @@ features = ["critical-section"] [dependencies.ringbuf] version = "0.4.7" default-features = false +git = "https://github.com/robamu/ringbuf.git" +branch = "remove-mut-on-split-ref" features = ["portable-atomic"] [dependencies.va108xx-hal] diff --git a/examples/rtic/src/bin/uart-echo-rtic.rs b/examples/rtic/src/bin/uart-echo-rtic.rs index 7392470..351418f 100644 --- a/examples/rtic/src/bin/uart-echo-rtic.rs +++ b/examples/rtic/src/bin/uart-echo-rtic.rs @@ -12,7 +12,7 @@ use ringbuf::StaticRb; const RX_RING_BUF_SIZE: usize = 1024; // Ring buffers to handling variable sized telemetry -static mut RINGBUF: Lazy> = +static RINGBUF: Lazy> = Lazy::new(StaticRb::::default); #[rtic::app(device = pac, dispatchers = [OC4])] @@ -71,7 +71,7 @@ mod app { rx.start(); - let (data_producer, data_consumer) = unsafe { RINGBUF.split_ref() }; + let (data_producer, data_consumer) = RINGBUF.split_ref(); echo_handler::spawn().unwrap(); ( Shared {}, diff --git a/flashloader/Cargo.toml b/flashloader/Cargo.toml index 65e701a..a6278c6 100644 --- a/flashloader/Cargo.toml +++ b/flashloader/Cargo.toml @@ -25,6 +25,8 @@ version = "0.4" [dependencies.ringbuf] version = "0.4.7" default-features = false +git = "https://github.com/robamu/ringbuf.git" +branch = "remove-mut-on-split-ref" features = ["portable-atomic"] [dependencies.once_cell] diff --git a/flashloader/src/main.rs b/flashloader/src/main.rs index 2f122da..da32a79 100644 --- a/flashloader/src/main.rs +++ b/flashloader/src/main.rs @@ -45,15 +45,15 @@ const BUF_RB_SIZE_TM: usize = 256; const SIZES_RB_SIZE_TM: usize = 16; // Ring buffers to handling variable sized telemetry -static mut BUF_RB_TM: Lazy> = +static BUF_RB_TM: Lazy> = Lazy::new(StaticRb::::default); -static mut SIZES_RB_TM: Lazy> = +static SIZES_RB_TM: Lazy> = Lazy::new(StaticRb::::default); // Ring buffers to handling variable sized telecommands -static mut BUF_RB_TC: Lazy> = +static BUF_RB_TC: Lazy> = Lazy::new(StaticRb::::default); -static mut SIZES_RB_TC: Lazy> = +static SIZES_RB_TC: Lazy> = Lazy::new(StaticRb::::default); pub struct DataProducer { @@ -149,11 +149,11 @@ mod app { let verif_reporter = VerificationReportCreator::new(0).unwrap(); - let (buf_prod_tm, buf_cons_tm) = unsafe { BUF_RB_TM.split_ref() }; - let (sizes_prod_tm, sizes_cons_tm) = unsafe { SIZES_RB_TM.split_ref() }; + let (buf_prod_tm, buf_cons_tm) = BUF_RB_TM.split_ref(); + let (sizes_prod_tm, sizes_cons_tm) = SIZES_RB_TM.split_ref(); - let (buf_prod_tc, buf_cons_tc) = unsafe { BUF_RB_TC.split_ref() }; - let (sizes_prod_tc, sizes_cons_tc) = unsafe { SIZES_RB_TC.split_ref() }; + let (buf_prod_tc, buf_cons_tc) = BUF_RB_TC.split_ref(); + let (sizes_prod_tc, sizes_cons_tc) = SIZES_RB_TC.split_ref(); let mut rx_context = IrqContextTimeoutOrMaxSize::new(MAX_TC_FRAME_SIZE); rx.read_fixed_len_or_timeout_based_using_irq(&mut rx_context) diff --git a/va108xx-hal/src/gpio/pin.rs b/va108xx-hal/src/gpio/pin.rs index ad91f85..944c7e8 100644 --- a/va108xx-hal/src/gpio/pin.rs +++ b/va108xx-hal/src/gpio/pin.rs @@ -320,7 +320,6 @@ macro_rules! pin_id { //================================================================================================== /// A type-level GPIO pin, parameterized by [PinId] and [PinMode] types - pub struct Pin { pub(in crate::gpio) regs: Registers, mode: PhantomData, diff --git a/va108xx-hal/src/uart.rs b/va108xx-hal/src/uart.rs index f1b3ae5..d960c7a 100644 --- a/va108xx-hal/src/uart.rs +++ b/va108xx-hal/src/uart.rs @@ -284,17 +284,17 @@ impl IrqResultMaxSizeOrTimeout { #[inline] pub fn overflow_error(&self) -> bool { - self.errors.map_or(false, |e| e.overflow) + self.errors.is_some_and(|e| e.overflow) } #[inline] pub fn framing_error(&self) -> bool { - self.errors.map_or(false, |e| e.framing) + self.errors.is_some_and(|e| e.framing) } #[inline] pub fn parity_error(&self) -> bool { - self.errors.map_or(false, |e| e.parity) + self.errors.is_some_and(|e| e.parity) } #[inline]