all clippy fixes #44

Merged
muellerr merged 1 commits from clippy-fixes into main 2025-02-13 17:38:46 +01:00
4 changed files with 22 additions and 17 deletions

View File

@ -15,6 +15,7 @@ rtt-log = "0.3"
log = "0.4"
crc = "3"
rtic-sync = "1"
static_cell = "2"
[dependencies.satrs]
version = "0.2"

View File

@ -52,11 +52,11 @@ impl WdtInterface for OptWdt {
}
}
use once_cell::sync::Lazy;
use ringbuf::{
traits::{Consumer, Observer, Producer, SplitRef},
CachingCons, StaticProd, StaticRb,
};
use static_cell::StaticCell;
// Larger buffer for TC to be able to hold the possibly large memory write packets.
const BUF_RB_SIZE_TC: usize = 2048;
@ -66,16 +66,12 @@ const BUF_RB_SIZE_TM: usize = 512;
const SIZES_RB_SIZE_TM: usize = 16;
// Ring buffers to handling variable sized telemetry
static mut BUF_RB_TM: Lazy<StaticRb<u8, BUF_RB_SIZE_TM>> =
Lazy::new(StaticRb::<u8, BUF_RB_SIZE_TM>::default);
static mut SIZES_RB_TM: Lazy<StaticRb<usize, SIZES_RB_SIZE_TM>> =
Lazy::new(StaticRb::<usize, SIZES_RB_SIZE_TM>::default);
static BUF_RB_TM: StaticCell<StaticRb<u8, BUF_RB_SIZE_TM>> = StaticCell::new();
static SIZES_RB_TM: StaticCell<StaticRb<usize, SIZES_RB_SIZE_TM>> = StaticCell::new();
// Ring buffers to handling variable sized telecommands
static mut BUF_RB_TC: Lazy<StaticRb<u8, BUF_RB_SIZE_TC>> =
Lazy::new(StaticRb::<u8, BUF_RB_SIZE_TC>::default);
static mut SIZES_RB_TC: Lazy<StaticRb<usize, SIZES_RB_SIZE_TC>> =
Lazy::new(StaticRb::<usize, SIZES_RB_SIZE_TC>::default);
static BUF_RB_TC: StaticCell<StaticRb<u8, BUF_RB_SIZE_TC>> = StaticCell::new();
static SIZES_RB_TC: StaticCell<StaticRb<usize, SIZES_RB_SIZE_TC>> = StaticCell::new();
pub struct DataProducer<const BUF_SIZE: usize, const SIZES_LEN: usize> {
pub buf_prod: StaticProd<'static, u8, BUF_SIZE>,
@ -166,6 +162,7 @@ mod app {
.xtal_n_clk_with_src_freq(Hertz::from_raw(EXTCLK_FREQ))
.freeze(&mut cx.device.sysconfig)
.unwrap();
enable_and_init_irq_router(&mut cx.device.sysconfig, &cx.device.irq_router);
setup_edac(&mut cx.device.sysconfig);
@ -184,11 +181,19 @@ 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
.init(StaticRb::<u8, BUF_RB_SIZE_TM>::default())
.split_ref();
let (sizes_prod_tm, sizes_cons_tm) = SIZES_RB_TM
.init(StaticRb::<usize, SIZES_RB_SIZE_TM>::default())
.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
.init(StaticRb::<u8, BUF_RB_SIZE_TC>::default())
.split_ref();
let (sizes_prod_tc, sizes_cons_tc) = SIZES_RB_TC
.init(StaticRb::<usize, SIZES_RB_SIZE_TC>::default())
.split_ref();
Mono::start(cx.core.SYST, clocks.sysclk().raw());
CLOCKS.set(clocks).unwrap();

View File

@ -321,7 +321,6 @@ macro_rules! pin_id {
//==================================================================================================
/// A type-level GPIO pin, parameterized by [`PinId`] and [`PinMode`] types
pub struct Pin<I: PinId, M: PinMode> {
pub(in crate::gpio) regs: Registers<I>,
mode: PhantomData<M>,

View File

@ -305,17 +305,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]