From 832250d21112f5ed68d2ee18a4b5d2f55aec4e5d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 May 2024 12:55:50 +0200 Subject: [PATCH] minor improvements --- satrs/src/pool.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/satrs/src/pool.rs b/satrs/src/pool.rs index d8a0373..e4c2776 100644 --- a/satrs/src/pool.rs +++ b/satrs/src/pool.rs @@ -133,6 +133,7 @@ impl Display for StaticPoolAddr { #[derive(Debug, Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum StoreIdError { InvalidSubpool(u16), InvalidPacketIdx(u16), @@ -156,6 +157,7 @@ impl Error for StoreIdError {} #[derive(Debug, Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum PoolError { /// Requested data block is too large DataTooLarge(usize), @@ -390,6 +392,14 @@ pub mod heapless_mod { static mut $sizes_list_name: core::mem::MaybeUninit<[usize; $num_blocks]> = core::mem::MaybeUninit::new([$crate::pool::STORE_FREE; $num_blocks]); }; + ($pool_name: ident, $sizes_list_name: ident, $num_blocks: expr, $block_size: expr, $meta_data: meta) => { + #[$meta_data] + static mut $pool_name: core::mem::MaybeUninit<[u8; $num_blocks * $block_size]> = + core::mem::MaybeUninit::new([0; $num_blocks * $block_size]); + #[$meta_data] + static mut $sizes_list_name: core::mem::MaybeUninit<[usize; $num_blocks]> = + core::mem::MaybeUninit::new([$crate::pool::STORE_FREE; $num_blocks]); + }; } /// A static memory pool similar to [super::StaticMemoryPool] which does not reply on