From 8f26cf4d24b0f9b99ed5f8777e470ea9acc93042 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 2 Sep 2025 15:30:40 +0200 Subject: [PATCH] bump dependencies --- Cargo.toml | 6 ++-- src/timer/regs.rs | 2 +- src/uart/mod.rs | 2 +- src/uart/rx_asynch.rs | 64 +++++++++++++++++++++---------------------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 42445a7..0580101 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,10 +12,10 @@ cortex-m = { version = "0.7" } cfg-if = "1" derive-mmio = { git = "https://github.com/knurling-rs/derive-mmio.git", version = "0.6" } bitbybit = "1.3" -arbitrary-int = "1.3" +arbitrary-int = "2" static_assertions = "1.1" nb = "1" -heapless = "0.8" +heapless = "0.9" critical-section = "1" embedded-hal = "1.0" embedded-hal-async = "1" @@ -31,7 +31,7 @@ va108xx = { version = "0.5", default-features = false, optional = true } va416xx = { version = "0.4", default-features = false, optional = true } embassy-sync = "0.7" embassy-time-driver = "0.2" -embassy-time-queue-utils = "0.1" +embassy-time-queue-utils = "0.3" once_cell = { version = "1", default-features = false, features = ["critical-section"] } [target.thumbv6m-none-eabi.dependencies] diff --git a/src/timer/regs.rs b/src/timer/regs.rs index 3f3636c..3e72e05 100644 --- a/src/timer/regs.rs +++ b/src/timer/regs.rs @@ -1,6 +1,6 @@ use core::marker::PhantomData; -use arbitrary_int::{Number, u7}; +use arbitrary_int::{prelude::*, u7}; #[cfg(feature = "vor1x")] const BASE_ADDR: usize = 0x4002_0000; diff --git a/src/uart/mod.rs b/src/uart/mod.rs index 62bcf2e..362cee1 100644 --- a/src/uart/mod.rs +++ b/src/uart/mod.rs @@ -17,7 +17,7 @@ pub mod regs; #[cfg(feature = "vor1x")] use crate::InterruptConfig; use crate::{FunSel, gpio::IoPeriphPin, pins::PinMarker, sealed::Sealed}; -use arbitrary_int::{Number, u6, u18}; +use arbitrary_int::{prelude::*, u6, u18}; use fugit::RateExtU32; use regs::{ClkScale, Control, Data, Enable, FifoClear, InterruptClear, MmioUart}; diff --git a/src/uart/rx_asynch.rs b/src/uart/rx_asynch.rs index f354654..b5756ff 100644 --- a/src/uart/rx_asynch.rs +++ b/src/uart/rx_asynch.rs @@ -16,7 +16,7 @@ //! structure returned by the interrupt handlers. use core::{cell::RefCell, convert::Infallible, future::Future, sync::atomic::Ordering}; -use arbitrary_int::Number; +use arbitrary_int::prelude::*; use critical_section::Mutex; use embassy_sync::waitqueue::AtomicWaker; use embedded_io::ErrorType; @@ -120,18 +120,18 @@ fn on_interrupt_rx_common_post_processing( /// Should be called in the user interrupt handler to enable /// asynchronous reception. This variant will overwrite old data in the ring buffer in case /// the ring buffer is full. -pub fn on_interrupt_rx_overwriting( +pub fn on_interrupt_rx_overwriting( bank: Bank, - prod: &mut heapless::spsc::Producer, - shared_consumer: &Mutex>>>, + prod: &mut heapless::spsc::Producer, + shared_consumer: &Mutex>>>, ) -> Result<(), AsyncUartErrors> { on_interrupt_rx_async_heapless_queue_overwriting(bank, prod, shared_consumer) } -pub fn on_interrupt_rx_async_heapless_queue_overwriting( +pub fn on_interrupt_rx_async_heapless_queue_overwriting( bank: Bank, - prod: &mut heapless::spsc::Producer, - shared_consumer: &Mutex>>>, + prod: &mut heapless::spsc::Producer, + shared_consumer: &Mutex>>>, ) -> Result<(), AsyncUartErrors> { let uart_regs = unsafe { bank.steal_regs() }; let irq_status = uart_regs.read_irq_status(); @@ -190,16 +190,16 @@ pub fn on_interrupt_rx_async_heapless_queue_overwriting( /// Interrupt handler for asynchronous RX operations. /// /// Should be called in the user interrupt handler to enable asynchronous reception. -pub fn on_interrupt_rx( +pub fn on_interrupt_rx( bank: Bank, - prod: &mut heapless::spsc::Producer<'_, u8, N>, + prod: &mut heapless::spsc::Producer<'_, u8>, ) -> Result<(), AsyncUartErrors> { on_interrupt_rx_async_heapless_queue(bank, prod) } -pub fn on_interrupt_rx_async_heapless_queue( +pub fn on_interrupt_rx_async_heapless_queue( bank: Bank, - prod: &mut heapless::spsc::Producer<'_, u8, N>, + prod: &mut heapless::spsc::Producer<'_, u8>, ) -> Result<(), AsyncUartErrors> { let uart_regs = unsafe { bank.steal_regs() }; let irq_status = uart_regs.read_irq_status(); @@ -255,17 +255,17 @@ impl Drop for ActiveReadGuard { } } -struct RxAsyncInner { +struct RxAsyncInner { rx: Rx, - pub queue: heapless::spsc::Consumer<'static, u8, N>, + pub queue: heapless::spsc::Consumer<'static, u8>, } /// Core data structure to allow asynchronous UART reception. /// /// If the ring buffer becomes full, data will be lost. -pub struct RxAsync(Option>); +pub struct RxAsync(Option); -impl ErrorType for RxAsync { +impl ErrorType for RxAsync { /// Error reporting is done using the result of the interrupt functions. type Error = Infallible; } @@ -276,12 +276,12 @@ fn stop_async_rx(rx: &mut Rx) { rx.clear_fifo(); } -impl RxAsync { +impl RxAsync { /// Create a new asynchronous receiver. /// /// The passed [heapless::spsc::Consumer] will be used to asynchronously receive data which /// is filled by the interrupt handler [on_interrupt_rx]. - pub fn new(mut rx: Rx, queue: heapless::spsc::Consumer<'static, u8, N>) -> Self { + pub fn new(mut rx: Rx, queue: heapless::spsc::Consumer<'static, u8>) -> Self { rx.disable_interrupts(); rx.disable(); rx.clear_fifo(); @@ -300,29 +300,29 @@ impl RxAsync { stop_async_rx(&mut self.0.as_mut().unwrap().rx); } - pub fn release(mut self) -> (Rx, heapless::spsc::Consumer<'static, u8, N>) { + pub fn release(mut self) -> (Rx, heapless::spsc::Consumer<'static, u8>) { self.stop(); let inner = self.0.take().unwrap(); (inner.rx, inner.queue) } } -impl Drop for RxAsync { +impl Drop for RxAsync { fn drop(&mut self) { self.stop(); } } -impl embedded_io_async::Read for RxAsync { +impl embedded_io_async::Read for RxAsync { async fn read(&mut self, buf: &mut [u8]) -> Result { let inner = self.0.as_ref().unwrap(); // Need to wait for the IRQ to read data and set this flag. If the queue is not // empty, we can read data immediately. - if inner.queue.len() == 0 { + if inner.queue.is_empty() { RX_HAS_DATA[inner.rx.id as usize].store(false, Ordering::Relaxed); } let _guard = ActiveReadGuard(inner.rx.id as usize); - let mut handle_data_in_queue = |consumer: &mut heapless::spsc::Consumer<'static, u8, N>| { + let mut handle_data_in_queue = |consumer: &mut heapless::spsc::Consumer<'static, u8>| { let data_to_read = consumer.len().min(buf.len()); for byte in buf.iter_mut().take(data_to_read) { // We own the consumer and we checked that the amount of data is guaranteed to be available. @@ -343,23 +343,23 @@ impl embedded_io_async::Read for RxAsync { } } -struct RxAsyncOverwritingInner { +struct RxAsyncOverwritingInner { rx: Rx, - pub shared_consumer: &'static Mutex>>>, + pub shared_consumer: &'static Mutex>>>, } /// Core data structure to allow asynchronous UART reception. /// /// If the ring buffer becomes full, the oldest data will be overwritten when using the /// [on_interrupt_rx_overwriting] interrupt handlers. -pub struct RxAsyncOverwriting(Option>); +pub struct RxAsyncOverwriting(Option); -impl ErrorType for RxAsyncOverwriting { +impl ErrorType for RxAsyncOverwriting { /// Error reporting is done using the result of the interrupt functions. type Error = Infallible; } -impl RxAsyncOverwriting { +impl RxAsyncOverwriting { /// Create a new asynchronous receiver. /// /// The passed shared [heapless::spsc::Consumer] will be used to asynchronously receive data @@ -367,7 +367,7 @@ impl RxAsyncOverwriting { /// interrupt handler to overwrite old data. pub fn new( mut rx: Rx, - shared_consumer: &'static Mutex>>>, + shared_consumer: &'static Mutex>>>, ) -> Self { rx.disable_interrupts(); rx.disable(); @@ -397,13 +397,13 @@ impl RxAsyncOverwriting { } } -impl Drop for RxAsyncOverwriting { +impl Drop for RxAsyncOverwriting { fn drop(&mut self) { self.stop(); } } -impl embedded_io_async::Read for RxAsyncOverwriting { +impl embedded_io_async::Read for RxAsyncOverwriting { async fn read(&mut self, buf: &mut [u8]) -> Result { let inner = self.0.as_ref().unwrap(); let id = inner.rx.id as usize; @@ -412,12 +412,12 @@ impl embedded_io_async::Read for RxAsyncOverwriting { critical_section::with(|cs| { let queue = inner.shared_consumer.borrow(cs); - if queue.borrow().as_ref().unwrap().len() == 0 { + if queue.borrow().as_ref().unwrap().is_empty() { RX_HAS_DATA[id].store(false, Ordering::Relaxed); } }); let _guard = ActiveReadGuard(id); - let mut handle_data_in_queue = |inner: &mut RxAsyncOverwritingInner| { + let mut handle_data_in_queue = |inner: &mut RxAsyncOverwritingInner| { critical_section::with(|cs| { let mut consumer_ref = inner.shared_consumer.borrow(cs).borrow_mut(); let consumer = consumer_ref.as_mut().unwrap();