Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed May 22, 2024
1 parent 3c3b434 commit 832250d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions satrs/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 832250d

Please sign in to comment.